forked from qt-creator/qt-creator
CMakePM: Store CMake Autorun state for all tools
Amends 2f39b51bdc
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>
This commit is contained in:
@@ -61,6 +61,8 @@ public:
|
|||||||
Utils::Id id() const { return m_id; }
|
Utils::Id id() const { return m_id; }
|
||||||
QVariantMap toMap () const;
|
QVariantMap toMap () const;
|
||||||
|
|
||||||
|
void setAutorun(bool autoRun) { m_isAutoRun = autoRun; }
|
||||||
|
|
||||||
void setFilePath(const Utils::FilePath &executable);
|
void setFilePath(const Utils::FilePath &executable);
|
||||||
Utils::FilePath filePath() const;
|
Utils::FilePath filePath() const;
|
||||||
Utils::FilePath cmakeExecutable() const;
|
Utils::FilePath cmakeExecutable() const;
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ void CMakeToolManager::restoreCMakeTools()
|
|||||||
emit m_instance->cmakeToolsLoaded();
|
emit m_instance->cmakeToolsLoaded();
|
||||||
|
|
||||||
// Store the default CMake tool "Autorun CMake" value globally
|
// Store the default CMake tool "Autorun CMake" value globally
|
||||||
|
// TODO: Remove in Qt Creator 13
|
||||||
auto settings = Internal::CMakeSpecificSettings::instance();
|
auto settings = Internal::CMakeSpecificSettings::instance();
|
||||||
if (settings->autorunCMake.value() == settings->autorunCMake.defaultValue()) {
|
if (settings->autorunCMake.value() == settings->autorunCMake.defaultValue()) {
|
||||||
CMakeTool *cmake = defaultCMakeTool();
|
CMakeTool *cmake = defaultCMakeTool();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "cmaketoolsettingsaccessor.h"
|
#include "cmaketoolsettingsaccessor.h"
|
||||||
|
|
||||||
#include "cmakeprojectmanagertr.h"
|
#include "cmakeprojectmanagertr.h"
|
||||||
|
#include "cmakespecificsettings.h"
|
||||||
#include "cmaketool.h"
|
#include "cmaketool.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.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());
|
data.insert(QLatin1String(CMAKE_TOOL_DEFAULT_KEY), defaultId.toSetting());
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (const CMakeTool *item : cmakeTools) {
|
for (CMakeTool *item : cmakeTools) {
|
||||||
Utils::FilePath fi = item->cmakeExecutable();
|
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
|
if (fi.needsDevice() || fi.isExecutableFile()) { // be graceful for device related stuff
|
||||||
QVariantMap tmp = item->toMap();
|
QVariantMap tmp = item->toMap();
|
||||||
if (tmp.isEmpty())
|
if (tmp.isEmpty())
|
||||||
|
|||||||
Reference in New Issue
Block a user