From 42cd0a3f7e3b502693c1ef4be2a57886c86b006a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 4 Jan 2016 11:07:53 +0100 Subject: Update images --- src/command_line_options.cpp | 6 +- src/dialog.cpp | 139 ++++++++++++++++++++++++++----------------- src/dialog.h | 12 +++- src/images.qrc | 1 + src/img/amiga.png | Bin 2382 -> 1986 bytes src/img/amiga2.png | Bin 4380 -> 4135 bytes src/img/atari.png | Bin 1726 -> 1353 bytes src/img/beos.png | Bin 2474 -> 2012 bytes src/img/bsd.png | Bin 7697 -> 7482 bytes src/img/debian.png | Bin 1823 -> 1652 bytes src/img/dosbox.png | Bin 9743 -> 6728 bytes src/img/fedora.png | Bin 2069 -> 1927 bytes src/img/gentoo.png | Bin 4315 -> 4039 bytes src/img/gnome.png | Bin 1304 -> 983 bytes src/img/kde.png | Bin 6568 -> 6230 bytes src/img/linux.png | Bin 4896 -> 4456 bytes src/img/locked.png | Bin 1901 -> 1610 bytes src/img/lxde.png | Bin 8685 -> 4510 bytes src/img/macos.png | Bin 1437 -> 1317 bytes src/img/mess.png | Bin 2341 -> 2199 bytes src/img/msdos.png | Bin 11611 -> 8316 bytes src/img/none.png | Bin 187 -> 85 bytes src/img/openslx-logo.png | Bin 17520 -> 12682 bytes src/img/opensolaris.png | Bin 3725 -> 2566 bytes src/img/os2.png | Bin 4715 -> 3993 bytes src/img/osx.png | Bin 3061 -> 2910 bytes src/img/qemu.png | Bin 3653 -> 2854 bytes src/img/redhat.png | Bin 1947 -> 1780 bytes src/img/riscos.png | Bin 2802 -> 2471 bytes src/img/riscos_orig.png | Bin 6048 -> 5376 bytes src/img/solaris.png | Bin 3683 -> 3139 bytes src/img/suse.png | Bin 1559 -> 1361 bytes src/img/term.png | Bin 18052 -> 15645 bytes src/img/title_l.png | Bin 9187 -> 6172 bytes src/img/title_r.png | Bin 3390 -> 2274 bytes src/img/ubuntu.png | Bin 1232 -> 1092 bytes src/img/unknown.png | Bin 6276 -> 5845 bytes src/img/virtualbox.png | Bin 8688 -> 8261 bytes src/img/vm-mix.png | Bin 0 -> 7051 bytes src/img/vmware.png | Bin 10024 -> 9383 bytes src/img/win2000.png | Bin 1582 -> 1397 bytes src/img/win311.png | Bin 2872 -> 2223 bytes src/img/win7.png | Bin 7619 -> 7286 bytes src/img/win8.png | Bin 5080 -> 2294 bytes src/img/windows.png | Bin 5636 -> 5359 bytes src/img/winxp.png | Bin 5365 -> 5023 bytes src/img/xfce.png | Bin 5326 -> 5183 bytes src/main.cpp | 23 ++++--- src/ui/dialog.ui | 76 +++++++++++++++++++---- src/vsession.h | 2 +- 50 files changed, 181 insertions(+), 78 deletions(-) create mode 100644 src/img/vm-mix.png (limited to 'src') diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp index b5cc8a6..3a9cbc5 100644 --- a/src/command_line_options.cpp +++ b/src/command_line_options.cpp @@ -21,13 +21,14 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { {"url", required_argument, NULL, 'u'}, {"version", no_argument, NULL, 'v'}, {"xpath", required_argument, NULL, 'x'}, + {"tab", required_argument, NULL, 'T'}, {0, 0, 0, 0} }; int c; // Again, please sort alphabetically in getopt_long call and switch statement - while ((c = getopt_long(argc, argv, "b:c:Dd:Ff:hP:pSs:t:u:vx:?", longOptions, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "b:c:Dd:Ff:hP:pSs:t:T:u:vx:?", longOptions, NULL)) != -1) { switch (c) { case 'b': options.insert("base", optarg); @@ -66,6 +67,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { case 't': options.insert("theme", optarg); break; + case 'T': + options.insert("tab", optarg); + break; case 'u': options.insert("url", optarg); break; diff --git a/src/dialog.cpp b/src/dialog.cpp index 605aeb4..8572c67 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -20,11 +20,15 @@ #include "vsession.h" #include "choosersettings.h" -Dialog::Dialog(QWidget *parent) +Dialog::Dialog(int defaultTab, QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { model_[0] = new SessionTreeModel(parent); model_[1] = new SessionTreeModel(parent); model_[2] = new SessionTreeModel(parent); + if (defaultTab < 0 || defaultTab > TAB_COUNT) defaultTab = TAB_ALL_VMS; + defaultTab_ = defaultTab; + qDebug() << "Default tab: " << defaultTab; + userInteracted_ = false; ui->setupUi(this); @@ -43,23 +47,23 @@ Dialog::Dialog(QWidget *parent) connect(centerTimer_, SIGNAL(timeout()), this, SLOT(onCenterTimer())); centerTimer_->start(1000); - activeTab_ = 2; - ui->tabButtonAllClasses->setChecked(true); - ui->helpBox->hide(); ui->newsBox->hide(); - oldRow_ = 0; // this is the old row (when switching to a new tab) - this->addStatusString(STR_LOADING); /* * TODO: why connect signal/slot when no item was loaded yet? + * TODO: Change "TODO" in the above line to "QUESTION", as it's just that QObject::connect(ui->treeView->selectionModel(), SIGNAL(currentChanged ( const QModelIndex&, const QModelIndex&)), this, SLOT(treeView_selectionChanged(const QModelIndex&, const QModelIndex&))); */ - this->onTabButtonChanged(2); + this->onTabButtonChanged(0); + this->selectPreviousSession(); + //activeTab_ = 2; + //ui->tabButtonAllClasses->setChecked(true); + // TODO: Implement bug report dialog :) ui->buttonBugReport->setEnabled(false); @@ -82,8 +86,9 @@ void Dialog::changeEvent(QEvent *e) { } } -void Dialog::on_treeView_doubleClicked(QModelIndex index) +void Dialog::on_treeView_doubleClicked(const QModelIndex& index) { + userInteracted_ = true; // this method gets called when a Session has been selected to start SessionTreeItem* item = @@ -155,6 +160,7 @@ void Dialog::addItems(const QList& entries, int tab) { setListModel(this->model_[tab]); } model_[tab]->updateView(); + selectPreviousSession(); } void Dialog::addStatusString(const int status) { @@ -184,13 +190,14 @@ void Dialog::on_pushButtonAbort_clicked() { } void Dialog::on_pushButtonStart_clicked() { + userInteracted_ = true; this->on_treeView_doubleClicked(ui->treeView->selectionModel()->currentIndex()); } bool Dialog::selectSession(const QString& name) { QModelIndex root(ui->treeView->rootIndex()); - for (int tab = 0; tab <= 2; ++tab) { + for (int tab = 0; tab <= TAB_COUNT; ++tab) { for (int i = 0; i < model_[tab]->rowCount(root); ++i) { QModelIndex index = model_[tab]->index(i, 0, root); if (!index.isValid()) { @@ -218,16 +225,28 @@ bool Dialog::selectSession(const QString& name) { } void Dialog::selectPreviousSession() { - if (ChooserSettings::getSetting("last-session").isEmpty()) { - this->onTabButtonChanged(2); - } else { + if (userInteracted_) { + qDebug() << "Not selecting previous session as user interacted or session was already selected"; + return; + } + if (!ChooserSettings::getSetting("last-session").isEmpty()) { + qDebug() << "Trying to select last session: " << ChooserSettings::getSetting("last-session"); ui->treeView->clearSelection(); - if (!selectSession(ChooserSettings::getSetting("last-session"))) { - // could not find last session, change to last used tab - this->onTabButtonChanged(ChooserSettings::getSetting("last-tab").toInt()); + if (selectSession(ChooserSettings::getSetting("last-session"))) { + qDebug() << "Success"; + userInteracted_ = true; + return; } } - //setListModel(this->model_[this->activeTab_]); + // could not find last session, change to last used tab + if (!ChooserSettings::getSetting("last-tab").isEmpty()) { + qDebug() << "Trying to select last tab " << ChooserSettings::getSetting("last-tab"); + this->onTabButtonChanged(ChooserSettings::getSetting("last-tab").toInt()); + } else { + qDebug() << "Selected default tab " << defaultTab_; + // Select default tab + this->onTabButtonChanged(defaultTab_); + } } void Dialog::startSession(const QString& name) { @@ -294,23 +313,17 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { QString temp_filename; if (reply->error() != QNetworkReply::NoError) { - if (debugMode) { - qDebug() << "Error reading from URL: " << reply->error(); - } + qDebug() << "Error reading from URL: " << reply->error(); QFile backup_file(xml_filename); if (!backup_file.open(QIODevice::ReadOnly)) { - if (debugMode) { - qDebug() << "Cannot read backup file " << xml_filename << " either"; - } + qDebug() << "Cannot read backup file " << xml_filename << " either"; this->removeStatusString(STR_LOADING); this->addStatusString(STR_URL_ERROR); return; } - if (debugMode) { - qDebug() << "Using backup file " << xml_filename; - } + qDebug() << "Using backup file " << xml_filename; backup_file.close(); temp_filename = xml_filename; @@ -334,7 +347,8 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { if (!sessions.isEmpty()) { qSort(sessions.begin(), sessions.end(), myLessThan); - this->addItems(sessions, 2); // TODO: No magic number; handle user specific classes + this->addItems(sessions, TAB_ALL_VMS); + // TODO: Filter user's classes and add to tab[TAB_MY_COURSES] } else { this->addStatusString(STR_NO_ITEMS); } @@ -344,6 +358,11 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { // select last-session selectPreviousSession(); + userInteracted_ = true; +} + +void Dialog::on_treeView_clicked(const QModelIndex&) { + userInteracted_ = true; } void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelIndex&) { @@ -360,43 +379,50 @@ void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelI return; } + QString description; if (s->type() == Session::VSESSION) { const VSession* vs = (VSession*) s; - ui->label_name->setText(vs->getAttribute("short_description", "param")); - ui->label_name->setToolTip(vs->getAttribute("short_description", "param")); - ui->label_creator->setText(vs->getAttribute("creator", "param")); ui->label_creator->setToolTip(vs->getAttribute("creator", "param")); - ui->label_os->setText(vs->getAttribute("os", "param")); - ui->label_os->setToolTip(vs->getAttribute("os", "param")); + ui->label_os->setText(vs->getAttribute("os_name", "param")); + ui->label_os->setToolTip(vs->getAttribute("os_name", "param")); - QString description(vs->getAttribute("long_description", "param") + "\n\nKeywords: "); - for (int i = 0; i < vs->keywords().length(); ++i) { - description += vs->keywords()[i] + ", "; - } - - ui->textBrowser->setText(description); + ui->label_platform->setText(vs->getAttribute("virtualizer_name", "param")); + ui->label_platform->setToolTip(vs->getAttribute("virtualizer_name", "param")); + if (vs->keywords().length() > 0) { + description = "\n\nKeywords: "; + for (int i = 0; i < vs->keywords().length(); ++i) { + description += vs->keywords()[i] + ", "; + } + } } else { - ui->label_name->setText(s->shortDescription()); ui->label_creator->setText(""); + ui->label_creator->setToolTip(""); ui->label_os->setText(QCoreApplication::instance()->translate("Dialog", "Native Linux")); - ui->textBrowser->setPlainText(QCoreApplication::instance()->translate("Dialog", "Linux X session running on this machine without virtualization.")); + ui->label_platform->setText("Linux"); + ui->label_platform->setToolTip(""); } + ui->label_name->setText(s->shortDescription()); + ui->label_name->setToolTip(s->shortDescription()); + ui->textBrowser->setPlainText(s->description() + description); } void Dialog::on_tabButtonLocal_clicked() { - onTabButtonChanged(0); + userInteracted_ = true; + onTabButtonChanged(TAB_NATIVE); } void Dialog::on_tabButtonMyClasses_clicked() { - onTabButtonChanged(1); + userInteracted_ = true; + onTabButtonChanged(TAB_MY_COURSES); } void Dialog::on_tabButtonAllClasses_clicked() { - onTabButtonChanged(2); + userInteracted_ = true; + onTabButtonChanged(TAB_ALL_VMS); } void Dialog::onTabButtonChanged(int tab) { @@ -418,9 +444,6 @@ void Dialog::onTabButtonChanged(int tab) { this->ui->filterEdit->setText(""); } - // save old row - //oldRow_ = ui->treeView->selectionModel()->currentIndex().row(); - // load the new list setListModel(model_[tab]); this->activeTab_ = tab; @@ -428,28 +451,38 @@ void Dialog::onTabButtonChanged(int tab) { ui->treeView->selectionModel()->clearSelection(); ui->treeView->selectionModel()->select(ui->treeView->model()->index(0, 0, ui->treeView->rootIndex()), QItemSelectionModel::Select); ui->treeView->selectionModel()->setCurrentIndex(ui->treeView->model()->index(0, 0, ui->treeView->rootIndex()), QItemSelectionModel::Select); - //treeView_selectionChanged(ui->treeView->model()->index(oldRow_, 0, ui->treeView->rootIndex()), ui->treeView->model()->index(0, 0, ui->treeView->rootIndex())); } void Dialog::on_filterEdit_textChanged() { - SessionTreeModel *newModel; + if (activeTab_ < 0 || activeTab_ >= TAB_COUNT) return; + SessionTreeModel *newModel = NULL; + userInteracted_ = true; // filter the current model - if (ui->filterEdit->text() != "" && ui->filterEdit->text().replace(" ", "").length() > 2) { - newModel = new SessionTreeModel(this); - newModel->addItems(this->model_[activeTab_]->lookForItem(ui->filterEdit->text())); - } else { + if (!ui->filterEdit->text().isEmpty() && ui->filterEdit->text().replace(" ", "").length() > 2) { + if (model_[activeTab_] != NULL) { + newModel = new SessionTreeModel(this); + newModel->addItems(this->model_[activeTab_]->lookForItem(ui->filterEdit->text())); + } + } + if (newModel == NULL) { newModel = model_[activeTab_]; } - setListModel(newModel); + if (newModel != NULL) { + setListModel(newModel); + } } void Dialog::setListModel(QAbstractItemModel *model) { + QAbstractItemModel *old = NULL; if (ui->treeView->model() == model_[0] || ui->treeView->model() == model_[1] || ui->treeView->model() == model_[2]) { } else { - ui->treeView->model()->deleteLater(); + old = ui->treeView->model(); } ui->treeView->setModel(model); + if (old != NULL) { + old->deleteLater(); + } // reconnect the treeModel QObject::connect(ui->treeView->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), diff --git a/src/dialog.h b/src/dialog.h index 59d2e48..04ee40f 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -24,8 +24,12 @@ class Dialog : public QDialog { static const int STR_URL_ERROR = 1; static const int STR_NO_ITEMS = 2; static const int STR__MAX = 3; + static const int TAB_NATIVE = 0; + static const int TAB_MY_COURSES = 1; + static const int TAB_ALL_VMS = 2; + static const int TAB_COUNT = 3; public: // Public methods - explicit Dialog(QWidget *parent = 0); + explicit Dialog(int defaultTab = -1, QWidget *parent = 0); ~Dialog(); void addItems(const QList&, int tab); void addStatusString(const int status); @@ -46,7 +50,8 @@ class Dialog : public QDialog { QTimer *centerTimer_; QString autoStartEntry_; int activeTab_; - int oldRow_; + int defaultTab_; + bool userInteracted_; QString strings_[STR__MAX]; void onTabButtonChanged(int tab); void configClearButton(); @@ -56,7 +61,8 @@ class Dialog : public QDialog { private slots: void on_pushButtonStart_clicked(); void on_pushButtonAbort_clicked(); - void on_treeView_doubleClicked(QModelIndex index); + void on_treeView_clicked(const QModelIndex& index); + void on_treeView_doubleClicked(const QModelIndex& index); void on_tabButtonLocal_clicked(); void on_tabButtonMyClasses_clicked(); void on_tabButtonAllClasses_clicked(); diff --git a/src/images.qrc b/src/images.qrc index a70331c..286cd53 100644 --- a/src/images.qrc +++ b/src/images.qrc @@ -39,5 +39,6 @@ img/winxp.png img/win2000.png img/msdos.png + img/vm-mix.png diff --git a/src/img/amiga.png b/src/img/amiga.png index 0291875..0dc5474 100644 Binary files a/src/img/amiga.png and b/src/img/amiga.png differ diff --git a/src/img/amiga2.png b/src/img/amiga2.png index d90af56..f455999 100644 Binary files a/src/img/amiga2.png and b/src/img/amiga2.png differ diff --git a/src/img/atari.png b/src/img/atari.png index 419dd16..d8a044e 100644 Binary files a/src/img/atari.png and b/src/img/atari.png differ diff --git a/src/img/beos.png b/src/img/beos.png index 11834fa..7613643 100644 Binary files a/src/img/beos.png and b/src/img/beos.png differ diff --git a/src/img/bsd.png b/src/img/bsd.png index 8b26986..ac370ca 100644 Binary files a/src/img/bsd.png and b/src/img/bsd.png differ diff --git a/src/img/debian.png b/src/img/debian.png index b1ebf06..6df0f6d 100644 Binary files a/src/img/debian.png and b/src/img/debian.png differ diff --git a/src/img/dosbox.png b/src/img/dosbox.png index 73a0f4c..db82dae 100644 Binary files a/src/img/dosbox.png and b/src/img/dosbox.png differ diff --git a/src/img/fedora.png b/src/img/fedora.png index 870716f..ccfdd7d 100644 Binary files a/src/img/fedora.png and b/src/img/fedora.png differ diff --git a/src/img/gentoo.png b/src/img/gentoo.png index 9505c79..47e059b 100644 Binary files a/src/img/gentoo.png and b/src/img/gentoo.png differ diff --git a/src/img/gnome.png b/src/img/gnome.png index d2f09cd..50514f4 100644 Binary files a/src/img/gnome.png and b/src/img/gnome.png differ diff --git a/src/img/kde.png b/src/img/kde.png index 6e29013..ae01d2f 100644 Binary files a/src/img/kde.png and b/src/img/kde.png differ diff --git a/src/img/linux.png b/src/img/linux.png index fd76d28..57807ad 100644 Binary files a/src/img/linux.png and b/src/img/linux.png differ diff --git a/src/img/locked.png b/src/img/locked.png index 414a9be..4aaade6 100644 Binary files a/src/img/locked.png and b/src/img/locked.png differ diff --git a/src/img/lxde.png b/src/img/lxde.png index 69b0f9e..f804d8e 100644 Binary files a/src/img/lxde.png and b/src/img/lxde.png differ diff --git a/src/img/macos.png b/src/img/macos.png index f4dd5f0..a78e3f2 100644 Binary files a/src/img/macos.png and b/src/img/macos.png differ diff --git a/src/img/mess.png b/src/img/mess.png index cb98f10..8940dab 100644 Binary files a/src/img/mess.png and b/src/img/mess.png differ diff --git a/src/img/msdos.png b/src/img/msdos.png index d6c004b..dd80dcf 100644 Binary files a/src/img/msdos.png and b/src/img/msdos.png differ diff --git a/src/img/none.png b/src/img/none.png index e6fc91a..059d565 100644 Binary files a/src/img/none.png and b/src/img/none.png differ diff --git a/src/img/openslx-logo.png b/src/img/openslx-logo.png index 7e40912..3eaec83 100644 Binary files a/src/img/openslx-logo.png and b/src/img/openslx-logo.png differ diff --git a/src/img/opensolaris.png b/src/img/opensolaris.png index e70051b..15ec66f 100644 Binary files a/src/img/opensolaris.png and b/src/img/opensolaris.png differ diff --git a/src/img/os2.png b/src/img/os2.png index 5a74de3..dcdef78 100644 Binary files a/src/img/os2.png and b/src/img/os2.png differ diff --git a/src/img/osx.png b/src/img/osx.png index 12a7ea3..99ce5c2 100644 Binary files a/src/img/osx.png and b/src/img/osx.png differ diff --git a/src/img/qemu.png b/src/img/qemu.png index a154cec..fadac31 100644 Binary files a/src/img/qemu.png and b/src/img/qemu.png differ diff --git a/src/img/redhat.png b/src/img/redhat.png index 437ca10..15a872a 100644 Binary files a/src/img/redhat.png and b/src/img/redhat.png differ diff --git a/src/img/riscos.png b/src/img/riscos.png index 2c4573e..7103dce 100644 Binary files a/src/img/riscos.png and b/src/img/riscos.png differ diff --git a/src/img/riscos_orig.png b/src/img/riscos_orig.png index 1b9752f..a334524 100644 Binary files a/src/img/riscos_orig.png and b/src/img/riscos_orig.png differ diff --git a/src/img/solaris.png b/src/img/solaris.png index 8433849..0acc4cb 100644 Binary files a/src/img/solaris.png and b/src/img/solaris.png differ diff --git a/src/img/suse.png b/src/img/suse.png index 1472b93..8e00d23 100644 Binary files a/src/img/suse.png and b/src/img/suse.png differ diff --git a/src/img/term.png b/src/img/term.png index f4c0200..f9d6989 100644 Binary files a/src/img/term.png and b/src/img/term.png differ diff --git a/src/img/title_l.png b/src/img/title_l.png index 900dd86..e1f5499 100644 Binary files a/src/img/title_l.png and b/src/img/title_l.png differ diff --git a/src/img/title_r.png b/src/img/title_r.png index 8ca9347..62bef1d 100644 Binary files a/src/img/title_r.png and b/src/img/title_r.png differ diff --git a/src/img/ubuntu.png b/src/img/ubuntu.png index b43c137..9224412 100644 Binary files a/src/img/ubuntu.png and b/src/img/ubuntu.png differ diff --git a/src/img/unknown.png b/src/img/unknown.png index 21ccd9c..2a76545 100644 Binary files a/src/img/unknown.png and b/src/img/unknown.png differ diff --git a/src/img/virtualbox.png b/src/img/virtualbox.png index 21bee21..c911799 100644 Binary files a/src/img/virtualbox.png and b/src/img/virtualbox.png differ diff --git a/src/img/vm-mix.png b/src/img/vm-mix.png new file mode 100644 index 0000000..4d60441 Binary files /dev/null and b/src/img/vm-mix.png differ diff --git a/src/img/vmware.png b/src/img/vmware.png index 5da57e6..72f6105 100644 Binary files a/src/img/vmware.png and b/src/img/vmware.png differ diff --git a/src/img/win2000.png b/src/img/win2000.png index 85073c1..55791ec 100644 Binary files a/src/img/win2000.png and b/src/img/win2000.png differ diff --git a/src/img/win311.png b/src/img/win311.png index b527bf4..6be2f0f 100644 Binary files a/src/img/win311.png and b/src/img/win311.png differ diff --git a/src/img/win7.png b/src/img/win7.png index 3552207..7824718 100644 Binary files a/src/img/win7.png and b/src/img/win7.png differ diff --git a/src/img/win8.png b/src/img/win8.png index ad3b0c3..9b4dded 100644 Binary files a/src/img/win8.png and b/src/img/win8.png differ diff --git a/src/img/windows.png b/src/img/windows.png index 50dc89f..ec653a9 100644 Binary files a/src/img/windows.png and b/src/img/windows.png differ diff --git a/src/img/winxp.png b/src/img/winxp.png index 0dce300..f7cff22 100644 Binary files a/src/img/winxp.png and b/src/img/winxp.png differ diff --git a/src/img/xfce.png b/src/img/xfce.png index 41c8d21..39e4012 100644 Binary files a/src/img/xfce.png and b/src/img/xfce.png differ diff --git a/src/main.cpp b/src/main.cpp index b3dbce1..83c93de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,6 +45,7 @@ int main(int argc, char *argv[]) { " -v, --version print version and exit\n" " -h, --help print usage information and exit\n" " -S, --runscript change path to run-virt.sh\n" + " -T --tab default tab (0=xsession, 1=my vms, 2=all vms)\n" "\nFILE can be a vmware .xml or an X .desktop file\n").toUtf8().data()); if (cmdOptions.contains("error")) { @@ -99,13 +100,14 @@ int main(int argc, char *argv[]) { QSettings settings(confFile, QSettings::IniFormat); settings.setIniCodec("UTF-8"); - QString defaultSession; - if (cmdOptions.contains("default")) { - defaultSession = cmdOptions.value("default"); - } else if (settings.contains("default")) { - defaultSession = settings.value("default").toString(); - } else { - defaultSession = ChooserSettings::getSetting("last-session"); + if (ChooserSettings::getSetting("last-session").isEmpty()) { + QString defaultSession; + if (cmdOptions.contains("default")) { + defaultSession = cmdOptions.value("default"); + } else if (settings.contains("default")) { + defaultSession = settings.value("default").toString(); + } + ChooserSettings::setSetting("last-session", defaultSession); } if (cmdOptions.contains("xpath")) { @@ -197,10 +199,15 @@ int main(int argc, char *argv[]) { basePath = settings.value("path").toString(); } + int defaultTab = -1; + if (cmdOptions.contains("tab")) { + defaultTab = cmdOptions.value("tab").toInt(); + } + /* read session files */ QList xsessions(XSession::readSessions(xSessionPath)); - Dialog w; + Dialog w(defaultTab); /* DOWNLOAD VSESSIONS */ HttpXmlDownloader httpxmldownloader; diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index 6ff8d9d..5be8154 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -132,8 +132,8 @@ margin-bottom:0px;} <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Loading...</span></p></body></html> +</style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html> @@ -164,8 +164,8 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Loading...</span></p></body></html> +</style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html> @@ -197,9 +197,25 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + + Local + + + :/linux:/linux + + + + 40 + 40 + + true @@ -207,6 +223,12 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + + My Classes @@ -217,9 +239,25 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + + All Classes + + + :/vm-mix:/vm-mix + + + + 40 + 40 + + true @@ -328,7 +366,7 @@ border:1px solid #999; - Description: + Description @@ -348,7 +386,7 @@ border:1px solid #999; - Name: + Name @@ -361,7 +399,7 @@ border:1px solid #999; - Creator: + Creator @@ -374,7 +412,14 @@ border:1px solid #999; - Operating System: + Operating System + + + + + + + Platform @@ -394,7 +439,7 @@ border:1px solid #999; - + @@ -407,7 +452,7 @@ border:1px solid #999; - + @@ -420,7 +465,14 @@ border:1px solid #999; - + + + + + + + + @@ -434,7 +486,7 @@ border:1px solid #999; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Click on an item on the left side for more infos.</span></p></body></html> diff --git a/src/vsession.h b/src/vsession.h index e542818..22f3a94 100644 --- a/src/vsession.h +++ b/src/vsession.h @@ -30,7 +30,7 @@ class VSession : public Session { } QString description() const { - return getAttribute("description"); + return getAttribute("long_description"); } QIcon icon() const; -- cgit v1.2.3-55-g7522