summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Darmochwal2010-10-08 12:50:05 +0200
committerJan Darmochwal2010-10-08 12:50:05 +0200
commit0bfe054324af214599382384ecc0d5050ed6c079 (patch)
treebcdcf58edcacc2c67d54532396c95bf05a22060a
parentTidy up the code (diff)
downloadvmchooser-0bfe054324af214599382384ecc0d5050ed6c079.tar.gz
vmchooser-0bfe054324af214599382384ecc0d5050ed6c079.tar.xz
vmchooser-0bfe054324af214599382384ecc0d5050ed6c079.zip
Sort Sessions
sort the Sessions by priority/short description before displaying them
-rw-r--r--src/main.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 91b39e7..68f92ef 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -7,12 +7,17 @@
#include <QMap>
#include <QString>
#include <QSettings>
+#include <QtAlgorithms>
#include "save_restore_session.h"
#include "xsession.h"
#include "vsession.h"
#include "globals.h"
#include "command_line_options.h"
+bool myLessThan(Session* a, Session* b) {
+ return *a < *b;
+}
+
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
@@ -146,13 +151,14 @@ int main(int argc, char *argv[]) {
Dialog w;
w.resize(width, height);
if (xsessions.size()) {
+ qSort(xsessions.begin(), xsessions.end(), myLessThan);
w.addItems(xsessions, a.translate("Dialog", "X Sessions"));
}
if (vsessions.size()) {
+ qSort(vsessions.begin(), vsessions.end(), myLessThan);
w.addItems(vsessions, a.translate("Dialog", "Virtual Sessions"));
}
w.selectSession(defaultSession);
w.show();
return a.exec();
}
-