BuildStep: Remove unused runInThread() and cancelChecker()

Change-Id: I9d4a858a25ab93b17f1018cecc785b42dd76ecc0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-11-09 16:10:08 +01:00
parent 1e632d0c25
commit 16f671874f
2 changed files with 9 additions and 33 deletions

View File

@@ -101,6 +101,14 @@
This signal needs to be emitted if the build step runs in the GUI thread. 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; using namespace Utils;
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled"; static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
@@ -287,33 +295,6 @@ QVariant BuildStep::data(Id id) const
return {}; 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<bool> BuildStep::runInThread(const std::function<bool()> &syncImpl)
{
m_runInGuiThread = false;
m_cancelFlag = false;
auto * const watcher = new QFutureWatcher<bool>(this);
connect(watcher, &QFutureWatcher<bool>::finished, this, [this, watcher] {
emit finished(watcher->result());
watcher->deleteLater();
});
auto future = Utils::runAsync(syncImpl);
watcher->setFuture(future);
return future;
}
std::function<bool ()> BuildStep::cancelChecker() const
{
return [step = QPointer<const BuildStep>(this)] { return step && step->isCanceled(); };
}
bool BuildStep::isCanceled() const bool BuildStep::isCanceled() const
{ {
return m_cancelFlag; return m_cancelFlag;
@@ -321,7 +302,7 @@ bool BuildStep::isCanceled() const
void BuildStep::doCancel() void BuildStep::doCancel()
{ {
QTC_ASSERT(!m_runInGuiThread, qWarning() << "Build step" << displayName() QTC_ASSERT(false, qWarning() << "Build step" << displayName()
<< "neeeds to implement the doCancel() function"); << "neeeds to implement the doCancel() function");
} }

View File

@@ -10,7 +10,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QFuture>
#include <QWidget> #include <QWidget>
#include <atomic> #include <atomic>
@@ -118,9 +117,6 @@ signals:
protected: protected:
virtual QWidget *createConfigWidget(); virtual QWidget *createConfigWidget();
QFuture<bool> runInThread(const std::function<bool()> &syncImpl);
std::function<bool()> cancelChecker() const;
bool isCanceled() const; bool isCanceled() const;
private: private:
@@ -133,7 +129,6 @@ private:
bool m_enabled = true; bool m_enabled = true;
bool m_immutable = false; bool m_immutable = false;
bool m_widgetExpandedByDefault = true; bool m_widgetExpandedByDefault = true;
bool m_runInGuiThread = true;
bool m_addMacroExpander = false; bool m_addMacroExpander = false;
std::optional<bool> m_wasExpanded; std::optional<bool> m_wasExpanded;
std::function<QString()> m_summaryUpdater; std::function<QString()> m_summaryUpdater;