aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2017-03-08 23:17:38 +0100
committerJoseph-Eugene Winzer2017-03-09 04:26:20 +0100
commit66c2ae244f6098c6af5120c96c616a1739d0ae02 (patch)
tree843f46064284b8a483ca95f96047d114964bf807
parent65ef0c8ff84588962a32ddc2df2e1de17325d0a5 (diff)
downloadscummvm-rg350-66c2ae244f6098c6af5120c96c616a1739d0ae02.tar.gz
scummvm-rg350-66c2ae244f6098c6af5120c96c616a1739d0ae02.tar.bz2
scummvm-rg350-66c2ae244f6098c6af5120c96c616a1739d0ae02.zip
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.
-rw-r--r--gui/ThemeEngine.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 8e04b35f45..c27d36d07e 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() {