From 9ecca8fe38afe8dc7eb5b404a6b54d89a76ce84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 7 Jul 2018 12:32:51 +0200 Subject: [PATCH] Reorder starting AnalTask and showing Dialog --- src/dialogs/AsyncTaskDialog.cpp | 3 ++- src/dialogs/OptionsDialog.cpp | 4 ++-- src/utils/AsyncTask.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dialogs/AsyncTaskDialog.cpp b/src/dialogs/AsyncTaskDialog.cpp index 56240515..d34556d0 100644 --- a/src/dialogs/AsyncTaskDialog.cpp +++ b/src/dialogs/AsyncTaskDialog.cpp @@ -43,7 +43,7 @@ void AsyncTaskDialog::updateLog(const QString &log) void AsyncTaskDialog::updateProgressTimer() { - int secondsElapsed = (task->getTimer().elapsed() + 500) / 1000; + int secondsElapsed = (task->getElapsedTime() + 500) / 1000; int minutesElapsed = secondsElapsed / 60; int hoursElapsed = minutesElapsed / 60; @@ -57,6 +57,7 @@ void AsyncTaskDialog::updateProgressTimer() label += " "; } label += tr("%n seconds", "%n second", secondsElapsed % 60); + printf("setText %s\n", label.toLocal8Bit().constData()); ui->timeLabel->setText(label); } diff --git a/src/dialogs/OptionsDialog.cpp b/src/dialogs/OptionsDialog.cpp index 90d69a86..8987b33e 100644 --- a/src/dialogs/OptionsDialog.cpp +++ b/src/dialogs/OptionsDialog.cpp @@ -242,13 +242,13 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList advanced) AsyncTask::Ptr analTaskPtr(analTask); - Core()->getAsyncTaskManager()->start(analTaskPtr); - AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analTaskPtr); taskDialog->setInterruptOnClose(true); taskDialog->setAttribute(Qt::WA_DeleteOnClose); taskDialog->show(); + Core()->getAsyncTaskManager()->start(analTaskPtr); + done(0); } diff --git a/src/utils/AsyncTask.h b/src/utils/AsyncTask.h index d405f91c..306c1d50 100644 --- a/src/utils/AsyncTask.h +++ b/src/utils/AsyncTask.h @@ -33,6 +33,7 @@ public: const QString &getLog() { return logBuffer; } const QElapsedTimer &getTimer() { return timer; } + qint64 getElapsedTime() { return timer.isValid() ? timer.elapsed() : 0; } virtual QString getTitle() { return QString(); }