forked from qt-creator/qt-creator
Let users disable environment entries
It's helpful to be able to temporarily disable environment variables, as opposed to having to remove (and then re-add) them entirely. Fixes: QTCREATORBUG-20984 Change-Id: Ib0d287035b9357507c4c19faaf3a1517382506b5 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -58,7 +58,7 @@ void ClangIndexingProjectSettings::saveMacros(const Utils::NameValueItems &items
|
||||
for (const Utils::NameValueItem &item : items) {
|
||||
using Operation = Utils::NameValueItem::Operation;
|
||||
switch (item.operation) {
|
||||
case Operation::Set:
|
||||
case Operation::SetEnabled:
|
||||
sets[item.name] = item.value;
|
||||
break;
|
||||
case Operation::Unset:
|
||||
@@ -88,7 +88,7 @@ Utils::NameValueItems ClangIndexingProjectSettings::readMacros() const
|
||||
|
||||
QVariant sets = m_project->namedSettings("set_indexing_macro");
|
||||
|
||||
items += fromQVariantMap(sets.toMap(), Utils::NameValueItem::Set);
|
||||
items += fromQVariantMap(sets.toMap(), Utils::NameValueItem::SetEnabled);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ void PreprocessorMacroWidget::currentIndexChanged(const QModelIndex ¤t)
|
||||
m_editButton->setEnabled(true);
|
||||
const QString &name = m_model->indexToVariable(current);
|
||||
bool modified = m_model->canReset(name) && m_model->changes(name);
|
||||
bool unset = m_model->canUnset(name);
|
||||
bool unset = m_model->isUnset(name);
|
||||
m_resetButton->setEnabled(modified || unset);
|
||||
m_unsetButton->setEnabled(!unset);
|
||||
} else {
|
||||
|
||||
@@ -189,7 +189,7 @@ void updateWithSettings(ClangBackEnd::CompilerMacros ¯os,
|
||||
});
|
||||
|
||||
auto point = std::partition_point(settingsItems.begin(), settingsItems.end(), [](const auto &entry) {
|
||||
return entry.operation == Utils::NameValueItem::Set;
|
||||
return entry.operation == Utils::NameValueItem::SetEnabled;
|
||||
});
|
||||
|
||||
std::transform(
|
||||
|
||||
Reference in New Issue
Block a user