[Scummvm-git-logs] scummvm master -> 8726792ae6cb3db94de9302bb9f41e808fdcdf7f

criezy criezy at scummvm.org
Thu Mar 9 23:27:50 CET 2017


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
66c2ae244f GUI: Fix resolution of theme filename to id
f39412fcec GUI: Fix Theme Label in Options->Misc
8726792ae6 Merge pull request #919 from Joefish/master


Commit: 66c2ae244f6098c6af5120c96c616a1739d0ae02
    https://github.com/scummvm/scummvm/commit/66c2ae244f6098c6af5120c96c616a1739d0ae02
Author: Joseph-Eugene Winzer (m999 at openmailbox.org)
Date: 2017-03-09T04:26:20+01:00

Commit Message:
GUI: Fix resolution of theme filename to id

getThemeId() returned "builtin" for valid filenames because FSNode only
searches for the theme filename, like "scummmodern.zip" in the current
directory. listUsableThemes() searches SearchMan default directories
for theme files.

Changed paths:
    gui/ThemeEngine.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 8e04b35..c27d36d 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -2420,19 +2420,32 @@ Common::String ThemeEngine::getThemeId(const Common::String &filename) {
 		return "builtin";
 
 	Common::FSNode node(filename);
-	if (!node.exists())
-		return "builtin";
+	if (node.exists()) {
+		if (node.getName().matchString("*.zip", true)) {
+			Common::String id = node.getName();
 
-	if (node.getName().matchString("*.zip", true)) {
-		Common::String id = node.getName();
+			for (int i = 0; i < 4; ++i)
+				id.deleteLastChar();
 
-		for (int i = 0; i < 4; ++i)
-			id.deleteLastChar();
+			return id;
+		} else {
+			return node.getName();
+		}
+	}
 
-		return id;
-	} else {
-		return node.getName();
+	// FIXME:
+	// A very ugly hack to map a id to a filename, this will generate
+	// a complete theme list, thus it is slower than it could be.
+	// But it is the easiest solution for now.
+	Common::List<ThemeDescriptor> list;
+	listUsableThemes(list);
+
+	for (Common::List<ThemeDescriptor>::const_iterator i = list.begin(); i != list.end(); ++i) {
+		if (filename.equalsIgnoreCase(i->filename))
+			return i->id;
 	}
+
+	return "builtin";
 }
 
 void ThemeEngine::showCursor() {


Commit: f39412fcec6ae9310b0587df6b4a5e6a5b5ab427
    https://github.com/scummvm/scummvm/commit/f39412fcec6ae9310b0587df6b4a5e6a5b5ab427
Author: Joseph-Eugene Winzer (m999 at openmailbox.org)
Date: 2017-03-09T04:26:20+01:00

Commit Message:
GUI: Fix Theme Label in Options->Misc

The theme label in the Misc tab will not change to the correct theme
when current language and theme is changed and 'apply' pressed.
loadNewTheme() does not do a rebuild of all widgets, including the
theme label, like it is explicitly done in the 'language section'.
The problem is that rebuild() uses the currently applied settings to
rebuild all widgets. Although a new theme was selected by the user the
label will be overwritten with the name of the still active theme.

By rearranging the logic a complete rebuild of the GUI is done and
updates the widgets correctly.

Changed paths:
    gui/options.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index 5b62d49..7a22a9b 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1838,24 +1838,6 @@ void GlobalOptionsDialog::apply() {
 		g_gui.loadNewTheme(g_gui.theme()->getThemeId(), selected);
 		ConfMan.set("gui_renderer", cfg, _domain);
 	}
-#ifdef USE_TRANSLATION
-	Common::String oldLang = ConfMan.get("gui_language");
-	int selLang = _guiLanguagePopUp->getSelectedTag();
-
-	ConfMan.set("gui_language", TransMan.getLangById(selLang));
-
-	Common::String newLang = ConfMan.get("gui_language").c_str();
-	if (newLang != oldLang) {
-		// Activate the selected language
-		TransMan.setLanguage(selLang);
-
-		// Rebuild the Launcher and Options dialogs
-		g_gui.loadNewTheme(g_gui.theme()->getThemeId(), ThemeEngine::kGfxDisabled, true);
-		rebuild();
-		if (_launcher != 0)
-			_launcher->rebuild();
-	}
-#endif // USE_TRANSLATION
 
 #ifdef USE_UPDATES
 	ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag());
@@ -1926,6 +1908,24 @@ void GlobalOptionsDialog::apply() {
 		draw();
 		_newTheme.clear();
 	}
+#ifdef USE_TRANSLATION
+	Common::String oldLang = ConfMan.get("gui_language");
+	int selLang = _guiLanguagePopUp->getSelectedTag();
+
+	ConfMan.set("gui_language", TransMan.getLangById(selLang));
+
+	Common::String newLang = ConfMan.get("gui_language").c_str();
+	if (newLang != oldLang) {
+		// Activate the selected language
+		TransMan.setLanguage(selLang);
+
+		// Rebuild the Launcher and Options dialogs
+		g_gui.loadNewTheme(g_gui.theme()->getThemeId(), ThemeEngine::kGfxDisabled, true);
+		rebuild();
+		if (_launcher != 0)
+			_launcher->rebuild();
+	}
+#endif // USE_TRANSLATION
 
 	OptionsDialog::apply();
 }


Commit: 8726792ae6cb3db94de9302bb9f41e808fdcdf7f
    https://github.com/scummvm/scummvm/commit/8726792ae6cb3db94de9302bb9f41e808fdcdf7f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-03-09T22:27:45Z

Commit Message:
Merge pull request #919 from Joefish/master

GUI: Fix for #9711

Changed paths:
    gui/ThemeEngine.cpp
    gui/options.cpp







More information about the Scummvm-git-logs mailing list