[Scummvm-cvs-logs] SF.net SVN: scummvm:[34897] scummvm/trunk/gui
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Nov 4 20:49:26 CET 2008
Revision: 34897
http://scummvm.svn.sourceforge.net/scummvm/?rev=34897&view=rev
Author: fingolfin
Date: 2008-11-04 19:49:26 +0000 (Tue, 04 Nov 2008)
Log Message:
-----------
Some cleanup / handle the case where the themepath is neither pointing to a dir nor to a .zip file
Modified Paths:
--------------
scummvm/trunk/gui/ThemeEngine.cpp
scummvm/trunk/gui/ThemeEngine.h
Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp 2008-11-04 16:11:40 UTC (rev 34896)
+++ scummvm/trunk/gui/ThemeEngine.cpp 2008-11-04 19:49:26 UTC (rev 34897)
@@ -487,18 +487,19 @@
/**********************************************************
* Theme XML loading
*********************************************************/
-bool ThemeEngine::loadTheme(Common::String fileName) {
+bool ThemeEngine::loadTheme(const Common::String &fileName) {
unloadTheme();
- if (fileName != "builtin")
+ bool tryAgain = false;
+ if (fileName != "builtin") {
ImageMan.addArchive(fileName);
+ if (!loadThemeXML(fileName)) {
+ warning("Could not parse custom theme '%s'. Falling back to default theme", fileName.c_str());
+ tryAgain = true; // Fall back to default builtin theme
+ }
+ }
- if (fileName == "builtin") {
- if (!loadDefaultXML())
- error("Could not load default embedded theme");
- } else if (!loadThemeXML(fileName)) {
- warning("Could not parse custom theme '%s'. Falling back to default theme", fileName.c_str());
-
+ if (fileName == "builtin" || tryAgain) {
if (!loadDefaultXML()) // if we can't load the embedded theme, this is a complete failure
error("Could not load default embedded theme");
}
@@ -571,9 +572,13 @@
#endif
} else if (node.isDirectory()) {
+ warning("Don't know how to open theme '%s'", themeName.c_str());
archive = new Common::FSDirectory(node);
}
+ if (!archive)
+ return false;
+
Common::File themercFile;
// FIXME: Possibly dereferencing a NULL pointer here if the node's
// name doesn't have a ".zip" suffix and the node is not a directory.
Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h 2008-11-04 16:11:40 UTC (rev 34896)
+++ scummvm/trunk/gui/ThemeEngine.h 2008-11-04 19:49:26 UTC (rev 34897)
@@ -476,8 +476,8 @@
return _initOk && _themeOk;
}
- /** Custom implementation of the GUI::Theme API, changed to use the XML parser. */
- bool loadTheme(Common::String themeName);
+ /** Load the them from the file with the specified name. */
+ bool loadTheme(const Common::String &fileName);
/**
* Changes the active graphics mode of the GUI; may be used to either
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list