[Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.108,1.109 launcher.h,1.20,1.21

Max Horn fingolfin at users.sourceforge.net
Tue Jan 4 17:44:54 CET 2005


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6290

Modified Files:
	launcher.cpp launcher.h 
Log Message:
After adding a new game, select the new entry

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- launcher.cpp	1 Jan 2005 16:09:07 -0000	1.108
+++ launcher.cpp	5 Jan 2005 01:42:47 -0000	1.109
@@ -443,22 +443,26 @@
 
 	// Restore last selection
 	String last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
-	if (!last.isEmpty()) {
+	selectGame(last);
+	
+	// En-/Disable the buttons depending on the list selection
+	updateButtons();
+
+	// Create file browser dialog
+	_browser = new BrowserDialog("Select directory with game data");
+}
+
+void LauncherDialog::selectGame(const String &name) {
+	if (!name.isEmpty()) {
 		int itemToSelect = 0;
 		StringList::const_iterator iter;
 		for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) {
-			if (last == *iter) {
+			if (name == *iter) {
 				_list->setSelected(itemToSelect);
 				break;
 			}
 		}
 	}
-	
-	// En-/Disable the buttons depending on the list selection
-	updateButtons();
-
-	// Create file browser dialog
-	_browser = new BrowserDialog("Select directory with game data");
 }
 
 LauncherDialog::~LauncherDialog() {
@@ -609,8 +613,9 @@
 				// Write config to disk
 				ConfMan.flushToDisk();
 
-				// Update the ListWidget and force a redraw
+				// Update the ListWidget, select the new item, and force a redraw
 				updateListing();
+				selectGame(domain);
 				draw();
 			} else {
 				// User aborted, remove the the new domain again

Index: launcher.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- launcher.h	1 Jan 2005 16:09:07 -0000	1.20
+++ launcher.h	5 Jan 2005 01:42:52 -0000	1.21
@@ -56,6 +56,8 @@
 	virtual void addGame();
 	void removeGame(int item);
 	void editGame(int item);
+	
+	void selectGame(const String &name);
 };
 
 } // End of namespace GUI





More information about the Scummvm-git-logs mailing list