[Scummvm-cvs-logs] SF.net SVN: scummvm:[35706] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Jan 3 17:24:10 CET 2009


Revision: 35706
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35706&view=rev
Author:   lordhoto
Date:     2009-01-03 16:24:10 +0000 (Sat, 03 Jan 2009)

Log Message:
-----------
- Prevented full theme search when "builtin" theme was specified
- Only do a recursive search for themes with depth 1 in '.'

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEngine.h

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2009-01-03 16:03:50 UTC (rev 35705)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2009-01-03 16:24:10 UTC (rev 35706)
@@ -1199,7 +1199,7 @@
 	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 @@
 	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 @@
 	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 @@
 	// 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);
 

Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h	2009-01-03 16:03:50 UTC (rev 35705)
+++ scummvm/trunk/gui/ThemeEngine.h	2009-01-03 16:24:10 UTC (rev 35706)
@@ -600,7 +600,7 @@
 
 	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:
 	/**


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