summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-12-22 14:02:31 +0100
committerSimon Rettberg2016-12-22 14:02:31 +0100
commit69a87ddf7faee8b26747b3e0c1cc97ab06bc779d (patch)
tree9f835c13c1a367af994e79734989d8f08f385bb2 /src/main.cpp
parentDon't lower() window on startup (diff)
downloadvmchooser2-69a87ddf7faee8b26747b3e0c1cc97ab06bc779d.tar.gz
vmchooser2-69a87ddf7faee8b26747b3e0c1cc97ab06bc779d.tar.xz
vmchooser2-69a87ddf7faee8b26747b3e0c1cc97ab06bc779d.zip
Add --autoquit <seconds> that will quit automatically if no action is performed within a given time span
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b37e73c..74cee75 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,27 +34,27 @@ int main(int argc, char *argv[]) {
std::string usage(
a.translate("Console", "Usage: vmchooser [ OPTIONS ]\n\n"
- " -b --base base directory where VM images are accessible\n"
- " -d, --default name of default session\n"
- " -c, --config alternative config file\n"
+ " -b --base base directory where VM images are accessible\n"
+ " -d, --default name of default session\n"
+ " -c, --config alternative config file\n"
" -l, --locations location id(s), space separated\n"
" --location-mode how to treat entries for this location (IGNORE, BUMP or EXCLUSIVE)\n"
- " --exam-mode enable exam mode\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"
+ " --exam-mode enable exam mode\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"
- " -h, --help print usage information and exit\n"
+ " -p, --pvs show pvs options\n"
+ " -D, --debug print debug information\n"
+ " -v, --version print version and exit\n"
+ " -h, --help print usage information and exit\n"
" -S, --runscript change path to run-virt.sh\n"
- " -T --tab default tab (0=xsession, 1=my vms, 2=all vms)\n"
- " --no-vtx Host doesn't support VT-x/AMD-V (mark 64bit guests)\n"
- " --start-uuid start lecture with the given uuid\n"
+ " -T --tab default tab (0=xsession, 1=my vms, 2=all vms)\n"
+ " --no-vtx Host doesn't support VT-x/AMD-V (mark 64bit guests)\n"
+ " --start-uuid start lecture with the given uuid\n"
"\nFILE can be a vmware .xml or an X .desktop file\n").toUtf8().data());
if (cmdOptions.contains("error")) {
@@ -300,6 +300,14 @@ int main(int argc, char *argv[]) {
pvsEnabled = true;
}
+ if (cmdOptions.contains("autoquit")) {
+ bool ok = false;
+ g_autoQuitSeconds = cmdOptions.value("autoquit").toInt(&ok, 10);
+ if (!ok) {
+ g_autoQuitSeconds = 0;
+ }
+ }
+
QRect desktopRect = QApplication::desktop()->availableGeometry(&w);
if (size == "fullscreen") {
width = desktopRect.width();