summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-04 12:56:35 +0200
committerSimon Rettberg2014-05-04 12:56:35 +0200
commit5103900bfeb0feced5b58d68924479bfc73d8ec5 (patch)
tree34a0d8145b6f3585e3cc4ae3a2f5a70e1a5db984 /src/main.cpp
parentshut up eclipse about missing break (diff)
downloadvmchooser2-5103900bfeb0feced5b58d68924479bfc73d8ec5.tar.gz
vmchooser2-5103900bfeb0feced5b58d68924479bfc73d8ec5.tar.xz
vmchooser2-5103900bfeb0feced5b58d68924479bfc73d8ec5.zip
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 :>
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp22
1 files changed, 12 insertions, 10 deletions
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 <width>x<height>\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<Session*> xsessions(XSession::readSessions(xSessionPath));