summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command_line_options.cpp12
-rw-r--r--src/dialog.cpp6
-rw-r--r--src/globals.cpp3
-rw-r--r--src/globals.h3
-rw-r--r--src/main.cpp19
5 files changed, 40 insertions, 3 deletions
diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp
index 0f26edf..466292a 100644
--- a/src/command_line_options.cpp
+++ b/src/command_line_options.cpp
@@ -26,6 +26,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) {
{"tab", required_argument, nullptr, 'T'},
{"theme", required_argument, nullptr, 't'},
{"url", required_argument, nullptr, 'u'},
+ {"url-list", required_argument, nullptr, 'ulst'},
+ {"url-news", required_argument, nullptr, 'unws'},
+ {"url-help", required_argument, nullptr, 'uhlp'},
{"version", no_argument, nullptr, 'v'},
{"xpath", required_argument, nullptr, 'x'},
{"location-mode", required_argument, nullptr, 'locm'},
@@ -110,6 +113,15 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) {
case 'nvtx':
options.insert("no-vtx", "no-vtx");
break;
+ case 'ulst':
+ options.insert("url-list", optarg);
+ break;
+ case 'unws':
+ options.insert("url-news", optarg);
+ break;
+ case 'uhlp':
+ options.insert("url-help", optarg);
+ break;
case 'uuid':
options.insert("uuid", optarg);
break;
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 5035b56..9472269 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -417,7 +417,7 @@ void Dialog::onCenterTimer() {
* Download lecture list, news and help
*/
void Dialog::downloadData(const QString& locationIds) {
- QUrl listUrl(g_urlBase + "list");
+ QUrl listUrl(g_urlList);
QUrlQuery listQuery(listUrl);
if (!locationIds.isEmpty()) {
@@ -489,7 +489,7 @@ void Dialog::downloadData(const QString& locationIds) {
});
//
// News
- FileDownloader::download(QUrl(g_urlBase + "news"), [this](QNetworkReply::NetworkError err, const QByteArray& data) {
+ FileDownloader::download(QUrl(g_urlNews), [this](QNetworkReply::NetworkError err, const QByteArray& data) {
if (err != QNetworkReply::NoError) {
if (g_debugMode) {
qDebug() << "Could not get news. Try to get cached news.";
@@ -560,7 +560,7 @@ void Dialog::downloadData(const QString& locationIds) {
});
//
// Download help
- FileDownloader::download(QUrl(g_urlBase + "help"), [this](QNetworkReply::NetworkError err, const QByteArray& data) {
+ FileDownloader::download(QUrl(g_urlHelp), [this](QNetworkReply::NetworkError err, const QByteArray& data) {
if (err != QNetworkReply::NoError) {
if (g_debugMode) {
qDebug() << "Could not get help xml. Try to get cached help...";
diff --git a/src/globals.cpp b/src/globals.cpp
index d4f2350..427b4bb 100644
--- a/src/globals.cpp
+++ b/src/globals.cpp
@@ -36,6 +36,9 @@ const QString TEMP_PATH_HELP("/tmp/vmchooser2/vmchooser2_help.xml");
const QString TEMP_PATH_NEWS("/tmp/vmchooser2/vmchooser2_news.xml");
QString g_urlBase;
+QString g_urlList;
+QString g_urlNews;
+QString g_urlHelp;
bool g_fullscreen = false;
diff --git a/src/globals.h b/src/globals.h
index 4b38377..860048e 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -42,6 +42,9 @@ extern const QString TEMP_PATH_HELP;
extern const QString TEMP_PATH_NEWS;
extern QString g_urlBase;
+extern QString g_urlList;
+extern QString g_urlNews;
+extern QString g_urlHelp;
extern bool g_fullscreen;
diff --git a/src/main.cpp b/src/main.cpp
index c3ca684..8d26c14 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -44,6 +44,9 @@ int main(int argc, char *argv[]) {
" -f, --file direct boot .desktop file\n"
" -x, --xpath path of X Session .desktop files\n"
" -u, --url url of vmware .xml file\n"
+ " --url-list url of vms' list as .xml file\n"
+ " --url-news url of the news to display\n"
+ " --url-help url of the help to display\n"
" -s, --size window size <width>x<height>\n"
" -t, --theme theme\n"
" --template-mode how to treat template entries (IGNORE or BUMP)\n"
@@ -171,6 +174,22 @@ int main(int argc, char *argv[]) {
g_urlBase += "/";
}
}
+ if (cmdOptions.contains("url-list")) {
+ g_urlList = cmdOptions.value("url-list");
+ } else {
+ // if not explictly specified, use the old scheme
+ g_urlList = g_urlBase + "list";
+ }
+ if (cmdOptions.contains("url-news")) {
+ g_urlNews = cmdOptions.value("url-news");
+ } else {
+ g_urlNews = g_urlBase + "news";
+ }
+ if (cmdOptions.contains("url-help")) {
+ g_urlHelp = cmdOptions.value("url-help");
+ } else {
+ g_urlHelp = g_urlBase + "help";
+ }
QString size;
int width = VMCHOOSER_DEFAULT_WIDTH, height = VMCHOOSER_DEFAULT_HEIGHT;