forked from qt-creator/qt-creator
CMake: Mark changes to CMake configuration that contradicts a kit
Mark changes in the project that override configuration settings from the kit. Task-number: QTCREATORBUG-17244 Change-Id: I3452116ad5f4626ffcd85dfcc86715b6946d6572 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFont>
|
||||
@@ -113,7 +114,9 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
case 1: {
|
||||
const QString value = item.isUserChanged ? item.newValue : item.value;
|
||||
const QString value = item.currentValue();
|
||||
const QString kitValue = m_kitConfiguartion.value(item.key);
|
||||
|
||||
switch (role) {
|
||||
case Qt::CheckStateRole:
|
||||
return (item.type == DataItem::BOOLEAN)
|
||||
@@ -128,8 +131,19 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const
|
||||
font.setItalic(item.isCMakeChanged);
|
||||
return font;
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
return item.toolTip();
|
||||
case Qt::ForegroundRole:
|
||||
return Utils::creatorTheme()->color((!kitValue.isNull() && kitValue != value)
|
||||
? Utils::Theme::TextColorHighlight : Utils::Theme::TextColorNormal);
|
||||
case Qt::ToolTipRole: {
|
||||
QString tooltip = item.toolTip();
|
||||
const QString kitValue = m_kitConfiguartion.value(item.key);
|
||||
if (!kitValue.isNull()) {
|
||||
if (!tooltip.isEmpty())
|
||||
tooltip.append("<br>");
|
||||
tooltip.append(tr("Kit value: %1").arg(kitValue));
|
||||
}
|
||||
return tooltip;
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@@ -273,6 +287,11 @@ void ConfigModel::setConfiguration(const QList<ConfigModel::DataItem> &config)
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void ConfigModel::setKitConfiguration(const QHash<QString, QString> &kitConfig)
|
||||
{
|
||||
m_kitConfiguartion = kitConfig;
|
||||
}
|
||||
|
||||
void ConfigModel::flush()
|
||||
{
|
||||
beginResetModel();
|
||||
@@ -338,10 +357,18 @@ ConfigModel::InternalDataItem::InternalDataItem(const ConfigModel::DataItem &ite
|
||||
QString ConfigModel::InternalDataItem::toolTip() const
|
||||
{
|
||||
QStringList tooltip(description);
|
||||
if (!value.isEmpty() && !newValue.isEmpty() && value != newValue)
|
||||
tooltip << QCoreApplication::translate("CMakeProjectManager", "Current CMake: %1").arg(value);
|
||||
if (inCMakeCache) {
|
||||
if (value != newValue)
|
||||
tooltip << QCoreApplication::translate("CMakeProjectManager", "Current CMake: %1").arg(value);
|
||||
} else {
|
||||
tooltip << QCoreApplication::translate("CMakeProjectManager", "Not in CMakeCache.txt").arg(value);
|
||||
}
|
||||
return tooltip.join("<br>");
|
||||
}
|
||||
|
||||
} // namespace CMakeProjectManager
|
||||
QString ConfigModel::InternalDataItem::currentValue() const
|
||||
{
|
||||
return isUserChanged ? newValue : value;
|
||||
}
|
||||
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
Reference in New Issue
Block a user