forked from qt-creator/qt-creator
CMake: Mark configuration items that were taken from the CMakeCache.txt file
Change-Id: Id9e707d7b07d35ade44959955db61810e34f7b30 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -332,6 +332,10 @@ CMakeConfig BuildDirManager::parsedConfiguration() const
|
|||||||
return m_cmakeCache;
|
return m_cmakeCache;
|
||||||
if (m_cmakeCache.isEmpty())
|
if (m_cmakeCache.isEmpty())
|
||||||
m_cmakeCache = m_reader->takeParsedConfiguration();
|
m_cmakeCache = m_reader->takeParsedConfiguration();
|
||||||
|
|
||||||
|
for (auto &ci : m_cmakeCache)
|
||||||
|
ci.inCMakeCache = true;
|
||||||
|
|
||||||
return m_cmakeCache;
|
return m_cmakeCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -273,6 +273,7 @@ QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration
|
|||||||
j.value = QString::fromUtf8(i.value);
|
j.value = QString::fromUtf8(i.value);
|
||||||
j.description = QString::fromUtf8(i.documentation);
|
j.description = QString::fromUtf8(i.documentation);
|
||||||
j.values = i.values;
|
j.values = i.values;
|
||||||
|
j.inCMakeCache = i.inCMakeCache;
|
||||||
|
|
||||||
j.isAdvanced = i.isAdvanced || i.type == CMakeConfigItem::INTERNAL;
|
j.isAdvanced = i.isAdvanced || i.type == CMakeConfigItem::INTERNAL;
|
||||||
switch (i.type) {
|
switch (i.type) {
|
||||||
@@ -308,6 +309,7 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
|
|||||||
ni.value = i.value.toUtf8();
|
ni.value = i.value.toUtf8();
|
||||||
ni.documentation = i.description.toUtf8();
|
ni.documentation = i.description.toUtf8();
|
||||||
ni.isAdvanced = i.isAdvanced;
|
ni.isAdvanced = i.isAdvanced;
|
||||||
|
ni.inCMakeCache = i.inCMakeCache;
|
||||||
ni.values = i.values;
|
ni.values = i.values;
|
||||||
switch (i.type) {
|
switch (i.type) {
|
||||||
case CMakeProjectManager::ConfigModel::DataItem::BOOLEAN:
|
case CMakeProjectManager::ConfigModel::DataItem::BOOLEAN:
|
||||||
|
@@ -67,6 +67,7 @@ public:
|
|||||||
QByteArray key;
|
QByteArray key;
|
||||||
Type type = STRING;
|
Type type = STRING;
|
||||||
bool isAdvanced = false;
|
bool isAdvanced = false;
|
||||||
|
bool inCMakeCache = false;
|
||||||
QByteArray value; // converted to string as needed
|
QByteArray value; // converted to string as needed
|
||||||
QByteArray documentation;
|
QByteArray documentation;
|
||||||
QStringList values;
|
QStringList values;
|
||||||
|
@@ -106,6 +106,7 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const
|
|||||||
QFont font;
|
QFont font;
|
||||||
font.setItalic(item.isCMakeChanged);
|
font.setItalic(item.isCMakeChanged);
|
||||||
font.setBold(item.isUserNew);
|
font.setBold(item.isUserNew);
|
||||||
|
font.setStrikeOut(!item.inCMakeCache && !item.isUserNew);
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -307,16 +308,16 @@ bool ConfigModel::hasCMakeChanges() const
|
|||||||
|
|
||||||
QList<ConfigModel::DataItem> ConfigModel::configurationChanges() const
|
QList<ConfigModel::DataItem> ConfigModel::configurationChanges() const
|
||||||
{
|
{
|
||||||
QList<DataItem> result;
|
|
||||||
const QList<InternalDataItem> tmp
|
const QList<InternalDataItem> tmp
|
||||||
= Utils::filtered(m_configuration, [](const InternalDataItem &i) { return i.isUserChanged || i.isUserNew; });
|
= Utils::filtered(m_configuration, [](const InternalDataItem &i) {
|
||||||
foreach (const InternalDataItem &item, tmp) {
|
return i.isUserChanged || i.isUserNew || !i.inCMakeCache;
|
||||||
|
});
|
||||||
|
return Utils::transform(tmp, [](const InternalDataItem &item) {
|
||||||
DataItem newItem(item);
|
DataItem newItem(item);
|
||||||
if (item.isUserChanged)
|
if (item.isUserChanged)
|
||||||
newItem.value = item.newValue;
|
newItem.value = item.newValue;
|
||||||
result << newItem;
|
return newItem;
|
||||||
}
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigModel::InternalDataItem &ConfigModel::itemAtRow(int row)
|
ConfigModel::InternalDataItem &ConfigModel::itemAtRow(int row)
|
||||||
|
@@ -46,6 +46,7 @@ public:
|
|||||||
QString key;
|
QString key;
|
||||||
Type type = STRING;
|
Type type = STRING;
|
||||||
bool isAdvanced = false;
|
bool isAdvanced = false;
|
||||||
|
bool inCMakeCache = false;
|
||||||
QString value;
|
QString value;
|
||||||
QString description;
|
QString description;
|
||||||
QStringList values;
|
QStringList values;
|
||||||
|
Reference in New Issue
Block a user