Utils/ProjectExplorer: More Key and Store

Change-Id: Ic9cc3a36b320c7413c362d1a1cdf024298d25027
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-08-24 16:14:26 +02:00
parent 648efd6524
commit b9f9d2574e
18 changed files with 130 additions and 126 deletions

View File

@@ -19,7 +19,7 @@ void fromSettings(const Key &postFix,
{ {
Store map; Store map;
s->beginGroup(category + postFix); s->beginGroup(category + postFix);
const KeyList keys = keyListFromStringList(s->allKeys()); const KeyList keys = keysFromStrings(s->allKeys());
for (const Key &key : keys) for (const Key &key : keys)
map.insert(key, s->value(key)); map.insert(key, s->value(key));
s->endGroup(); s->endGroup();

View File

@@ -7,13 +7,14 @@
namespace Utils { namespace Utils {
KeyList keyListFromStringList(const QStringList &list) KeyList keysFromStrings(const QStringList &list)
{ {
#ifdef QTC_USE_STORE return transform(list, &keyFromString);
return transform(list, [](const QString &str) { return str.toUtf8(); }); }
#else
return list; QStringList stringsFromKeys(const KeyList &list)
#endif {
return transform(list, &stringFromKey);
} }
} // Utils } // Utils

View File

@@ -18,6 +18,7 @@ using Store = QMap<Key, QVariant>;
using Store = QVariantMap; using Store = QVariantMap;
#endif #endif
QTCREATOR_UTILS_EXPORT KeyList keyListFromStringList(const QStringList &list); QTCREATOR_UTILS_EXPORT KeyList keysFromStrings(const QStringList &list);
QTCREATOR_UTILS_EXPORT QStringList stringsFromKeys(const KeyList &list);
} // Utils } // Utils

View File

@@ -488,7 +488,7 @@ void SessionManagerPrivate::updateSessionMenu()
void SessionManagerPrivate::restoreValues(const PersistentSettingsReader &reader) void SessionManagerPrivate::restoreValues(const PersistentSettingsReader &reader)
{ {
const KeyList keys = keyListFromStringList(reader.restoreValue("valueKeys").toStringList()); const KeyList keys = keysFromStrings(reader.restoreValue("valueKeys").toStringList());
for (const Key &key : keys) { for (const Key &key : keys) {
QVariant value = reader.restoreValue("value-" + key); QVariant value = reader.restoreValue("value-" + key);
m_values.insert(key, value); m_values.insert(key, value);

View File

@@ -981,12 +981,11 @@ Abis MsvcToolChain::supportedAbis() const
void MsvcToolChain::toMap(Store &data) const void MsvcToolChain::toMap(Store &data) const
{ {
ToolChain::toMap(data); ToolChain::toMap(data);
data.insert(QLatin1String(varsBatKeyC), m_vcvarsBat); data.insert(varsBatKeyC, m_vcvarsBat);
if (!m_varsBatArg.isEmpty()) if (!m_varsBatArg.isEmpty())
data.insert(QLatin1String(varsBatArgKeyC), m_varsBatArg); data.insert(varsBatArgKeyC, m_varsBatArg);
Utils::EnvironmentItem::sort(&m_environmentModifications); EnvironmentItem::sort(&m_environmentModifications);
data.insert(QLatin1String(environModsKeyC), data.insert(environModsKeyC, EnvironmentItem::toVariantList(m_environmentModifications));
Utils::EnvironmentItem::toVariantList(m_environmentModifications));
} }
void MsvcToolChain::fromMap(const Store &data) void MsvcToolChain::fromMap(const Store &data)
@@ -996,11 +995,11 @@ void MsvcToolChain::fromMap(const Store &data)
g_availableMsvcToolchains.removeOne(this); g_availableMsvcToolchains.removeOne(this);
return; return;
} }
m_vcvarsBat = QDir::fromNativeSeparators(data.value(QLatin1String(varsBatKeyC)).toString()); m_vcvarsBat = QDir::fromNativeSeparators(data.value(varsBatKeyC).toString());
m_varsBatArg = data.value(QLatin1String(varsBatArgKeyC)).toString(); m_varsBatArg = data.value(varsBatArgKeyC).toString();
m_environmentModifications = Utils::EnvironmentItem::itemsFromVariantList( m_environmentModifications = EnvironmentItem::itemsFromVariantList(
data.value(QLatin1String(environModsKeyC)).toList()); data.value(environModsKeyC).toList());
rescanForCompiler(); rescanForCompiler();
initEnvModWatcher(Utils::asyncRun(envModThreadPool(), &MsvcToolChain::environmentModifications, initEnvModWatcher(Utils::asyncRun(envModThreadPool(), &MsvcToolChain::environmentModifications,

View File

@@ -184,7 +184,7 @@ public:
Target *m_activeTarget = nullptr; Target *m_activeTarget = nullptr;
EditorConfiguration m_editorConfiguration; EditorConfiguration m_editorConfiguration;
Context m_projectLanguages; Context m_projectLanguages;
QVariantMap m_pluginSettings; Store m_pluginSettings;
std::unique_ptr<Internal::UserFileAccessor> m_accessor; std::unique_ptr<Internal::UserFileAccessor> m_accessor;
QHash<Id, QPair<QString, std::function<void()>>> m_generators; QHash<Id, QPair<QString, std::function<void()>>> m_generators;
@@ -194,7 +194,7 @@ public:
FilePath m_rootProjectDirectory; FilePath m_rootProjectDirectory;
mutable QVector<const Node *> m_sortedNodeList; mutable QVector<const Node *> m_sortedNodeList;
QVariantMap m_extraData; Store m_extraData;
}; };
ProjectPrivate::~ProjectPrivate() ProjectPrivate::~ProjectPrivate()
@@ -635,7 +635,7 @@ void Project::saveSettings()
if (!d->m_accessor) if (!d->m_accessor)
d->m_accessor = std::make_unique<Internal::UserFileAccessor>(this); d->m_accessor = std::make_unique<Internal::UserFileAccessor>(this);
if (!targets().isEmpty()) { if (!targets().isEmpty()) {
QVariantMap map; Store map;
toMap(map); toMap(map);
d->m_accessor->saveSettings(map, ICore::dialogParent()); d->m_accessor->saveSettings(map, ICore::dialogParent());
} }
@@ -645,7 +645,7 @@ Project::RestoreResult Project::restoreSettings(QString *errorMessage)
{ {
if (!d->m_accessor) if (!d->m_accessor)
d->m_accessor = std::make_unique<Internal::UserFileAccessor>(this); d->m_accessor = std::make_unique<Internal::UserFileAccessor>(this);
QVariantMap map(d->m_accessor->restoreSettings(ICore::dialogParent())); Store map(d->m_accessor->restoreSettings(ICore::dialogParent()));
RestoreResult result = fromMap(map, errorMessage); RestoreResult result = fromMap(map, errorMessage);
if (result == RestoreResult::Ok) if (result == RestoreResult::Ok)
emit settingsLoaded(); emit settingsLoaded();
@@ -681,7 +681,7 @@ FilePaths Project::files(const NodeMatcher &filter) const
} }
/*! /*!
Serializes all data into a QVariantMap. Serializes all data into a Store.
This map is then saved in the .user file of the project. This map is then saved in the .user file of the project.
Just put all your data into the map. Just put all your data into the map.
@@ -695,14 +695,14 @@ void Project::toMap(Store &map) const
{ {
const QList<Target *> ts = targets(); const QList<Target *> ts = targets();
map.insert(QLatin1String(ACTIVE_TARGET_KEY), ts.indexOf(d->m_activeTarget)); map.insert(ACTIVE_TARGET_KEY, ts.indexOf(d->m_activeTarget));
map.insert(QLatin1String(TARGET_COUNT_KEY), ts.size()); map.insert(TARGET_COUNT_KEY, ts.size());
for (int i = 0; i < ts.size(); ++i) for (int i = 0; i < ts.size(); ++i)
map.insert(QString::fromLatin1(TARGET_KEY_PREFIX) + QString::number(i), ts.at(i)->toMap()); map.insert(TARGET_KEY_PREFIX + Key::number(i), QVariant::fromValue(ts.at(i)->toMap()));
map.insert(QLatin1String(EDITOR_SETTINGS_KEY), d->m_editorConfiguration.toMap()); map.insert(EDITOR_SETTINGS_KEY, QVariant::fromValue(d->m_editorConfiguration.toMap()));
if (!d->m_pluginSettings.isEmpty()) if (!d->m_pluginSettings.isEmpty())
map.insert(QLatin1String(PLUGIN_SETTINGS_KEY), d->m_pluginSettings); map.insert(PLUGIN_SETTINGS_KEY, QVariant::fromValue(d->m_pluginSettings));
} }
/*! /*!
@@ -767,19 +767,19 @@ ContainerNode *Project::containerNode() const
Project::RestoreResult Project::fromMap(const Store &map, QString *errorMessage) Project::RestoreResult Project::fromMap(const Store &map, QString *errorMessage)
{ {
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
if (map.contains(QLatin1String(EDITOR_SETTINGS_KEY))) { if (map.contains(EDITOR_SETTINGS_KEY)) {
QVariantMap values(map.value(QLatin1String(EDITOR_SETTINGS_KEY)).toMap()); Store values(map.value(EDITOR_SETTINGS_KEY).value<Store>());
d->m_editorConfiguration.fromMap(values); d->m_editorConfiguration.fromMap(values);
} }
if (map.contains(QLatin1String(PLUGIN_SETTINGS_KEY))) if (map.contains(PLUGIN_SETTINGS_KEY))
d->m_pluginSettings = map.value(QLatin1String(PLUGIN_SETTINGS_KEY)).toMap(); d->m_pluginSettings = map.value(PLUGIN_SETTINGS_KEY).toMap();
bool ok; bool ok;
int maxI(map.value(QLatin1String(TARGET_COUNT_KEY), 0).toInt(&ok)); int maxI(map.value(TARGET_COUNT_KEY, 0).toInt(&ok));
if (!ok || maxI < 0) if (!ok || maxI < 0)
maxI = 0; maxI = 0;
int active(map.value(QLatin1String(ACTIVE_TARGET_KEY), 0).toInt(&ok)); int active(map.value(ACTIVE_TARGET_KEY, 0).toInt(&ok));
if (!ok || active < 0 || active >= maxI) if (!ok || active < 0 || active >= maxI)
active = 0; active = 0;
@@ -799,13 +799,13 @@ Project::RestoreResult Project::fromMap(const Store &map, QString *errorMessage)
return RestoreResult::Ok; return RestoreResult::Ok;
} }
void Project::createTargetFromMap(const QVariantMap &map, int index) void Project::createTargetFromMap(const Store &map, int index)
{ {
const QString key = QString::fromLatin1(TARGET_KEY_PREFIX) + QString::number(index); const Key key = TARGET_KEY_PREFIX + Key::number(index);
if (!map.contains(key)) if (!map.contains(key))
return; return;
const QVariantMap targetMap = map.value(key).toMap(); const Store targetMap = map.value(key).toMap();
Id id = idFromMap(targetMap); Id id = idFromMap(targetMap);
if (target(id)) { if (target(id)) {

View File

@@ -349,7 +349,7 @@ void ProjectManagerPrivate::saveSession()
depMap.insert(key, values); depMap.insert(key, values);
++i; ++i;
} }
SessionManager::setSessionValue(QLatin1String("ProjectDependencies"), QVariant(depMap)); SessionManager::setSessionValue("ProjectDependencies", QVariant(depMap));
} }
/*! /*!
@@ -654,7 +654,7 @@ void ProjectManagerPrivate::loadSession()
d->m_casadeSetActive = false; d->m_casadeSetActive = false;
// not ideal that this is in ProjectManager // not ideal that this is in ProjectManager
Id modeId = Id::fromSetting(SessionManager::value(QLatin1String("ActiveMode"))); Id modeId = Id::fromSetting(SessionManager::value("ActiveMode"));
if (!modeId.isValid()) if (!modeId.isValid())
modeId = Id(Core::Constants::MODE_EDIT); modeId = Id(Core::Constants::MODE_EDIT);
@@ -705,8 +705,7 @@ FilePaths ProjectManager::projectsForSessionName(const QString &session)
return {}; return {};
} }
} }
return transform(reader.restoreValue(QLatin1String("ProjectList")).toStringList(), return transform(reader.restoreValue("ProjectList").toStringList(), &FilePath::fromUserInput);
&FilePath::fromUserInput);
} }
#ifdef WITH_TESTS #ifdef WITH_TESTS

View File

@@ -202,7 +202,7 @@ public:
QList<RunWorker *> stopDependencies; QList<RunWorker *> stopDependencies;
QString id; QString id;
QVariantMap data; Store data;
bool supportsReRunning = true; bool supportsReRunning = true;
bool essential = false; bool essential = false;
}; };
@@ -241,7 +241,7 @@ public:
const MacroExpander *macroExpander = nullptr; const MacroExpander *macroExpander = nullptr;
AspectContainerData aspectData; AspectContainerData aspectData;
QString buildKey; QString buildKey;
QMap<Id, QVariantMap> settingsData; QMap<Id, Store> settingsData;
Id runConfigId; Id runConfigId;
BuildTargetInfo buildTargetInfo; BuildTargetInfo buildTargetInfo;
FilePath buildDirectory; FilePath buildDirectory;
@@ -947,7 +947,7 @@ const BaseAspect::Data *RunControl::aspect(BaseAspect::Data::ClassId classId) co
return d->aspectData.aspect(classId); return d->aspectData.aspect(classId);
} }
QVariantMap RunControl::settingsData(Id id) const Store RunControl::settingsData(Id id) const
{ {
return d->settingsData.value(id); return d->settingsData.value(id);
} }
@@ -1738,12 +1738,12 @@ void RunWorker::setId(const QString &id)
d->id = id; d->id = id;
} }
void RunWorker::recordData(const QString &channel, const QVariant &data) void RunWorker::recordData(const Key &channel, const QVariant &data)
{ {
d->data[channel] = data; d->data[channel] = data;
} }
QVariant RunWorker::recordedData(const QString &channel) const QVariant RunWorker::recordedData(const Key &channel) const
{ {
return d->data[channel]; return d->data[channel];
} }

View File

@@ -54,8 +54,8 @@ public:
void setId(const QString &id); void setId(const QString &id);
void recordData(const QString &channel, const QVariant &data); void recordData(const Utils::Key &channel, const QVariant &data);
QVariant recordedData(const QString &channel) const; QVariant recordedData(const Utils::Key &channel) const;
// Part of read-only interface of RunControl for convenience. // Part of read-only interface of RunControl for convenience.
void appendMessage(const QString &msg, Utils::OutputFormat format, bool appendNewLine = true); void appendMessage(const QString &msg, Utils::OutputFormat format, bool appendNewLine = true);
@@ -191,7 +191,7 @@ public:
Utils::FilePath buildDirectory() const; Utils::FilePath buildDirectory() const;
Utils::Environment buildEnvironment() const; Utils::Environment buildEnvironment() const;
QVariantMap settingsData(Utils::Id id) const; Utils::Store settingsData(Utils::Id id) const;
Utils::FilePath targetFilePath() const; Utils::FilePath targetFilePath() const;
Utils::FilePath projectFilePath() const; Utils::FilePath projectFilePath() const;

View File

@@ -22,6 +22,8 @@
#include <QPushButton> #include <QPushButton>
#include <QTreeView> #include <QTreeView>
using namespace Utils;
namespace ProjectExplorer { namespace ProjectExplorer {
const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.lo; *.la; *.obj; *~; *.files;" const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.lo; *.la; *.obj; *~; *.files;"
@@ -534,7 +536,7 @@ SelectableFilesWidget::SelectableFilesWidget(QWidget *parent) :
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
m_baseDirLabel->setText(Tr::tr("Source directory:")); m_baseDirLabel->setText(Tr::tr("Source directory:"));
m_baseDirChooser->setHistoryCompleter(QLatin1String("PE.AddToProjectDir.History")); m_baseDirChooser->setHistoryCompleter("PE.AddToProjectDir.History");
m_startParsingButton->setText(Tr::tr("Start Parsing")); m_startParsingButton->setText(Tr::tr("Start Parsing"));
layout->addWidget(m_baseDirLabel, static_cast<int>(SelectableFilesWidgetRows::BaseDirectory), 0); layout->addWidget(m_baseDirLabel, static_cast<int>(SelectableFilesWidgetRows::BaseDirectory), 0);
layout->addWidget(m_baseDirChooser->lineEdit(), static_cast<int>(SelectableFilesWidgetRows::BaseDirectory), 1); layout->addWidget(m_baseDirChooser->lineEdit(), static_cast<int>(SelectableFilesWidgetRows::BaseDirectory), 1);
@@ -638,7 +640,7 @@ void SelectableFilesWidget::cancelParsing()
m_model->cancel(); m_model->cancel();
} }
void SelectableFilesWidget::enableFilterHistoryCompletion(const QString &keyPrefix) void SelectableFilesWidget::enableFilterHistoryCompletion(const Key &keyPrefix)
{ {
m_selectFilesFilterEdit->setHistoryCompleter(keyPrefix + ".select", true); m_selectFilesFilterEdit->setHistoryCompleter(keyPrefix + ".select", true);
m_hideFilesFilterEdit->setHistoryCompleter(keyPrefix + ".hide", true); m_hideFilesFilterEdit->setHistoryCompleter(keyPrefix + ".hide", true);

View File

@@ -5,7 +5,8 @@
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <utils/fileutils.h> #include <utils/filepath.h>
#include <utils/storekey.h>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QDialog> #include <QDialog>
@@ -178,7 +179,7 @@ public:
void resetModel(const Utils::FilePath &path, const Utils::FilePaths &files); void resetModel(const Utils::FilePath &path, const Utils::FilePaths &files);
void cancelParsing(); void cancelParsing();
void enableFilterHistoryCompletion(const QString &keyPrefix); void enableFilterHistoryCompletion(const Utils::Key &keyPrefix);
signals: signals:
void selectedFilesChanged(); void selectedFilesChanged();

View File

@@ -627,7 +627,7 @@ Store Target::toMap() const
} }
if (!d->m_pluginSettings.isEmpty()) if (!d->m_pluginSettings.isEmpty())
map.insert(PLUGIN_SETTINGS_KEY, d->m_pluginSettings); map.insert(PLUGIN_SETTINGS_KEY, QVariant::fromValue(d->m_pluginSettings));
return map; return map;
} }
@@ -903,7 +903,7 @@ bool Target::fromMap(const Store &map)
const Key key = BC_KEY_PREFIX + Key::number(i); const Key key = BC_KEY_PREFIX + Key::number(i);
if (!map.contains(key)) if (!map.contains(key))
return false; return false;
const Store valueMap = map.value(key).toMap(); const Store valueMap = map.value(key).value<Store>();
BuildConfiguration *bc = BuildConfigurationFactory::restore(this, valueMap); BuildConfiguration *bc = BuildConfigurationFactory::restore(this, valueMap);
if (!bc) { if (!bc) {
qWarning("No factory found to restore build configuration!"); qWarning("No factory found to restore build configuration!");
@@ -964,7 +964,7 @@ bool Target::fromMap(const Store &map)
if (!rc) if (!rc)
continue; continue;
const Utils::Id theIdFromMap = ProjectExplorer::idFromMap(valueMap); const Utils::Id theIdFromMap = ProjectExplorer::idFromMap(valueMap);
if (!theIdFromMap.toString().contains("///::///")) { // Hack for cmake 4.10 -> 4.11 if (!theIdFromMap.name().contains("///::///")) { // Hack for cmake 4.10 -> 4.11
QTC_CHECK(rc->id().withSuffix(rc->buildKey()) == theIdFromMap); QTC_CHECK(rc->id().withSuffix(rc->buildKey()) == theIdFromMap);
} }
addRunConfiguration(rc); addRunConfiguration(rc);
@@ -973,7 +973,7 @@ bool Target::fromMap(const Store &map)
} }
if (map.contains(PLUGIN_SETTINGS_KEY)) if (map.contains(PLUGIN_SETTINGS_KEY))
d->m_pluginSettings = map.value(PLUGIN_SETTINGS_KEY).toMap(); d->m_pluginSettings = map.value(PLUGIN_SETTINGS_KEY).value<Store>();
return true; return true;
} }

View File

@@ -309,7 +309,7 @@ void ToolChain::setTargetAbiNoSignal(const Abi &abi)
d->m_targetAbi = abi; d->m_targetAbi = abi;
} }
void ToolChain::setTargetAbiKey(const QString &abiKey) void ToolChain::setTargetAbiKey(const Key &abiKey)
{ {
d->m_targetAbiKey = abiKey; d->m_targetAbiKey = abiKey;
} }
@@ -334,7 +334,7 @@ bool ToolChain::matchesCompilerCommand(const FilePath &command) const
return compilerCommand().isSameExecutable(command); return compilerCommand().isSameExecutable(command);
} }
void ToolChain::setCompilerCommandKey(const QString &commandKey) void ToolChain::setCompilerCommandKey(const Key &commandKey)
{ {
d->m_compilerCommandKey = commandKey; d->m_compilerCommandKey = commandKey;
} }
@@ -354,16 +354,16 @@ void ToolChain::fromMap(const Store &data)
{ {
AspectContainer::fromMap(data); AspectContainer::fromMap(data);
d->m_displayName = data.value(QLatin1String(DISPLAY_NAME_KEY)).toString(); d->m_displayName = data.value(DISPLAY_NAME_KEY).toString();
// make sure we have new style ids: // make sure we have new style ids:
const QString id = data.value(QLatin1String(ID_KEY)).toString(); const QString id = data.value(ID_KEY).toString();
int pos = id.indexOf(QLatin1Char(':')); int pos = id.indexOf(QLatin1Char(':'));
QTC_ASSERT(pos > 0, reportError(); return); QTC_ASSERT(pos > 0, reportError(); return);
d->m_typeId = Id::fromString(id.left(pos)); d->m_typeId = Id::fromString(id.left(pos));
d->m_id = id.mid(pos + 1).toUtf8(); d->m_id = id.mid(pos + 1).toUtf8();
const bool autoDetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool(); const bool autoDetect = data.value(AUTODETECT_KEY, false).toBool();
d->m_detection = autoDetect ? AutoDetection : ManualDetection; d->m_detection = autoDetect ? AutoDetection : ManualDetection;
d->m_detectionSource = data.value(DETECTION_SOURCE_KEY).toString(); d->m_detectionSource = data.value(DETECTION_SOURCE_KEY).toString();
@@ -372,14 +372,14 @@ void ToolChain::fromMap(const Store &data)
if (data.contains(LANGUAGE_KEY_V2)) { if (data.contains(LANGUAGE_KEY_V2)) {
// remove hack to trim language id in 4.4: This is to fix up broken language // remove hack to trim language id in 4.4: This is to fix up broken language
// ids that happened in 4.3 master branch // ids that happened in 4.3 master branch
const QString langId = data.value(QLatin1String(LANGUAGE_KEY_V2)).toString(); const QString langId = data.value(LANGUAGE_KEY_V2).toString();
const int pos = langId.lastIndexOf('.'); const int pos = langId.lastIndexOf('.');
if (pos >= 0) if (pos >= 0)
d->m_language = Id::fromString(langId.mid(pos + 1)); d->m_language = Id::fromString(langId.mid(pos + 1));
else else
d->m_language = Id::fromString(langId); d->m_language = Id::fromString(langId);
} else if (data.contains(LANGUAGE_KEY_V1)) { // Import from old settings } else if (data.contains(LANGUAGE_KEY_V1)) { // Import from old settings
d->m_language = Internal::fromLanguageV1(data.value(QLatin1String(LANGUAGE_KEY_V1)).toInt()); d->m_language = Internal::fromLanguageV1(data.value(LANGUAGE_KEY_V1).toInt());
} }
if (!d->m_language.isValid()) if (!d->m_language.isValid())
@@ -612,7 +612,7 @@ ToolChain *ToolChainFactory::restore(const Store &data)
static QPair<QString, QString> rawIdData(const Store &data) static QPair<QString, QString> rawIdData(const Store &data)
{ {
const QString raw = data.value(QLatin1String(ID_KEY)).toString(); const QString raw = data.value(ID_KEY).toString();
const int pos = raw.indexOf(QLatin1Char(':')); const int pos = raw.indexOf(QLatin1Char(':'));
QTC_ASSERT(pos > 0, return qMakePair(QString::fromLatin1("unknown"), QString::fromLatin1("unknown"))); QTC_ASSERT(pos > 0, return qMakePair(QString::fromLatin1("unknown"), QString::fromLatin1("unknown")));
return {raw.mid(0, pos), raw.mid(pos + 1)}; return {raw.mid(0, pos), raw.mid(pos + 1)};
@@ -630,7 +630,7 @@ Id ToolChainFactory::typeIdFromMap(const Store &data)
void ToolChainFactory::autoDetectionToMap(Store &data, bool detected) void ToolChainFactory::autoDetectionToMap(Store &data, bool detected)
{ {
data.insert(QLatin1String(AUTODETECT_KEY), detected); data.insert(AUTODETECT_KEY, detected);
} }
ToolChain *ToolChainFactory::createToolChain(Id toolChainType) ToolChain *ToolChainFactory::createToolChain(Id toolChainType)
@@ -700,9 +700,9 @@ BadToolchain::BadToolchain(const FilePath &filePath, const FilePath &symlinkTarg
{} {}
static QString badToolchainFilePathKey() { return {"FilePath"}; } static Key badToolchainFilePathKey() { return {"FilePath"}; }
static QString badToolchainSymlinkTargetKey() { return {"TargetFilePath"}; } static Key badToolchainSymlinkTargetKey() { return {"TargetFilePath"}; }
static QString badToolchainTimestampKey() { return {"Timestamp"}; } static Key badToolchainTimestampKey() { return {"Timestamp"}; }
Store BadToolchain::toMap() const Store BadToolchain::toMap() const
{ {
@@ -737,13 +737,15 @@ bool BadToolchains::isBadToolchain(const FilePath &toolchain) const
QVariant BadToolchains::toVariant() const QVariant BadToolchains::toVariant() const
{ {
return Utils::transform<QVariantList>(toolchains, &BadToolchain::toMap); return Utils::transform<QVariantList>(toolchains, [](const BadToolchain &bdc) {
return QVariant::fromValue(bdc.toMap());
});
} }
BadToolchains BadToolchains::fromVariant(const QVariant &v) BadToolchains BadToolchains::fromVariant(const QVariant &v)
{ {
return Utils::transform<QList<BadToolchain>>(v.toList(), return Utils::transform<QList<BadToolchain>>(v.toList(),
[](const QVariant &e) { return BadToolchain::fromMap(e.toMap()); }); [](const QVariant &e) { return BadToolchain::fromMap(e.value<Store>()); });
} }
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -170,9 +170,9 @@ protected:
void setTypeDisplayName(const QString &typeName); void setTypeDisplayName(const QString &typeName);
void setTargetAbiNoSignal(const Abi &abi); void setTargetAbiNoSignal(const Abi &abi);
void setTargetAbiKey(const QString &abiKey); void setTargetAbiKey(const Utils::Key &abiKey);
void setCompilerCommandKey(const QString &commandKey); void setCompilerCommandKey(const Utils::Key &commandKey);
const MacrosCache &predefinedMacrosCache() const; const MacrosCache &predefinedMacrosCache() const;
const HeaderPathsCache &headerPathsCache() const; const HeaderPathsCache &headerPathsCache() const;
@@ -265,11 +265,11 @@ public:
virtual bool canCreate() const; virtual bool canCreate() const;
virtual ToolChain *create() const; virtual ToolChain *create() const;
ToolChain *restore(const QVariantMap &data); ToolChain *restore(const Utils::Store &data);
static QByteArray idFromMap(const QVariantMap &data); static QByteArray idFromMap(const Utils::Store &data);
static Utils::Id typeIdFromMap(const QVariantMap &data); static Utils::Id typeIdFromMap(const Utils::Store &data);
static void autoDetectionToMap(QVariantMap &data, bool detected); static void autoDetectionToMap(Utils::Store &data, bool detected);
static ToolChain *createToolChain(Utils::Id toolChainType); static ToolChain *createToolChain(Utils::Id toolChainType);

View File

@@ -34,7 +34,7 @@ public:
ToolChainSettingsUpgraderV0() : Utils::VersionUpgrader(0, "4.6") { } ToolChainSettingsUpgraderV0() : Utils::VersionUpgrader(0, "4.6") { }
// NOOP // NOOP
QVariantMap upgrade(const QVariantMap &data) final { return data; } Store upgrade(const Store &data) final { return data; }
}; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -214,17 +214,17 @@ Toolchains ToolChainSettingsAccessor::restoreToolChains(QWidget *parent) const
void ToolChainSettingsAccessor::saveToolChains(const Toolchains &toolchains, QWidget *parent) void ToolChainSettingsAccessor::saveToolChains(const Toolchains &toolchains, QWidget *parent)
{ {
QVariantMap data; Store data;
int count = 0; int count = 0;
for (const ToolChain *tc : toolchains) { for (const ToolChain *tc : toolchains) {
if (!tc || (!tc->isValid() && tc->isAutoDetected())) if (!tc || (!tc->isValid() && tc->isAutoDetected()))
continue; continue;
QVariantMap tmp; Store tmp;
tc->toMap(tmp); tc->toMap(tmp);
if (tmp.isEmpty()) if (tmp.isEmpty())
continue; continue;
data.insert(QString::fromLatin1(TOOLCHAIN_DATA_KEY) + QString::number(count), tmp); data.insert(TOOLCHAIN_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
++count; ++count;
} }
data.insert(TOOLCHAIN_COUNT_KEY, count); data.insert(TOOLCHAIN_COUNT_KEY, count);
@@ -234,18 +234,18 @@ void ToolChainSettingsAccessor::saveToolChains(const Toolchains &toolchains, QWi
saveSettings(data, parent); saveSettings(data, parent);
} }
Toolchains ToolChainSettingsAccessor::toolChains(const QVariantMap &data) const Toolchains ToolChainSettingsAccessor::toolChains(const Store &data) const
{ {
Toolchains result; Toolchains result;
const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories(); const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories();
const int count = data.value(TOOLCHAIN_COUNT_KEY, 0).toInt(); const int count = data.value(TOOLCHAIN_COUNT_KEY, 0).toInt();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
const QString key = QString::fromLatin1(TOOLCHAIN_DATA_KEY) + QString::number(i); const Key key = TOOLCHAIN_DATA_KEY + Key::number(i);
if (!data.contains(key)) if (!data.contains(key))
break; break;
const QVariantMap tcMap = data.value(key).toMap(); const Store tcMap = data.value(key).value<Store>();
bool restored = false; bool restored = false;
const Utils::Id tcType = ToolChainFactory::typeIdFromMap(tcMap); const Utils::Id tcType = ToolChainFactory::typeIdFromMap(tcMap);

View File

@@ -23,7 +23,7 @@ public:
void saveToolChains(const QList<ToolChain *> &toolchains, QWidget *parent); void saveToolChains(const QList<ToolChain *> &toolchains, QWidget *parent);
private: private:
QList<ToolChain *> toolChains(const QVariantMap &data) const; QList<ToolChain *> toolChains(const Utils::Store &data) const;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -323,9 +323,9 @@ SettingsMergeResult
UserFileAccessor::merge(const MergingSettingsAccessor::SettingsMergeData &global, UserFileAccessor::merge(const MergingSettingsAccessor::SettingsMergeData &global,
const MergingSettingsAccessor::SettingsMergeData &local) const const MergingSettingsAccessor::SettingsMergeData &local) const
{ {
const QStringList stickyKeys = global.main.value(USER_STICKY_KEYS_KEY).toStringList(); const KeyList stickyKeys = keyFromString(global.main.value(USER_STICKY_KEYS_KEY).toStringList());
const QString key = local.key; const Key key = local.key;
const QVariant mainValue = local.main.value(key); const QVariant mainValue = local.main.value(key);
const QVariant secondaryValue = local.secondary.value(key); const QVariant secondaryValue = local.secondary.value(key);
@@ -350,11 +350,11 @@ UserFileAccessor::merge(const MergingSettingsAccessor::SettingsMergeData &global
// Although this approach is more flexible than permanent/forever sticky settings, it has // Although this approach is more flexible than permanent/forever sticky settings, it has
// the side-effect that if a particular value unintentionally becomes the same in both // the side-effect that if a particular value unintentionally becomes the same in both
// the .user and .shared files, this setting will "unstick". // the .user and .shared files, this setting will "unstick".
SettingsMergeFunction UserFileAccessor::userStickyTrackerFunction(QStringList &stickyKeys) const SettingsMergeFunction UserFileAccessor::userStickyTrackerFunction(KeyList &stickyKeys) const
{ {
return [&stickyKeys](const SettingsMergeData &global, const SettingsMergeData &local) return [&stickyKeys](const SettingsMergeData &global, const SettingsMergeData &local)
-> SettingsMergeResult { -> SettingsMergeResult {
const QString key = local.key; const Key key = local.key;
const QVariant main = local.main.value(key); const QVariant main = local.main.value(key);
const QVariant secondary = local.secondary.value(key); const QVariant secondary = local.secondary.value(key);
@@ -402,10 +402,10 @@ FilePath UserFileAccessor::sharedFile() const
} }
Store UserFileAccessor::postprocessMerge(const Store &main, Store UserFileAccessor::postprocessMerge(const Store &main,
const Store &secondary, const Store &secondary,
const Store &result) const const Store &result) const
{ {
project()->setProperty(SHARED_SETTINGS, secondary); project()->setProperty(SHARED_SETTINGS, QVariant::fromValue(secondary));
return MergingSettingsAccessor::postprocessMerge(main, secondary, result); return MergingSettingsAccessor::postprocessMerge(main, secondary, result);
} }
@@ -416,7 +416,7 @@ Store UserFileAccessor::preprocessReadSettings(const Store &data) const
// Move from old Version field to new one: // Move from old Version field to new one:
// This cannot be done in a normal upgrader since the version information is needed // This cannot be done in a normal upgrader since the version information is needed
// to decide which upgraders to run // to decide which upgraders to run
const QString obsoleteKey = OBSOLETE_VERSION_KEY; const Key obsoleteKey = OBSOLETE_VERSION_KEY;
const int obsoleteVersion = tmp.value(obsoleteKey, -1).toInt(); const int obsoleteVersion = tmp.value(obsoleteKey, -1).toInt();
if (obsoleteVersion > versionFromMap(tmp)) if (obsoleteVersion > versionFromMap(tmp))
@@ -429,13 +429,13 @@ Store UserFileAccessor::preprocessReadSettings(const Store &data) const
Store UserFileAccessor::prepareToWriteSettings(const Store &data) const Store UserFileAccessor::prepareToWriteSettings(const Store &data) const
{ {
const Store tmp = MergingSettingsAccessor::prepareToWriteSettings(data); const Store tmp = MergingSettingsAccessor::prepareToWriteSettings(data);
const Store shared = retrieveSharedSettings().toMap(); const Store shared = retrieveSharedSettings().value<Store>();
Store result; Store result;
if (!shared.isEmpty()) { if (!shared.isEmpty()) {
QStringList stickyKeys; KeyList stickyKeys;
SettingsMergeFunction merge = userStickyTrackerFunction(stickyKeys); SettingsMergeFunction merge = userStickyTrackerFunction(stickyKeys);
result = mergeQVariantMaps(tmp, shared, merge).toMap(); result = mergeQVariantMaps(tmp, shared, merge).value<Store>();
result.insert(USER_STICKY_KEYS_KEY, stickyKeys); result.insert(USER_STICKY_KEYS_KEY, stringFromKey(stickyKeys));
} else { } else {
result = tmp; result = tmp;
} }
@@ -454,7 +454,7 @@ Store UserFileVersion14Upgrader::upgrade(const Store &map)
Store result; Store result;
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) { for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
if (it.value().typeId() == QVariant::Map) if (it.value().typeId() == QVariant::Map)
result.insert(it.key(), upgrade(it.value().toMap())); result.insert(it.key(), upgrade(it.value().value<Store>()));
else if (it.key() == "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory" else if (it.key() == "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory"
|| it.key() == "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory" || it.key() == "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory"
|| it.key() == "GenericProjectManager.GenericBuildConfiguration.BuildDirectory" || it.key() == "GenericProjectManager.GenericBuildConfiguration.BuildDirectory"
@@ -473,11 +473,11 @@ Store UserFileVersion14Upgrader::upgrade(const Store &map)
Store UserFileVersion15Upgrader::upgrade(const Store &map) Store UserFileVersion15Upgrader::upgrade(const Store &map)
{ {
const QList<Change> changes{{QLatin1String("ProjectExplorer.Project.Updater.EnvironmentId"), const QList<Change> changes{
QLatin1String("EnvironmentId")}, {"ProjectExplorer.Project.Updater.EnvironmentId", "EnvironmentId"},
{QLatin1String("ProjectExplorer.Project.UserStickyKeys"), {"ProjectExplorer.Project.UserStickyKeys", "UserStickyKeys"}
QLatin1String("UserStickyKeys")}}; };
return renameKeys(changes, Store(map)); return renameKeys(changes, map);
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -489,12 +489,12 @@ UserFileVersion16Upgrader::OldStepMaps UserFileVersion16Upgrader::extractStepMap
OldStepMaps result; OldStepMaps result;
result.defaultDisplayName = deployMap.value("ProjectExplorer.ProjectConfiguration.DefaultDisplayName").toString(); result.defaultDisplayName = deployMap.value("ProjectExplorer.ProjectConfiguration.DefaultDisplayName").toString();
result.displayName = deployMap.value("ProjectExplorer.ProjectConfiguration.DisplayName").toString(); result.displayName = deployMap.value("ProjectExplorer.ProjectConfiguration.DisplayName").toString();
const QString stepListKey = "ProjectExplorer.BuildConfiguration.BuildStepList.0"; const Key stepListKey = "ProjectExplorer.BuildConfiguration.BuildStepList.0";
Store stepListMap = deployMap.value(stepListKey).toMap(); Store stepListMap = deployMap.value(stepListKey).value<Store>();
int stepCount = stepListMap.value("ProjectExplorer.BuildStepList.StepsCount", 0).toInt(); int stepCount = stepListMap.value("ProjectExplorer.BuildStepList.StepsCount", 0).toInt();
QString stepKey = "ProjectExplorer.BuildStepList.Step."; Key stepKey = "ProjectExplorer.BuildStepList.Step.";
for (int i = 0; i < stepCount; ++i) { for (int i = 0; i < stepCount; ++i) {
Store stepMap = stepListMap.value(stepKey + QString::number(i)).toMap(); Store stepMap = stepListMap.value(stepKey + Key::number(i)).value<Store>();
const QString id = stepMap.value("ProjectExplorer.ProjectConfiguration.Id").toString(); const QString id = stepMap.value("ProjectExplorer.ProjectConfiguration.Id").toString();
if (id == "Qt4ProjectManager.AndroidDeployQtStep") if (id == "Qt4ProjectManager.AndroidDeployQtStep")
result.androidDeployQt = stepMap; result.androidDeployQt = stepMap;
@@ -509,14 +509,14 @@ UserFileVersion16Upgrader::OldStepMaps UserFileVersion16Upgrader::extractStepMap
Store UserFileVersion16Upgrader::removeAndroidPackageStep(Store deployMap) Store UserFileVersion16Upgrader::removeAndroidPackageStep(Store deployMap)
{ {
const QString stepListKey = "ProjectExplorer.BuildConfiguration.BuildStepList.0"; const Key stepListKey = "ProjectExplorer.BuildConfiguration.BuildStepList.0";
Store stepListMap = deployMap.value(stepListKey).toMap(); Store stepListMap = deployMap.value(stepListKey).value<Store>();
const QString stepCountKey = "ProjectExplorer.BuildStepList.StepsCount"; const QString stepCountKey = "ProjectExplorer.BuildStepList.StepsCount";
int stepCount = stepListMap.value(stepCountKey, 0).toInt(); int stepCount = stepListMap.value(stepCountKey, 0).toInt();
QString stepKey = "ProjectExplorer.BuildStepList.Step."; QString stepKey = "ProjectExplorer.BuildStepList.Step.";
int targetPosition = 0; int targetPosition = 0;
for (int sourcePosition = 0; sourcePosition < stepCount; ++sourcePosition) { for (int sourcePosition = 0; sourcePosition < stepCount; ++sourcePosition) {
Store stepMap = stepListMap.value(stepKey + QString::number(sourcePosition)).toMap(); Store stepMap = stepListMap.value(stepKey + QString::number(sourcePosition)).value<Store>();
if (stepMap.value("ProjectExplorer.ProjectConfiguration.Id").toString() if (stepMap.value("ProjectExplorer.ProjectConfiguration.Id").toString()
!= "Qt4ProjectManager.AndroidPackageInstallationStep") { != "Qt4ProjectManager.AndroidPackageInstallationStep") {
stepListMap.insert(stepKey + QString::number(targetPosition), stepMap); stepListMap.insert(stepKey + QString::number(targetPosition), stepMap);
@@ -543,7 +543,7 @@ Store UserFileVersion16Upgrader::insertSteps(Store buildConfigurationMap,
const QString bslKey = "ProjectExplorer.BuildConfiguration.BuildStepList."; const QString bslKey = "ProjectExplorer.BuildConfiguration.BuildStepList.";
const QString bslTypeKey = "ProjectExplorer.ProjectConfiguration.Id"; const QString bslTypeKey = "ProjectExplorer.ProjectConfiguration.Id";
for (int bslNumber = 0; bslNumber < stepListCount; ++bslNumber) { for (int bslNumber = 0; bslNumber < stepListCount; ++bslNumber) {
Store buildStepListMap = buildConfigurationMap.value(bslKey + QString::number(bslNumber)).toMap(); Store buildStepListMap = buildConfigurationMap.value(bslKey + QString::number(bslNumber)).value<Store>();
if (buildStepListMap.value(bslTypeKey) != "ProjectExplorer.BuildSteps.Build") if (buildStepListMap.value(bslTypeKey) != "ProjectExplorer.BuildSteps.Build")
continue; continue;
@@ -638,7 +638,7 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
for (int i = 0; i < targetCount; ++i) { for (int i = 0; i < targetCount; ++i) {
QString targetKey = QLatin1String("ProjectExplorer.Project.Target.") + QString::number(i); QString targetKey = QLatin1String("ProjectExplorer.Project.Target.") + QString::number(i);
Store targetMap = data.value(targetKey).toMap(); Store targetMap = data.value(targetKey).value<Store>();
const QString dcCountKey = "ProjectExplorer.Target.DeployConfigurationCount"; const QString dcCountKey = "ProjectExplorer.Target.DeployConfigurationCount";
int deployconfigurationCount = targetMap.value(dcCountKey).toInt(); int deployconfigurationCount = targetMap.value(dcCountKey).toInt();
@@ -651,7 +651,7 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
QString deployKey = "ProjectExplorer.Target.DeployConfiguration."; QString deployKey = "ProjectExplorer.Target.DeployConfiguration.";
for (int j = 0; j < deployconfigurationCount; ++j) { for (int j = 0; j < deployconfigurationCount; ++j) {
Store deployConfigurationMap Store deployConfigurationMap
= targetMap.value(deployKey + QString::number(j)).toMap(); = targetMap.value(deployKey + QString::number(j)).value<Store>();
OldStepMaps oldStep = extractStepMaps(deployConfigurationMap); OldStepMaps oldStep = extractStepMaps(deployConfigurationMap);
if (!oldStep.isEmpty()) { if (!oldStep.isEmpty()) {
oldSteps.append(oldStep); oldSteps.append(oldStep);
@@ -672,7 +672,7 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
QString bcKey = "ProjectExplorer.Target.BuildConfiguration."; QString bcKey = "ProjectExplorer.Target.BuildConfiguration.";
for (int j = 0; j < buildConfigurationCount; ++j) { for (int j = 0; j < buildConfigurationCount; ++j) {
Store oldBuildConfigurationMap = targetMap.value(bcKey + QString::number(j)).toMap(); Store oldBuildConfigurationMap = targetMap.value(bcKey + QString::number(j)).value<Store>();
oldBuildConfigurations.append(oldBuildConfigurationMap); oldBuildConfigurations.append(oldBuildConfigurationMap);
} }
@@ -703,7 +703,7 @@ Store UserFileVersion17Upgrader::upgrade(const Store &map)
m_sticky = map.value(USER_STICKY_KEYS_KEY).toList(); m_sticky = map.value(USER_STICKY_KEYS_KEY).toList();
if (m_sticky.isEmpty()) if (m_sticky.isEmpty())
return map; return map;
return process(map).toMap(); return process(map).value<Store>();
} }
QVariant UserFileVersion17Upgrader::process(const QVariant &entry) QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
@@ -716,7 +716,7 @@ QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
return result; return result;
} }
case QVariant::Map: { case QVariant::Map: {
Store result = entry.toMap(); Store result = entry.value<Store>();
for (Store::iterator i = result.begin(), end = result.end(); i != end; ++i) { for (Store::iterator i = result.begin(), end = result.end(); i != end; ++i) {
QVariant &v = i.value(); QVariant &v = i.value();
v = process(v); v = process(v);
@@ -731,7 +731,7 @@ QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
Store UserFileVersion18Upgrader::upgrade(const Store &map) Store UserFileVersion18Upgrader::upgrade(const Store &map)
{ {
return process(map).toMap(); return process(map).value<Store>();
} }
QVariant UserFileVersion18Upgrader::process(const QVariant &entry) QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
@@ -741,7 +741,7 @@ QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
return Utils::transform(entry.toList(), &UserFileVersion18Upgrader::process); return Utils::transform(entry.toList(), &UserFileVersion18Upgrader::process);
case QVariant::Map: case QVariant::Map:
return Utils::transform<QMap<QString, QVariant>>( return Utils::transform<QMap<QString, QVariant>>(
entry.toMap().toStdMap(), [](const StringVariantPair &item) -> StringVariantPair { entry.value<Store>().toStdMap(), [](const StringVariantPair &item) -> StringVariantPair {
const QString key = (item.first const QString key = (item.first
== "AutotoolsProjectManager.MakeStep.AdditionalArguments" == "AutotoolsProjectManager.MakeStep.AdditionalArguments"
? QString("AutotoolsProjectManager.MakeStep.MakeArguments") ? QString("AutotoolsProjectManager.MakeStep.MakeArguments")
@@ -755,7 +755,7 @@ QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
Store UserFileVersion19Upgrader::upgrade(const Store &map) Store UserFileVersion19Upgrader::upgrade(const Store &map)
{ {
return process(map, QStringList()).toMap(); return process(map, QStringList()).value<Store>();
} }
QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const QStringList &path) QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const QStringList &path)
@@ -795,7 +795,7 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const QString
return Utils::transform(entry.toList(), return Utils::transform(entry.toList(),
std::bind(&UserFileVersion19Upgrader::process, std::placeholders::_1, path)); std::bind(&UserFileVersion19Upgrader::process, std::placeholders::_1, path));
case QVariant::Map: case QVariant::Map:
return Utils::transform<Store>(entry.toMap().toStdMap(), return Utils::transform<Store>(entry.value<Store>().toStdMap(),
[&](const StringVariantPair &item) -> StringVariantPair { [&](const StringVariantPair &item) -> StringVariantPair {
if (path.size() == 2 && path.at(1).startsWith("ProjectExplorer.Target.RunConfiguration.")) { if (path.size() == 2 && path.at(1).startsWith("ProjectExplorer.Target.RunConfiguration.")) {
if (argsKeys.contains(item.first)) if (argsKeys.contains(item.first))
@@ -820,7 +820,7 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const QString
Store UserFileVersion20Upgrader::upgrade(const Store &map) Store UserFileVersion20Upgrader::upgrade(const Store &map)
{ {
return process(map).toMap(); return process(map).value<Store>();
} }
QVariant UserFileVersion20Upgrader::process(const QVariant &entry) QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
@@ -830,7 +830,7 @@ QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
return Utils::transform(entry.toList(), &UserFileVersion20Upgrader::process); return Utils::transform(entry.toList(), &UserFileVersion20Upgrader::process);
case QVariant::Map: case QVariant::Map:
return Utils::transform<QMap<QString, QVariant>>( return Utils::transform<QMap<QString, QVariant>>(
entry.toMap().toStdMap(), [](const StringVariantPair &item) { entry.value<Store>().toStdMap(), [](const StringVariantPair &item) {
StringVariantPair res = {item.first, item.second}; StringVariantPair res = {item.first, item.second};
if (item.first == "ProjectExplorer.ProjectConfiguration.Id" if (item.first == "ProjectExplorer.ProjectConfiguration.Id"
&& item.second == "Qbs.Deploy") && item.second == "Qbs.Deploy")
@@ -846,7 +846,7 @@ QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
Store UserFileVersion21Upgrader::upgrade(const Store &map) Store UserFileVersion21Upgrader::upgrade(const Store &map)
{ {
return process(map).toMap(); return process(map).value<Store>();
} }
QVariant UserFileVersion21Upgrader::process(const QVariant &entry) QVariant UserFileVersion21Upgrader::process(const QVariant &entry)
@@ -855,7 +855,7 @@ QVariant UserFileVersion21Upgrader::process(const QVariant &entry)
case QVariant::List: case QVariant::List:
return Utils::transform(entry.toList(), &UserFileVersion21Upgrader::process); return Utils::transform(entry.toList(), &UserFileVersion21Upgrader::process);
case QVariant::Map: { case QVariant::Map: {
Store entryMap = entry.toMap(); Store entryMap = entry.value<Store>();
if (entryMap.value("ProjectExplorer.ProjectConfiguration.Id").toString() if (entryMap.value("ProjectExplorer.ProjectConfiguration.Id").toString()
== "DeployToGenericLinux") { == "DeployToGenericLinux") {
entryMap.insert("_checkMakeInstall", true); entryMap.insert("_checkMakeInstall", true);

View File

@@ -6,7 +6,6 @@
#include <utils/settingsaccessor.h> #include <utils/settingsaccessor.h>
#include <QHash> #include <QHash>
#include <QMessageBox>
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -38,7 +37,7 @@ protected:
Utils::SettingsMergeResult merge(const SettingsMergeData &global, Utils::SettingsMergeResult merge(const SettingsMergeData &global,
const SettingsMergeData &local) const final; const SettingsMergeData &local) const final;
private: private:
Utils::SettingsMergeFunction userStickyTrackerFunction(QStringList &stickyKeys) const; Utils::SettingsMergeFunction userStickyTrackerFunction(Utils::KeyList &stickyKeys) const;
Project *m_project; Project *m_project;
}; };