summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dialog.cpp23
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);
}