diff options
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r-- | src/dialog.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 8ff215e..d758b0a 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -150,7 +150,7 @@ void Dialog::on_comboBoxOthers_currentIndexChanged(int index) { } } -void Dialog::selectSession(const QString& name) { +bool Dialog::selectSession(const QString& name) { QModelIndex root(ui->treeView->rootIndex()); for (int i = 0; i < model_->rowCount(root); ++i) { @@ -167,16 +167,21 @@ void Dialog::selectSession(const QString& name) { if (s->shortDescription() == name) { ui->treeView->selectionModel() ->setCurrentIndex(index, QItemSelectionModel::Select); - return; + return true; } } } + return false; } void Dialog::selectPreviousSession() { selectSession(readSessionName()); } +void Dialog::startSession(const QString& name) { + autoStartEntry_ = name; +} + void Dialog::showSettingsPVS() { pvsSettings_ = new QSettings("openslx", "pvs", this); QStringList accessOptions; @@ -223,6 +228,15 @@ void Dialog::setTheme() { } void Dialog::on_centerTimer() { + if (!autoStartEntry_.isEmpty()) { + if (this->selectSession(autoStartEntry_)) { + this->on_treeView_activated(ui->treeView->selectionModel()->currentIndex()); + } else { + QMessageBox::critical(this, "Autostart", QString::fromUtf8("Konnte %1 nicht starten.").arg(autoStartEntry_)); + } + autoStartEntry_.clear(); + return; + } // center dialog on primary screen QRect desktopRect = QApplication::desktop()->availableGeometry(this); QPoint center = desktopRect.center(); |