From fe540e88284959fa75ea6c56984f0955bf2ee1da Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 1 Mar 2021 19:27:08 +0100 Subject: [PATCH] CMakeProjectManager: Remove isCmakeChanged state Since CMake's file-api cache is the only source of truth for CMake configuration, there is no need to keep track of such a state. Qt Creator will issue -D= -U command line parameters for CMake, which will update the file api json files. Change-Id: I08e7041a95422549502eb7961f96570225e942fa Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/cmakebuildconfiguration.cpp | 3 +-- src/plugins/cmakeprojectmanager/configmodel.cpp | 8 -------- src/plugins/cmakeprojectmanager/configmodel.h | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index d4d2f0d2675..3f40ca0b92d 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -526,8 +526,7 @@ void CMakeBuildSettingsWidget::updateButtonState() }); m_resetButton->setEnabled(m_configModel->hasChanges() && !isParsing); - m_reconfigureButton->setEnabled((!configChanges.isEmpty() || m_configModel->hasCMakeChanges()) - && !isParsing); + m_reconfigureButton->setEnabled(!configChanges.isEmpty() && !isParsing); m_buildConfiguration->setConfigurationChanges(configChanges); } diff --git a/src/plugins/cmakeprojectmanager/configmodel.cpp b/src/plugins/cmakeprojectmanager/configmodel.cpp index f30adb22394..b3bf8533c6d 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.cpp +++ b/src/plugins/cmakeprojectmanager/configmodel.cpp @@ -123,11 +123,6 @@ bool ConfigModel::hasChanges() const }); } -bool ConfigModel::hasCMakeChanges() const -{ - return Utils::contains(m_configuration, [](const InternalDataItem &i) { return i.isCMakeChanged; }); -} - bool ConfigModel::canForceTo(const QModelIndex &idx, const ConfigModel::DataItem::Type type) const { if (idx.model() != const_cast(this) || idx.column() != 1) @@ -264,7 +259,6 @@ void ConfigModel::setConfiguration(const QList &c // merge old/new entry: InternalDataItem item(*newIt); item.newValue = (newIt->value != oldIt->newValue) ? oldIt->newValue : QString(); - item.isCMakeChanged = (oldIt->value != newIt->value); item.isUserChanged = !item.newValue.isEmpty() && (item.newValue != item.value); result << item; ++newIt; @@ -390,7 +384,6 @@ QVariant ConfigModelTreeItem::data(int column, int role) const return toolTip(); case Qt::FontRole: { QFont font; - font.setItalic(dataItem->isCMakeChanged); font.setBold(dataItem->isUserNew); font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); return font; @@ -414,7 +407,6 @@ QVariant ConfigModelTreeItem::data(int column, int role) const case Qt::FontRole: { QFont font; font.setBold((dataItem->isUserChanged || dataItem->isUserNew) && !dataItem->isUnset); - font.setItalic(dataItem->isCMakeChanged); font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); return font; } diff --git a/src/plugins/cmakeprojectmanager/configmodel.h b/src/plugins/cmakeprojectmanager/configmodel.h index 70f0fa3960a..8fb621c2ea0 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.h +++ b/src/plugins/cmakeprojectmanager/configmodel.h @@ -144,7 +144,6 @@ public: void resetAllChanges(); bool hasChanges() const; - bool hasCMakeChanges() const; bool canForceTo(const QModelIndex &idx, const DataItem::Type type) const; void forceTo(const QModelIndex &idx, const DataItem::Type type); @@ -168,7 +167,6 @@ private: bool isUserChanged = false; bool isUserNew = false; - bool isCMakeChanged = false; QString newValue; QString kitValue; };