From 132abc789dd12f0681a4064ea4aff56748b2227d Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 9 Oct 2019 21:29:12 +0300 Subject: [PATCH] ProjectExplorer: Apply low priority build immediately The MakeSteps are instantiated when the project is opened, but if the low priority setting is changed after that, it was not applied until reopening the project, because the setting was only tested on the ctor. Moved the setting test to actual execution. Task-number: QTCREATORBUG-23048 Change-Id: Ie0bcbe07f6d9a09b173f7e0fa6f1d5d12b4ac601 Reviewed-by: Christian Kandeler --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 2 +- src/plugins/projectexplorer/abstractprocessstep.cpp | 7 +++---- src/plugins/projectexplorer/abstractprocessstep.h | 2 +- src/plugins/projectexplorer/makestep.cpp | 2 +- src/plugins/qmakeprojectmanager/qmakestep.cpp | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 581adade966..68b514d6f13 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -87,7 +87,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) : if (m_buildTarget.isEmpty()) setBuildTarget(defaultBuildTarget()); - setLowPriorityIfConfigured(); + setLowPriority(); connect(target(), &Target::kitChanged, this, &CMakeBuildStep::cmakeCommandChanged); connect(project(), &Project::parsingFinished, diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index ce16dea25f7..fe3cb141189 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -230,7 +230,7 @@ void AbstractProcessStep::doRun() d->m_process->setWorkingDirectory(wd.absolutePath()); d->m_process->setEnvironment(d->m_param.environment()); d->m_process->setCommand(effectiveCommand); - if (d->m_lowPriority) + if (d->m_lowPriority && ProjectExplorerPlugin::projectExplorerSettings().lowBuildPriority) d->m_process->setLowPriority(); connect(d->m_process.get(), &QProcess::readyReadStandardOutput, @@ -251,10 +251,9 @@ void AbstractProcessStep::doRun() processStarted(); } -void AbstractProcessStep::setLowPriorityIfConfigured() +void AbstractProcessStep::setLowPriority() { - if (ProjectExplorerPlugin::projectExplorerSettings().lowBuildPriority) - d->m_lowPriority = true; + d->m_lowPriority = true; } void AbstractProcessStep::doCancel() diff --git a/src/plugins/projectexplorer/abstractprocessstep.h b/src/plugins/projectexplorer/abstractprocessstep.h index a4a0350b20c..3cc7aa8bf50 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.h +++ b/src/plugins/projectexplorer/abstractprocessstep.h @@ -57,7 +57,7 @@ protected: ~AbstractProcessStep() override; bool init() override; void doRun() override; - void setLowPriorityIfConfigured(); + void setLowPriority(); virtual void finish(bool success); virtual void processStarted(); diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index e8220b04a7f..64834f190b1 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -65,7 +65,7 @@ MakeStep::MakeStep(BuildStepList *parent, Core::Id id) m_userJobCount(defaultJobCount()) { setDefaultDisplayName(defaultDisplayName()); - setLowPriorityIfConfigured(); + setLowPriority(); } void MakeStep::setBuildTarget(const QString &buildTarget) diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index d55dfa15d3e..671a7ee3751 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -76,7 +76,7 @@ QMakeStep::QMakeStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Constants::Q { //: QMakeStep default display name setDefaultDisplayName(tr("qmake")); - setLowPriorityIfConfigured(); + setLowPriority(); } QmakeBuildConfiguration *QMakeStep::qmakeBuildConfiguration() const