[Scummvm-cvs-logs] SF.net SVN: scummvm:[33415] scummvm/trunk/gui/massadd.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Jul 29 18:29:28 CEST 2008


Revision: 33415
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33415&view=rev
Author:   fingolfin
Date:     2008-07-29 16:29:28 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
Mass detector: sort all newly detected games by target name before adding them to the config manager

Modified Paths:
--------------
    scummvm/trunk/gui/massadd.cpp

Modified: scummvm/trunk/gui/massadd.cpp
===================================================================
--- scummvm/trunk/gui/massadd.cpp	2008-07-29 16:16:15 UTC (rev 33414)
+++ scummvm/trunk/gui/massadd.cpp	2008-07-29 16:29:28 UTC (rev 33415)
@@ -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 @@
 	}
 }
 
+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",


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list