diff options
-rw-r--r-- | src/command_line_options.cpp | 4 | ||||
-rw-r--r-- | src/dialog.cpp | 20 | ||||
-rw-r--r-- | src/globals.cpp | 1 | ||||
-rw-r--r-- | src/globals.h | 1 | ||||
-rw-r--r-- | src/i18n/de.ts | 64 | ||||
-rwxr-xr-x | src/i18n/pt.ts | 93 | ||||
-rw-r--r-- | src/main.cpp | 69 | ||||
-rw-r--r-- | src/ui/dialog.ui | 19 |
8 files changed, 156 insertions, 115 deletions
diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp index f020f0d..22c5475 100644 --- a/src/command_line_options.cpp +++ b/src/command_line_options.cpp @@ -6,6 +6,7 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { // parse command line arguments (please sort by short option for easier handling) static const struct option longOptions[] = { + {"allow-vm-edit", no_argument, NULL, 'vmed'}, {"autoquit", required_argument, NULL, 'aqit'}, {"base", required_argument, NULL, 'b'}, {"path", required_argument, NULL, 'b'}, // Compatibility to v1.0 @@ -108,6 +109,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { case 'uuid': options.insert("uuid", optarg); break; + case 'vmed': + options.insert("allow-vm-edit", ""); + break; default: options.insert("error", "error"); break; diff --git a/src/dialog.cpp b/src/dialog.cpp index 105d476..6d245bb 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -81,6 +81,7 @@ Dialog::Dialog(int defaultTab, bool examMode, QWidget *parent) //activeTab_ = 2; //ui->tabButtonAllClasses->setChecked(true); + ui->chkAdminMode->setVisible(g_allowVmEdit); // TODO: Implement bug report dialog :) ui->buttonBugReport->setEnabled(false); @@ -119,15 +120,24 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index) if (s == NULL) // no valid session has been selected, do nothing return; + // These two are up here in case run-virt cares... + if (ui->PVS_checkbox->isChecked()) { + setenv("PVS_AUTO_CONNECT", "TRUE", 1); + } else { + setenv("PVS_AUTO_CONNECT", "FALSE", 1); + } + if (g_allowVmEdit && ui->chkAdminMode->isChecked()) { + setenv("VMCHOOSER_ADMIN_MODE", "TRUE", 1); + } else { + setenv("VMCHOOSER_ADMIN_MODE", "FALSE", 1); + } + + // Run session if (s->run()) { - // Run session start script + // Run session start script if the session could be initialized successfully if (QFile::exists(sessionStartScript)) { // Use the current environment variables and add the necessary // information for the startUpScipt. - if (ui->PVS_checkbox->isChecked()) - setenv("PVS_AUTO_CONNECT", "TRUE", 1); - else - setenv("PVS_AUTO_CONNECT", "FALSE", 1); // export session information to the environment of the process to be exec'ed setenv("SESSION_NAME", s->shortDescription().toUtf8(), 1); setenv("SESSION_UUID", s->uuid().toUtf8(), 1); diff --git a/src/globals.cpp b/src/globals.cpp index 50bb19a..1531e67 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -21,6 +21,7 @@ const QString previousSessionFile(userPath + "/vmchooser2.ini"); bool debugMode = false; bool pvsEnabled = false; int g_autoQuitSeconds = 0; +bool g_allowVmEdit = false; QString pool; QString theme; diff --git a/src/globals.h b/src/globals.h index a2a8805..8b592ac 100644 --- a/src/globals.h +++ b/src/globals.h @@ -25,6 +25,7 @@ class Session; extern bool debugMode; extern bool pvsEnabled; extern int g_autoQuitSeconds; +extern bool g_allowVmEdit; extern QString binPath; extern QString etcPath; diff --git a/src/i18n/de.ts b/src/i18n/de.ts index a28d83c..704791d 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -24,35 +24,6 @@ <translation>Ungültige Größe</translation> </message> <message> - <source>Usage: vmchooser [ OPTIONS ] - - -b --base base directory where VM images are accessible - -d, --default name of default session - -c, --config alternative config file - -l, --locations location id(s), space separated - --location-mode how to treat entries for this location (IGNORE, BUMP or EXCLUSIVE) - --exam-mode enable exam mode - -P, --pool one or more pool names to display (comma separated) - -f, --file direct boot .desktop file - -x, --xpath path of X Session .desktop files - -u, --url url of vmware .xml file - -s, --size window size <width>x<height> - -t, --theme theme - --template-mode how to treat template entries (IGNORE or BUMP) - -p, --pvs show pvs options - -D, --debug print debug information - -v, --version print version and exit - -h, --help print usage information and exit - -S, --runscript change path to run-virt.sh - -T --tab default tab (0=xsession, 1=my vms, 2=all vms) - --no-vtx Host doesn't support VT-x/AMD-V (mark 64bit guests) - --start-uuid start lecture with the given uuid - -FILE can be a vmware .xml or an X .desktop file -</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Requested --config not found: </source> <translation>Gewünschte --config nicht gefunden:</translation> </message> @@ -68,6 +39,37 @@ FILE can be a vmware .xml or an X .desktop file <source>No config file found or given</source> <translation>Keine Konfiguration angegeben und/oder gefunden</translation> </message> + <message> + <source>Usage: vmchooser [ OPTIONS ] + + --allow-vm-edit show the 'edit this vm' checkbox + --autoquit [secs] automatically exit if no selection is made after secs seconds + -b --base base directory where VM images are accessible + -d, --default name of default session + -c, --config alternative config file + -l, --locations location id(s), space separated + --location-mode how to treat entries for this location (IGNORE, BUMP or EXCLUSIVE) + --exam-mode enable exam mode + -P, --pool one or more pool names to display (comma separated) + -f, --file direct boot .desktop file + -x, --xpath path of X Session .desktop files + -u, --url url of vmware .xml file + -s, --size window size <width>x<height> + -t, --theme theme + --template-mode how to treat template entries (IGNORE or BUMP) + -p, --pvs show pvs options + -D, --debug print debug information + -v, --version print version and exit + -h, --help print usage information and exit + -S, --runscript change path to run-virt.sh + -T --tab default tab (0=xsession, 1=my vms, 2=all vms) + --no-vtx Host doesn't support VT-x/AMD-V (mark 64bit guests) + --start-uuid start lecture with the given uuid + +FILE can be a vmware .xml or an X .desktop file +</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>Dialog</name> @@ -203,6 +205,10 @@ FILE can be a vmware .xml or an X .desktop file <source>Could not get help (XML has no //news/info)</source> <translation>Konnte Hilfe nicht abrufen (//news/info nicht gefunden)</translation> </message> + <message> + <source>Edit VM</source> + <translation>Adminmodus (VM Bearbeiten)</translation> + </message> </context> <context> <name>QObject</name> diff --git a/src/i18n/pt.ts b/src/i18n/pt.ts index c331c47..f873fe8 100755 --- a/src/i18n/pt.ts +++ b/src/i18n/pt.ts @@ -7,74 +7,76 @@ <location filename="../main.cpp" line="36"/> <source>Usage: vmchooser [ OPTIONS ] - -b --base base directory where VM images are accessible - -d, --default name of default session - -c, --config alternative config file - -l, --locations location id(s), space separated - --location-mode how to treat entries for this location (IGNORE, BUMP or EXCLUSIVE) - --exam-mode enable exam mode - -P, --pool one or more pool names to display (comma separated) - -f, --file direct boot .desktop file - -x, --xpath path of X Session .desktop files - -u, --url url of vmware .xml file - -s, --size window size <width>x<height> - -t, --theme theme - --template-mode how to treat template entries (IGNORE or BUMP) - -p, --pvs show pvs options - -D, --debug print debug information - -v, --version print version and exit - -h, --help print usage information and exit - -S, --runscript change path to run-virt.sh - -T --tab default tab (0=xsession, 1=my vms, 2=all vms) - --no-vtx Host doesn't support VT-x/AMD-V (mark 64bit guests) - --start-uuid start lecture with the given uuid + --allow-vm-edit show the 'edit this vm' checkbox + --autoquit [secs] automatically exit if no selection is made after secs seconds + -b --base base directory where VM images are accessible + -d, --default name of default session + -c, --config alternative config file + -l, --locations location id(s), space separated + --location-mode how to treat entries for this location (IGNORE, BUMP or EXCLUSIVE) + --exam-mode enable exam mode + -P, --pool one or more pool names to display (comma separated) + -f, --file direct boot .desktop file + -x, --xpath path of X Session .desktop files + -u, --url url of vmware .xml file + -s, --size window size <width>x<height> + -t, --theme theme + --template-mode how to treat template entries (IGNORE or BUMP) + -p, --pvs show pvs options + -D, --debug print debug information + -v, --version print version and exit + -h, --help print usage information and exit + -S, --runscript change path to run-virt.sh + -T --tab default tab (0=xsession, 1=my vms, 2=all vms) + --no-vtx Host doesn't support VT-x/AMD-V (mark 64bit guests) + --start-uuid start lecture with the given uuid FILE can be a vmware .xml or an X .desktop file </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="88"/> + <location filename="../main.cpp" line="90"/> <source>vmchooser: failed to run session</source> <translation>vmchooser: falhou ao executar a sessão</translation> </message> <message> - <location filename="../main.cpp" line="94"/> + <location filename="../main.cpp" line="96"/> <source>vmchooser: invalid session file</source> <translation>vmchooser: arquivo de sessão inválido</translation> </message> <message> - <location filename="../main.cpp" line="109"/> + <location filename="../main.cpp" line="111"/> <source>Requested --config not found: </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="114"/> + <location filename="../main.cpp" line="116"/> <source>Using user specific config: </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="118"/> + <location filename="../main.cpp" line="120"/> <source>Using global config: </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="121"/> + <location filename="../main.cpp" line="123"/> <source>No config file found or given</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="150"/> + <location filename="../main.cpp" line="152"/> <source>vmchooser: no URL given</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="165"/> + <location filename="../main.cpp" line="167"/> <source>vmchooser: invalid URL</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../main.cpp" line="194"/> + <location filename="../main.cpp" line="196"/> <source>vmchooser: invalid size argument</source> <translation type="unfinished"></translation> </message> @@ -83,7 +85,7 @@ FILE can be a vmware .xml or an X .desktop file <name>Dialog</name> <message> <location filename="../ui/dialog.ui" line="14"/> - <location filename="../dialog.cpp" line="173"/> + <location filename="../dialog.cpp" line="184"/> <source>vmchooser</source> <translation>seletor</translation> </message> @@ -148,27 +150,32 @@ FILE can be a vmware .xml or an X .desktop file <translation type="unfinished"></translation> </message> <message> - <location filename="../ui/dialog.ui" line="536"/> + <location filename="../ui/dialog.ui" line="533"/> + <source>Edit VM</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../ui/dialog.ui" line="543"/> <source>Join PVS</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../ui/dialog.ui" line="566"/> + <location filename="../ui/dialog.ui" line="573"/> <source>Report Bug</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../ui/dialog.ui" line="573"/> + <location filename="../ui/dialog.ui" line="580"/> <source>Help/News</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../ui/dialog.ui" line="593"/> + <location filename="../ui/dialog.ui" line="600"/> <source>Abort</source> <translation>Interromper</translation> </message> <message> - <location filename="../ui/dialog.ui" line="600"/> + <location filename="../ui/dialog.ui" line="607"/> <source>Start</source> <translation>Iniciar</translation> </message> @@ -193,37 +200,37 @@ FILE can be a vmware .xml or an X .desktop file <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="387"/> + <location filename="../dialog.cpp" line="400"/> <source>Auto logout in %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="484"/> + <location filename="../dialog.cpp" line="497"/> <source>Native Linux</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="617"/> + <location filename="../dialog.cpp" line="630"/> <source>Could not get news.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="639"/> + <location filename="../dialog.cpp" line="652"/> <source>Could not get news. (//news/date or //news/info missing)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="688"/> + <location filename="../dialog.cpp" line="701"/> <source>Could not get help.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="710"/> + <location filename="../dialog.cpp" line="723"/> <source>Could not get help (XML has no //news/info)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../dialog.cpp" line="174"/> + <location filename="../dialog.cpp" line="185"/> <source>Vmchooser failed to run the selected session!</source> <translation>O seletor da VM falhou ao executar a sessão selecionada!</translation> </message> 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 <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" - " -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 <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" + " -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<Session*> 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") { diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index cde9282..6516207 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -132,8 +132,8 @@ margin-bottom:0px;}</string> <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Loading...</p></body></html></string> +</style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Loading...</span></p></body></html></string> </property> </widget> </item> @@ -164,8 +164,8 @@ p, li { white-space: pre-wrap; } <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Loading...</p></body></html></string> +</style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Loading...</span></p></body></html></string> </property> </widget> </item> @@ -492,8 +492,8 @@ border:1px solid #999; <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click on an item on the left side for more information</p></body></html></string> +</style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Click on an item on the left side for more information</span></p></body></html></string> </property> </widget> </item> @@ -528,6 +528,13 @@ p, li { white-space: pre-wrap; } </spacer> </item> <item> + <widget class="QCheckBox" name="chkAdminMode"> + <property name="text"> + <string>Edit VM</string> + </property> + </widget> + </item> + <item> <widget class="QCheckBox" name="PVS_checkbox"> <property name="layoutDirection"> <enum>Qt::RightToLeft</enum> |