diff options
author | Jan Darmochwal | 2010-10-08 12:50:05 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-08 12:50:05 +0200 |
commit | 0bfe054324af214599382384ecc0d5050ed6c079 (patch) | |
tree | bcdcf58edcacc2c67d54532396c95bf05a22060a /src | |
parent | Tidy up the code (diff) | |
download | vmchooser-0bfe054324af214599382384ecc0d5050ed6c079.tar.gz vmchooser-0bfe054324af214599382384ecc0d5050ed6c079.tar.xz vmchooser-0bfe054324af214599382384ecc0d5050ed6c079.zip |
Sort Sessions
sort the Sessions by priority/short description before displaying them
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 8 |
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(); } - |