forked from qt-creator/qt-creator
Utils: Introduce variantFromStore and storeFromVariant
These are functional replacements for QVariant::fromValue(QVariantMap) (or QVariant::fromValue(Store)) and QVariant::toMap() (or QVariant::toValue<Store>()) We will have a few code paths in the end that need to explicitly operarate on both QVariantMap and Store (e.g. actual reading/writing to keep format compatibility etc), so these can't in the end be simple to/fromValue(OneType) but need an internal 'if' or such. Change-Id: I954f3cb24fa8fe123162b72bbd25d891dd19b768 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -135,7 +135,7 @@ QVariant ParseValueStackEntry::value() const
|
||||
case QVariant::Invalid:
|
||||
return QVariant();
|
||||
case QVariant::Map:
|
||||
return QVariant::fromValue(mapValue);
|
||||
return variantFromStore(mapValue);
|
||||
case QVariant::List:
|
||||
return QVariant(listValue);
|
||||
default:
|
||||
@@ -378,7 +378,7 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
|
||||
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::Map)));
|
||||
if (!key.isEmpty())
|
||||
w.writeAttribute(ctx.keyAttribute, key);
|
||||
const Store varMap = variant.value<Store>();
|
||||
const Store varMap = storeFromVariant(variant);
|
||||
const Store::const_iterator cend = varMap.constEnd();
|
||||
for (Store::const_iterator i = varMap.constBegin(); i != cend; ++i)
|
||||
writeVariantValue(w, ctx, i.value(), i.key());
|
||||
|
||||
@@ -388,7 +388,7 @@ Store VersionUpgrader::renameKeys(const QList<Change> &changes, Store map) const
|
||||
while (i != map.end()) {
|
||||
QVariant v = i.value();
|
||||
if (v.type() == QVariant::Map)
|
||||
i.value() = QVariant::fromValue(renameKeys(changes, v.value<Store>()));
|
||||
i.value() = variantFromStore(renameKeys(changes, storeFromVariant(v)));
|
||||
|
||||
++i;
|
||||
}
|
||||
@@ -639,7 +639,7 @@ MergingSettingsAccessor::mergeSettings(const SettingsAccessor::RestoreData &main
|
||||
= [this](const SettingsMergeData &global, const SettingsMergeData &local) {
|
||||
return merge(global, local);
|
||||
};
|
||||
const Store result = mergeQVariantMaps(main.data, secondary.data, mergeFunction).value<Store>();
|
||||
const Store result = storeFromVariant(mergeQVariantMaps(main.data, secondary.data, mergeFunction));
|
||||
|
||||
// Update from the base version to Creator's version.
|
||||
return RestoreData(main.path, postprocessMerge(main.data, secondary.data, result));
|
||||
@@ -720,15 +720,15 @@ static QVariant mergeQVariantMapsRecursion(const Store &mainTree, const Store &s
|
||||
if (kv.second.type() == QVariant::Map) {
|
||||
const Key newKeyPrefix = keyPrefix + kv.first + '/';
|
||||
kv.second = mergeQVariantMapsRecursion(mainTree, secondaryTree, newKeyPrefix,
|
||||
kv.second.value<Store>(),
|
||||
secondarySubtree.value(kv.first).value<Store>(),
|
||||
storeFromVariant(kv.second),
|
||||
storeFromVariant(secondarySubtree.value(kv.first)),
|
||||
merge);
|
||||
}
|
||||
if (!kv.second.isNull())
|
||||
result.insert(kv.first, kv.second);
|
||||
}
|
||||
|
||||
return QVariant::fromValue(result);
|
||||
return variantFromStore(result);
|
||||
}
|
||||
|
||||
QVariant mergeQVariantMaps(const Store &mainTree, const Store &secondaryTree,
|
||||
|
||||
@@ -17,4 +17,14 @@ QStringList stringsFromKeys(const KeyList &list)
|
||||
return transform(list, &stringFromKey);
|
||||
}
|
||||
|
||||
QVariant variantFromStore(const Store &store)
|
||||
{
|
||||
return QVariant::fromValue(store);
|
||||
}
|
||||
|
||||
Store storeFromVariant(const QVariant &value)
|
||||
{
|
||||
return value.value<Store>();
|
||||
}
|
||||
|
||||
} // Utils
|
||||
|
||||
@@ -21,4 +21,7 @@ using Store = QVariantMap;
|
||||
QTCREATOR_UTILS_EXPORT KeyList keysFromStrings(const QStringList &list);
|
||||
QTCREATOR_UTILS_EXPORT QStringList stringsFromKeys(const KeyList &list);
|
||||
|
||||
QTCREATOR_UTILS_EXPORT QVariant variantFromStore(const Store &store);
|
||||
QTCREATOR_UTILS_EXPORT Store storeFromVariant(const QVariant &value);
|
||||
|
||||
} // Utils
|
||||
|
||||
@@ -94,7 +94,7 @@ void DebugServerProviderManager::restoreProviders()
|
||||
if (!data.contains(key))
|
||||
break;
|
||||
|
||||
Store map = data.value(key).value<Store>();
|
||||
Store map = storeFromVariant(data.value(key));
|
||||
const KeyList keys = map.keys();
|
||||
for (const Key &key : keys) {
|
||||
const int lastDot = key.lastIndexOf('.');
|
||||
|
||||
@@ -243,13 +243,13 @@ JLinkUvscServerProvider::JLinkUvscServerProvider()
|
||||
void JLinkUvscServerProvider::toMap(Store &data) const
|
||||
{
|
||||
UvscServerProvider::toMap(data);
|
||||
data.insert(adapterOptionsKeyC, QVariant::fromValue(m_adapterOpts.toMap()));
|
||||
data.insert(adapterOptionsKeyC, variantFromStore(m_adapterOpts.toMap()));
|
||||
}
|
||||
|
||||
void JLinkUvscServerProvider::fromMap(const Store &data)
|
||||
{
|
||||
UvscServerProvider::fromMap(data);
|
||||
m_adapterOpts.fromMap(data.value(adapterOptionsKeyC).value<Store>());
|
||||
m_adapterOpts.fromMap(storeFromVariant(data.value(adapterOptionsKeyC)));
|
||||
}
|
||||
|
||||
bool JLinkUvscServerProvider::operator==(const IDebugServerProvider &other) const
|
||||
|
||||
@@ -209,7 +209,7 @@ void StLinkUvscServerProvider::toMap(Store &data) const
|
||||
void StLinkUvscServerProvider::fromMap(const Store &data)
|
||||
{
|
||||
UvscServerProvider::fromMap(data);
|
||||
m_adapterOpts.fromMap(data.value(adapterOptionsKeyC).value<Store>());
|
||||
m_adapterOpts.fromMap(storeFromVariant(data.value(adapterOptionsKeyC)));
|
||||
}
|
||||
|
||||
bool StLinkUvscServerProvider::operator==(const IDebugServerProvider &other) const
|
||||
|
||||
@@ -151,8 +151,8 @@ void UvscServerProvider::toMap(Store &data) const
|
||||
{
|
||||
IDebugServerProvider::toMap(data);
|
||||
data.insert(toolsIniKeyC, m_toolsIniFile.toSettings());
|
||||
data.insert(deviceSelectionKeyC, QVariant::fromValue(m_deviceSelection.toMap()));
|
||||
data.insert(driverSelectionKeyC, QVariant::fromValue(m_driverSelection.toMap()));
|
||||
data.insert(deviceSelectionKeyC, variantFromStore(m_deviceSelection.toMap()));
|
||||
data.insert(driverSelectionKeyC, variantFromStore(m_driverSelection.toMap()));
|
||||
}
|
||||
|
||||
bool UvscServerProvider::isValid() const
|
||||
@@ -223,8 +223,8 @@ void UvscServerProvider::fromMap(const Store &data)
|
||||
{
|
||||
IDebugServerProvider::fromMap(data);
|
||||
m_toolsIniFile = FilePath::fromSettings(data.value(toolsIniKeyC));
|
||||
m_deviceSelection.fromMap(data.value(deviceSelectionKeyC).value<Store>());
|
||||
m_driverSelection.fromMap(data.value(driverSelectionKeyC).value<Store>());
|
||||
m_deviceSelection.fromMap(storeFromVariant(data.value(deviceSelectionKeyC)));
|
||||
m_driverSelection.fromMap(storeFromVariant(data.value(driverSelectionKeyC)));
|
||||
}
|
||||
|
||||
FilePath UvscServerProvider::projectFilePath(DebuggerRunTool *runTool, QString &errorMessage) const
|
||||
|
||||
@@ -83,7 +83,7 @@ Store DeviceSelection::toMap() const
|
||||
m.insert(deviceMemoryIdKeyC, memory.id);
|
||||
m.insert(deviceMemoryStartKeyC, memory.start);
|
||||
m.insert(deviceMemorySizeKeyC, memory.size);
|
||||
memoryList.push_back(QVariant::fromValue(m));
|
||||
memoryList.push_back(variantFromStore(m));
|
||||
}
|
||||
map.insert(deviceMemoryKeyC, memoryList);
|
||||
// Device ALGORITHM.
|
||||
@@ -95,7 +95,7 @@ Store DeviceSelection::toMap() const
|
||||
m.insert(deviceAlgorithmFlashSizeKeyC, algorithm.flashSize);
|
||||
m.insert(deviceAlgorithmRamStartKeyC, algorithm.ramStart);
|
||||
m.insert(deviceAlgorithmRamSizeKeyC, algorithm.ramSize);
|
||||
algorithmList.push_back(QVariant::fromValue(m));
|
||||
algorithmList.push_back(variantFromStore(m));
|
||||
}
|
||||
map.insert(deviceAlgorithmKeyC, algorithmList);
|
||||
map.insert(deviceAlgorithmIndexKeyC, algorithmIndex);
|
||||
|
||||
@@ -124,7 +124,7 @@ static Store convertToMapFromVersionBefore410(ProjectExplorer::Project *p)
|
||||
void ClangToolsProjectSettings::load()
|
||||
{
|
||||
// Load map
|
||||
Store map = m_project->namedSettings(SETTINGS_KEY_MAIN).value<Store>();
|
||||
Store map = storeFromVariant(m_project->namedSettings(SETTINGS_KEY_MAIN));
|
||||
|
||||
bool write = false;
|
||||
if (map.isEmpty()) {
|
||||
@@ -148,7 +148,7 @@ void ClangToolsProjectSettings::load()
|
||||
|
||||
const QVariantList list = map.value(SETTINGS_KEY_SUPPRESSED_DIAGS).toList();
|
||||
for (const QVariant &v : list) {
|
||||
const Store diag = v.value<Store>();
|
||||
const Store diag = storeFromVariant(v);
|
||||
const QString fp = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH).toString();
|
||||
if (fp.isEmpty())
|
||||
continue;
|
||||
@@ -190,13 +190,13 @@ void ClangToolsProjectSettings::store()
|
||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH, diag.filePath.toString());
|
||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_MESSAGE, diag.description);
|
||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER, diag.uniquifier);
|
||||
list << QVariant::fromValue(diagMap);
|
||||
list << variantFromStore(diagMap);
|
||||
}
|
||||
map.insert(SETTINGS_KEY_SUPPRESSED_DIAGS, list);
|
||||
|
||||
m_runSettings.toMap(map, SETTINGS_PREFIX);
|
||||
|
||||
m_project->setNamedSettings(SETTINGS_KEY_MAIN, QVariant::fromValue(map));
|
||||
m_project->setNamedSettings(SETTINGS_KEY_MAIN, variantFromStore(map));
|
||||
}
|
||||
|
||||
ClangToolsProjectSettings::ClangToolsProjectSettingsPtr
|
||||
|
||||
@@ -1433,7 +1433,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
setInitializer([this, target](const BuildInfo &info) {
|
||||
const Kit *k = target->kit();
|
||||
const QtSupport::QtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
|
||||
const Store extraInfoMap = info.extraInfo.value<Store>();
|
||||
const Store extraInfoMap = storeFromVariant(info.extraInfo);
|
||||
const QString buildType = extraInfoMap.contains(CMAKE_BUILD_TYPE)
|
||||
? extraInfoMap.value(CMAKE_BUILD_TYPE).toString()
|
||||
: info.typeName;
|
||||
@@ -1942,7 +1942,7 @@ BuildInfo CMakeBuildConfigurationFactory::createBuildInfo(BuildType buildType)
|
||||
Store extraInfo;
|
||||
// enable QML debugging by default
|
||||
extraInfo.insert(Constants::QML_DEBUG_SETTING, TriState::Enabled.toVariant());
|
||||
info.extraInfo = QVariant::fromValue(extraInfo);
|
||||
info.extraInfo = variantFromStore(extraInfo);
|
||||
break;
|
||||
}
|
||||
case BuildTypeRelease:
|
||||
@@ -1969,7 +1969,7 @@ BuildInfo CMakeBuildConfigurationFactory::createBuildInfo(BuildType buildType)
|
||||
extraInfo.insert(CMAKE_BUILD_TYPE, "RelWithDebInfo");
|
||||
// enable QML debugging by default
|
||||
extraInfo.insert(Constants::QML_DEBUG_SETTING, TriState::Enabled.toVariant());
|
||||
info.extraInfo = QVariant::fromValue(extraInfo);
|
||||
info.extraInfo = variantFromStore(extraInfo);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -186,7 +186,7 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo
|
||||
Store tmp = item->toMap();
|
||||
if (tmp.isEmpty())
|
||||
continue;
|
||||
data.insert(CMAKE_TOOL_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
|
||||
data.insert(CMAKE_TOOL_DATA_KEY + Key::number(count), variantFromStore(tmp));
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ CMakeToolSettingsAccessor::cmakeTools(const Store &data, bool fromSdk) const
|
||||
if (!data.contains(key))
|
||||
continue;
|
||||
|
||||
const Store dbMap = data.value(key).value<Store>();
|
||||
const Store dbMap = storeFromVariant(data.value(key));
|
||||
auto item = std::make_unique<CMakeTool>(dbMap, fromSdk);
|
||||
const FilePath cmakeExecutable = item->cmakeExecutable();
|
||||
if (item->isAutoDetected() && !cmakeExecutable.needsDevice() && !cmakeExecutable.isExecutableFile()) {
|
||||
|
||||
@@ -233,7 +233,7 @@ CopilotProjectSettings::CopilotProjectSettings(ProjectExplorer::Project *project
|
||||
|
||||
initEnableAspect(enableCopilot);
|
||||
|
||||
Store map = project->namedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID).value<Store>();
|
||||
Store map = storeFromVariant(project->namedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID));
|
||||
fromMap(map);
|
||||
|
||||
connect(&enableCopilot, &BaseAspect::changed, this, [this, project] { save(project); });
|
||||
@@ -256,7 +256,7 @@ void CopilotProjectSettings::save(ProjectExplorer::Project *project)
|
||||
{
|
||||
Store map;
|
||||
toMap(map);
|
||||
project->setNamedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID, QVariant::fromValue(map));
|
||||
project->setNamedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID, variantFromStore(map));
|
||||
|
||||
// This triggers a restart of the Copilot language server.
|
||||
settings().apply();
|
||||
|
||||
@@ -498,7 +498,7 @@ void ClangdProjectSettings::loadSettings()
|
||||
{
|
||||
if (!m_project)
|
||||
return;
|
||||
const Store data = m_project->namedSettings(clangdSettingsKey()).value<Store>();
|
||||
const Store data = storeFromVariant(m_project->namedSettings(clangdSettingsKey()));
|
||||
m_useGlobalSettings = data.value(clangdUseGlobalSettingsKey(), true).toBool();
|
||||
m_blockIndexing = data.value(clangdblockIndexingSettingsKey(), false).toBool();
|
||||
if (!m_useGlobalSettings)
|
||||
@@ -514,7 +514,7 @@ void ClangdProjectSettings::saveSettings()
|
||||
data = m_customSettings.toMap();
|
||||
data.insert(clangdUseGlobalSettingsKey(), m_useGlobalSettings);
|
||||
data.insert(clangdblockIndexingSettingsKey(), m_blockIndexing);
|
||||
m_project->setNamedSettings(clangdSettingsKey(), QVariant::fromValue(data));
|
||||
m_project->setNamedSettings(clangdSettingsKey(), variantFromStore(data));
|
||||
}
|
||||
|
||||
Store ClangdSettings::Data::toMap() const
|
||||
|
||||
@@ -767,7 +767,7 @@ void DebuggerItemModel::readDebuggers(const FilePath &fileName, bool isSystem)
|
||||
const Key key = DEBUGGER_DATA_KEY + Key::number(i);
|
||||
if (!data.contains(key))
|
||||
continue;
|
||||
const Store dbMap = data.value(key).value<Store>();
|
||||
const Store dbMap = storeFromVariant(data.value(key));
|
||||
DebuggerItem item(dbMap);
|
||||
if (isSystem) {
|
||||
item.setAutoDetected(true);
|
||||
@@ -821,7 +821,7 @@ void DebuggerItemModel::saveDebuggers()
|
||||
if (item.isValid() && item.engineType() != NoEngineType) {
|
||||
Store tmp = item.toMap();
|
||||
if (!tmp.isEmpty()) {
|
||||
data.insert(DEBUGGER_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
|
||||
data.insert(DEBUGGER_DATA_KEY + Key::number(count), variantFromStore(tmp));
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void IosDevice::fromMap(const Store &map)
|
||||
IDevice::fromMap(map);
|
||||
|
||||
m_extraInfo.clear();
|
||||
const Store vMap = map.value(Constants::EXTRA_INFO_KEY).value<Store>();
|
||||
const Store vMap = storeFromVariant(map.value(Constants::EXTRA_INFO_KEY));
|
||||
for (auto i = vMap.cbegin(), end = vMap.cend(); i != end; ++i)
|
||||
m_extraInfo.insert(stringFromKey(i.key()), i.value().toString());
|
||||
}
|
||||
@@ -142,7 +142,7 @@ Store IosDevice::toMap() const
|
||||
Store vMap;
|
||||
for (auto i = m_extraInfo.cbegin(), end = m_extraInfo.cend(); i != end; ++i)
|
||||
vMap.insert(keyFromString(i.key()), i.value());
|
||||
res.insert(Constants::EXTRA_INFO_KEY, QVariant::fromValue(vMap));
|
||||
res.insert(Constants::EXTRA_INFO_KEY, variantFromStore(vMap));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ void IosDeviceTypeAspect::fromMap(const Store &map)
|
||||
{
|
||||
bool deviceTypeIsInt;
|
||||
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
|
||||
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).value<Store>()))
|
||||
if (deviceTypeIsInt || !m_deviceType.fromMap(storeFromVariant(map.value(deviceTypeKey))))
|
||||
updateDeviceType();
|
||||
|
||||
m_runConfiguration->update();
|
||||
|
||||
@@ -612,7 +612,7 @@ QList<BaseSettings *> LanguageClientSettings::fromSettings(QSettings *settingsIn
|
||||
for (auto varList :
|
||||
{settingsIn->value(clientsKey).toList(), settingsIn->value(typedClientsKey).toList()}) {
|
||||
for (const QVariant &var : varList) {
|
||||
const Store map = var.value<Store>();
|
||||
const Store map = storeFromVariant(var);
|
||||
Id typeId = Id::fromSetting(map.value(typeIdKey));
|
||||
if (!typeId.isValid())
|
||||
typeId = Constants::LANGUAGECLIENT_STDIO_SETTINGS_ID;
|
||||
@@ -659,7 +659,7 @@ void LanguageClientSettings::toSettings(QSettings *settings,
|
||||
settings->beginGroup(settingsGroupKey);
|
||||
auto transform = [](const QList<BaseSettings *> &settings) {
|
||||
return Utils::transform(settings, [](const BaseSettings *setting) {
|
||||
return QVariant::fromValue(setting->toMap());
|
||||
return variantFromStore(setting->toMap());
|
||||
});
|
||||
};
|
||||
auto isStdioSetting = Utils::equal(&BaseSettings::m_settingsTypeId,
|
||||
|
||||
@@ -42,11 +42,11 @@ void ToolsSettingsAccessor::saveMesonTools(const std::vector<MesonTools::Tool_t>
|
||||
for (const MesonTools::Tool_t &tool : tools) {
|
||||
auto asMeson = std::dynamic_pointer_cast<MesonWrapper>(tool);
|
||||
if (asMeson)
|
||||
data.insert(entryName(entry_count), QVariant::fromValue(toVariantMap<MesonWrapper>(*asMeson)));
|
||||
data.insert(entryName(entry_count), variantFromStore(toVariantMap<MesonWrapper>(*asMeson)));
|
||||
else {
|
||||
auto asNinja = std::dynamic_pointer_cast<NinjaWrapper>(tool);
|
||||
if (asNinja)
|
||||
data.insert(entryName(entry_count), QVariant::fromValue(toVariantMap<NinjaWrapper>(*asNinja)));
|
||||
data.insert(entryName(entry_count), variantFromStore(toVariantMap<NinjaWrapper>(*asNinja)));
|
||||
}
|
||||
entry_count++;
|
||||
}
|
||||
@@ -66,9 +66,9 @@ std::vector<MesonTools::Tool_t> ToolsSettingsAccessor::loadMesonTools(QWidget *p
|
||||
const auto map = data[name].toMap();
|
||||
auto type = map.value(ToolsSettings::TOOL_TYPE_KEY, ToolsSettings::TOOL_TYPE_MESON);
|
||||
if (type == ToolsSettings::TOOL_TYPE_NINJA)
|
||||
result.emplace_back(fromVariantMap<NinjaWrapper *>(data[name].value<Store>()));
|
||||
result.emplace_back(fromVariantMap<NinjaWrapper *>(storeFromVariant(data[name])));
|
||||
else
|
||||
result.emplace_back(fromVariantMap<MesonWrapper *>(data[name].value<Store>()));
|
||||
result.emplace_back(fromVariantMap<MesonWrapper *>(storeFromVariant(data[name])));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -381,8 +381,8 @@ void BuildConfiguration::toMap(Store &map) const
|
||||
EnvironmentItem::toStringList(d->m_userEnvironmentChanges));
|
||||
|
||||
map.insert(BUILD_STEP_LIST_COUNT, 2);
|
||||
map.insert(BUILD_STEP_LIST_PREFIX + Key::number(0), QVariant::fromValue(d->m_buildSteps.toMap()));
|
||||
map.insert(BUILD_STEP_LIST_PREFIX + Key::number(1), QVariant::fromValue(d->m_cleanSteps.toMap()));
|
||||
map.insert(BUILD_STEP_LIST_PREFIX + Key::number(0), variantFromStore(d->m_buildSteps.toMap()));
|
||||
map.insert(BUILD_STEP_LIST_PREFIX + Key::number(1), variantFromStore(d->m_cleanSteps.toMap()));
|
||||
|
||||
map.insert(PARSE_STD_OUT_KEY, d->m_parseStdOut);
|
||||
map.insert(CUSTOM_PARSERS_KEY, transform(d->m_customParsers, &Id::toSetting));
|
||||
@@ -401,7 +401,7 @@ void BuildConfiguration::fromMap(const Store &map)
|
||||
|
||||
int maxI = map.value(BUILD_STEP_LIST_COUNT, 0).toInt();
|
||||
for (int i = 0; i < maxI; ++i) {
|
||||
Store data = map.value(BUILD_STEP_LIST_PREFIX + Key::number(i)).value<Store>();
|
||||
Store data = storeFromVariant(map.value(BUILD_STEP_LIST_PREFIX + Key::number(i)));
|
||||
if (data.isEmpty()) {
|
||||
qWarning() << "No data for build step list" << i << "found!";
|
||||
continue;
|
||||
|
||||
@@ -62,7 +62,7 @@ Store BuildStepList::toMap() const
|
||||
for (int i = 0; i < m_steps.count(); ++i) {
|
||||
Store data;
|
||||
m_steps.at(i)->toMap(data);
|
||||
map.insert(STEPS_PREFIX + Key::number(i), QVariant::fromValue(data));
|
||||
map.insert(STEPS_PREFIX + Key::number(i), variantFromStore(data));
|
||||
}
|
||||
|
||||
return map;
|
||||
@@ -111,7 +111,7 @@ bool BuildStepList::fromMap(const Store &map)
|
||||
|
||||
int maxSteps = map.value(STEPS_COUNT_KEY, 0).toInt();
|
||||
for (int i = 0; i < maxSteps; ++i) {
|
||||
Store bsData(map.value(STEPS_PREFIX + Key::number(i)).value<Store>());
|
||||
Store bsData = storeFromVariant(map.value(STEPS_PREFIX + Key::number(i)));
|
||||
if (bsData.isEmpty()) {
|
||||
qWarning() << "No step data found for" << i << "(continuing).";
|
||||
continue;
|
||||
|
||||
@@ -144,8 +144,8 @@ Store CustomParserSettings::toMap() const
|
||||
Store map;
|
||||
map.insert(idKey, id.toSetting());
|
||||
map.insert(nameKey, displayName);
|
||||
map.insert(errorKey, QVariant::fromValue(error.toMap()));
|
||||
map.insert(warningKey, QVariant::fromValue(warning.toMap()));
|
||||
map.insert(errorKey, variantFromStore(error.toMap()));
|
||||
map.insert(warningKey, variantFromStore(warning.toMap()));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -153,8 +153,8 @@ void CustomParserSettings::fromMap(const Store &map)
|
||||
{
|
||||
id = Id::fromSetting(map.value(idKey));
|
||||
displayName = map.value(nameKey).toString();
|
||||
error.fromMap(map.value(errorKey).value<Store>());
|
||||
warning.fromMap(map.value(warningKey).value<Store>());
|
||||
error.fromMap(storeFromVariant(map.value(errorKey)));
|
||||
warning.fromMap(storeFromVariant(map.value(warningKey)));
|
||||
}
|
||||
|
||||
CustomParsersAspect::CustomParsersAspect(Target *target)
|
||||
|
||||
@@ -54,14 +54,14 @@ void DeployConfiguration::toMap(Store &map) const
|
||||
{
|
||||
ProjectConfiguration::toMap(map);
|
||||
map.insert(BUILD_STEP_LIST_COUNT, 1);
|
||||
map.insert(Key(BUILD_STEP_LIST_PREFIX) + '0', QVariant::fromValue(m_stepList.toMap()));
|
||||
map.insert(Key(BUILD_STEP_LIST_PREFIX) + '0', variantFromStore(m_stepList.toMap()));
|
||||
map.insert(USES_DEPLOYMENT_DATA, usesCustomDeploymentData());
|
||||
Store deployData;
|
||||
for (int i = 0; i < m_customDeploymentData.fileCount(); ++i) {
|
||||
const DeployableFile &f = m_customDeploymentData.fileAt(i);
|
||||
deployData.insert(keyFromString(f.localFilePath().toString()), f.remoteDirectory());
|
||||
}
|
||||
map.insert(DEPLOYMENT_DATA, QVariant::fromValue(deployData));
|
||||
map.insert(DEPLOYMENT_DATA, variantFromStore(deployData));
|
||||
}
|
||||
|
||||
void DeployConfiguration::fromMap(const Store &map)
|
||||
@@ -75,7 +75,7 @@ void DeployConfiguration::fromMap(const Store &map)
|
||||
reportError();
|
||||
return;
|
||||
}
|
||||
Store data = map.value(Key(BUILD_STEP_LIST_PREFIX) + '0').value<Store>();
|
||||
Store data = storeFromVariant(map.value(Key(BUILD_STEP_LIST_PREFIX) + '0'));
|
||||
if (!data.isEmpty()) {
|
||||
m_stepList.clear();
|
||||
if (!m_stepList.fromMap(data)) {
|
||||
@@ -91,7 +91,7 @@ void DeployConfiguration::fromMap(const Store &map)
|
||||
}
|
||||
|
||||
m_usesCustomDeploymentData = map.value(USES_DEPLOYMENT_DATA, false).toBool();
|
||||
const Store deployData = map.value(DEPLOYMENT_DATA).value<Store>();
|
||||
const Store deployData = storeFromVariant(map.value(DEPLOYMENT_DATA));
|
||||
for (auto it = deployData.begin(); it != deployData.end(); ++it)
|
||||
m_customDeploymentData.addFile(FilePath::fromString(stringFromKey(it.key())), it.value().toString());
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void DeviceManager::save()
|
||||
if (d->clonedInstance == this || !d->writer)
|
||||
return;
|
||||
Store data;
|
||||
data.insert(DeviceManagerKey, QVariant::fromValue(toMap()));
|
||||
data.insert(DeviceManagerKey, variantFromStore(toMap()));
|
||||
d->writer->save(data, Core::ICore::dialogParent());
|
||||
}
|
||||
|
||||
@@ -157,11 +157,11 @@ void DeviceManager::load()
|
||||
QHash<Id, Id> defaultDevices;
|
||||
QList<IDevice::Ptr> sdkDevices;
|
||||
if (reader.load(systemSettingsFilePath("devices.xml")))
|
||||
sdkDevices = fromMap(reader.restoreValues().value(DeviceManagerKey).value<Store>(), &defaultDevices);
|
||||
sdkDevices = fromMap(storeFromVariant(reader.restoreValues().value(DeviceManagerKey)), &defaultDevices);
|
||||
// read devices file from user settings path
|
||||
QList<IDevice::Ptr> userDevices;
|
||||
if (reader.load(settingsFilePath("devices.xml")))
|
||||
userDevices = fromMap(reader.restoreValues().value(DeviceManagerKey).value<Store>(), &defaultDevices);
|
||||
userDevices = fromMap(storeFromVariant(reader.restoreValues().value(DeviceManagerKey)), &defaultDevices);
|
||||
// Insert devices into the model. Prefer the higher device version when there are multiple
|
||||
// devices with the same id.
|
||||
for (IDevice::ConstPtr device : std::as_const(userDevices)) {
|
||||
@@ -209,13 +209,13 @@ QList<IDevice::Ptr> DeviceManager::fromMap(const Store &map, QHash<Id, Id> *defa
|
||||
QList<IDevice::Ptr> devices;
|
||||
|
||||
if (defaultDevices) {
|
||||
const Store defaultDevsMap = map.value(DefaultDevicesKey).value<Store>();
|
||||
const Store defaultDevsMap = storeFromVariant(map.value(DefaultDevicesKey));
|
||||
for (auto it = defaultDevsMap.constBegin(); it != defaultDevsMap.constEnd(); ++it)
|
||||
defaultDevices->insert(Id::fromString(stringFromKey(it.key())), Id::fromSetting(it.value()));
|
||||
}
|
||||
const QVariantList deviceList = map.value(DeviceListKey).toList();
|
||||
for (const QVariant &v : deviceList) {
|
||||
const Store map = v.value<Store>();
|
||||
const Store map = storeFromVariant(v);
|
||||
const IDeviceFactory * const factory = restoreFactory(map);
|
||||
if (!factory)
|
||||
continue;
|
||||
@@ -234,10 +234,10 @@ Store DeviceManager::toMap() const
|
||||
for (auto it = d->defaultDevices.constBegin(); it != d->defaultDevices.constEnd(); ++it)
|
||||
defaultDeviceMap.insert(keyFromString(it.key().toString()), it.value().toSetting());
|
||||
|
||||
map.insert(DefaultDevicesKey, QVariant::fromValue(defaultDeviceMap));
|
||||
map.insert(DefaultDevicesKey, variantFromStore(defaultDeviceMap));
|
||||
QVariantList deviceList;
|
||||
for (const IDevice::Ptr &device : std::as_const(d->devices))
|
||||
deviceList << QVariant::fromValue(device->toMap());
|
||||
deviceList << variantFromStore(device->toMap());
|
||||
map.insert(DeviceListKey, deviceList);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ void IDevice::fromMap(const Store &map)
|
||||
d->debugServerPath = FilePath::fromSettings(map.value(DebugServerKey));
|
||||
const FilePath qmlRunCmd = FilePath::fromSettings(map.value(QmlRuntimeKey));
|
||||
d->qmlRunCommand = qmlRunCmd;
|
||||
d->extraData = map.value(ExtraDataKey).value<Store>();
|
||||
d->extraData = storeFromVariant(map.value(ExtraDataKey));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -509,7 +509,7 @@ Store IDevice::toMap() const
|
||||
map.insert(DebugServerKey, d->debugServerPath.toSettings());
|
||||
map.insert(QmlRuntimeKey, d->qmlRunCommand.toSettings());
|
||||
|
||||
map.insert(ExtraDataKey, QVariant::fromValue(d->extraData));
|
||||
map.insert(ExtraDataKey, variantFromStore(d->extraData));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ Store EditorConfiguration::toMap() const
|
||||
{"language", QVariant::fromValue(itCodeStyle.key().toSetting())},
|
||||
{"value", QVariant::fromValue(itCodeStyle.value()->toMap())}
|
||||
};
|
||||
map.insert(kCodeStylePrefix + Key::number(i), QVariant::fromValue(settingsIdMap));
|
||||
map.insert(kCodeStylePrefix + Key::number(i), variantFromStore(settingsIdMap));
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -204,13 +204,13 @@ void EditorConfiguration::fromMap(const Store &map)
|
||||
|
||||
const int codeStyleCount = map.value(kCodeStyleCount, 0).toInt();
|
||||
for (int i = 0; i < codeStyleCount; ++i) {
|
||||
Store settingsIdMap = map.value(kCodeStylePrefix + Key::number(i)).value<Store>();
|
||||
Store settingsIdMap = storeFromVariant(map.value(kCodeStylePrefix + Key::number(i)));
|
||||
if (settingsIdMap.isEmpty()) {
|
||||
qWarning() << "No data for code style settings list" << i << "found!";
|
||||
continue;
|
||||
}
|
||||
Id languageId = Id::fromSetting(settingsIdMap.value("language"));
|
||||
Store value = settingsIdMap.value("value").value<Store>();
|
||||
Store value = storeFromVariant(settingsIdMap.value("value"));
|
||||
ICodeStylePreferences *preferences = d->m_languageCodeStylePreferences.value(languageId);
|
||||
if (preferences)
|
||||
preferences->fromMap(value);
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
void ExtraAbi::load()
|
||||
{
|
||||
AbiFlavorAccessor accessor;
|
||||
const Store data = accessor.restoreSettings(Core::ICore::dialogParent()).value("Flavors").value<Store>();
|
||||
const Store data = storeFromVariant(accessor.restoreSettings(Core::ICore::dialogParent()).value("Flavors"));
|
||||
for (auto it = data.constBegin(); it != data.constEnd(); ++it) {
|
||||
const Key flavor = it.key();
|
||||
if (flavor.isEmpty())
|
||||
|
||||
@@ -146,7 +146,7 @@ Kit::Kit(const Store &data)
|
||||
if (it != data.constEnd())
|
||||
d->m_irrelevantAspects = transform<QSet<Id>>(it.value().toList(), &Id::fromSetting);
|
||||
|
||||
Store extra = data.value(DATA_KEY).value<Store>();
|
||||
Store extra = storeFromVariant(data.value(DATA_KEY));
|
||||
d->m_data.clear(); // remove default values
|
||||
const Store::ConstIterator cend = extra.constEnd();
|
||||
for (Store::ConstIterator it = extra.constBegin(); it != cend; ++it)
|
||||
@@ -518,7 +518,7 @@ Store Kit::toMap() const
|
||||
const IdVariantConstIt cend = d->m_data.constEnd();
|
||||
for (IdVariantConstIt it = d->m_data.constBegin(); it != cend; ++it)
|
||||
extra.insert(keyFromString(QString::fromLatin1(it.key().name().constData())), it.value());
|
||||
data.insert(DATA_KEY, QVariant::fromValue(extra));
|
||||
data.insert(DATA_KEY, variantFromStore(extra));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ void KitManager::saveKits()
|
||||
Store tmp = k->toMap();
|
||||
if (tmp.isEmpty())
|
||||
continue;
|
||||
data.insert(KIT_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
|
||||
data.insert(KIT_DATA_KEY + Key::number(count), variantFromStore(tmp));
|
||||
++count;
|
||||
}
|
||||
data.insert(KIT_COUNT_KEY, count);
|
||||
@@ -518,7 +518,7 @@ static KitList restoreKitsHelper(const FilePath &fileName)
|
||||
if (!data.contains(key))
|
||||
break;
|
||||
|
||||
const Store stMap = data.value(key).value<Store>();
|
||||
const Store stMap = storeFromVariant(data.value(key));
|
||||
|
||||
auto k = std::make_unique<Kit>(stMap);
|
||||
if (k->id().isValid()) {
|
||||
|
||||
@@ -698,11 +698,11 @@ void Project::toMap(Store &map) const
|
||||
map.insert(ACTIVE_TARGET_KEY, ts.indexOf(d->m_activeTarget));
|
||||
map.insert(TARGET_COUNT_KEY, ts.size());
|
||||
for (int i = 0; i < ts.size(); ++i)
|
||||
map.insert(TARGET_KEY_PREFIX + Key::number(i), QVariant::fromValue(ts.at(i)->toMap()));
|
||||
map.insert(TARGET_KEY_PREFIX + Key::number(i), variantFromStore(ts.at(i)->toMap()));
|
||||
|
||||
map.insert(EDITOR_SETTINGS_KEY, QVariant::fromValue(d->m_editorConfiguration.toMap()));
|
||||
map.insert(EDITOR_SETTINGS_KEY, variantFromStore(d->m_editorConfiguration.toMap()));
|
||||
if (!d->m_pluginSettings.isEmpty())
|
||||
map.insert(PLUGIN_SETTINGS_KEY, QVariant::fromValue(d->m_pluginSettings));
|
||||
map.insert(PLUGIN_SETTINGS_KEY, variantFromStore(d->m_pluginSettings));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -768,12 +768,12 @@ Project::RestoreResult Project::fromMap(const Store &map, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
if (map.contains(EDITOR_SETTINGS_KEY)) {
|
||||
Store values(map.value(EDITOR_SETTINGS_KEY).value<Store>());
|
||||
Store values = storeFromVariant(map.value(EDITOR_SETTINGS_KEY));
|
||||
d->m_editorConfiguration.fromMap(values);
|
||||
}
|
||||
|
||||
if (map.contains(PLUGIN_SETTINGS_KEY))
|
||||
d->m_pluginSettings = map.value(PLUGIN_SETTINGS_KEY).value<Store>();
|
||||
d->m_pluginSettings = storeFromVariant(map.value(PLUGIN_SETTINGS_KEY));
|
||||
|
||||
bool ok;
|
||||
int maxI(map.value(TARGET_COUNT_KEY, 0).toInt(&ok));
|
||||
@@ -805,7 +805,7 @@ void Project::createTargetFromMap(const Store &map, int index)
|
||||
if (!map.contains(key))
|
||||
return;
|
||||
|
||||
const Store targetMap = map.value(key).value<Store>();
|
||||
const Store targetMap = storeFromVariant(map.value(key));
|
||||
|
||||
Id id = idFromMap(targetMap);
|
||||
if (target(id)) {
|
||||
|
||||
@@ -57,7 +57,7 @@ void ProjectCommentsSettings::loadSettings()
|
||||
if (!entry.isValid())
|
||||
return;
|
||||
|
||||
const Store data = entry.value<Store>();
|
||||
const Store data = storeFromVariant(entry);
|
||||
m_useGlobalSettings = data.value(kUseGlobalKey, true).toBool();
|
||||
m_customSettings.enableDoxygen = data.value(CommentsSettings::enableDoxygenSettingsKey(),
|
||||
m_customSettings.enableDoxygen).toBool();
|
||||
@@ -87,7 +87,7 @@ void ProjectCommentsSettings::saveSettings()
|
||||
data.insert(CommentsSettings::generateBriefSettingsKey(), m_customSettings.generateBrief);
|
||||
data.insert(CommentsSettings::leadingAsterisksSettingsKey(), m_customSettings.leadingAsterisks);
|
||||
data.insert(CommentsSettings::commandPrefixKey(), int(m_customSettings.commandPrefix));
|
||||
m_project->setNamedSettings(CommentsSettings::mainSettingsKey(), QVariant::fromValue(data));
|
||||
m_project->setNamedSettings(CommentsSettings::mainSettingsKey(), variantFromStore(data));
|
||||
}
|
||||
|
||||
class ProjectCommentsSettingsWidget::Private
|
||||
|
||||
@@ -1702,8 +1702,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
const int customParserCount = s->value(Constants::CUSTOM_PARSER_COUNT_KEY).toInt();
|
||||
for (int i = 0; i < customParserCount; ++i) {
|
||||
CustomParserSettings settings;
|
||||
settings.fromMap(s->value(Constants::CUSTOM_PARSER_PREFIX_KEY
|
||||
+ Key::number(i)).value<Store>());
|
||||
settings.fromMap(storeFromVariant(
|
||||
s->value(Constants::CUSTOM_PARSER_PREFIX_KEY + Key::number(i))));
|
||||
dd->m_customParsers << settings;
|
||||
}
|
||||
|
||||
@@ -2279,7 +2279,7 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
|
||||
s->setValueWithDefault(Constants::CUSTOM_PARSER_COUNT_KEY, int(dd->m_customParsers.count()), 0);
|
||||
for (int i = 0; i < dd->m_customParsers.count(); ++i) {
|
||||
s->setValue(Constants::CUSTOM_PARSER_PREFIX_KEY + Key::number(i),
|
||||
QVariant::fromValue(dd->m_customParsers.at(i).toMap()));
|
||||
variantFromStore(dd->m_customParsers.at(i).toMap()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -605,7 +605,7 @@ Store Target::toMap() const
|
||||
for (int i = 0; i < bcs.size(); ++i) {
|
||||
Store data;
|
||||
bcs.at(i)->toMap(data);
|
||||
map.insert(BC_KEY_PREFIX + Key::number(i), QVariant::fromValue(data));
|
||||
map.insert(BC_KEY_PREFIX + Key::number(i), variantFromStore(data));
|
||||
}
|
||||
|
||||
const QList<DeployConfiguration *> dcs = deployConfigurations();
|
||||
@@ -614,7 +614,7 @@ Store Target::toMap() const
|
||||
for (int i = 0; i < dcs.size(); ++i) {
|
||||
Store data;
|
||||
dcs.at(i)->toMap(data);
|
||||
map.insert(DC_KEY_PREFIX + Key::number(i), QVariant::fromValue(data));
|
||||
map.insert(DC_KEY_PREFIX + Key::number(i), variantFromStore(data));
|
||||
}
|
||||
|
||||
const QList<RunConfiguration *> rcs = runConfigurations();
|
||||
@@ -623,11 +623,11 @@ Store Target::toMap() const
|
||||
for (int i = 0; i < rcs.size(); ++i) {
|
||||
Store data;
|
||||
rcs.at(i)->toMap(data);
|
||||
map.insert(RC_KEY_PREFIX + Key::number(i), QVariant::fromValue(data));
|
||||
map.insert(RC_KEY_PREFIX + Key::number(i), variantFromStore(data));
|
||||
}
|
||||
|
||||
if (!d->m_pluginSettings.isEmpty())
|
||||
map.insert(PLUGIN_SETTINGS_KEY, QVariant::fromValue(d->m_pluginSettings));
|
||||
map.insert(PLUGIN_SETTINGS_KEY, variantFromStore(d->m_pluginSettings));
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -903,7 +903,7 @@ bool Target::fromMap(const Store &map)
|
||||
const Key key = BC_KEY_PREFIX + Key::number(i);
|
||||
if (!map.contains(key))
|
||||
return false;
|
||||
const Store valueMap = map.value(key).value<Store>();
|
||||
const Store valueMap = storeFromVariant(map.value(key));
|
||||
BuildConfiguration *bc = BuildConfigurationFactory::restore(this, valueMap);
|
||||
if (!bc) {
|
||||
qWarning("No factory found to restore build configuration!");
|
||||
@@ -930,7 +930,7 @@ bool Target::fromMap(const Store &map)
|
||||
const Key key = DC_KEY_PREFIX + Key::number(i);
|
||||
if (!map.contains(key))
|
||||
return false;
|
||||
Store valueMap = map.value(key).value<Store>();
|
||||
Store valueMap = storeFromVariant(map.value(key));
|
||||
DeployConfiguration *dc = DeployConfigurationFactory::restore(this, valueMap);
|
||||
if (!dc) {
|
||||
Utils::Id id = idFromMap(valueMap);
|
||||
@@ -959,7 +959,7 @@ bool Target::fromMap(const Store &map)
|
||||
return false;
|
||||
|
||||
// Ignore missing RCs: We will just populate them using the default ones.
|
||||
Store valueMap = map.value(key).value<Store>();
|
||||
Store valueMap = storeFromVariant(map.value(key));
|
||||
RunConfiguration *rc = RunConfigurationFactory::restore(this, valueMap);
|
||||
if (!rc)
|
||||
continue;
|
||||
@@ -973,7 +973,7 @@ bool Target::fromMap(const Store &map)
|
||||
}
|
||||
|
||||
if (map.contains(PLUGIN_SETTINGS_KEY))
|
||||
d->m_pluginSettings = map.value(PLUGIN_SETTINGS_KEY).value<Store>();
|
||||
d->m_pluginSettings = storeFromVariant(map.value(PLUGIN_SETTINGS_KEY));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -738,14 +738,14 @@ bool BadToolchains::isBadToolchain(const FilePath &toolchain) const
|
||||
QVariant BadToolchains::toVariant() const
|
||||
{
|
||||
return Utils::transform<QVariantList>(toolchains, [](const BadToolchain &bdc) {
|
||||
return QVariant::fromValue(bdc.toMap());
|
||||
return variantFromStore(bdc.toMap());
|
||||
});
|
||||
}
|
||||
|
||||
BadToolchains BadToolchains::fromVariant(const QVariant &v)
|
||||
{
|
||||
return Utils::transform<QList<BadToolchain>>(v.toList(),
|
||||
[](const QVariant &e) { return BadToolchain::fromMap(e.value<Store>()); });
|
||||
[](const QVariant &e) { return BadToolchain::fromMap(storeFromVariant(e)); });
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -224,7 +224,7 @@ void ToolChainSettingsAccessor::saveToolChains(const Toolchains &toolchains, QWi
|
||||
tc->toMap(tmp);
|
||||
if (tmp.isEmpty())
|
||||
continue;
|
||||
data.insert(TOOLCHAIN_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
|
||||
data.insert(TOOLCHAIN_DATA_KEY + Key::number(count), variantFromStore(tmp));
|
||||
++count;
|
||||
}
|
||||
data.insert(TOOLCHAIN_COUNT_KEY, count);
|
||||
@@ -245,7 +245,7 @@ Toolchains ToolChainSettingsAccessor::toolChains(const Store &data) const
|
||||
if (!data.contains(key))
|
||||
break;
|
||||
|
||||
const Store tcMap = data.value(key).value<Store>();
|
||||
const Store tcMap = storeFromVariant(data.value(key));
|
||||
|
||||
bool restored = false;
|
||||
const Utils::Id tcType = ToolChainFactory::typeIdFromMap(tcMap);
|
||||
|
||||
@@ -405,7 +405,7 @@ Store UserFileAccessor::postprocessMerge(const Store &main,
|
||||
const Store &secondary,
|
||||
const Store &result) const
|
||||
{
|
||||
project()->setProperty(SHARED_SETTINGS, QVariant::fromValue(secondary));
|
||||
project()->setProperty(SHARED_SETTINGS, variantFromStore(secondary));
|
||||
return MergingSettingsAccessor::postprocessMerge(main, secondary, result);
|
||||
}
|
||||
|
||||
@@ -429,12 +429,12 @@ Store UserFileAccessor::preprocessReadSettings(const Store &data) const
|
||||
Store UserFileAccessor::prepareToWriteSettings(const Store &data) const
|
||||
{
|
||||
const Store tmp = MergingSettingsAccessor::prepareToWriteSettings(data);
|
||||
const Store shared = retrieveSharedSettings().value<Store>();
|
||||
const Store shared = storeFromVariant(retrieveSharedSettings());
|
||||
Store result;
|
||||
if (!shared.isEmpty()) {
|
||||
KeyList stickyKeys;
|
||||
SettingsMergeFunction merge = userStickyTrackerFunction(stickyKeys);
|
||||
result = mergeQVariantMaps(tmp, shared, merge).value<Store>();
|
||||
result = storeFromVariant(mergeQVariantMaps(tmp, shared, merge));
|
||||
result.insert(USER_STICKY_KEYS_KEY, stringsFromKeys(stickyKeys));
|
||||
} else {
|
||||
result = tmp;
|
||||
@@ -454,7 +454,7 @@ Store UserFileVersion14Upgrader::upgrade(const Store &map)
|
||||
Store result;
|
||||
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
|
||||
if (it.value().typeId() == QVariant::Map)
|
||||
result.insert(it.key(), QVariant::fromValue(upgrade(it.value().value<Store>())));
|
||||
result.insert(it.key(), variantFromStore(upgrade(storeFromVariant(it.value()))));
|
||||
else if (it.key() == "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory"
|
||||
|| it.key() == "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory"
|
||||
|| it.key() == "GenericProjectManager.GenericBuildConfiguration.BuildDirectory"
|
||||
@@ -490,11 +490,11 @@ UserFileVersion16Upgrader::OldStepMaps UserFileVersion16Upgrader::extractStepMap
|
||||
result.defaultDisplayName = deployMap.value("ProjectExplorer.ProjectConfiguration.DefaultDisplayName").toString();
|
||||
result.displayName = deployMap.value("ProjectExplorer.ProjectConfiguration.DisplayName").toString();
|
||||
const Key stepListKey = "ProjectExplorer.BuildConfiguration.BuildStepList.0";
|
||||
Store stepListMap = deployMap.value(stepListKey).value<Store>();
|
||||
Store stepListMap = storeFromVariant(deployMap.value(stepListKey));
|
||||
int stepCount = stepListMap.value("ProjectExplorer.BuildStepList.StepsCount", 0).toInt();
|
||||
Key stepKey = "ProjectExplorer.BuildStepList.Step.";
|
||||
for (int i = 0; i < stepCount; ++i) {
|
||||
Store stepMap = stepListMap.value(stepKey + Key::number(i)).value<Store>();
|
||||
Store stepMap = storeFromVariant(stepListMap.value(stepKey + Key::number(i)));
|
||||
const QString id = stepMap.value("ProjectExplorer.ProjectConfiguration.Id").toString();
|
||||
if (id == "Qt4ProjectManager.AndroidDeployQtStep")
|
||||
result.androidDeployQt = stepMap;
|
||||
@@ -510,16 +510,16 @@ UserFileVersion16Upgrader::OldStepMaps UserFileVersion16Upgrader::extractStepMap
|
||||
Store UserFileVersion16Upgrader::removeAndroidPackageStep(Store deployMap)
|
||||
{
|
||||
const Key stepListKey = "ProjectExplorer.BuildConfiguration.BuildStepList.0";
|
||||
Store stepListMap = deployMap.value(stepListKey).value<Store>();
|
||||
Store stepListMap = storeFromVariant(deployMap.value(stepListKey));
|
||||
const Key stepCountKey = "ProjectExplorer.BuildStepList.StepsCount";
|
||||
int stepCount = stepListMap.value(stepCountKey, 0).toInt();
|
||||
Key stepKey = "ProjectExplorer.BuildStepList.Step.";
|
||||
int targetPosition = 0;
|
||||
for (int sourcePosition = 0; sourcePosition < stepCount; ++sourcePosition) {
|
||||
Store stepMap = stepListMap.value(stepKey + Key::number(sourcePosition)).value<Store>();
|
||||
Store stepMap = storeFromVariant(stepListMap.value(stepKey + Key::number(sourcePosition)));
|
||||
if (stepMap.value("ProjectExplorer.ProjectConfiguration.Id").toString()
|
||||
!= "Qt4ProjectManager.AndroidPackageInstallationStep") {
|
||||
stepListMap.insert(stepKey + Key::number(targetPosition), QVariant::fromValue(stepMap));
|
||||
stepListMap.insert(stepKey + Key::number(targetPosition), variantFromStore(stepMap));
|
||||
++targetPosition;
|
||||
}
|
||||
}
|
||||
@@ -529,7 +529,7 @@ Store UserFileVersion16Upgrader::removeAndroidPackageStep(Store deployMap)
|
||||
for (int i = targetPosition; i < stepCount; ++i)
|
||||
stepListMap.remove(stepKey + Key::number(i));
|
||||
|
||||
deployMap.insert(stepListKey, QVariant::fromValue(stepListMap));
|
||||
deployMap.insert(stepListKey, variantFromStore(stepListMap));
|
||||
return deployMap;
|
||||
}
|
||||
|
||||
@@ -598,10 +598,10 @@ Store UserFileVersion16Upgrader::insertSteps(Store buildConfigurationMap,
|
||||
androidBuildApkStep.insert(VerboseOutputKey, verbose);
|
||||
|
||||
const Key buildStepKey = "ProjectExplorer.BuildStepList.Step.";
|
||||
buildStepListMap.insert(buildStepKey + Key::number(stepCount), QVariant::fromValue(androidPackageInstallStep));
|
||||
buildStepListMap.insert(buildStepKey + Key::number(stepCount + 1), QVariant::fromValue(androidBuildApkStep));
|
||||
buildStepListMap.insert(buildStepKey + Key::number(stepCount), variantFromStore(androidPackageInstallStep));
|
||||
buildStepListMap.insert(buildStepKey + Key::number(stepCount + 1), variantFromStore(androidBuildApkStep));
|
||||
|
||||
buildConfigurationMap.insert(bslKey + Key::number(bslNumber), QVariant::fromValue(buildStepListMap));
|
||||
buildConfigurationMap.insert(bslKey + Key::number(bslNumber), variantFromStore(buildStepListMap));
|
||||
}
|
||||
|
||||
if (policy == RenameBuildConfiguration) {
|
||||
@@ -638,7 +638,7 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
|
||||
|
||||
for (int i = 0; i < targetCount; ++i) {
|
||||
Key targetKey = "ProjectExplorer.Project.Target." + Key::number(i);
|
||||
Store targetMap = data.value(targetKey).value<Store>();
|
||||
Store targetMap = storeFromVariant(data.value(targetKey));
|
||||
|
||||
const Key dcCountKey = "ProjectExplorer.Target.DeployConfigurationCount";
|
||||
int deployconfigurationCount = targetMap.value(dcCountKey).toInt();
|
||||
@@ -651,7 +651,7 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
|
||||
Key deployKey = "ProjectExplorer.Target.DeployConfiguration.";
|
||||
for (int j = 0; j < deployconfigurationCount; ++j) {
|
||||
Store deployConfigurationMap
|
||||
= targetMap.value(deployKey + Key::number(j)).value<Store>();
|
||||
= storeFromVariant(targetMap.value(deployKey + Key::number(j)));
|
||||
OldStepMaps oldStep = extractStepMaps(deployConfigurationMap);
|
||||
if (!oldStep.isEmpty()) {
|
||||
oldSteps.append(oldStep);
|
||||
@@ -672,7 +672,7 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
|
||||
|
||||
Key bcKey = "ProjectExplorer.Target.BuildConfiguration.";
|
||||
for (int j = 0; j < buildConfigurationCount; ++j) {
|
||||
Store oldBuildConfigurationMap = targetMap.value(bcKey + Key::number(j)).value<Store>();
|
||||
Store oldBuildConfigurationMap = storeFromVariant(targetMap.value(bcKey + Key::number(j)));
|
||||
oldBuildConfigurations.append(oldBuildConfigurationMap);
|
||||
}
|
||||
|
||||
@@ -691,8 +691,8 @@ Store UserFileVersion16Upgrader::upgrade(const Store &data)
|
||||
targetMap.insert(bcCountKey, newBuildConfigurations.size());
|
||||
|
||||
for (int j = 0; j < newBuildConfigurations.size(); ++j)
|
||||
targetMap.insert(bcKey + Key::number(j), QVariant::fromValue(newBuildConfigurations.at(j)));
|
||||
result.insert(targetKey, QVariant::fromValue(targetMap));
|
||||
targetMap.insert(bcKey + Key::number(j), variantFromStore(newBuildConfigurations.at(j)));
|
||||
result.insert(targetKey, variantFromStore(targetMap));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -703,7 +703,7 @@ Store UserFileVersion17Upgrader::upgrade(const Store &map)
|
||||
m_sticky = map.value(USER_STICKY_KEYS_KEY).toList();
|
||||
if (m_sticky.isEmpty())
|
||||
return map;
|
||||
return process(QVariant::fromValue(map)).value<Store>();
|
||||
return storeFromVariant(process(variantFromStore(map)));
|
||||
}
|
||||
|
||||
QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
|
||||
@@ -716,13 +716,13 @@ QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
|
||||
return result;
|
||||
}
|
||||
case QVariant::Map: {
|
||||
Store result = entry.value<Store>();
|
||||
Store result = storeFromVariant(entry);
|
||||
for (Store::iterator i = result.begin(), end = result.end(); i != end; ++i) {
|
||||
QVariant &v = i.value();
|
||||
v = process(v);
|
||||
}
|
||||
result.insert(USER_STICKY_KEYS_KEY, m_sticky);
|
||||
return QVariant::fromValue(result);
|
||||
return variantFromStore(result);
|
||||
}
|
||||
default:
|
||||
return entry;
|
||||
@@ -731,7 +731,7 @@ QVariant UserFileVersion17Upgrader::process(const QVariant &entry)
|
||||
|
||||
Store UserFileVersion18Upgrader::upgrade(const Store &map)
|
||||
{
|
||||
return process(QVariant::fromValue(map)).value<Store>();
|
||||
return storeFromVariant(process(variantFromStore(map)));
|
||||
}
|
||||
|
||||
QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
|
||||
@@ -740,7 +740,7 @@ QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
|
||||
case QVariant::List:
|
||||
return Utils::transform(entry.toList(), &UserFileVersion18Upgrader::process);
|
||||
case QVariant::Map: {
|
||||
Store map = entry.value<Store>();
|
||||
Store map = storeFromVariant(entry);
|
||||
Store result;
|
||||
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
|
||||
Key key = it.key() == "AutotoolsProjectManager.MakeStep.AdditionalArguments"
|
||||
@@ -748,7 +748,7 @@ QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
|
||||
: it.key();
|
||||
result.insert(key, UserFileVersion18Upgrader::process(it.value()));
|
||||
}
|
||||
return QVariant::fromValue(result);
|
||||
return variantFromStore(result);
|
||||
}
|
||||
default:
|
||||
return entry;
|
||||
@@ -757,7 +757,7 @@ QVariant UserFileVersion18Upgrader::process(const QVariant &entry)
|
||||
|
||||
Store UserFileVersion19Upgrader::upgrade(const Store &map)
|
||||
{
|
||||
return process(QVariant::fromValue(map), KeyList()).value<Store>();
|
||||
return storeFromVariant(process(variantFromStore(map), KeyList()));
|
||||
}
|
||||
|
||||
QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const KeyList &path)
|
||||
@@ -797,7 +797,7 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const KeyList
|
||||
return Utils::transform(entry.toList(),
|
||||
std::bind(&UserFileVersion19Upgrader::process, std::placeholders::_1, path));
|
||||
case QVariant::Map: {
|
||||
Store map = entry.value<Store>();
|
||||
Store map = storeFromVariant(entry);
|
||||
Store result;
|
||||
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
|
||||
Key key = it.key();
|
||||
@@ -820,7 +820,7 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const KeyList
|
||||
}
|
||||
result.insert(key, value);
|
||||
};
|
||||
return QVariant::fromValue(result);
|
||||
return variantFromStore(result);
|
||||
}
|
||||
default:
|
||||
return entry;
|
||||
@@ -829,7 +829,7 @@ QVariant UserFileVersion19Upgrader::process(const QVariant &entry, const KeyList
|
||||
|
||||
Store UserFileVersion20Upgrader::upgrade(const Store &map)
|
||||
{
|
||||
return process(QVariant::fromValue(map)).value<Store>();
|
||||
return storeFromVariant(process(variantFromStore(map)));
|
||||
}
|
||||
|
||||
QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
|
||||
@@ -838,7 +838,7 @@ QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
|
||||
case QVariant::List:
|
||||
return Utils::transform(entry.toList(), &UserFileVersion20Upgrader::process);
|
||||
case QVariant::Map: {
|
||||
Store map = entry.value<Store>();
|
||||
Store map = storeFromVariant(entry);
|
||||
Store result;
|
||||
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) {
|
||||
Key key = it.key();
|
||||
@@ -849,7 +849,7 @@ QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
|
||||
value = UserFileVersion20Upgrader::process(value);
|
||||
result.insert(key, value);
|
||||
}
|
||||
return QVariant::fromValue(result);
|
||||
return variantFromStore(result);
|
||||
}
|
||||
default:
|
||||
return entry;
|
||||
@@ -858,7 +858,7 @@ QVariant UserFileVersion20Upgrader::process(const QVariant &entry)
|
||||
|
||||
Store UserFileVersion21Upgrader::upgrade(const Store &map)
|
||||
{
|
||||
return process(QVariant::fromValue(map)).value<Store>();
|
||||
return storeFromVariant(process(variantFromStore(map)));
|
||||
}
|
||||
|
||||
QVariant UserFileVersion21Upgrader::process(const QVariant &entry)
|
||||
@@ -867,17 +867,17 @@ QVariant UserFileVersion21Upgrader::process(const QVariant &entry)
|
||||
case QVariant::List:
|
||||
return Utils::transform(entry.toList(), &UserFileVersion21Upgrader::process);
|
||||
case QVariant::Map: {
|
||||
Store entryMap = entry.value<Store>();
|
||||
Store entryMap = storeFromVariant(entry);
|
||||
if (entryMap.value("ProjectExplorer.ProjectConfiguration.Id").toString()
|
||||
== "DeployToGenericLinux") {
|
||||
entryMap.insert("_checkMakeInstall", true);
|
||||
return QVariant::fromValue(entryMap);
|
||||
return variantFromStore(entryMap);
|
||||
}
|
||||
Store map = entry.value<Store>();
|
||||
Store map = storeFromVariant(entry);
|
||||
Store result;
|
||||
for (auto it = map.cbegin(), end = map.cend(); it != end; ++it)
|
||||
result.insert(it.key(), UserFileVersion21Upgrader::process(it.value()));
|
||||
return QVariant::fromValue(result);
|
||||
return variantFromStore(result);
|
||||
}
|
||||
default:
|
||||
return entry;
|
||||
@@ -898,7 +898,7 @@ public:
|
||||
TestUserFileAccessor(Project *project) : UserFileAccessor(project) { }
|
||||
|
||||
void storeSharedSettings(const Store &data) const { m_storedSettings = data; }
|
||||
QVariant retrieveSharedSettings() const override { return QVariant::fromValue(m_storedSettings); }
|
||||
QVariant retrieveSharedSettings() const override { return variantFromStore(m_storedSettings); }
|
||||
|
||||
using UserFileAccessor::preprocessReadSettings;
|
||||
using UserFileAccessor::prepareToWriteSettings;
|
||||
|
||||
@@ -442,7 +442,7 @@ public:
|
||||
if (tmp.isEmpty())
|
||||
continue;
|
||||
|
||||
data.insert(QNXConfigDataKey + Key::number(count), QVariant::fromValue(tmp));
|
||||
data.insert(QNXConfigDataKey + Key::number(count), variantFromStore(tmp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ public:
|
||||
continue;
|
||||
|
||||
QnxConfiguration config;
|
||||
config.fromMap(data.value(key).value<Store>());
|
||||
config.fromMap(storeFromVariant(data.value(key)));
|
||||
m_configurations[config.m_envFile] = config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ static bool restoreQtVersions()
|
||||
if (!ok || count < 0)
|
||||
continue;
|
||||
|
||||
const Store qtversionMap = it.value().value<Store>();
|
||||
const Store qtversionMap = storeFromVariant(it.value());
|
||||
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
|
||||
|
||||
bool restored = false;
|
||||
@@ -261,7 +261,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
|
||||
if (!ok || count < 0)
|
||||
continue;
|
||||
|
||||
Store qtversionMap = it.value().value<Store>();
|
||||
Store qtversionMap = storeFromVariant(it.value());
|
||||
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
|
||||
const QString autoDetectionSource = qtversionMap.value("autodetectionSource").toString();
|
||||
sdkVersions << autoDetectionSource;
|
||||
|
||||
@@ -208,7 +208,7 @@ ICodeStylePreferences *CodeStylePool::loadCodeStyle(const FilePath &fileName)
|
||||
if (m.contains(codeStyleDataKey)) {
|
||||
const QByteArray id = fileName.completeBaseName().toUtf8();
|
||||
const QString displayName = reader.restoreValue(displayNameKey).toString();
|
||||
const Store map = reader.restoreValue(codeStyleDataKey).value<Store>();
|
||||
const Store map = storeFromVariant(reader.restoreValue(codeStyleDataKey));
|
||||
if (d->m_factory) {
|
||||
codeStyle = d->m_factory->createCodeStyle();
|
||||
codeStyle->setId(id);
|
||||
@@ -245,7 +245,7 @@ void CodeStylePool::exportCodeStyle(const FilePath &fileName, ICodeStylePreferen
|
||||
const Store map = codeStyle->toMap();
|
||||
const Store tmp = {
|
||||
{displayNameKey, codeStyle->displayName()},
|
||||
{codeStyleDataKey, QVariant::fromValue(map)}
|
||||
{codeStyleDataKey, variantFromStore(map)}
|
||||
};
|
||||
PersistentSettingsWriter writer(fileName, QLatin1String(codeStyleDocKey));
|
||||
writer.save(tmp, Core::ICore::dialogParent());
|
||||
|
||||
Reference in New Issue
Block a user