From 3a252ef86c60d6730dff2c2f26266e6db7e21e16 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Sat, 13 Jan 2024 16:46:53 +0100 Subject: [PATCH] PluginInstallWizard: Reuse TaskTreeRunner Change-Id: I66e7909d1ec0ce04ca250f4bda42bf9b2630966f Reviewed-by: Reviewed-by: Eike Ziller --- src/plugins/coreplugin/plugininstallwizard.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/plugins/coreplugin/plugininstallwizard.cpp b/src/plugins/coreplugin/plugininstallwizard.cpp index 1b918836ece..22c41a5541b 100644 --- a/src/plugins/coreplugin/plugininstallwizard.cpp +++ b/src/plugins/coreplugin/plugininstallwizard.cpp @@ -10,6 +10,8 @@ #include #include +#include + #include #include #include @@ -189,7 +191,7 @@ public: m_label->setWordWrap(true); m_cancelButton = new QPushButton(Tr::tr("Cancel")); connect(m_cancelButton, &QPushButton::clicked, this, [this] { - m_taskTree.reset(); + m_taskTreeRunner.reset(); m_cancelButton->setVisible(false); m_label->setType(InfoLabel::Information); m_label->setText(Tr::tr("Canceled.")); @@ -260,28 +262,21 @@ public: UnarchiverTask(onUnarchiverSetup, onUnarchiverError, CallDoneIf::Error), AsyncTask(onCheckerSetup, onCheckerDone, CallDoneIf::Success) }; - m_taskTree.reset(new TaskTree(root)); - - connect(m_taskTree.get(), &TaskTree::done, this, [this] { - m_cancelButton->setVisible(false); - m_taskTree.release()->deleteLater(); - }); - m_cancelButton->setVisible(true); - m_taskTree->start(); + m_taskTreeRunner.start(root, {}, [this](DoneWith) { m_cancelButton->setVisible(false); }); } void cleanupPage() final { // back button pressed - m_taskTree.reset(); + m_taskTreeRunner.reset(); m_tempDir.reset(); } bool isComplete() const final { return m_isComplete; } std::unique_ptr m_tempDir; - std::unique_ptr m_taskTree; + TaskTreeRunner m_taskTreeRunner; InfoLabel *m_label = nullptr; QPushButton *m_cancelButton = nullptr; QTextEdit *m_output = nullptr;