summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Schwabe2014-03-31 16:32:44 +0200
committerNils Schwabe2014-03-31 16:32:44 +0200
commitd2be02fceb3b2f1cd2fe4720560acc85a6c331be (patch)
treece1bd2c8869e17bcfb669d4bbb7dd2507e9e0ec0
parentadded news and help download (diff)
downloadvmchooser2-d2be02fceb3b2f1cd2fe4720560acc85a6c331be.tar.gz
vmchooser2-d2be02fceb3b2f1cd2fe4720560acc85a6c331be.tar.xz
vmchooser2-d2be02fceb3b2f1cd2fe4720560acc85a6c331be.zip
Help/News improvement, added ini settings, made some translations for new text elemtents, cleaned code
-rw-r--r--src/choosersettings.cpp57
-rw-r--r--src/choosersettings.h30
-rw-r--r--src/dialog.cpp61
-rw-r--r--src/dialog.h3
-rw-r--r--src/globals.cpp2
-rw-r--r--src/globals.h2
-rw-r--r--src/i18n/de.ts173
-rwxr-xr-xsrc/i18n/pt.ts196
-rw-r--r--src/main.cpp38
-rw-r--r--src/sessionsiconholder.cpp3
-rw-r--r--src/sessiontreemodel.cpp1
-rw-r--r--src/ui/dialog.ui2
12 files changed, 451 insertions, 117 deletions
diff --git a/src/choosersettings.cpp b/src/choosersettings.cpp
new file mode 100644
index 0000000..2b8b9ac
--- /dev/null
+++ b/src/choosersettings.cpp
@@ -0,0 +1,57 @@
+/*
+ * choosersettings.cpp
+ *
+ * Created on: Mar 24, 2014
+ * Author: nils
+ */
+
+#include "choosersettings.h"
+#include "globals.h"
+
+bool ChooserSettings::settingsLoaded = false;
+ChooserSettings* ChooserSettings::chooserSettings = NULL;
+
+ChooserSettings::ChooserSettings() {
+ // test (and make) directory
+ QDir saveFileDir(QFileInfo(previousSessionFile).absoluteDir());
+ if (!saveFileDir.exists()) {
+ if (!saveFileDir.mkpath(saveFileDir.path())) {
+ return;
+ }
+ }
+
+ settings = new QSettings(previousSessionFile + ".ini", QSettings::IniFormat);
+ settings->setIniCodec("UTF-8");
+
+ if (settings->status() != QSettings::NoError) {
+ if (debugMode) {
+ qDebug() << "Settings: " << previousSessionFile << " contains erros.";
+ }
+ return;
+ }
+
+ settingsLoaded = true;
+}
+
+ChooserSettings::~ChooserSettings() {
+ settings->deleteLater();
+}
+
+QString ChooserSettings::getSetting(QString key) {
+ if (!settingsLoaded) {
+ chooserSettings = new ChooserSettings();
+ if (!settingsLoaded) return "";
+ }
+
+ return chooserSettings->settings->value(key).toString();
+}
+
+bool ChooserSettings::setSetting(QString key, QString value) {
+ if (!settingsLoaded) {
+ chooserSettings = new ChooserSettings();
+ if (!settingsLoaded) return false;
+ }
+ chooserSettings->settings->setValue(key, value);
+// chooserSettings->settings->sync();
+ return true;
+}
diff --git a/src/choosersettings.h b/src/choosersettings.h
new file mode 100644
index 0000000..74e01ab
--- /dev/null
+++ b/src/choosersettings.h
@@ -0,0 +1,30 @@
+/*
+ * choosersettings.h
+ *
+ * Created on: Mar 24, 2014
+ * Author: nils
+ */
+
+#ifndef CHOOSERSETTINGS_H_
+#define CHOOSERSETTINGS_H_
+
+#include <QDebug>
+#include <QSettings>
+#include <QDir>
+
+class ChooserSettings {
+public:
+ static QString getSetting(QString key);
+ static bool setSetting(QString key, QString value);
+
+private:
+ static ChooserSettings* chooserSettings;
+ static bool settingsLoaded;
+
+ QSettings* settings;
+
+ ChooserSettings();
+ virtual ~ChooserSettings();
+};
+
+#endif /* CHOOSERSETTINGS_H_ */
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 4e65d16..6236208 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -202,6 +202,7 @@ bool Dialog::selectSession(const QString& name) {
// change the tab
onTabButtonChanged(tab);
// set selection
+ ui->treeView->selectionModel()->clearSelection();
ui->treeView->selectionModel()
->setCurrentIndex(index, QItemSelectionModel::Select);
return true;
@@ -213,8 +214,10 @@ bool Dialog::selectSession(const QString& name) {
}
void Dialog::selectPreviousSession() {
- qDebug() << "selecting previous session";
- selectSession(ChooserSettings::getSetting("last-session"));
+ if (!ChooserSettings::getSetting("last-session").isEmpty()) {
+ ui->treeView->clearSelection();
+ selectSession(ChooserSettings::getSetting("last-session"));
+ }
}
void Dialog::startSession(const QString& name) {
@@ -301,23 +304,16 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) {
this->addLabelItem(QCoreApplication::instance()->translate("Dialog", "URL Error"), 1);
return;
}
-
if (debugMode) {
qDebug() << "Used backup file " << xml_backup_filename;
}
-
backup_file.close();
QList<Session*> sessions = VSession::readXmlFile(xml_backup_filename);
-
qSort(sessions.begin(), sessions.end(), myLessThan);
-
this->addItems(sessions, 1);
-
} else {
-
QFile file(xml_filename);
-
if (!file.open(QIODevice::WriteOnly)) {
if (debugMode) {
qDebug() << "Could not write XML to " << xml_filename;
@@ -326,11 +322,9 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) {
}
QByteArray data = reply->readAll();
-
if (file.write(data) != data.length()) {
return;
}
-
file.close();
}
@@ -373,7 +367,6 @@ void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelI
ui->label_os->setText(vs->getAttribute("os", "param"));
ui->label_os->setToolTip(vs->getAttribute("os", "param"));
- //ui->textBrowser->setText(vs->getAttribute("long_description", "param"));
QString description(vs->getAttribute("long_description", "param") + "\n\nKeywords: ");
for (int i = 0; i < vs->keywords().length(); ++i) {
description += vs->keywords()[i] + ", ";
@@ -410,18 +403,6 @@ void Dialog::onTabButtonChanged(int tab) {
// give focus to treeView
ui->treeView->setFocus();
- // one button needs to be enabled
- if (this->activeTab == tab) {
- switch (tab) {
- case 0: ui->tabButtonLocal->setChecked(true); break;
- case 1: ui->tabButtonMyClasses->setChecked(true); break;
- case 2: ui->tabButtonAllClasses->setChecked(true); break;
- }
- }
-
-
- this->activeTab = tab;
-
// when button was pressed disable the other buttons
if (tab == 0) {
ui->tabButtonLocal->setChecked(true);
@@ -442,26 +423,26 @@ void Dialog::onTabButtonChanged(int tab) {
// load the new list
setListModel(model_[tab]);
+ this->activeTab = tab;
}
void Dialog::on_filterEdit_textChanged() {
SessionTreeModel *newModel;
// filter the current model
- if (ui->filterEdit->text() != "" && ui->filterEdit->text().length() > 2) {
+ if (ui->filterEdit->text() != "" && ui->filterEdit->text().replace(" ", "").length() > 2) {
newModel = new SessionTreeModel(this);
newModel->addItems(this->model_[activeTab]->lookForItem(ui->filterEdit->text()));
} else {
newModel = model_[activeTab];
}
-
setListModel(newModel);
}
void Dialog::setListModel(QAbstractItemModel *model) {
if (ui->treeView->model() == model_[0] || ui->treeView->model() == model_[1] || ui->treeView->model() == model_[2]) {
} else {
- ui->treeView->model()->deleteLater();
+ //ui->treeView->model()->deleteLater();
}
ui->treeView->setModel(model);
@@ -502,16 +483,18 @@ void Dialog::addNewsAfterDownload(QNetworkReply* reply) {
QDateTime timestamp;
timestamp.setTime_t(newsNode.firstChildElement("date").text().toInt());
- if (ChooserSettings::getSetting("last-news").toUInt() > timestamp.toTime_t()) {
- return;
- }
-
// format and print news
ui->newsTextBrowser->setText(QString("<p style='font-size:16px; margin-bottom: 2px;'>" + newsNode.firstChildElement("headline").text() + "</p> <small>"
+ timestamp.toString(Qt::SystemLocaleShortDate) + "</small><p>"
+ newsNode.firstChildElement("info").text() + "</p>"));
- on_helpNewsButton_clicked();
+ if (ChooserSettings::getSetting("last-news").toUInt() < timestamp.toTime_t()) {
+ // show news if not seen before
+ on_helpNewsButton_clicked();
+ }
+
+ // update ini
+ ChooserSettings::setSetting("last-news", QString::number(timestamp.toTime_t()));
}
void Dialog::addHelpAfterDownload(QNetworkReply* reply) {
@@ -521,14 +504,24 @@ void Dialog::addHelpAfterDownload(QNetworkReply* reply) {
}
return;
}
- QByteArray data = reply->readAll();
+ QByteArray data = reply->readAll();
QDomDocument doc;
+
if (!doc.setContent(data)) {
- qDebug() << "Help file contains errors.";
+ if (debugMode) {
+ qDebug() << "Help file contains errors.";
+ }
return;
}
ui->helpTextBrowser->setText(QString(data));
+}
+void Dialog::keyPressEvent(QKeyEvent* event) {
+ switch(event->key()) {
+ case Qt::Key_Return: this->on_pushButtonStart_clicked(); break;
+ case Qt::Key_Escape: this->on_pushButtonAbort_clicked(); break;
+ case Qt::Key_H: this->on_helpNewsButton_clicked(); break;
+ }
}
diff --git a/src/dialog.h b/src/dialog.h
index d6391ac..f11b674 100644
--- a/src/dialog.h
+++ b/src/dialog.h
@@ -6,6 +6,8 @@
#include <QList>
#include <QSettings>
#include <QNetworkReply>
+#include <QKeyEvent>
+
#include "session.h"
#include "sessiontreemodel.h"
@@ -58,6 +60,7 @@ class Dialog : public QDialog {
void treeView_selectionChanged(const QModelIndex& current, const QModelIndex&);
void on_helpNewsButton_clicked();
void onCenterTimer();
+ void keyPressEvent(QKeyEvent * e);
public slots:
void addSessionsAfterDownload(QNetworkReply* reply);
diff --git a/src/globals.cpp b/src/globals.cpp
index 92026b8..6ff6aed 100644
--- a/src/globals.cpp
+++ b/src/globals.cpp
@@ -30,6 +30,8 @@ const QString iconsTempPath("/tmp/vmchooser2/icons/");
const QString xml_backup_filename("/tmp/vmchooser2/vmchooser2_backup.xml");
const QString xml_filename("/tmp/vmchooser2/vmchooser2.xml");
+QString urlBase;
+
bool myLessThan(Session* a, Session* b) {
return *a < *b;
}
diff --git a/src/globals.h b/src/globals.h
index 8215c19..00d10c5 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -48,6 +48,8 @@ extern const QString iconsTempPath;
extern const QString xml_backup_filename;
extern const QString xml_filename;
+extern QString urlBase;
+
bool myLessThan(Session* a, Session* b);
#endif
diff --git a/src/i18n/de.ts b/src/i18n/de.ts
index 25ecae9..7ac1550 100644
--- a/src/i18n/de.ts
+++ b/src/i18n/de.ts
@@ -4,7 +4,6 @@
<context>
<name>Console</name>
<message>
- <location filename="../main.cpp" line="32"/>
<source>Usage: vmchooser [ OPTIONS | FILE ]
-d, --default name of default session
@@ -17,7 +16,7 @@
FILE can be a vmware .xml or an X .desktop file
</source>
- <translation>Aufruf: vmchooser [ OPTIONEN | DATEI ]
+ <translation type="obsolete">Aufruf: vmchooser [ OPTIONEN | DATEI ]
-d, --default Name der Standardsitzung
-P, --pool Name der Umgebung
@@ -31,114 +30,224 @@ FILE can be a vmware .xml or an X .desktop file
</translation>
</message>
<message>
- <location filename="../main.cpp" line="68"/>
- <location filename="../main.cpp" line="80"/>
<source>vmchooser: failed to run session</source>
<translation>vmchooser: Fehler beim Start der Sitzung</translation>
</message>
<message>
- <location filename="../main.cpp" line="85"/>
<source>vmchooser: invalid session file</source>
<translation>vmchooser: ungültige Sitzungsdatei</translation>
</message>
<message>
- <location filename="../main.cpp" line="143"/>
<source>vmchooser: invlid size argument</source>
- <translation>vmchooser: ungültige Größenangabe</translation>
+ <translation type="obsolete">vmchooser: ungültige Größenangabe</translation>
</message>
<message>
- <location filename="../main.cpp" line="168"/>
<source>vmchooser: no sessions found</source>
- <translation>vmchooser: keine Sitzungen gefunden</translation>
+ <translation type="obsolete">vmchooser: keine Sitzungen gefunden</translation>
</message>
<message>
- <location filename="../main.cpp" line="180"/>
<source>vmchooser: external script %1 is not executable</source>
- <translation>vmchooser: externes Skript %1 ist nicht ausführbar</translation>
+ <translation type="obsolete">vmchooser: externes Skript %1 ist nicht ausführbar</translation>
+ </message>
+ <message>
+ <source>Usage: vmchooser [ OPTIONS ]
+
+ -d, --default name of default session
+ -c, --config alternative config file
+ -e, --env name of the environment
+ -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 &lt;width&gt;x&lt;height&gt;
+ -t, --theme theme
+ -b, --pvs show pvs options
+ -D, --debug print debug information
+ -v, --version print version and exit
+ -h, --help print usage information and exit
+
+FILE can be a vmware .xml or an X .desktop file
+</source>
+ <translation>Aufruf: vmchooser [ OPTIONS ]
+
+ -d, --default Name der Default Session
+ -c, --config Alternative Config Datei
+ -e, --env Name der Desktopumgebung
+ -f, --file Boote .desktop file direkt
+ -x, --xpath Pfad zu X Session .desktop Dateien
+ -u, --url Basis URL zu list.php, news.php, help.php
+ -s, --size Fenster Größe &lt;width&gt;x&lt;height&gt;
+ -t, --theme theme
+ -b, --pvs Zeige pvs Optionen
+ -D, --debug Schaltehalte Debug ein
+ -v, --version Gibt Version aus (ohne Start)
+ -h, --help Gibt diese Hilfe Seite aus</translation>
+ </message>
+ <message>
+ <source>vmchooser: no URL given</source>
+ <translation>Fehlende URL</translation>
+ </message>
+ <message>
+ <source>vmchooser: invalid URL</source>
+ <translation>Ungültige URL</translation>
+ </message>
+ <message>
+ <source>vmchooser: invalid size argument</source>
+ <translation>Ungültige Größe</translation>
</message>
</context>
<context>
<name>Dialog</name>
<message>
- <location filename="../ui/dialog.ui" line="14"/>
- <location filename="../dialog.cpp" line="69"/>
<source>vmchooser</source>
<translation>vmchooser</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="36"/>
<source>PVS Options</source>
<translation>PVS Einstellungen</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="44"/>
<source>VNC access by lecturer:</source>
<translation>VNC-Zugriff für Dozenten:</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="61"/>
<source>VNC access by others:</source>
<translation>VNC-Zugriff für andere:</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="102"/>
<source>Accept chat messages</source>
- <translation>Chat-Nachrichten akzeptieren</translation>
+ <translation type="obsolete">Chat-Nachrichten akzeptieren</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="109"/>
<source>Accept file transfers</source>
- <translation>Dateiübertragungen akzeptieren</translation>
+ <translation type="obsolete">Dateiübertragungen akzeptieren</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="149"/>
<source>Abort</source>
<translation>Abbrechen</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="156"/>
<source>Start</source>
<translation>Start</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="20"/>
<source>None</source>
<translation>kein Zugriff</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="20"/>
<source>View Only</source>
<translation>nur ansehen</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="21"/>
<source>Full</source>
<translation>Vollzugriff</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="70"/>
<source>Vmchooser failed to run the selected session!</source>
<translation>Vmchooser konnte die gewählte Sitzung nicht ausführen!</translation>
</message>
<message>
- <location filename="../main.cpp" line="176"/>
<source>X Sessions</source>
- <translation>X-Sitzungen</translation>
+ <translation type="obsolete">X-Sitzungen</translation>
</message>
<message>
- <location filename="../main.cpp" line="188"/>
<source>Virtual Sessions</source>
- <translation>Virtuelle Sitzungen</translation>
+ <translation type="obsolete">Virtuelle Sitzungen</translation>
</message>
<message>
- <location filename="../main.cpp" line="226"/>
<source>Loading...</source>
<translation>Laden...</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="271"/>
<source>No Items</source>
<translation>Keine Einträge</translation>
</message>
+ <message>
+ <source>Help</source>
+ <translation>Hilfe</translation>
+ </message>
+ <message>
+ <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Loading...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Lädt...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
+ </message>
+ <message>
+ <source>News</source>
+ <translation>News</translation>
+ </message>
+ <message>
+ <source>Local</source>
+ <translation>Lokal</translation>
+ </message>
+ <message>
+ <source>My Classes</source>
+ <translation>Meine Kurse</translation>
+ </message>
+ <message>
+ <source>All Classes</source>
+ <translation>Alle Kurse</translation>
+ </message>
+ <message>
+ <source>Filter:</source>
+ <translation>Filter:</translation>
+ </message>
+ <message>
+ <source>Details</source>
+ <translation>Details</translation>
+ </message>
+ <message>
+ <source>Description:</source>
+ <translation>Beschreibung:</translation>
+ </message>
+ <message>
+ <source>Name:</source>
+ <translation>Name:</translation>
+ </message>
+ <message>
+ <source>Creator:</source>
+ <translation>Autor:</translation>
+ </message>
+ <message>
+ <source>Operating System:</source>
+ <translation>Betriebssystem:</translation>
+ </message>
+ <message>
+ <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;Ubuntu&apos;; font-size:11pt;&quot;&gt;Click on an item on the left side for more infos.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;Ubuntu&apos;; font-size:11pt;&quot;&gt;Für mehr Infos auf einen Eintrag in der Liste klicken.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
+ </message>
+ <message>
+ <source>Report Bug</source>
+ <translation>Fehler melden</translation>
+ </message>
+ <message>
+ <source>Help/News</source>
+ <translation>Hilfe/News</translation>
+ </message>
+ <message>
+ <source>URL Error</source>
+ <translation>URL Error</translation>
+ </message>
+ <message>
+ <source>Native</source>
+ <translation>Nativ</translation>
+ </message>
+ <message>
+ <source>Running on this machine.</source>
+ <translation>Läuft auf diesem Rechner.</translation>
+ </message>
</context>
</TS>
diff --git a/src/i18n/pt.ts b/src/i18n/pt.ts
index d75f1f2..4782956 100755
--- a/src/i18n/pt.ts
+++ b/src/i18n/pt.ts
@@ -4,7 +4,6 @@
<context>
<name>Console</name>
<message>
- <location filename="../main.cpp" line="32"/>
<source>Usage: vmchooser [ OPTIONS | FILE ]
-d, --default name of default session
@@ -17,7 +16,7 @@
FILE can be a vmware .xml or an X .desktop file
</source>
- <translation>Uso: vmchooser [ OPÇOES | ARQUIVO ]
+ <translation type="obsolete">Uso: vmchooser [ OPÇOES | ARQUIVO ]
-d, --(default) nome da sessão padrão
-P, --(pool) nome do pool do ambiente
@@ -31,105 +30,244 @@ ARQUIVO pode ser um arquivo xml do vmware ou do área de trabalho do X
</translation>
</message>
<message>
- <location filename="../main.cpp" line="68"/>
- <location filename="../main.cpp" line="80"/>
+ <location filename="../main.cpp" line="32"/>
+ <source>Usage: vmchooser [ OPTIONS ]
+
+ -d, --default name of default session
+ -c, --config alternative config file
+ -e, --env name of the environment
+ -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 &lt;width&gt;x&lt;height&gt;
+ -t, --theme theme
+ -b, --pvs show pvs options
+ -D, --debug print debug information
+ -v, --version print version and exit
+ -h, --help print usage information and exit
+
+FILE can be a vmware .xml or an X .desktop file
+</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../main.cpp" line="73"/>
<source>vmchooser: failed to run session</source>
<translation>vmchooser: falhou ao executar a sessão</translation>
</message>
<message>
- <location filename="../main.cpp" line="85"/>
+ <location filename="../main.cpp" line="79"/>
<source>vmchooser: invalid session file</source>
<translation>vmchooser: arquivo de sessão inválido</translation>
</message>
<message>
- <location filename="../main.cpp" line="143"/>
+ <location filename="../main.cpp" line="128"/>
+ <source>vmchooser: no URL given</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../main.cpp" line="134"/>
+ <source>vmchooser: invalid URL</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../main.cpp" line="156"/>
+ <source>vmchooser: invalid size argument</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>vmchooser: invlid size argument</source>
- <translation>vmchooser: argumento de tamanho inválido</translation>
+ <translation type="obsolete">vmchooser: argumento de tamanho inválido</translation>
</message>
<message>
- <location filename="../main.cpp" line="168"/>
<source>vmchooser: no sessions found</source>
- <translation>vmchooser: nenhuma sessão encontrada</translation>
+ <translation type="obsolete">vmchooser: nenhuma sessão encontrada</translation>
</message>
<message>
- <location filename="../main.cpp" line="180"/>
<source>vmchooser: external script %1 is not executable</source>
- <translation>vmchooser: o script externo %1 não é executável</translation>
+ <translation type="obsolete">vmchooser: o script externo %1 não é executável</translation>
</message>
</context>
<context>
<name>Dialog</name>
<message>
<location filename="../ui/dialog.ui" line="14"/>
- <location filename="../dialog.cpp" line="69"/>
+ <location filename="../dialog.cpp" line="94"/>
<source>vmchooser</source>
<translation>seletor</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="36"/>
+ <location filename="../ui/dialog.ui" line="120"/>
+ <source>Help</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="126"/>
+ <location filename="../ui/dialog.ui" line="152"/>
+ <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Loading...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="146"/>
+ <source>News</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="189"/>
+ <source>Local</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="199"/>
+ <source>My Classes</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="209"/>
+ <source>All Classes</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="275"/>
+ <source>Filter:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="307"/>
+ <source>Details</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="319"/>
+ <source>Description:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="339"/>
+ <source>Name:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="352"/>
+ <source>Creator:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="365"/>
+ <source>Operating System:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="422"/>
+ <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;Ubuntu&apos;; font-size:11pt;&quot;&gt;Click on an item on the left side for more infos.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="443"/>
<source>PVS Options</source>
<translation>Opções do PVS</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="44"/>
+ <location filename="../ui/dialog.ui" line="467"/>
<source>VNC access by lecturer:</source>
<translation>Acesso VNC para o Instrutor:</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="61"/>
+ <location filename="../ui/dialog.ui" line="497"/>
<source>VNC access by others:</source>
<translation>Acesso VNC para os demais:</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="102"/>
+ <location filename="../ui/dialog.ui" line="543"/>
+ <source>Report Bug</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="563"/>
+ <source>Help/News</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Accept chat messages</source>
- <translation>Aceitar mensagens instantâneas</translation>
+ <translation type="obsolete">Aceitar mensagens instantâneas</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="109"/>
<source>Accept file transfers</source>
- <translation>Aceitar transferência de arquivos</translation>
+ <translation type="obsolete">Aceitar transferência de arquivos</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="149"/>
+ <location filename="../ui/dialog.ui" line="570"/>
<source>Abort</source>
<translation>Interromper</translation>
</message>
<message>
- <location filename="../ui/dialog.ui" line="156"/>
+ <location filename="../ui/dialog.ui" line="577"/>
<source>Start</source>
<translation>Iniciar</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="20"/>
+ <location filename="../dialog.cpp" line="230"/>
<source>None</source>
<translatorcomment>it&apos;s used for no access</translatorcomment>
<translation>Nada</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="20"/>
+ <location filename="../dialog.cpp" line="230"/>
<source>View Only</source>
<translation>Apenar ver</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="21"/>
+ <location filename="../dialog.cpp" line="230"/>
<source>Full</source>
<translation>Total</translation>
</message>
<message>
- <location filename="../dialog.cpp" line="70"/>
+ <location filename="../dialog.cpp" line="303"/>
+ <location filename="../dialog.cpp" line="342"/>
+ <location filename="../main.cpp" line="224"/>
+ <source>Loading...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="304"/>
+ <source>URL Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="347"/>
+ <source>No Items</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="390"/>
+ <source>Native</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="391"/>
+ <source>Running on this machine.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="95"/>
<source>Vmchooser failed to run the selected session!</source>
<translation>O seletor da VM falhou ao executar a sessão selecionada!</translation>
</message>
<message>
- <location filename="../main.cpp" line="176"/>
<source>X Sessions</source>
- <translation>Sessões X</translation>
+ <translation type="obsolete">Sessões X</translation>
</message>
<message>
- <location filename="../main.cpp" line="188"/>
<source>Virtual Sessions</source>
- <translation>Sessões Virtuais</translation>
+ <translation type="obsolete">Sessões Virtuais</translation>
</message>
</context>
</TS>
diff --git a/src/main.cpp b/src/main.cpp
index f20564d..d55f01c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -120,11 +120,23 @@ 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");
+ urlBase = cmdOptions.value("url");
} else if (settings.contains("url")) {
- vSessionUrl = settings.value("url").toString();
+ urlBase = settings.value("url").toString();
+ } else {
+ std::cerr << a.translate("Console", "vmchooser: no URL given").toUtf8().data() << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ /* PARSE URL */
+ if (!urlBase.startsWith("http://")) {
+ std::cerr << a.translate("Console", "vmchooser: invalid URL").toUtf8().data() << std::endl;
+ return EXIT_FAILURE;
+ } else {
+ if (!urlBase.endsWith("/")) {
+ urlBase += "/";
+ }
}
QString size;
@@ -143,7 +155,7 @@ int main(int argc, char *argv[]) {
} else if (!size.isEmpty()) {
std::cerr << a.translate(
"Console",
- "vmchooser: invlid size argument").toUtf8().data()
+ "vmchooser: invalid size argument").toUtf8().data()
<< std::endl;
return EXIT_FAILURE;
} else {
@@ -173,25 +185,21 @@ int main(int argc, char *argv[]) {
Dialog w;
/* DOWNLOAD VSESSIONS */
-
HttpXmlDownloader httpxmldownloader;
httpxmldownloader.connectSlot(&w, SLOT(addSessionsAfterDownload(QNetworkReply*)));
- if (!vSessionUrl.isEmpty()) {
- // read xml and add items later
- httpxmldownloader.makeRequest(vSessionUrl);
- }
+ // read xml and add items later
+ httpxmldownloader.makeRequest(urlBase + "list.php");
/* DOWNLOAD NEWS */
HttpXmlDownloader news_downloader;
news_downloader.connectSlot(&w, SLOT(addNewsAfterDownload(QNetworkReply*)));
- // TODO: url
- news_downloader.makeRequest("http://localhost/news.php");
+ news_downloader.makeRequest(urlBase + "news.php");
/* DOWNLOAD HELP-SECTION */
HttpXmlDownloader help_downloader;
help_downloader.connectSlot(&w, SLOT(addHelpAfterDownload(QNetworkReply*)));
- help_downloader.makeRequest("http://localhost/help.php");
+ help_downloader.makeRequest(urlBase + "help.php");
w.setTheme();
@@ -213,17 +221,13 @@ int main(int argc, char *argv[]) {
w.addItems(xsessions, 0);
}
- if (!vSessionUrl.isEmpty()) {
- w.addLabelItem(a.translate("Dialog", "Loading..."), 1);
- }
+ w.addLabelItem(a.translate("Dialog", "Loading..."), 1);
QSettings SLXsettings(OPENSLXCONFIG, QSettings::NativeFormat);
if ( SLXsettings.contains("SLX_BENCHMARK_VM") ) {
QString vm = SLXsettings.value("SLX_BENCHMARK_VM").toString();
vm.remove('\'');
w.startSession(vm);
- } else {
- w.selectSession(defaultSession);
}
w.show();
diff --git a/src/sessionsiconholder.cpp b/src/sessionsiconholder.cpp
index 5f7c590..b52d93d 100644
--- a/src/sessionsiconholder.cpp
+++ b/src/sessionsiconholder.cpp
@@ -85,9 +85,6 @@ QIcon SessionsIconHolder::getIcon(const QUrl& url) {
QString file_path = iconsTempPath + file_name;
if (QFile::exists(file_path)) {
- if (debugMode) {
- qDebug() << "Loaded file from: " << file_path;
- }
QIcon icon(file_path);
icons.insert(url.toString(), icon);
return icon;
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp
index 722850e..3858ffe 100644
--- a/src/sessiontreemodel.cpp
+++ b/src/sessiontreemodel.cpp
@@ -188,7 +188,6 @@ QList<Session*> SessionTreeModel::lookForItem(const QString& label) {
}
} else {
QList<QString> items = label.split(" ", QString::SkipEmptyParts);
-
for (int i = 0; i < root_->childCount(); ++i) {
SessionTreeItem* item = root_->child(i);
if (item->session()->containsKeywords(items)) {
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index 55a1441..04fd93e 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -153,7 +153,7 @@ p, li { white-space: pre-wrap; }
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Heute gibt es nichts neues.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Loading...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>