aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-01-03 16:24:10 +0000
committerJohannes Schickel2009-01-03 16:24:10 +0000
commitec631ba7f1cdeb8de4d247ac39cd4ccc4f24b078 (patch)
treecd89a5185e800d917aba76ee4a54732c5779d79b
parent3ee62c226f6eaa5dfc2b39ab77ca9c0ea76b147b (diff)
downloadscummvm-rg350-ec631ba7f1cdeb8de4d247ac39cd4ccc4f24b078.tar.gz
scummvm-rg350-ec631ba7f1cdeb8de4d247ac39cd4ccc4f24b078.tar.bz2
scummvm-rg350-ec631ba7f1cdeb8de4d247ac39cd4ccc4f24b078.zip
- Prevented full theme search when "builtin" theme was specified
- Only do a recursive search for themes with depth 1 in '.' svn-id: r35706
-rw-r--r--gui/ThemeEngine.cpp14
-rw-r--r--gui/ThemeEngine.h2
2 files changed, 12 insertions, 4 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 839137e1da..869294142f 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1199,7 +1199,7 @@ void ThemeEngine::listUsableThemes(Common::List<ThemeDescriptor> &list) {
if (ConfMan.hasKey("extrapath"))
listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list);
- listUsableThemes(Common::FSNode("."), list);
+ listUsableThemes(Common::FSNode("."), list, 1);
// Now we need to strip all duplicates
// TODO: It might not be the best idea to strip duplicates. The user might
@@ -1218,7 +1218,7 @@ void ThemeEngine::listUsableThemes(Common::List<ThemeDescriptor> &list) {
output.clear();
}
-void ThemeEngine::listUsableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list) {
+void ThemeEngine::listUsableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list, int depth) {
if (!node.exists() || !node.isReadable() || !node.isDirectory())
return;
@@ -1266,12 +1266,16 @@ void ThemeEngine::listUsableThemes(Common::FSNode node, Common::List<ThemeDescri
fileList.clear();
#endif
+ // Check if we exceeded the given recursion depth
+ if (depth - 1 == -1)
+ return;
+
// As next step we will search all subdirectories
if (!node.getChildren(fileList, Common::FSNode::kListDirectoriesOnly))
return;
for (Common::FSList::iterator i = fileList.begin(); i != fileList.end(); ++i)
- listUsableThemes(*i, list);
+ listUsableThemes(*i, list, depth == -1 ? - 1 : depth - 1);
}
Common::String ThemeEngine::getThemeFile(const Common::String &id) {
@@ -1280,6 +1284,10 @@ Common::String ThemeEngine::getThemeFile(const Common::String &id) {
// of the builtin one.
if (id.equalsIgnoreCase("default"))
return Common::String();
+
+ // For our builtin theme we don't have to do anything for now too
+ if (id.equalsIgnoreCase("builtin"))
+ return Common::String();
Common::FSNode node(id);
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 434730da51..b7b4bfaca6 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -600,7 +600,7 @@ private:
static Common::String getThemeFile(const Common::String &id);
static Common::String getThemeId(const Common::String &filename);
- static void listUsableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list);
+ static void listUsableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list, int depth=-1);
public:
/**