From 5103900bfeb0feced5b58d68924479bfc73d8ec5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 4 May 2014 12:56:35 +0200 Subject: Lots of fixes, cleanup, refactoring * Added command line option to set the base path where images can be accessed locally, in case NFS/CIFS is used. * Sorted command line options in source file to make it easier to add new options (prevent accidental shortopt collisions). * Disable "My Courses" button if the list is empty. * Added some TODO notes :> --- src/main.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index e646620..2c80919 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,15 +31,16 @@ 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" - " -e, --env name of the environment\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" - " -b, --pvs show pvs options\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" @@ -94,6 +95,7 @@ int main(int argc, char *argv[]) { } else { confFile = globalConfFile; } + // TODO: This is the system wide settings, give proper name QSettings settings(confFile, QSettings::IniFormat); settings.setIniCodec("UTF-8"); @@ -106,12 +108,6 @@ int main(int argc, char *argv[]) { defaultSession = ChooserSettings::getSetting("last-session"); } - if (cmdOptions.contains("path")) { - vSessionPath = cmdOptions.value("path"); - } else if (settings.contains("path")) { - vSessionPath = settings.value("path").toString(); - } // else keep default path - if (cmdOptions.contains("xpath")) { xSessionPath = cmdOptions.value("xpath"); } else if (settings.contains("xpath")) { @@ -171,8 +167,8 @@ int main(int argc, char *argv[]) { height = VMCHOOSER_DEFAULT_HEIGHT; } - if (cmdOptions.contains("env")) { - pool = cmdOptions.value("env"); + if (cmdOptions.contains("pool")) { + pool = cmdOptions.value("pool"); } else if (settings.contains("pool")) { pool = settings.value("pool").toString(); } @@ -187,6 +183,12 @@ int main(int argc, char *argv[]) { debugMode = true; } + if (cmdOptions.contains("base")) { + basePath = cmdOptions.value("base"); + } else if (settings.contains("base")) { + basePath = settings.value("base").toString(); + } + /* read session files */ QList xsessions(XSession::readSessions(xSessionPath)); -- cgit v1.2.3-55-g7522