summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-20 16:43:34 +0100
committerSimon Rettberg2016-01-20 16:43:34 +0100
commit414c109d650a1014e7b84dfb66a00df420d67c97 (patch)
treeede0c5404aa408cd2bbb626312ed46383c7b13b6 /src/main.cpp
parentRe-introduce tree structure: Allow server-defined sections (diff)
downloadvmchooser2-414c109d650a1014e7b84dfb66a00df420d67c97.tar.gz
vmchooser2-414c109d650a1014e7b84dfb66a00df420d67c97.tar.xz
vmchooser2-414c109d650a1014e7b84dfb66a00df420d67c97.zip
Remodel section handling: Use constants
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4d0053e..0a4f6cd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -7,6 +7,7 @@
#include <QDesktopWidget>
#include <QLocale>
#include <QtDebug>
+#include <QMessageBox>
#include <cstdlib>
#include <iostream>
@@ -35,12 +36,14 @@ int main(int argc, char *argv[]) {
" -d, --default name of default session\n"
" -c, --config alternative config file\n"
" -l, --location location id(s), space separated\n"
+ " --location-mode how to treat entries for this location (IGNORE, BUMP or EXCLUSIVE)\n"
" -P, --pool one or more pool names to display (comma separated)\n"
" -f, --file direct boot .desktop file\n"
" -x, --xpath path of X Session .desktop files\n"
" -u, --url url of vmware .xml file\n"
" -s, --size window size <width>x<height>\n"
" -t, --theme theme\n"
+ " --template-mode how to treat template entries (IGNORE or BUMP)\n"
" -p, --pvs show pvs options\n"
" -D, --debug print debug information\n"
" -v, --version print version and exit\n"
@@ -200,6 +203,34 @@ int main(int argc, char *argv[]) {
basePath = settings.value("path").toString();
}
+ if (cmdOptions.contains("location-mode")) {
+ QString mode = cmdOptions.value("location-mode");
+ if (mode == "IGNORE") {
+ g_forLocationHandling = LOCATION_IGNORE;
+ } else if (mode == "BUMP") {
+ g_forLocationHandling = LOCATION_BUMP;
+ } else if (mode == "EXCLUSIVE") {
+ g_forLocationHandling = LOCATION_EXCLUSIVE;
+ } else {
+ qDebug() << "Invalid location mode: " << mode;
+ QMessageBox::critical(NULL, "Error", "Invalid location mode: " + mode);
+ return 1;
+ }
+ }
+
+ if (cmdOptions.contains("template-mode")) {
+ QString mode = cmdOptions.value("template-mode");
+ if (mode == "IGNORE") {
+ g_forLocationHandling = LOCATION_IGNORE;
+ } else if (mode == "BUMP") {
+ g_forLocationHandling = LOCATION_BUMP;
+ } else {
+ qDebug() << "Invalid template mode: " << mode;
+ QMessageBox::critical(NULL, "Error", "Invalid template mode: " + mode);
+ return 1;
+ }
+ }
+
int defaultTab = -1;
if (cmdOptions.contains("tab")) {
defaultTab = cmdOptions.value("tab").toInt();