diff options
author | Max Horn | 2005-01-05 01:42:52 +0000 |
---|---|---|
committer | Max Horn | 2005-01-05 01:42:52 +0000 |
commit | 41b914e773da70b17b83eec69bfb9c2a14ea13f8 (patch) | |
tree | 06d7275c47bf031c4db3c02313ba39427e2cc1b4 | |
parent | 56656f002f1163181b0eb62888f59558e9169e35 (diff) | |
download | scummvm-rg350-41b914e773da70b17b83eec69bfb9c2a14ea13f8.tar.gz scummvm-rg350-41b914e773da70b17b83eec69bfb9c2a14ea13f8.tar.bz2 scummvm-rg350-41b914e773da70b17b83eec69bfb9c2a14ea13f8.zip |
After adding a new game, select the new entry
svn-id: r16434
-rw-r--r-- | gui/launcher.cpp | 23 | ||||
-rw-r--r-- | gui/launcher.h | 2 |
2 files changed, 16 insertions, 9 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp index a97ebc88d1..f72bdfa795 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -443,22 +443,26 @@ LauncherDialog::LauncherDialog(GameDetector &detector) // 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 @@ void LauncherDialog::addGame() { // 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 diff --git a/gui/launcher.h b/gui/launcher.h index a0ad898b5b..ba6cfa5210 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -56,6 +56,8 @@ protected: virtual void addGame(); void removeGame(int item); void editGame(int item); + + void selectGame(const String &name); }; } // End of namespace GUI |