diff options
author | Jan Darmochwal | 2010-10-10 13:51:15 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-10 13:51:15 +0200 |
commit | 5471c7e1e6de9e7899c6f1fe037573fab37a2125 (patch) | |
tree | 762a400be029e2a3b9e3000196de6842d91334c9 /src | |
parent | Remove debug printf from vsession.cpp (diff) | |
download | vmchooser-5471c7e1e6de9e7899c6f1fe037573fab37a2125.tar.gz vmchooser-5471c7e1e6de9e7899c6f1fe037573fab37a2125.tar.xz vmchooser-5471c7e1e6de9e7899c6f1fe037573fab37a2125.zip |
Failure message if session cannot be started
Diffstat (limited to 'src')
-rw-r--r-- | src/dialog.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 2d6fecf..cfb3fae 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -1,4 +1,7 @@ #include "dialog.h" + +#include <QMessageBox> + #include "ui_dialog.h" #include "save_restore_session.h" #include "sessiontreeitem.h" @@ -14,7 +17,8 @@ Dialog::Dialog(QWidget *parent) if (ifaceDBus_->isValid()) { // PVS is running QStringList accessOptions; - accessOptions << trUtf8("None") << trUtf8("View Only") << trUtf8("Full"); + accessOptions <<trUtf8("None") << trUtf8("View Only") << + trUtf8("Full"); ui->comboBoxLecturer->insertItems(0, accessOptions); ui->comboBoxOthers->insertItems(0, accessOptions); @@ -43,17 +47,17 @@ void Dialog::changeEvent(QEvent *e) { } void Dialog::on_treeView_activated(QModelIndex index) { - // TODO handle failures - // TODO get rid of this->entries, storing them in the model should be enough - // alternatively use references instead of copies? + // this method gets called when a Session has been activated SessionTreeItem* item = static_cast<SessionTreeItem*>(index.internalPointer()); const Session* s(item->session()); if (!s) { + // no valid session has been selected, do nothing return; } + if (s->run()) { if (ifaceDBus_->isValid()) { writePVSSettings(); @@ -61,15 +65,15 @@ void Dialog::on_treeView_activated(QModelIndex index) { writeSessionName(s->shortDescription()); close(); } else { - // TODO: error instead of close - close(); + QMessageBox::warning( + this, trUtf8("vmchooser"), + trUtf8("Vmchooser failed to run the selected session!"); } } void Dialog::addItems(const QList<Session*>& entries, const QString& section) { this->model_->addItems(entries, section); - // TODO: do this only once? ui->treeView->setModel(model_); ui->treeView->expandAll(); } @@ -79,7 +83,6 @@ void Dialog::on_pushButtonAbort_clicked() { } void Dialog::on_pushButtonStart_clicked() { - // TODO: check if a model is selected this->on_treeView_activated(ui->treeView->selectionModel()->currentIndex()); } @@ -147,14 +150,14 @@ void Dialog::writePVSSettings() { } void Dialog::on_comboBoxLecturer_currentIndexChanged(int index) { - // TODO: may others have more access than lecturer? + // TODO (Jan): may others have more access than lecturer? if (index < ui->comboBoxOthers->currentIndex()) { ui->comboBoxOthers->setCurrentIndex(index); } } void Dialog::on_comboBoxOthers_currentIndexChanged(int index) { - // TODO: may others have more access than lecturer? + // TODO (Jan): may others have more access than lecturer? if (index > ui->comboBoxLecturer->currentIndex()) { ui->comboBoxLecturer->setCurrentIndex(index); } |