From 2a16fac8b643214a5e62288a1d88e9bd28ffc949 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 14 Jan 2025 16:47:28 +0100 Subject: [PATCH] RunWorker: Get rid of setSupportsReRunning() Use RunControl::setSupportReRunning() instead. Change-Id: I7cfcf9cb3542756ab3d990a22b6224f390b7eed9 Reviewed-by: hjk --- src/plugins/debugger/debuggerruncontrol.cpp | 2 +- src/plugins/projectexplorer/runcontrol.cpp | 26 +------------------ src/plugins/projectexplorer/runcontrol.h | 1 - .../qmlprofiler/qmlprofilerruncontrol.cpp | 2 +- src/plugins/valgrind/valgrindengine.cpp | 2 +- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 0f1e9b1ef30..d699122d7c4 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -238,7 +238,7 @@ void DebuggerRunTool::continueAfterTerminalStart() // QML and/or mixed are not prepared for it. // setSupportsReRunning(!m_runParameters.isQmlDebugging); - setSupportsReRunning(false); // FIXME: Broken in general. + runControl()->setSupportsReRunning(false); // FIXME: Broken in general. // FIXME: Disabled due to Android. Make Android device report available ports instead. // int portsUsed = portsUsedByDebugger(); diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 52284c60170..7a93e136007 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -233,7 +233,6 @@ public: QList stopDependencies; QString id; - bool supportsReRunning = true; bool essential = false; }; @@ -350,7 +349,6 @@ public: void showError(const QString &msg); static bool isAllowedTransition(RunControlState from, RunControlState to); - bool supportsReRunning() const; bool isUsingTaskTree() const { return bool(m_runRecipe); } void startTaskTree(); void checkAutoDeleteAndEmitStopped(); @@ -1211,24 +1209,7 @@ void RunControl::setSupportsReRunning(bool reRunningSupported) bool RunControl::supportsReRunning() const { - if (d->isUsingTaskTree()) - return d->m_supportsReRunning; - return d->supportsReRunning(); -} - -bool RunControlPrivate::supportsReRunning() const -{ - for (RunWorker *worker : m_workers) { - if (!worker) { - debugMessage("Found unknown deleted worker when checking for re-run support"); - return false; - } - if (!worker->d->supportsReRunning) - return false; - if (worker->d->state != RunWorkerState::Done) - return false; - } - return true; + return d->m_supportsReRunning; } void RunControlPrivate::startTaskTree() @@ -1902,11 +1883,6 @@ void RunWorker::setId(const QString &id) d->id = id; } -void RunWorker::setSupportsReRunning(bool reRunningSupported) -{ - d->supportsReRunning = reRunningSupported; -} - QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, const FilePath &program) { QString failedToStart = Tr::tr("The process failed to start."); diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index 6169113ab3e..b33fb7141c0 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -69,7 +69,6 @@ public: void reportDone(); void reportFailure(const QString &msg = QString()); - void setSupportsReRunning(bool reRunningSupported); static QString userMessageForProcessError(QProcess::ProcessError, const Utils::FilePath &programName); diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 99937025b34..58f9173a10e 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -40,7 +40,7 @@ QmlProfilerRunner::QmlProfilerRunner(RunControl *runControl) setId("QmlProfilerRunner"); runControl->requestQmlChannel(); runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR); - setSupportsReRunning(false); + runControl->setSupportsReRunning(false); } void QmlProfilerRunner::start() diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 67238bd0e90..493af260efd 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -29,7 +29,7 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl) : RunWorker(runControl) { runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR); - setSupportsReRunning(false); + runControl->setSupportsReRunning(false); m_settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS));