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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Jan 2 21:21:21 CET 2009


Revision: 35681
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35681&view=rev
Author:   lordhoto
Date:     2009-01-02 20:21:21 +0000 (Fri, 02 Jan 2009)

Log Message:
-----------
- Fixed --gui-theme command line description
- Added --list-themes command line command to list available GUI themes

Modified Paths:
--------------
    scummvm/trunk/base/commandLine.cpp
    scummvm/trunk/gui/GuiManager.cpp
    scummvm/trunk/gui/GuiManager.h
    scummvm/trunk/gui/themebrowser.cpp

Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp	2009-01-02 20:03:45 UTC (rev 35680)
+++ scummvm/trunk/base/commandLine.cpp	2009-01-02 20:21:21 UTC (rev 35681)
@@ -34,6 +34,8 @@
 
 #include "sound/mididrv.h"
 
+#include "gui/GuiManager.h"
+
 #define DETECTOR_TESTING_HACK
 
 namespace Base {
@@ -68,8 +70,9 @@
 	"  -g, --gfx-mode=MODE      Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n"
 	"                           supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n"
 	"                           dotmatrix)\n"
-	"  --gui-theme=THEME        Select GUI theme (default, modern, classic)\n"
+	"  --gui-theme=THEME        Select GUI theme\n"
 	"  --themepath=PATH         Path to where GUI themes are stored\n"
+	"  --list-themes            Lists all usable GUI themes\n"
 	"  -e, --music-driver=MODE  Select music driver (see README for details)\n"
 	"  -q, --language=LANG      Select language (en,de,fr,it,pt,es,jp,zh,kr,se,gb,\n"
 	"                           hb,ru,cz)\n"
@@ -484,6 +487,9 @@
 				}
 			END_OPTION
 
+			DO_LONG_COMMAND("list-themes")
+			END_OPTION
+
 			DO_LONG_OPTION("target-md5")
 			END_OPTION
 
@@ -617,7 +623,20 @@
 	ConfMan.setActiveDomain(oldDomain);
 }
 
+/** Lists all usable themes */
+static void listThemes() {
+	typedef Common::List<GUI::GuiManager::ThemeDescriptor> ThList;
+	ThList thList;
+	GUI::GuiManager::listUsableThemes(thList);
 
+	printf("Theme          Description\n");
+	printf("-------------- ------------------------------------------------\n");
+
+	for (ThList::const_iterator i = thList.begin(); i != thList.end(); ++i)
+		printf("%-14s %s\n", i->id.c_str(), i->name.c_str());
+}
+
+
 #ifdef DETECTOR_TESTING_HACK
 static void runDetectorTest() {
 	// HACK: The following code can be used to test the detection code of our
@@ -715,6 +734,9 @@
 	} else if (command == "list-saves") {
 		listSaves(settings["list-saves"].c_str());
 		return false;
+	} else if (command == "list-themes") {
+		listThemes();
+		return false;
 	} else if (command == "version") {
 		printf("%s\n", gScummVMFullVersion);
 		printf("Features compiled in: %s\n", gScummVMFeatures);

Modified: scummvm/trunk/gui/GuiManager.cpp
===================================================================
--- scummvm/trunk/gui/GuiManager.cpp	2009-01-02 20:03:45 UTC (rev 35680)
+++ scummvm/trunk/gui/GuiManager.cpp	2009-01-02 20:21:21 UTC (rev 35681)
@@ -60,7 +60,6 @@
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
 
-
 	ConfMan.registerDefault("gui_theme", "scummmodern");
 	Common::String themefile(ConfMan.get("gui_theme"));
 
@@ -151,7 +150,7 @@
 
 } // end of anonymous namespace
 
-void GuiManager::listUseableThemes(Common::List<ThemeDescriptor> &list) {
+void GuiManager::listUsableThemes(Common::List<ThemeDescriptor> &list) {
 	ThemeDescriptor th;
 	th.name = "ScummVM Classic Theme (Builtin Version)";
 	th.id = "builtin";
@@ -159,10 +158,10 @@
 	list.push_back(th);
 
 	if (ConfMan.hasKey("themepath"))
-		listUseableThemes(Common::FSNode(ConfMan.get("themepath")), list);
+		listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list);
 
 #ifdef DATA_PATH
-	listUseableThemes(Common::FSNode(DATA_PATH), list);
+	listUsableThemes(Common::FSNode(DATA_PATH), list);
 #endif
 
 #ifdef MACOSX
@@ -171,16 +170,16 @@
 		char buf[256];
 		if (CFURLGetFileSystemRepresentation(resourceUrl, true, (UInt8 *)buf, 256)) {
 			Common::FSNode resourcePath(buf);
-			listUseableThemes(resourcePath, list);
+			listUsableThemes(resourcePath, list);
 		}
 		CFRelease(resourceUrl);
 	}
 #endif
 
 	if (ConfMan.hasKey("extrapath"))
-		listUseableThemes(Common::FSNode(ConfMan.get("extrapath")), list);
+		listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list);
 
-	listUseableThemes(Common::FSNode("."), list);
+	listUsableThemes(Common::FSNode("."), list);
 
 	// Now we need to strip all duplicates
 	// TODO: It might not be the best idea to strip duplicates. The user might
@@ -199,7 +198,7 @@
 	output.clear();
 }
 
-void GuiManager::listUseableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list) {
+void GuiManager::listUsableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list) {
 	if (!node.exists() || !node.isReadable() || !node.isDirectory())
 		return;
 
@@ -252,7 +251,7 @@
 		return;
 
 	for (Common::FSList::iterator i = fileList.begin(); i != fileList.end(); ++i)
-		listUseableThemes(*i, list);
+		listUsableThemes(*i, list);
 }
 
 Common::String GuiManager::findThemeFile(const Common::String &id) {
@@ -273,7 +272,7 @@
 	// a complete theme list, thus it is slower than it could be.
 	// But it is the easiest solution for now.
 	Common::List<ThemeDescriptor> list;
-	listUseableThemes(list);
+	listUsableThemes(list);
 
 	for (Common::List<ThemeDescriptor>::const_iterator i = list.begin(); i != list.end(); ++i) {
 		if (id.equalsIgnoreCase(i->id))

Modified: scummvm/trunk/gui/GuiManager.h
===================================================================
--- scummvm/trunk/gui/GuiManager.h	2009-01-02 20:03:45 UTC (rev 35680)
+++ scummvm/trunk/gui/GuiManager.h	2009-01-02 20:21:21 UTC (rev 35681)
@@ -102,7 +102,7 @@
 	/**
 	 * Lists all theme files useable.
 	 */
-	void listUseableThemes(Common::List<ThemeDescriptor> &list);
+	static void listUsableThemes(Common::List<ThemeDescriptor> &list);
 protected:
 	enum RedrawStatus {
 		kRedrawDisabled = 0,
@@ -159,7 +159,7 @@
 	void screenChange();
 
 	Common::String findThemeFile(const Common::String &id);
-	void listUseableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list);
+	static void listUsableThemes(Common::FSNode node, Common::List<ThemeDescriptor> &list);
 };
 
 } // End of namespace GUI

Modified: scummvm/trunk/gui/themebrowser.cpp
===================================================================
--- scummvm/trunk/gui/themebrowser.cpp	2009-01-02 20:03:45 UTC (rev 35680)
+++ scummvm/trunk/gui/themebrowser.cpp	2009-01-02 20:21:21 UTC (rev 35681)
@@ -95,7 +95,7 @@
 void ThemeBrowser::updateListing() {
 	_themes.clear();
 
-	g_gui.listUseableThemes(_themes);
+	GuiManager::listUsableThemes(_themes);
 
 	Common::StringList list;
 	for (ThemeDescList::const_iterator i = _themes.begin(); i != _themes.end(); ++i)


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