aboutsummaryrefslogtreecommitdiff
path: root/gui/themebrowser.cpp
diff options
context:
space:
mode:
authorVicent Marti2008-08-16 14:06:26 +0000
committerVicent Marti2008-08-16 14:06:26 +0000
commit5201a46054a1390739b21532c45e0e9926b857bc (patch)
tree12c2981126b18c16a5acb430cb951ba6ef554621 /gui/themebrowser.cpp
parent146be8e16b0abd43f87274a305d9d65b594d1d7f (diff)
downloadscummvm-rg350-5201a46054a1390739b21532c45e0e9926b857bc.tar.gz
scummvm-rg350-5201a46054a1390739b21532c45e0e9926b857bc.tar.bz2
scummvm-rg350-5201a46054a1390739b21532c45e0e9926b857bc.zip
Added support for loading uncompressed/unpackaged themes.
svn-id: r33941
Diffstat (limited to 'gui/themebrowser.cpp')
-rw-r--r--gui/themebrowser.cpp43
1 files changed, 33 insertions, 10 deletions
diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp
index 490248619b..dd15742258 100644
--- a/gui/themebrowser.cpp
+++ b/gui/themebrowser.cpp
@@ -146,16 +146,34 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) {
return;
FSList fslist;
- if (!node.getChildren(fslist, FilesystemNode::kListAll))
- return;
-
- for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
- if (i->isDirectory()) {
- addDir(list, i->getPath(), level-1);
- } else {
+
+#ifdef USE_ZLIB
+ if (node.lookupFile(fslist, "*.zip", false, true, 0)) {
+ for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
Entry th;
if (isTheme(*i, th)) {
bool add = true;
+
+ for (ThList::const_iterator p = list.begin(); p != list.end(); ++p) {
+ if (p->name == th.name || p->file == th.file) {
+ add = false;
+ break;
+ }
+ }
+
+ if (add)
+ list.push_back(th);
+ }
+ }
+ }
+#endif
+
+ if (node.lookupFile(fslist, "THEMERC", false, true, 1)) {
+ for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
+ Entry th;
+ if (isTheme(i->getParent(), th)) {
+ bool add = true;
+
for (ThList::const_iterator p = list.begin(); p != list.end(); ++p) {
if (p->name == th.name || p->file == th.file) {
add = false;
@@ -171,12 +189,17 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) {
}
bool ThemeBrowser::isTheme(const FilesystemNode &node, Entry &out) {
- out.file = node.getName();
+ out.file = node.getName();
- if (!out.file.hasSuffix(".zip"))
+#ifdef USE_ZLIB
+ if (!out.file.hasSuffix(".zip") && !node.isDirectory())
return false;
+#else
+ if (!node.isDirectory())
+ return false;
+#endif
- if (!Theme::themeConfigUseable(out.file, out.name))
+ if (!Theme::themeConfigUseable(node, out.name))
return false;
return true;