aboutsummaryrefslogtreecommitdiff
path: root/gui/browser.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2013-01-28 07:14:40 -0800
committerJohannes Schickel2013-01-28 07:14:40 -0800
commitd0e9ef7dc12f5c9ff18f09536545c0e2e5e604d7 (patch)
tree0b99c2f5e20977976583e03c2a5bd42fdd19ef49 /gui/browser.cpp
parent44f58f4031e1b85f6131aa3e6807819b279718b1 (diff)
parent0a3e00b307c7977fda9849b577a81c5c6304b8e5 (diff)
downloadscummvm-rg350-d0e9ef7dc12f5c9ff18f09536545c0e2e5e604d7.tar.gz
scummvm-rg350-d0e9ef7dc12f5c9ff18f09536545c0e2e5e604d7.tar.bz2
scummvm-rg350-d0e9ef7dc12f5c9ff18f09536545c0e2e5e604d7.zip
Merge pull request #306 from lordhoto/filechooser-hidden
GUI: Allow user to display hidden files in the browser dialog.
Diffstat (limited to 'gui/browser.cpp')
-rw-r--r--gui/browser.cpp18
1 files changed, 16 insertions, 2 deletions
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());