Reorder starting AnalTask and showing Dialog

This commit is contained in:
Florian Märkl 2018-07-07 12:32:51 +02:00
parent df61dcdc55
commit 9ecca8fe38
3 changed files with 5 additions and 3 deletions

View File

@ -43,7 +43,7 @@ void AsyncTaskDialog::updateLog(const QString &log)
void AsyncTaskDialog::updateProgressTimer() void AsyncTaskDialog::updateProgressTimer()
{ {
int secondsElapsed = (task->getTimer().elapsed() + 500) / 1000; int secondsElapsed = (task->getElapsedTime() + 500) / 1000;
int minutesElapsed = secondsElapsed / 60; int minutesElapsed = secondsElapsed / 60;
int hoursElapsed = minutesElapsed / 60; int hoursElapsed = minutesElapsed / 60;
@ -57,6 +57,7 @@ void AsyncTaskDialog::updateProgressTimer()
label += " "; label += " ";
} }
label += tr("%n seconds", "%n second", secondsElapsed % 60); label += tr("%n seconds", "%n second", secondsElapsed % 60);
printf("setText %s\n", label.toLocal8Bit().constData());
ui->timeLabel->setText(label); ui->timeLabel->setText(label);
} }

View File

@ -242,13 +242,13 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
AsyncTask::Ptr analTaskPtr(analTask); AsyncTask::Ptr analTaskPtr(analTask);
Core()->getAsyncTaskManager()->start(analTaskPtr);
AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analTaskPtr); AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analTaskPtr);
taskDialog->setInterruptOnClose(true); taskDialog->setInterruptOnClose(true);
taskDialog->setAttribute(Qt::WA_DeleteOnClose); taskDialog->setAttribute(Qt::WA_DeleteOnClose);
taskDialog->show(); taskDialog->show();
Core()->getAsyncTaskManager()->start(analTaskPtr);
done(0); done(0);
} }

View File

@ -33,6 +33,7 @@ public:
const QString &getLog() { return logBuffer; } const QString &getLog() { return logBuffer; }
const QElapsedTimer &getTimer() { return timer; } const QElapsedTimer &getTimer() { return timer; }
qint64 getElapsedTime() { return timer.isValid() ? timer.elapsed() : 0; }
virtual QString getTitle() { return QString(); } virtual QString getTitle() { return QString(); }