After adding a new game, select the new entry
svn-id: r16434
This commit is contained in:
parent
56656f002f
commit
41b914e773
2 changed files with 18 additions and 11 deletions
|
@ -443,16 +443,7 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
|
||||||
|
|
||||||
// Restore last selection
|
// Restore last selection
|
||||||
String last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
|
String last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
|
||||||
if (!last.isEmpty()) {
|
selectGame(last);
|
||||||
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
|
// En-/Disable the buttons depending on the list selection
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
@ -461,6 +452,19 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
|
||||||
_browser = new BrowserDialog("Select directory with game data");
|
_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 (name == *iter) {
|
||||||
|
_list->setSelected(itemToSelect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LauncherDialog::~LauncherDialog() {
|
LauncherDialog::~LauncherDialog() {
|
||||||
delete _browser;
|
delete _browser;
|
||||||
}
|
}
|
||||||
|
@ -609,8 +613,9 @@ void LauncherDialog::addGame() {
|
||||||
// Write config to disk
|
// Write config to disk
|
||||||
ConfMan.flushToDisk();
|
ConfMan.flushToDisk();
|
||||||
|
|
||||||
// Update the ListWidget and force a redraw
|
// Update the ListWidget, select the new item, and force a redraw
|
||||||
updateListing();
|
updateListing();
|
||||||
|
selectGame(domain);
|
||||||
draw();
|
draw();
|
||||||
} else {
|
} else {
|
||||||
// User aborted, remove the the new domain again
|
// User aborted, remove the the new domain again
|
||||||
|
|
|
@ -56,6 +56,8 @@ protected:
|
||||||
virtual void addGame();
|
virtual void addGame();
|
||||||
void removeGame(int item);
|
void removeGame(int item);
|
||||||
void editGame(int item);
|
void editGame(int item);
|
||||||
|
|
||||||
|
void selectGame(const String &name);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace GUI
|
} // End of namespace GUI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue