Added an error if the <systemList> tag is missing.

Made SystemView more themable (added a ThemeExtras component, made theming on pre-existing elements less restrictive).
This commit is contained in:
Aloshi 2014-01-07 16:57:30 -06:00
parent 5a84bc03ea
commit 81a9941645
5 changed files with 67 additions and 59 deletions

View file

@ -200,8 +200,8 @@ Reference
* image name="header" - POSITION | SIZE | PATH * image name="header" - POSITION | SIZE | PATH
#### system #### system
* image name="header" - PATH * image name="header" - ALL
* image name="system" - PATH * image name="system" - ALL
#### menu #### menu
* ninepatch name="background" - PATH * ninepatch name="background" - PATH

View file

@ -238,6 +238,12 @@ bool SystemData::loadConfig(const std::string& path, bool writeExample)
//actually read the file //actually read the file
pugi::xml_node systemList = doc.child("systemList"); pugi::xml_node systemList = doc.child("systemList");
if(!systemList)
{
LOG(LogError) << "es_systems.cfg is missing the <systemList> tag!";
return false;
}
for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system")) for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system"))
{ {
std::string name, fullname, path, cmd; std::string name, fullname, path, cmd;

View file

@ -23,8 +23,6 @@ namespace fs = boost::filesystem;
bool scrape_cmdline = false; bool scrape_cmdline = false;
bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height) bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height)
{
if(argc > 1)
{ {
for(int i = 1; i < argc; i++) for(int i = 1; i < argc; i++)
{ {
@ -75,13 +73,12 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height
std::cout << "--debug even more logging\n"; std::cout << "--debug even more logging\n";
std::cout << "--dimtime [seconds] time to wait before dimming the screen (default 30, use 0 for never)\n"; std::cout << "--dimtime [seconds] time to wait before dimming the screen (default 30, use 0 for never)\n";
std::cout << "--scrape scrape using command line interface\n"; std::cout << "--scrape scrape using command line interface\n";
std::cout << "--windowed not fullscreen\n"; std::cout << "--windowed not fullscreen, should be used in conjunction with -w and -h\n";
std::cout << "--help summon a sentient, angry tuba\n\n"; std::cout << "--help summon a sentient, angry tuba\n\n";
std::cout << "More information available in README.md.\n"; std::cout << "More information available in README.md.\n";
return false; //exit after printing help return false; //exit after printing help
} }
} }
}
return true; return true;
} }

View file

@ -10,7 +10,8 @@ SystemView::SystemView(Window* window, SystemData* system) : GuiComponent(window
mHeaderImage(window), mHeaderImage(window),
mHeaderText(window), mHeaderText(window),
mImage(window) mImage(window),
mExtras(window)
{ {
setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight());
@ -26,6 +27,7 @@ SystemView::SystemView(Window* window, SystemData* system) : GuiComponent(window
mImage.setPosition(mSize.x() / 2, mSize.y() * 0.6f); mImage.setPosition(mSize.x() / 2, mSize.y() * 0.6f);
mImage.setResize(0, mSize.y() * 0.8f, false); mImage.setResize(0, mSize.y() * 0.8f, false);
addChild(&mExtras);
addChild(&mImage); addChild(&mImage);
addChild(&mHeaderText); addChild(&mHeaderText);
addChild(&mHeaderImage); addChild(&mHeaderImage);
@ -37,8 +39,10 @@ void SystemView::updateData()
{ {
using namespace ThemeFlags; using namespace ThemeFlags;
mExtras.setExtras(ThemeData::makeExtras(mSystem->getTheme(), "system", mWindow));
mHeaderImage.setImage(""); mHeaderImage.setImage("");
mHeaderImage.applyTheme(mSystem->getTheme(), "system", "header", PATH); mHeaderImage.applyTheme(mSystem->getTheme(), "system", "header", ALL);
// header // header
if(mHeaderImage.hasImage()) if(mHeaderImage.hasImage())
@ -51,7 +55,7 @@ void SystemView::updateData()
mHeaderText.setText(mSystem->getFullName()); mHeaderText.setText(mSystem->getFullName());
} }
mImage.applyTheme(mSystem->getTheme(), "system", "system", PATH); mImage.applyTheme(mSystem->getTheme(), "system", "system", ALL);
} }
bool SystemView::input(InputConfig* config, Input input) bool SystemView::input(InputConfig* config, Input input)

View file

@ -22,4 +22,5 @@ private:
TextComponent mHeaderText; TextComponent mHeaderText;
ImageComponent mHeaderImage; ImageComponent mHeaderImage;
ImageComponent mImage; ImageComponent mImage;
ThemeExtras mExtras;
}; };