From 0a3e00b307c7977fda9849b577a81c5c6304b8e5 Mon Sep 17 00:00:00 2001
From: Johannes Schickel
Date: Sun, 27 Jan 2013 19:11:20 +0100
Subject: GUI: Allow user to display hidden files in the browser dialog.
This implements feature request #3600774 "File browser: show hidden files".
---
gui/ThemeEngine.h | 2 +-
gui/browser.cpp | 18 ++++++++++++--
gui/browser.h | 4 ++++
gui/themes/default.inc | 14 +++++++++--
gui/themes/scummclassic.zip | Bin 103734 -> 104007 bytes
gui/themes/scummclassic/THEMERC | 2 +-
gui/themes/scummclassic/classic_layout.stx | 25 ++++++++++++--------
gui/themes/scummclassic/classic_layout_lowres.stx | 26 ++++++++++++---------
gui/themes/scummmodern.zip | Bin 1462039 -> 1462312 bytes
gui/themes/scummmodern/THEMERC | 2 +-
gui/themes/scummmodern/scummmodern_layout.stx | 25 ++++++++++++--------
.../scummmodern/scummmodern_layout_lowres.stx | 26 ++++++++++++---------
12 files changed, 95 insertions(+), 49 deletions(-)
(limited to 'gui')
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index dda9f2c2b5..6e5fd291b7 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -35,7 +35,7 @@
#include "graphics/pixelformat.h"
-#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.19"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.20"
class OSystem;
diff --git a/gui/browser.cpp b/gui/browser.cpp
index 2b4f254156..84f2d0f747 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -32,7 +32,8 @@ namespace GUI {
enum {
kChooseCmd = 'Chos',
- kGoUpCmd = 'GoUp'
+ kGoUpCmd = 'GoUp',
+ kHiddenCmd = 'Hidd'
};
/* We want to use this as a general directory selector at some point... possible uses
@@ -47,6 +48,7 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
_isDirBrowser = dirBrowser;
_fileList = NULL;
_currentPath = NULL;
+ _showHidden = ConfMan.getBool("gui_browser_show_hidden", Common::ConfigManager::kApplicationDomain);
// Headline - TODO: should be customizable during creation time
new StaticTextWidget(this, "Browser.Headline", title);
@@ -61,6 +63,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
_backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;
+ // Checkbox for the "show hidden files" state.
+ _showHiddenWidget = new CheckboxWidget(this, "Browser.Hidden", _("Show hidden files"), _("Show files marked with the hidden attribute"), kHiddenCmd);
+
// Buttons
if (g_system->getOverlayWidth() > 320)
new ButtonWidget(this, "Browser.Up", _("Go up"), _("Go to previous directory level"), kGoUpCmd);
@@ -132,6 +137,15 @@ void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
if (data != (uint32)-1 && _isDirBrowser && !_nodeContent[data].isDirectory())
_fileList->setSelected(-1);
break;
+ case kHiddenCmd:
+ // Update whether the user wants hidden files to be shown
+ _showHidden = _showHiddenWidget->getState();
+ // We save the state in the application domain to avoid cluttering and
+ // to prevent odd behavior.
+ ConfMan.setBool("gui_browser_show_hidden", _showHidden, Common::ConfigManager::kApplicationDomain);
+ // Update the file listing
+ updateListing();
+ break;
default:
Dialog::handleCommand(sender, cmd, data);
}
@@ -145,7 +159,7 @@ void BrowserDialog::updateListing() {
ConfMan.set("browser_lastpath", _node.getPath());
// Read in the data from the file system
- if (!_node.getChildren(_nodeContent, Common::FSNode::kListAll))
+ if (!_node.getChildren(_nodeContent, Common::FSNode::kListAll, _showHidden))
_nodeContent.clear();
else
Common::sort(_nodeContent.begin(), _nodeContent.end());
diff --git a/gui/browser.h b/gui/browser.h
index 5cf091fbf4..7c098617bb 100644
--- a/gui/browser.h
+++ b/gui/browser.h
@@ -29,6 +29,7 @@ namespace GUI {
class ListWidget;
class StaticTextWidget;
+class CheckboxWidget;
class CommandSender;
class BrowserDialog : public Dialog {
@@ -40,6 +41,7 @@ public:
virtual int runModal();
#else
virtual void open();
+
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
#endif
@@ -54,6 +56,8 @@ protected:
StaticTextWidget *_currentPath;
Common::FSNode _node;
Common::FSList _nodeContent;
+ bool _showHidden;
+ CheckboxWidget *_showHiddenWidget;
#endif
Common::FSNode _choice;
bool _isDirBrowser;
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 78c04f14c6..b0db4735e7 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -740,7 +740,11 @@
"height='Globals.Line.Height' "
"/> "
" "
-" "
+" "
+" "
+" "
" "
@@ -753,6 +757,7 @@
"/> "
" "
" "
+" "
" "
" "
"
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index d42efb5aa4..097f4d6e44 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -163,18 +163,22 @@
height = 'Globals.Line.Height'
/>
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 412ed6a96f..8daabf87dc 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index 9e8776263b..f4304622cb 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.19:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.8.20:ScummVM Modern Theme:No Author]
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index fa57e62c54..49c13cf1b0 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -180,17 +180,22 @@
height = 'Globals.Line.Height'
/>
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 5c3cc8357e..5e6ba32a5d 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -161,18 +161,22 @@
height = 'Globals.Line.Height'
/>
-
-
-
-
-
-
+
+
+
+
+
+
+
--
cgit v1.2.3