diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2023-01-23 23:58:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-23 23:58:52 +0100 |
commit | 16477a8f6c1fc646208b41b76598ce8e7a60369e (patch) | |
tree | 782055d4c36affd2b9bd84905805c94f04134590 /launcher/ui/widgets/ProgressWidget.cpp | |
parent | 04e4900415aa102f3ad2f40375e3b59bfc7ee9ba (diff) | |
parent | ea5020e188d7cb6d4c8dcf7f953161759ed17899 (diff) | |
download | PrismLauncher-16477a8f6c1fc646208b41b76598ce8e7a60369e.tar.gz PrismLauncher-16477a8f6c1fc646208b41b76598ce8e7a60369e.tar.bz2 PrismLauncher-16477a8f6c1fc646208b41b76598ce8e7a60369e.zip |
Merge pull request #675 from flowln/generalize_mod_model
Diffstat (limited to 'launcher/ui/widgets/ProgressWidget.cpp')
-rw-r--r-- | launcher/ui/widgets/ProgressWidget.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/launcher/ui/widgets/ProgressWidget.cpp b/launcher/ui/widgets/ProgressWidget.cpp index b60d9a7a..f736af08 100644 --- a/launcher/ui/widgets/ProgressWidget.cpp +++ b/launcher/ui/widgets/ProgressWidget.cpp @@ -39,7 +39,7 @@ void ProgressWidget::progressFormat(QString format) m_bar->setFormat(format); } -void ProgressWidget::watch(Task* task) +void ProgressWidget::watch(const Task* task) { if (!task) return; @@ -54,14 +54,17 @@ void ProgressWidget::watch(Task* task) connect(m_task, &Task::progress, this, &ProgressWidget::handleTaskProgress); connect(m_task, &Task::destroyed, this, &ProgressWidget::taskDestroyed); - show(); + if (m_task->isRunning()) + show(); + else + connect(m_task, &Task::started, this, &ProgressWidget::show); } -void ProgressWidget::start(Task* task) +void ProgressWidget::start(const Task* task) { watch(task); if (!m_task->isRunning()) - QMetaObject::invokeMethod(m_task, "start", Qt::QueuedConnection); + QMetaObject::invokeMethod(const_cast<Task*>(m_task), "start", Qt::QueuedConnection); } bool ProgressWidget::exec(std::shared_ptr<Task> task) |