From 414c109d650a1014e7b84dfb66a00df420d67c97 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 20 Jan 2016 16:43:34 +0100 Subject: Remodel section handling: Use constants --- src/main.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/main.cpp') 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 #include #include +#include #include #include @@ -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 x\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(); -- cgit v1.2.3-55-g7522