From 16f671874fde2f9d6c1a674a0af8a56b4691a82f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 9 Nov 2022 16:10:08 +0100 Subject: [PATCH] BuildStep: Remove unused runInThread() and cancelChecker() Change-Id: I9d4a858a25ab93b17f1018cecc785b42dd76ecc0 Reviewed-by: Christian Kandeler Reviewed-by: --- src/plugins/projectexplorer/buildstep.cpp | 37 ++++++----------------- src/plugins/projectexplorer/buildstep.h | 5 --- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp index 4088ce3d0b4..762d97ed801 100644 --- a/src/plugins/projectexplorer/buildstep.cpp +++ b/src/plugins/projectexplorer/buildstep.cpp @@ -101,6 +101,14 @@ This signal needs to be emitted if the build step runs in the GUI thread. */ +/*! + \fn bool ProjectExplorer::BuildStep::isImmutable() + + If this function returns \c true, the user cannot delete this build step for + this target and the user is prevented from changing the order in which + immutable steps are run. The default implementation returns \c false. +*/ + using namespace Utils; static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled"; @@ -287,33 +295,6 @@ QVariant BuildStep::data(Id id) const return {}; } -/*! - \fn BuildStep::isImmutable() - - If this function returns \c true, the user cannot delete this build step for - this target and the user is prevented from changing the order in which - immutable steps are run. The default implementation returns \c false. -*/ - -QFuture BuildStep::runInThread(const std::function &syncImpl) -{ - m_runInGuiThread = false; - m_cancelFlag = false; - auto * const watcher = new QFutureWatcher(this); - connect(watcher, &QFutureWatcher::finished, this, [this, watcher] { - emit finished(watcher->result()); - watcher->deleteLater(); - }); - auto future = Utils::runAsync(syncImpl); - watcher->setFuture(future); - return future; -} - -std::function BuildStep::cancelChecker() const -{ - return [step = QPointer(this)] { return step && step->isCanceled(); }; -} - bool BuildStep::isCanceled() const { return m_cancelFlag; @@ -321,7 +302,7 @@ bool BuildStep::isCanceled() const void BuildStep::doCancel() { - QTC_ASSERT(!m_runInGuiThread, qWarning() << "Build step" << displayName() + QTC_ASSERT(false, qWarning() << "Build step" << displayName() << "neeeds to implement the doCancel() function"); } diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index 0f5def37bd4..9ed15cdddc3 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -10,7 +10,6 @@ #include -#include #include #include @@ -118,9 +117,6 @@ signals: protected: virtual QWidget *createConfigWidget(); - QFuture runInThread(const std::function &syncImpl); - - std::function cancelChecker() const; bool isCanceled() const; private: @@ -133,7 +129,6 @@ private: bool m_enabled = true; bool m_immutable = false; bool m_widgetExpandedByDefault = true; - bool m_runInGuiThread = true; bool m_addMacroExpander = false; std::optional m_wasExpanded; std::function m_summaryUpdater;