aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2023-05-08 14:28:20 +0200
committerCristian Adam <cristian.adam@qt.io>2023-05-08 14:52:48 +0000
commita8f288fc9e752f34e8e3b732ced758074060c52d (patch)
treeb35a275591d2cc5af49fa3afd13a0af8736deb72
parent4a2a1c2978bf5fc84830cbfaffc4a2ab5c7127ec (diff)
CMakePM: Store CMake Autorun state for all tools
Amends 2f39b51bdc1f73e2d87cc641a8501fd04ee76b4f The default tool's value is taken as default global value, then will be saved for all tools. This fixes the case when the false Autorun value for the default CMake tool would always be set as global autorun with no option to actually set global Autorun value due to the "upgrade" path mechanism. Change-Id: I17076bc0c77b087c5d4048fdfe74ddf91d837fd4 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketool.h2
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp1
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp8
3 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmaketool.h b/src/plugins/cmakeprojectmanager/cmaketool.h
index 42fa7b8f62..54628910cc 100644
--- a/src/plugins/cmakeprojectmanager/cmaketool.h
+++ b/src/plugins/cmakeprojectmanager/cmaketool.h
@@ -61,6 +61,8 @@ public:
Utils::Id id() const { return m_id; }
QVariantMap toMap () const;
+ void setAutorun(bool autoRun) { m_isAutoRun = autoRun; }
+
void setFilePath(const Utils::FilePath &executable);
Utils::FilePath filePath() const;
Utils::FilePath cmakeExecutable() const;
diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
index 8bc396ced1..7e4c777317 100644
--- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp
@@ -141,6 +141,7 @@ void CMakeToolManager::restoreCMakeTools()
emit m_instance->cmakeToolsLoaded();
// Store the default CMake tool "Autorun CMake" value globally
+ // TODO: Remove in Qt Creator 13
auto settings = Internal::CMakeSpecificSettings::instance();
if (settings->autorunCMake.value() == settings->autorunCMake.defaultValue()) {
CMakeTool *cmake = defaultCMakeTool();
diff --git a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp
index 43f1915709..cfce81f005 100644
--- a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp
@@ -4,6 +4,7 @@
#include "cmaketoolsettingsaccessor.h"
#include "cmakeprojectmanagertr.h"
+#include "cmakespecificsettings.h"
#include "cmaketool.h"
#include <coreplugin/icore.h>
@@ -185,9 +186,14 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo
data.insert(QLatin1String(CMAKE_TOOL_DEFAULT_KEY), defaultId.toSetting());
int count = 0;
- for (const CMakeTool *item : cmakeTools) {
+ for (CMakeTool *item : cmakeTools) {
Utils::FilePath fi = item->cmakeExecutable();
+ // Gobal Autorun value will be set for all tools
+ // TODO: Remove in Qt Creator 13
+ const auto settings = CMakeSpecificSettings::instance();
+ item->setAutorun(settings->autorunCMake.value());
+
if (fi.needsDevice() || fi.isExecutableFile()) { // be graceful for device related stuff
QVariantMap tmp = item->toMap();
if (tmp.isEmpty())