From 2f567778f71a1c6dcfdaa7831d7642e4c45c5c7b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 19 Jan 2017 12:22:44 +0100 Subject: Add "admin mode" (edit vm) --- src/main.cpp | 69 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 32 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 74cee75..2f1dfab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,27 +34,29 @@ 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" - " -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 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" - " -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" + " --allow-vm-edit show the 'edit this vm' checkbox\n" + " --autoquit [secs] automatically exit if no selection is made after secs seconds\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 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" + " -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" "\nFILE can be a vmware .xml or an X .desktop file\n").toUtf8().data()); if (cmdOptions.contains("error")) { @@ -266,6 +268,20 @@ int main(int argc, char *argv[]) { g_noVtx = true; } + if (cmdOptions.contains("pvs")) { + pvsEnabled = true; + } + + if (cmdOptions.contains("autoquit")) { + bool ok = false; + g_autoQuitSeconds = cmdOptions.value("autoquit").toInt(&ok, 10); + if (!ok) { + g_autoQuitSeconds = 0; + } + } + + g_allowVmEdit = cmdOptions.contains("allow-vm-edit"); + /* read session files */ QList xsessions(XSession::readSessions(xSessionPath)); @@ -296,17 +312,6 @@ int main(int argc, char *argv[]) { w.setTheme(); w.setWindowFlags(Qt::FramelessWindowHint); - if (cmdOptions.contains("pvs")) { - 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") { -- cgit v1.2.3-55-g7522