summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorNils Schwabe2014-03-04 17:54:57 +0100
committerNils Schwabe2014-03-04 17:54:57 +0100
commit03b7858c880ea1fba3915af17c55b42d5e13c58a (patch)
tree7d1ea603194b98d213c3f90253371ef974f8ee0f /src/main.cpp
parentAdded httpxmldownloader (diff)
downloadvmchooser2-03b7858c880ea1fba3915af17c55b42d5e13c58a.tar.gz
vmchooser2-03b7858c880ea1fba3915af17c55b42d5e13c58a.tar.xz
vmchooser2-03b7858c880ea1fba3915af17c55b42d5e13c58a.zip
- included the --url commandline options for a xml url
- httpxmldownloader moved to main.cpp (it's finally working :D) - given url is downloaded and printed on commandline - todo: parse http response
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d1b0ace..365287e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -42,6 +42,7 @@ int main(int argc, char *argv[]) {
" -f, --file direct boot FILE\n"
" -p, --path path to vmware .xml files\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"
@@ -51,11 +52,6 @@ int main(int argc, char *argv[]) {
"\nFILE can be a vmware .xml or an X .desktop file\n")
.toUtf8().data());
- // ---------
- std::cout << "testing http" << std::endl;
- httpxmldownloader httpxmldownloader;
- // ---------
-
if (cmdOptions.contains("error")) {
std::cerr << usage;
return EXIT_FAILURE;
@@ -140,6 +136,13 @@ int main(int argc, char *argv[]) {
xSessionPath = settings.value("xpath").toString();
} // else keep default path
+ QString vSessionUrl = "";
+ if (cmdOptions.contains("url")) {
+ vSessionUrl = cmdOptions.value("url");
+ } else if (settings.contains("url")) {
+ vSessionUrl = settings.value("url").toString();
+ }
+
QString size;
if (cmdOptions.contains("size")) {
size = cmdOptions.value("size");
@@ -184,6 +187,16 @@ int main(int argc, char *argv[]) {
QList<Session*> xsessions(XSession::readSessions(xSessionPath));
QList<Session*> vsessions(VSession::readXmlDir(vSessionPath));
+ /* add sessions from remote xml if possible */
+ httpxmldownloader httpxmldownloader;
+ if (!vSessionUrl.isEmpty()) {
+ vsessions.append(VSession::readXmlUrl(vSessionUrl, httpxmldownloader));
+ } else {
+ if (debugMode) {
+ qDebug() << "empty URl given";
+ }
+ }
+
Dialog w;
w.setTheme();