[Scummvm-cvs-logs] SF.net SVN: scummvm:[46312] scummvm/trunk/gui/browser.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Dec 9 17:48:33 CET 2009


Revision: 46312
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46312&view=rev
Author:   lordhoto
Date:     2009-12-09 16:48:33 +0000 (Wed, 09 Dec 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/gui/browser.cpp

Modified: scummvm/trunk/gui/browser.cpp
===================================================================
--- scummvm/trunk/gui/browser.cpp	2009-12-09 16:46:14 UTC (rev 46311)
+++ scummvm/trunk/gui/browser.cpp	2009-12-09 16:48:33 UTC (rev 46312)
@@ -184,11 +184,10 @@
 			// 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 @@
 		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 @@
 	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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list