Commit df627018 authored by Tobias Hunger's avatar Tobias Hunger

CMake: Mark configuration items that were taken from the CMakeCache.txt file

Change-Id: Id9e707d7b07d35ade44959955db61810e34f7b30
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 0f7d75cc
......@@ -332,6 +332,10 @@ CMakeConfig BuildDirManager::parsedConfiguration() const
return m_cmakeCache;
if (m_cmakeCache.isEmpty())
m_cmakeCache = m_reader->takeParsedConfiguration();
for (auto &ci : m_cmakeCache)
ci.inCMakeCache = true;
return m_cmakeCache;
}
......
......@@ -273,6 +273,7 @@ QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration
j.value = QString::fromUtf8(i.value);
j.description = QString::fromUtf8(i.documentation);
j.values = i.values;
j.inCMakeCache = i.inCMakeCache;
j.isAdvanced = i.isAdvanced || i.type == CMakeConfigItem::INTERNAL;
switch (i.type) {
......@@ -308,6 +309,7 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
ni.value = i.value.toUtf8();
ni.documentation = i.description.toUtf8();
ni.isAdvanced = i.isAdvanced;
ni.inCMakeCache = i.inCMakeCache;
ni.values = i.values;
switch (i.type) {
case CMakeProjectManager::ConfigModel::DataItem::BOOLEAN:
......
......@@ -67,6 +67,7 @@ public:
QByteArray key;
Type type = STRING;
bool isAdvanced = false;
bool inCMakeCache = false;
QByteArray value; // converted to string as needed
QByteArray documentation;
QStringList values;
......
......@@ -106,6 +106,7 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const
QFont font;
font.setItalic(item.isCMakeChanged);
font.setBold(item.isUserNew);
font.setStrikeOut(!item.inCMakeCache && !item.isUserNew);
return font;
}
default:
......@@ -307,16 +308,16 @@ bool ConfigModel::hasCMakeChanges() const
QList<ConfigModel::DataItem> ConfigModel::configurationChanges() const
{
QList<DataItem> result;
const QList<InternalDataItem> tmp
= Utils::filtered(m_configuration, [](const InternalDataItem &i) { return i.isUserChanged || i.isUserNew; });
foreach (const InternalDataItem &item, tmp) {
= Utils::filtered(m_configuration, [](const InternalDataItem &i) {
return i.isUserChanged || i.isUserNew || !i.inCMakeCache;
});
return Utils::transform(tmp, [](const InternalDataItem &item) {
DataItem newItem(item);
if (item.isUserChanged)
newItem.value = item.newValue;
result << newItem;
}
return result;
return newItem;
});
}
ConfigModel::InternalDataItem &ConfigModel::itemAtRow(int row)
......
......@@ -46,6 +46,7 @@ public:
QString key;
Type type = STRING;
bool isAdvanced = false;
bool inCMakeCache = false;
QString value;
QString description;
QStringList values;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment