From 6705b6d670ce859d1d22c4ed748f71ac6fb2d5a6 Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Wed, 3 Aug 2016 10:45:09 +0200 Subject: check for autostart when download is finished and not after a fixed time of 1 second. --- src/dialog.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/dialog.cpp') diff --git a/src/dialog.cpp b/src/dialog.cpp index 87eae8e..c7a85e0 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -353,16 +353,8 @@ void Dialog::setTheme() { ui->label_r->setStyleSheet(label_r_style); } + void Dialog::onCenterTimer() { - if (!autoStartEntry_.isEmpty()) { - if (this->selectSessionByUuid(autoStartEntry_) || this->selectSession(autoStartEntry_)) { - this->on_treeView_doubleClicked(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(); @@ -418,11 +410,14 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { this->addStatusString(STR_NO_ITEMS); } + checkAutostart(); + // select last-session selectPreviousSession(); userInteracted_ = true; } + void Dialog::mousePressEvent(QMouseEvent * event) { QDialog::mousePressEvent(event); userInteracted_ = true; @@ -793,3 +788,14 @@ bool Dialog::eventFilter(QObject*, QEvent *event) { } return false; } +void Dialog::checkAutostart() { + if (!autoStartEntry_.isEmpty()) { + if (this->selectSessionByUuid(autoStartEntry_) || this->selectSession(autoStartEntry_)) { + this->on_treeView_doubleClicked(ui->treeView->selectionModel()->currentIndex()); + } else { + QMessageBox::critical(this, "Autostart", QString::fromUtf8("Konnte %1 nicht starten.").arg(autoStartEntry_)); + } + autoStartEntry_.clear(); + return; + } +} -- cgit v1.2.3-55-g7522