aboutsummaryrefslogtreecommitdiff
path: root/gui/launcher.cpp
diff options
context:
space:
mode:
authorMax Horn2004-10-01 21:12:18 +0000
committerMax Horn2004-10-01 21:12:18 +0000
commitee3158cb8ca8b05d7c1a474f09ade8ac91209fbc (patch)
tree33a41f126af456cf18e93b338ca3d8be391be89b /gui/launcher.cpp
parentca12f3f996bd8775002c58248dc8e2fb133d4caa (diff)
downloadscummvm-rg350-ee3158cb8ca8b05d7c1a474f09ade8ac91209fbc.tar.gz
scummvm-rg350-ee3158cb8ca8b05d7c1a474f09ade8ac91209fbc.tar.bz2
scummvm-rg350-ee3158cb8ca8b05d7c1a474f09ade8ac91209fbc.zip
Patch #896096 (Restoring last selected game selection) with some personal modifications
svn-id: r15372
Diffstat (limited to 'gui/launcher.cpp')
-rw-r--r--gui/launcher.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 54fc742268..23764fda90 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -421,9 +421,19 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
// Populate the list
updateListing();
- // TODO - make a default selection (maybe the game user played last?)
- //_list->setSelected(0);
-
+ // Restore last selection
+ String last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
+ if (!last.isEmpty()) {
+ int itemToSelect = 0;
+ StringList::const_iterator iter;
+ for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) {
+ if (last == *iter) {
+ _list->setSelected(itemToSelect);
+ break;
+ }
+ }
+ }
+
// En-/Disable the buttons depending on the list selection
updateButtons();
@@ -435,6 +445,18 @@ LauncherDialog::~LauncherDialog() {
delete _browser;
}
+void LauncherDialog::close() {
+ // Save last selection
+ const int sel = _list->getSelected();
+ if (sel >= 0)
+ ConfMan.set(String("lastselectedgame"), _domains[sel], ConfigManager::kApplicationDomain);
+ else
+ ConfMan.removeKey(String("lastselectedgame"), ConfigManager::kApplicationDomain);
+
+ ConfMan.flushToDisk();
+ Dialog::close();
+}
+
void LauncherDialog::updateListing() {
Common::StringList l;
@@ -654,9 +676,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
updateButtons();
break;
case kQuitCmd:
-#ifdef __PALM_OS__
close();
-#endif
g_system->quit();
break;
default: