diff options
author | Max Horn | 2008-07-29 16:29:28 +0000 |
---|---|---|
committer | Max Horn | 2008-07-29 16:29:28 +0000 |
commit | 57c069ad47b3ca40f7ec280d3c30942cc4b41e86 (patch) | |
tree | 09eb963ee973d66ec688da00a7912b1b6eca0c11 /gui | |
parent | df6e8e88896c5af373d4c4efdd38bb226c4f03d5 (diff) | |
download | scummvm-rg350-57c069ad47b3ca40f7ec280d3c30942cc4b41e86.tar.gz scummvm-rg350-57c069ad47b3ca40f7ec280d3c30942cc4b41e86.tar.bz2 scummvm-rg350-57c069ad47b3ca40f7ec280d3c30942cc4b41e86.zip |
Mass detector: sort all newly detected games by target name before adding them to the config manager
svn-id: r33415
Diffstat (limited to 'gui')
-rw-r--r-- | gui/massadd.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 687d367516..6842466ad9 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -23,7 +23,9 @@ */ #include "engines/metaengine.h" +#include "common/algorithm.h" #include "common/events.h" +#include "common/func.h" #include "common/config-manager.h" #include "gui/launcher.h" // For addGameToConf() @@ -113,10 +115,19 @@ MassAddDialog::MassAddDialog(const FilesystemNode &startDir) } } +struct GameDescLess { + bool operator()(const GameDescriptor &x, const GameDescriptor &y) const { + return x.preferredtarget().compareToIgnoreCase(y.preferredtarget()) < 0; + } +}; + void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { // FIXME: It's a really bad thing that we use two arbitrary constants if (cmd == kOkCmd) { + // Sort the detected games. This is not strictly necessary, but nice for + // people who want to edit their config file by hand after a mass add. + sort(_games.begin(), _games.end(), GameDescLess()); // Add all the detected games to the config for (GameList::const_iterator iter = _games.begin(); iter != _games.end(); ++iter) { printf(" Added gameid '%s', desc '%s'\n", |