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<var>=<value> -U<var> command line
parameters for CMake, which will update the file api json files.

Change-Id: I08e7041a95422549502eb7961f96570225e942fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2021-03-01 19:27:08 +01:00
parent 3c3e9a97fd
commit fe540e8828
3 changed files with 1 additions and 12 deletions

View File

@@ -526,8 +526,7 @@ void CMakeBuildSettingsWidget::updateButtonState()
}); });
m_resetButton->setEnabled(m_configModel->hasChanges() && !isParsing); m_resetButton->setEnabled(m_configModel->hasChanges() && !isParsing);
m_reconfigureButton->setEnabled((!configChanges.isEmpty() || m_configModel->hasCMakeChanges()) m_reconfigureButton->setEnabled(!configChanges.isEmpty() && !isParsing);
&& !isParsing);
m_buildConfiguration->setConfigurationChanges(configChanges); m_buildConfiguration->setConfigurationChanges(configChanges);
} }

View File

@@ -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 bool ConfigModel::canForceTo(const QModelIndex &idx, const ConfigModel::DataItem::Type type) const
{ {
if (idx.model() != const_cast<ConfigModel *>(this) || idx.column() != 1) if (idx.model() != const_cast<ConfigModel *>(this) || idx.column() != 1)
@@ -264,7 +259,6 @@ void ConfigModel::setConfiguration(const QList<ConfigModel::InternalDataItem> &c
// merge old/new entry: // merge old/new entry:
InternalDataItem item(*newIt); InternalDataItem item(*newIt);
item.newValue = (newIt->value != oldIt->newValue) ? oldIt->newValue : QString(); item.newValue = (newIt->value != oldIt->newValue) ? oldIt->newValue : QString();
item.isCMakeChanged = (oldIt->value != newIt->value);
item.isUserChanged = !item.newValue.isEmpty() && (item.newValue != item.value); item.isUserChanged = !item.newValue.isEmpty() && (item.newValue != item.value);
result << item; result << item;
++newIt; ++newIt;
@@ -390,7 +384,6 @@ QVariant ConfigModelTreeItem::data(int column, int role) const
return toolTip(); return toolTip();
case Qt::FontRole: { case Qt::FontRole: {
QFont font; QFont font;
font.setItalic(dataItem->isCMakeChanged);
font.setBold(dataItem->isUserNew); font.setBold(dataItem->isUserNew);
font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset);
return font; return font;
@@ -414,7 +407,6 @@ QVariant ConfigModelTreeItem::data(int column, int role) const
case Qt::FontRole: { case Qt::FontRole: {
QFont font; QFont font;
font.setBold((dataItem->isUserChanged || dataItem->isUserNew) && !dataItem->isUnset); font.setBold((dataItem->isUserChanged || dataItem->isUserNew) && !dataItem->isUnset);
font.setItalic(dataItem->isCMakeChanged);
font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset);
return font; return font;
} }

View File

@@ -144,7 +144,6 @@ public:
void resetAllChanges(); void resetAllChanges();
bool hasChanges() const; bool hasChanges() const;
bool hasCMakeChanges() const;
bool canForceTo(const QModelIndex &idx, const DataItem::Type type) const; bool canForceTo(const QModelIndex &idx, const DataItem::Type type) const;
void forceTo(const QModelIndex &idx, const DataItem::Type type); void forceTo(const QModelIndex &idx, const DataItem::Type type);
@@ -168,7 +167,6 @@ private:
bool isUserChanged = false; bool isUserChanged = false;
bool isUserNew = false; bool isUserNew = false;
bool isCMakeChanged = false;
QString newValue; QString newValue;
QString kitValue; QString kitValue;
}; };