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
#### system
* image name="header" - PATH
* image name="system" - PATH
* image name="header" - ALL
* image name="system" - ALL
#### menu
* ninepatch name="background" - PATH

View file

@ -238,6 +238,12 @@ bool SystemData::loadConfig(const std::string& path, bool writeExample)
//actually read the file
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"))
{
std::string name, fullname, path, cmd;

View file

@ -24,62 +24,59 @@ bool scrape_cmdline = false;
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++)
if(strcmp(argv[i], "-w") == 0)
{
if(strcmp(argv[i], "-w") == 0)
{
*width = atoi(argv[i + 1]);
i++; //skip the argument value
}else if(strcmp(argv[i], "-h") == 0)
{
*height = atoi(argv[i + 1]);
i++; //skip the argument value
}else if(strcmp(argv[i], "--gamelist-only") == 0)
{
Settings::getInstance()->setBool("PARSEGAMELISTONLY", true);
}else if(strcmp(argv[i], "--ignore-gamelist") == 0)
{
Settings::getInstance()->setBool("IGNOREGAMELIST", true);
}else if(strcmp(argv[i], "--draw-framerate") == 0)
{
Settings::getInstance()->setBool("DRAWFRAMERATE", true);
}else if(strcmp(argv[i], "--no-exit") == 0)
{
Settings::getInstance()->setBool("DONTSHOWEXIT", true);
}else if(strcmp(argv[i], "--debug") == 0)
{
Settings::getInstance()->setBool("DEBUG", true);
Log::setReportingLevel(LogDebug);
}else if(strcmp(argv[i], "--dimtime") == 0)
{
Settings::getInstance()->setInt("DIMTIME", atoi(argv[i + 1]) * 1000);
i++; //skip the argument value
}else if(strcmp(argv[i], "--windowed") == 0)
{
Settings::getInstance()->setBool("WINDOWED", true);
}else if(strcmp(argv[i], "--scrape") == 0)
{
scrape_cmdline = true;
}else if(strcmp(argv[i], "--help") == 0)
{
std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";
std::cout << "Command line arguments:\n";
std::cout << "-w [width in pixels] set screen width\n";
std::cout << "-h [height in pixels] set screen height\n";
std::cout << "--gamelist-only skip automatic game detection, only read from gamelist.xml\n";
std::cout << "--ignore-gamelist ignore the gamelist (useful for troubleshooting)\n";
std::cout << "--draw-framerate display the framerate\n";
std::cout << "--no-exit don't show the exit option in the menu\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 << "--scrape scrape using command line interface\n";
std::cout << "--windowed not fullscreen\n";
std::cout << "--help summon a sentient, angry tuba\n\n";
std::cout << "More information available in README.md.\n";
return false; //exit after printing help
}
*width = atoi(argv[i + 1]);
i++; //skip the argument value
}else if(strcmp(argv[i], "-h") == 0)
{
*height = atoi(argv[i + 1]);
i++; //skip the argument value
}else if(strcmp(argv[i], "--gamelist-only") == 0)
{
Settings::getInstance()->setBool("PARSEGAMELISTONLY", true);
}else if(strcmp(argv[i], "--ignore-gamelist") == 0)
{
Settings::getInstance()->setBool("IGNOREGAMELIST", true);
}else if(strcmp(argv[i], "--draw-framerate") == 0)
{
Settings::getInstance()->setBool("DRAWFRAMERATE", true);
}else if(strcmp(argv[i], "--no-exit") == 0)
{
Settings::getInstance()->setBool("DONTSHOWEXIT", true);
}else if(strcmp(argv[i], "--debug") == 0)
{
Settings::getInstance()->setBool("DEBUG", true);
Log::setReportingLevel(LogDebug);
}else if(strcmp(argv[i], "--dimtime") == 0)
{
Settings::getInstance()->setInt("DIMTIME", atoi(argv[i + 1]) * 1000);
i++; //skip the argument value
}else if(strcmp(argv[i], "--windowed") == 0)
{
Settings::getInstance()->setBool("WINDOWED", true);
}else if(strcmp(argv[i], "--scrape") == 0)
{
scrape_cmdline = true;
}else if(strcmp(argv[i], "--help") == 0)
{
std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";
std::cout << "Command line arguments:\n";
std::cout << "-w [width in pixels] set screen width\n";
std::cout << "-h [height in pixels] set screen height\n";
std::cout << "--gamelist-only skip automatic game detection, only read from gamelist.xml\n";
std::cout << "--ignore-gamelist ignore the gamelist (useful for troubleshooting)\n";
std::cout << "--draw-framerate display the framerate\n";
std::cout << "--no-exit don't show the exit option in the menu\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 << "--scrape scrape using command line interface\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 << "More information available in README.md.\n";
return false; //exit after printing help
}
}

View file

@ -10,7 +10,8 @@ SystemView::SystemView(Window* window, SystemData* system) : GuiComponent(window
mHeaderImage(window),
mHeaderText(window),
mImage(window)
mImage(window),
mExtras(window)
{
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.setResize(0, mSize.y() * 0.8f, false);
addChild(&mExtras);
addChild(&mImage);
addChild(&mHeaderText);
addChild(&mHeaderImage);
@ -37,8 +39,10 @@ void SystemView::updateData()
{
using namespace ThemeFlags;
mExtras.setExtras(ThemeData::makeExtras(mSystem->getTheme(), "system", mWindow));
mHeaderImage.setImage("");
mHeaderImage.applyTheme(mSystem->getTheme(), "system", "header", PATH);
mHeaderImage.applyTheme(mSystem->getTheme(), "system", "header", ALL);
// header
if(mHeaderImage.hasImage())
@ -51,7 +55,7 @@ void SystemView::updateData()
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)

View file

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