aboutsummaryrefslogtreecommitdiff
path: root/gui/browser.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2009-12-09 16:48:33 +0000
committerJohannes Schickel2009-12-09 16:48:33 +0000
commit8f34e4b11c77740ad9a8e316f30382e8ad9cd4dc (patch)
treea344c0b6a938b11c2aaf59b7c3722ef3267452ec /gui/browser.cpp
parentd60b5ca516e80aebe2183f1525d067ea1796c97c (diff)
downloadscummvm-rg350-8f34e4b11c77740ad9a8e316f30382e8ad9cd4dc.tar.gz
scummvm-rg350-8f34e4b11c77740ad9a8e316f30382e8ad9cd4dc.tar.bz2
scummvm-rg350-8f34e4b11c77740ad9a8e316f30382e8ad9cd4dc.zip
Commit of the 2nd revision of my patch for FR# 2840967 "GUI: Display filenames in "Add games"'s file dialog", since it seems on "Making it easier for users to add games" on -devel the majority of developers, who commented, are for this.
svn-id: r46312
Diffstat (limited to 'gui/browser.cpp')
-rw-r--r--gui/browser.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/gui/browser.cpp b/gui/browser.cpp
index 3aa07d5548..e7be11531c 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -184,11 +184,10 @@ void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
// If nothing is selected in the list widget, choose the current dir.
// Else, choose the dir that is selected.
int selection = _fileList->getSelected();
- if (selection >= 0) {
+ if (selection >= 0)
_choice = _nodeContent[selection];
- } else {
+ else
_choice = _node;
- }
setResult(1);
close();
} else {
@@ -214,12 +213,19 @@ void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
if (_nodeContent[data].isDirectory()) {
_node = _nodeContent[data];
updateListing();
- } else {
+ } else if (!_isDirBrowser) {
_choice = _nodeContent[data];
setResult(1);
close();
}
break;
+ case kListSelectionChangedCmd:
+ // We do not allow selecting directories in directory
+ // browser mode, thus we will invalidate the selection
+ // when the user selects an directory over here.
+ if (data != (uint32)-1 && _isDirBrowser && !_nodeContent[data].isDirectory())
+ _fileList->setSelected(-1);
+ break;
default:
Dialog::handleCommand(sender, cmd, data);
}
@@ -233,24 +239,32 @@ void BrowserDialog::updateListing() {
ConfMan.set("browser_lastpath", _node.getPath());
// Read in the data from the file system
- Common::FSNode::ListMode listMode =
- _isDirBrowser ? Common::FSNode::kListDirectoriesOnly
- : Common::FSNode::kListAll;
- if (!_node.getChildren(_nodeContent, listMode)) {
+ if (!_node.getChildren(_nodeContent, Common::FSNode::kListAll))
_nodeContent.clear();
- } else {
+ else
Common::sort(_nodeContent.begin(), _nodeContent.end());
- }
// Populate the ListWidget
Common::StringList list;
+ ListWidget::ColorList colors;
for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) {
- if (!_isDirBrowser && i->isDirectory())
+ if (i->isDirectory())
list.push_back(i->getDisplayName() + "/");
else
list.push_back(i->getDisplayName());
+
+ if (_isDirBrowser) {
+ if (i->isDirectory())
+ colors.push_back(ThemeEngine::kFontColorNormal);
+ else
+ colors.push_back(ThemeEngine::kFontColorAlternate);
+ }
}
- _fileList->setList(list);
+
+ if (_isDirBrowser)
+ _fileList->setList(list, &colors);
+ else
+ _fileList->setList(list);
_fileList->scrollTo(0);
// Finally, redraw