Plugins: A bit more Keys and Store

Change-Id: Iee55eeaa881dd9f2047fdbe95ad8d827f4ba34e0
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-08-24 16:14:26 +02:00
parent e1e1af36d2
commit 8d0aa34bfc
53 changed files with 243 additions and 239 deletions

View File

@@ -89,52 +89,50 @@ const char LinuxOsKey[] = "linux";
const char WindowsOsKey[] = "windows"; const char WindowsOsKey[] = "windows";
const char macOsKey[] = "mac"; const char macOsKey[] = "mac";
const char SettingsGroup[] = "AndroidConfigurations";
const char SDKLocationKey[] = "SDKLocation";
const char CustomNdkLocationsKey[] = "CustomNdkLocations";
const char DefaultNdkLocationKey[] = "DefaultNdkLocation";
const char SdkFullyConfiguredKey[] = "AllEssentialsInstalled";
const char SDKManagerToolArgsKey[] = "SDKManagerToolArgs";
const char OpenJDKLocationKey[] = "OpenJDKLocation";
const char OpenSslPriLocationKey[] = "OpenSSLPriLocation";
const char AutomaticKitCreationKey[] = "AutomatiKitCreation";
const char EmulatorArgsKey[] = "EmulatorArgs";
namespace { const QLatin1String ArmToolchainPrefix("arm-linux-androideabi");
const QLatin1String SettingsGroup("AndroidConfigurations"); const QLatin1String X86ToolchainPrefix("x86");
const QLatin1String SDKLocationKey("SDKLocation"); const QLatin1String AArch64ToolchainPrefix("aarch64-linux-android");
const QLatin1String CustomNdkLocationsKey("CustomNdkLocations"); const QLatin1String X86_64ToolchainPrefix("x86_64");
const QLatin1String DefaultNdkLocationKey("DefaultNdkLocation");
const QLatin1String SdkFullyConfiguredKey("AllEssentialsInstalled");
const QLatin1String SDKManagerToolArgsKey("SDKManagerToolArgs");
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
const QLatin1String OpenSslPriLocationKey("OpenSSLPriLocation");
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
const QLatin1String EmulatorArgsKey("EmulatorArgs");
const QLatin1String ArmToolchainPrefix("arm-linux-androideabi"); const QLatin1String ArmToolsPrefix ("arm-linux-androideabi");
const QLatin1String X86ToolchainPrefix("x86"); const QLatin1String X86ToolsPrefix("i686-linux-android");
const QLatin1String AArch64ToolchainPrefix("aarch64-linux-android"); const QLatin1String AArch64ToolsPrefix("aarch64-linux-android");
const QLatin1String X86_64ToolchainPrefix("x86_64"); const QLatin1String X86_64ToolsPrefix("x86_64-linux-android");
const QLatin1String ArmToolsPrefix("arm-linux-androideabi"); const QLatin1String ArmToolsDisplayName("arm");
const QLatin1String X86ToolsPrefix("i686-linux-android"); const QLatin1String X86ToolsDisplayName("i686");
const QLatin1String AArch64ToolsPrefix("aarch64-linux-android"); const QLatin1String AArch64ToolsDisplayName("aarch64");
const QLatin1String X86_64ToolsPrefix("x86_64-linux-android"); const QLatin1String X86_64ToolsDisplayName("x86_64");
const QLatin1String ArmToolsDisplayName("arm"); const QLatin1String Unknown("unknown");
const QLatin1String X86ToolsDisplayName("i686"); const QLatin1String keytoolName("keytool");
const QLatin1String AArch64ToolsDisplayName("aarch64"); const QLatin1String changeTimeStamp("ChangeTimeStamp");
const QLatin1String X86_64ToolsDisplayName("x86_64");
const QLatin1String Unknown("unknown"); const char sdkToolsVersionKey[] = "Pkg.Revision";
const QLatin1String keytoolName("keytool"); const char ndkRevisionKey[] = "Pkg.Revision";
const QLatin1String changeTimeStamp("ChangeTimeStamp");
const QLatin1String sdkToolsVersionKey("Pkg.Revision"); static QString sdkSettingsFileName()
const QLatin1String ndkRevisionKey("Pkg.Revision"); {
return Core::ICore::installerResourcePath("android.xml").toString();
static QString sdkSettingsFileName()
{
return Core::ICore::installerResourcePath("android.xml").toString();
}
static QString ndkPackageMarker()
{
return QLatin1String(Constants::ndkPackageName) + ";";
}
} }
static QString ndkPackageMarker()
{
return QLatin1String(Constants::ndkPackageName) + ";";
}
////////////////////////////////// //////////////////////////////////
// AndroidConfig // AndroidConfig
////////////////////////////////// //////////////////////////////////

View File

@@ -79,9 +79,9 @@ void BareMetalDevice::fromMap(const Store &map)
} }
} }
QVariantMap BareMetalDevice::toMap() const Store BareMetalDevice::toMap() const
{ {
QVariantMap map = IDevice::toMap(); Store map = IDevice::toMap();
map.insert(debugServerProviderIdKeyC, debugServerProviderId()); map.insert(debugServerProviderIdKeyC, debugServerProviderId());
return map; return map;
} }

View File

@@ -8,6 +8,9 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/store.h>
using namespace Utils;
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -97,10 +100,10 @@ void ClangToolsProjectSettings::removeAllSuppressedDiagnostics()
emit suppressedDiagnosticsChanged(); emit suppressedDiagnosticsChanged();
} }
static QVariantMap convertToMapFromVersionBefore410(ProjectExplorer::Project *p) static Store convertToMapFromVersionBefore410(ProjectExplorer::Project *p)
{ {
// These keys haven't changed. // These keys haven't changed.
const QStringList keys = { const Key keys[] = {
SETTINGS_KEY_SELECTED_DIRS, SETTINGS_KEY_SELECTED_DIRS,
SETTINGS_KEY_SELECTED_FILES, SETTINGS_KEY_SELECTED_FILES,
SETTINGS_KEY_SUPPRESSED_DIAGS, SETTINGS_KEY_SUPPRESSED_DIAGS,
@@ -108,8 +111,8 @@ static QVariantMap convertToMapFromVersionBefore410(ProjectExplorer::Project *p)
"ClangTools.BuildBeforeAnalysis", "ClangTools.BuildBeforeAnalysis",
}; };
QVariantMap map; Store map;
for (const QString &key : keys) for (const Key &key : keys)
map.insert(key, p->namedSettings(key)); map.insert(key, p->namedSettings(key));
map.insert(SETTINGS_PREFIX + QString(diagnosticConfigIdKey), map.insert(SETTINGS_PREFIX + QString(diagnosticConfigIdKey),
@@ -121,7 +124,7 @@ static QVariantMap convertToMapFromVersionBefore410(ProjectExplorer::Project *p)
void ClangToolsProjectSettings::load() void ClangToolsProjectSettings::load()
{ {
// Load map // Load map
QVariantMap map = m_project->namedSettings(SETTINGS_KEY_MAIN).toMap(); Store map = m_project->namedSettings(SETTINGS_KEY_MAIN).toMap();
bool write = false; bool write = false;
if (map.isEmpty()) { if (map.isEmpty()) {
@@ -145,7 +148,7 @@ void ClangToolsProjectSettings::load()
const QVariantList list = map.value(SETTINGS_KEY_SUPPRESSED_DIAGS).toList(); const QVariantList list = map.value(SETTINGS_KEY_SUPPRESSED_DIAGS).toList();
for (const QVariant &v : list) { for (const QVariant &v : list) {
const QVariantMap diag = v.toMap(); const Store diag = v.toMap();
const QString fp = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH).toString(); const QString fp = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH).toString();
if (fp.isEmpty()) if (fp.isEmpty())
continue; continue;
@@ -172,7 +175,7 @@ void ClangToolsProjectSettings::load()
void ClangToolsProjectSettings::store() void ClangToolsProjectSettings::store()
{ {
QVariantMap map; Store map;
map.insert(SETTINGS_KEY_USE_GLOBAL_SETTINGS, m_useGlobalSettings); map.insert(SETTINGS_KEY_USE_GLOBAL_SETTINGS, m_useGlobalSettings);
const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString); const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString);
@@ -183,7 +186,7 @@ void ClangToolsProjectSettings::store()
QVariantList list; QVariantList list;
for (const SuppressedDiagnostic &diag : std::as_const(m_suppressedDiagnostics)) { for (const SuppressedDiagnostic &diag : std::as_const(m_suppressedDiagnostics)) {
QVariantMap diagMap; Store diagMap;
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH, diag.filePath.toString()); 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_MESSAGE, diag.description);
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER, diag.uniquifier); diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER, diag.uniquifier);

View File

@@ -1433,7 +1433,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
setInitializer([this, target](const BuildInfo &info) { setInitializer([this, target](const BuildInfo &info) {
const Kit *k = target->kit(); const Kit *k = target->kit();
const QtSupport::QtVersion *qt = QtSupport::QtKitAspect::qtVersion(k); const QtSupport::QtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
const QVariantMap extraInfoMap = info.extraInfo.value<QVariantMap>(); const Store extraInfoMap = info.extraInfo.value<Store>();
const QString buildType = extraInfoMap.contains(CMAKE_BUILD_TYPE) const QString buildType = extraInfoMap.contains(CMAKE_BUILD_TYPE)
? extraInfoMap.value(CMAKE_BUILD_TYPE).toString() ? extraInfoMap.value(CMAKE_BUILD_TYPE).toString()
: info.typeName; : info.typeName;
@@ -1939,7 +1939,7 @@ BuildInfo CMakeBuildConfigurationFactory::createBuildInfo(BuildType buildType)
info.typeName = "Debug"; info.typeName = "Debug";
info.displayName = ::ProjectExplorer::Tr::tr("Debug"); info.displayName = ::ProjectExplorer::Tr::tr("Debug");
info.buildType = BuildConfiguration::Debug; info.buildType = BuildConfiguration::Debug;
QVariantMap extraInfo; Store extraInfo;
// enable QML debugging by default // enable QML debugging by default
extraInfo.insert(Constants::QML_DEBUG_SETTING, TriState::Enabled.toVariant()); extraInfo.insert(Constants::QML_DEBUG_SETTING, TriState::Enabled.toVariant());
info.extraInfo = extraInfo; info.extraInfo = extraInfo;
@@ -1964,7 +1964,7 @@ BuildInfo CMakeBuildConfigurationFactory::createBuildInfo(BuildType buildType)
info.typeName = "Profile"; info.typeName = "Profile";
info.displayName = Tr::tr("Profile"); info.displayName = Tr::tr("Profile");
info.buildType = BuildConfiguration::Profile; info.buildType = BuildConfiguration::Profile;
QVariantMap extraInfo; Store extraInfo;
// override CMake build type, which defaults to info.typeName // override CMake build type, which defaults to info.typeName
extraInfo.insert(CMAKE_BUILD_TYPE, "RelWithDebInfo"); extraInfo.insert(CMAKE_BUILD_TYPE, "RelWithDebInfo");
// enable QML debugging by default // enable QML debugging by default
@@ -2234,32 +2234,29 @@ ConfigureEnvironmentAspect::ConfigureEnvironmentAspect(AspectContainer *containe
void ConfigureEnvironmentAspect::fromMap(const Store &map) void ConfigureEnvironmentAspect::fromMap(const Store &map)
{ {
// Match the key values from Qt Creator 9.0.0/1 to the ones from EnvironmentAspect // Match the key values from Qt Creator 9.0.0/1 to the ones from EnvironmentAspect
const bool cleanSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)) const bool cleanSystemEnvironment = map.value(CLEAR_SYSTEM_ENVIRONMENT_KEY).toBool();
.toBool();
const QStringList userEnvironmentChanges const QStringList userEnvironmentChanges
= map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList(); = map.value(USER_ENVIRONMENT_CHANGES_KEY).toStringList();
const int baseEnvironmentIndex const int baseEnvironmentIndex = map.value(BASE_ENVIRONMENT_KEY, baseEnvironmentBase()).toInt();
= map.value(QLatin1String(BASE_ENVIRONMENT_KEY), baseEnvironmentBase()).toInt();
QVariantMap tmpMap; Store tmpMap;
tmpMap.insert(QLatin1String(BASE_KEY), cleanSystemEnvironment ? 0 : baseEnvironmentIndex); tmpMap.insert(BASE_KEY, cleanSystemEnvironment ? 0 : baseEnvironmentIndex);
tmpMap.insert(QLatin1String(CHANGES_KEY), userEnvironmentChanges); tmpMap.insert(CHANGES_KEY, userEnvironmentChanges);
ProjectExplorer::EnvironmentAspect::fromMap(tmpMap); ProjectExplorer::EnvironmentAspect::fromMap(tmpMap);
} }
void ConfigureEnvironmentAspect::toMap(Store &map) const void ConfigureEnvironmentAspect::toMap(Store &map) const
{ {
QVariantMap tmpMap; Store tmpMap;
ProjectExplorer::EnvironmentAspect::toMap(tmpMap); ProjectExplorer::EnvironmentAspect::toMap(tmpMap);
const int baseKey = tmpMap.value(BASE_KEY).toInt(); const int baseKey = tmpMap.value(BASE_KEY).toInt();
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), baseKey == 0); map.insert(CLEAR_SYSTEM_ENVIRONMENT_KEY, baseKey == 0);
map.insert(QLatin1String(BASE_ENVIRONMENT_KEY), baseKey); map.insert(BASE_ENVIRONMENT_KEY, baseKey);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), map.insert(USER_ENVIRONMENT_CHANGES_KEY, tmpMap.value(CHANGES_KEY).toStringList());
tmpMap.value(CHANGES_KEY).toStringList());
} }
} // namespace Internal } // namespace Internal

View File

@@ -277,23 +277,22 @@ void CMakeBuildStep::toMap(Utils::Store &map) const
{ {
CMakeAbstractProcessStep::toMap(map); CMakeAbstractProcessStep::toMap(map);
map.insert(BUILD_TARGETS_KEY, m_buildTargets); map.insert(BUILD_TARGETS_KEY, m_buildTargets);
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment); map.insert(CLEAR_SYSTEM_ENVIRONMENT_KEY, m_clearSystemEnvironment);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(m_userEnvironmentChanges)); map.insert(USER_ENVIRONMENT_CHANGES_KEY, EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.insert(QLatin1String(BUILD_PRESET_KEY), m_buildPreset); map.insert(BUILD_PRESET_KEY, m_buildPreset);
} }
void CMakeBuildStep::fromMap(const Utils::Store &map) void CMakeBuildStep::fromMap(const Utils::Store &map)
{ {
setBuildTargets(map.value(BUILD_TARGETS_KEY).toStringList()); setBuildTargets(map.value(BUILD_TARGETS_KEY).toStringList());
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)) m_clearSystemEnvironment = map.value(CLEAR_SYSTEM_ENVIRONMENT_KEY).toBool();
.toBool();
m_userEnvironmentChanges = EnvironmentItem::fromStringList( m_userEnvironmentChanges = EnvironmentItem::fromStringList(
map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList()); map.value(USER_ENVIRONMENT_CHANGES_KEY).toStringList());
updateAndEmitEnvironmentChanged(); updateAndEmitEnvironmentChanged();
m_buildPreset = map.value(QLatin1String(BUILD_PRESET_KEY)).toString(); m_buildPreset = map.value(BUILD_PRESET_KEY).toString();
BuildStep::fromMap(map); BuildStep::fromMap(map);
} }

View File

@@ -409,14 +409,14 @@ CMakeToolItemConfigWidget::CMakeToolItemConfigWidget(CMakeToolItemModel *model)
m_binaryChooser = new PathChooser(this); m_binaryChooser = new PathChooser(this);
m_binaryChooser->setExpectedKind(PathChooser::ExistingCommand); m_binaryChooser->setExpectedKind(PathChooser::ExistingCommand);
m_binaryChooser->setMinimumWidth(400); m_binaryChooser->setMinimumWidth(400);
m_binaryChooser->setHistoryCompleter(QLatin1String("Cmake.Command.History")); m_binaryChooser->setHistoryCompleter("Cmake.Command.History");
m_binaryChooser->setCommandVersionArguments({"--version"}); m_binaryChooser->setCommandVersionArguments({"--version"});
m_binaryChooser->setAllowPathFromDevice(true); m_binaryChooser->setAllowPathFromDevice(true);
m_qchFileChooser = new PathChooser(this); m_qchFileChooser = new PathChooser(this);
m_qchFileChooser->setExpectedKind(PathChooser::File); m_qchFileChooser->setExpectedKind(PathChooser::File);
m_qchFileChooser->setMinimumWidth(400); m_qchFileChooser->setMinimumWidth(400);
m_qchFileChooser->setHistoryCompleter(QLatin1String("Cmake.qchFile.History")); m_qchFileChooser->setHistoryCompleter("Cmake.qchFile.History");
m_qchFileChooser->setPromptDialogFilter("*.qch"); m_qchFileChooser->setPromptDialogFilter("*.qch");
m_qchFileChooser->setPromptDialogTitle(Tr::tr("CMake .qch File")); m_qchFileChooser->setPromptDialogTitle(Tr::tr("CMake .qch File"));

View File

@@ -105,7 +105,7 @@ CMakeTool::CMakeTool(Detection d, const Id &id)
QTC_ASSERT(m_id.isValid(), m_id = Id::fromString(QUuid::createUuid().toString())); QTC_ASSERT(m_id.isValid(), m_id = Id::fromString(QUuid::createUuid().toString()));
} }
CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) : CMakeTool::CMakeTool(const Store &map, bool fromSdk) :
CMakeTool(fromSdk ? CMakeTool::AutoDetection : CMakeTool::ManualDetection, CMakeTool(fromSdk ? CMakeTool::AutoDetection : CMakeTool::ManualDetection,
Id::fromSetting(map.value(CMAKE_INFORMATION_ID))) Id::fromSetting(map.value(CMAKE_INFORMATION_ID)))
{ {
@@ -175,9 +175,9 @@ void CMakeTool::runCMake(Process &cmake, const QStringList &args, int timeoutS)
cmake.runBlocking(); cmake.runBlocking();
} }
QVariantMap CMakeTool::toMap() const Store CMakeTool::toMap() const
{ {
QVariantMap data; Store data;
data.insert(CMAKE_INFORMATION_DISPLAYNAME, m_displayName); data.insert(CMAKE_INFORMATION_DISPLAYNAME, m_displayName);
data.insert(CMAKE_INFORMATION_ID, m_id.toSetting()); data.insert(CMAKE_INFORMATION_ID, m_id.toSetting());
data.insert(CMAKE_INFORMATION_COMMAND, m_executable.toString()); data.insert(CMAKE_INFORMATION_COMMAND, m_executable.toString());

View File

@@ -52,7 +52,7 @@ public:
using PathMapper = std::function<Utils::FilePath (const Utils::FilePath &)>; using PathMapper = std::function<Utils::FilePath (const Utils::FilePath &)>;
explicit CMakeTool(Detection d, const Utils::Id &id); explicit CMakeTool(Detection d, const Utils::Id &id);
explicit CMakeTool(const QVariantMap &map, bool fromSdk); explicit CMakeTool(const Utils::Store &map, bool fromSdk);
~CMakeTool(); ~CMakeTool();
static Utils::Id createId(); static Utils::Id createId();

View File

@@ -30,7 +30,7 @@ public:
CMakeToolSettingsUpgraderV0() : VersionUpgrader(0, "4.6") { } CMakeToolSettingsUpgraderV0() : VersionUpgrader(0, "4.6") { }
// NOOP // NOOP
QVariantMap upgrade(const QVariantMap &data) final { return data; } Store upgrade(const Store &data) final { return data; }
}; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -170,8 +170,8 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo
const Id &defaultId, const Id &defaultId,
QWidget *parent) QWidget *parent)
{ {
QVariantMap data; Store data;
data.insert(QLatin1String(CMAKE_TOOL_DEFAULT_KEY), defaultId.toSetting()); data.insert(CMAKE_TOOL_DEFAULT_KEY, defaultId.toSetting());
int count = 0; int count = 0;
const bool autoRun = settings().autorunCMake(); const bool autoRun = settings().autorunCMake();
@@ -183,30 +183,30 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo
item->setAutorun(autoRun); item->setAutorun(autoRun);
if (fi.needsDevice() || fi.isExecutableFile()) { // be graceful for device related stuff if (fi.needsDevice() || fi.isExecutableFile()) { // be graceful for device related stuff
QVariantMap tmp = item->toMap(); Store tmp = item->toMap();
if (tmp.isEmpty()) if (tmp.isEmpty())
continue; continue;
data.insert(QString::fromLatin1(CMAKE_TOOL_DATA_KEY) + QString::number(count), tmp); data.insert(CMAKE_TOOL_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
++count; ++count;
} }
} }
data.insert(QLatin1String(CMAKE_TOOL_COUNT_KEY), count); data.insert(CMAKE_TOOL_COUNT_KEY, count);
saveSettings(data, parent); saveSettings(data, parent);
} }
CMakeToolSettingsAccessor::CMakeTools CMakeToolSettingsAccessor::CMakeTools
CMakeToolSettingsAccessor::cmakeTools(const QVariantMap &data, bool fromSdk) const CMakeToolSettingsAccessor::cmakeTools(const Store &data, bool fromSdk) const
{ {
CMakeTools result; CMakeTools result;
int count = data.value(QLatin1String(CMAKE_TOOL_COUNT_KEY), 0).toInt(); int count = data.value(CMAKE_TOOL_COUNT_KEY, 0).toInt();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
const QString key = QString::fromLatin1(CMAKE_TOOL_DATA_KEY) + QString::number(i); const Key key = CMAKE_TOOL_DATA_KEY + Key::number(i);
if (!data.contains(key)) if (!data.contains(key))
continue; continue;
const QVariantMap dbMap = data.value(key).toMap(); const Store dbMap = data.value(key).value<Store>();
auto item = std::make_unique<CMakeTool>(dbMap, fromSdk); auto item = std::make_unique<CMakeTool>(dbMap, fromSdk);
const FilePath cmakeExecutable = item->cmakeExecutable(); const FilePath cmakeExecutable = item->cmakeExecutable();
if (item->isAutoDetected() && !cmakeExecutable.needsDevice() && !cmakeExecutable.isExecutableFile()) { if (item->isAutoDetected() && !cmakeExecutable.needsDevice() && !cmakeExecutable.isExecutableFile()) {

View File

@@ -5,6 +5,7 @@
#include <utils/id.h> #include <utils/id.h>
#include <utils/settingsaccessor.h> #include <utils/settingsaccessor.h>
#include <utils/store.h>
namespace CMakeProjectManager { namespace CMakeProjectManager {
@@ -29,7 +30,7 @@ public:
QWidget *parent); QWidget *parent);
private: private:
CMakeTools cmakeTools(const QVariantMap &data, bool fromSdk) const; CMakeTools cmakeTools(const Utils::Store &data, bool fromSdk) const;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -233,7 +233,7 @@ CopilotProjectSettings::CopilotProjectSettings(ProjectExplorer::Project *project
initEnableAspect(enableCopilot); initEnableAspect(enableCopilot);
QVariantMap map = project->namedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID).toMap(); Store map = project->namedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID).value<Store>();
fromMap(map); fromMap(map);
connect(&enableCopilot, &BaseAspect::changed, this, [this, project] { save(project); }); connect(&enableCopilot, &BaseAspect::changed, this, [this, project] { save(project); });
@@ -254,9 +254,9 @@ bool CopilotProjectSettings::isEnabled() const
void CopilotProjectSettings::save(ProjectExplorer::Project *project) void CopilotProjectSettings::save(ProjectExplorer::Project *project)
{ {
QVariantMap map; Store map;
toMap(map); toMap(map);
project->setNamedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID, map); project->setNamedSettings(Constants::COPILOT_PROJECT_SETTINGS_ID, QVariant::fromValue(map));
// This triggers a restart of the Copilot language server. // This triggers a restart of the Copilot language server.
settings().apply(); settings().apply();

View File

@@ -498,7 +498,7 @@ void ClangdProjectSettings::loadSettings()
{ {
if (!m_project) if (!m_project)
return; return;
const QVariantMap data = m_project->namedSettings(clangdSettingsKey()).toMap(); const Store data = m_project->namedSettings(clangdSettingsKey()).value<Store>();
m_useGlobalSettings = data.value(clangdUseGlobalSettingsKey(), true).toBool(); m_useGlobalSettings = data.value(clangdUseGlobalSettingsKey(), true).toBool();
m_blockIndexing = data.value(clangdblockIndexingSettingsKey(), false).toBool(); m_blockIndexing = data.value(clangdblockIndexingSettingsKey(), false).toBool();
if (!m_useGlobalSettings) if (!m_useGlobalSettings)
@@ -509,17 +509,17 @@ void ClangdProjectSettings::saveSettings()
{ {
if (!m_project) if (!m_project)
return; return;
QVariantMap data; Store data;
if (!m_useGlobalSettings) if (!m_useGlobalSettings)
data = m_customSettings.toMap(); data = m_customSettings.toMap();
data.insert(clangdUseGlobalSettingsKey(), m_useGlobalSettings); data.insert(clangdUseGlobalSettingsKey(), m_useGlobalSettings);
data.insert(clangdblockIndexingSettingsKey(), m_blockIndexing); data.insert(clangdblockIndexingSettingsKey(), m_blockIndexing);
m_project->setNamedSettings(clangdSettingsKey(), data); m_project->setNamedSettings(clangdSettingsKey(), QVariant::fromValue(data));
} }
QVariantMap ClangdSettings::Data::toMap() const Store ClangdSettings::Data::toMap() const
{ {
QVariantMap map; Store map;
map.insert(useClangdKey(), useClangd); map.insert(useClangdKey(), useClangd);
map.insert(clangdPathKey(), map.insert(clangdPathKey(),
executableFilePath != fallbackClangdFilePath() ? executableFilePath.toString() executableFilePath != fallbackClangdFilePath() ? executableFilePath.toString()

View File

@@ -591,15 +591,15 @@ public:
CppCodeStylePreferences *originalCppCodeStylePreferences = CppToolsSettings::cppCodeStyle(); CppCodeStylePreferences *originalCppCodeStylePreferences = CppToolsSettings::cppCodeStyle();
if (originalCppCodeStylePreferences->codeStyleSettings() != m_pageCppCodeStylePreferences->codeStyleSettings()) { if (originalCppCodeStylePreferences->codeStyleSettings() != m_pageCppCodeStylePreferences->codeStyleSettings()) {
originalCppCodeStylePreferences->setCodeStyleSettings(m_pageCppCodeStylePreferences->codeStyleSettings()); originalCppCodeStylePreferences->setCodeStyleSettings(m_pageCppCodeStylePreferences->codeStyleSettings());
originalCppCodeStylePreferences->toSettings(QLatin1String(CppEditor::Constants::CPP_SETTINGS_ID)); originalCppCodeStylePreferences->toSettings(CppEditor::Constants::CPP_SETTINGS_ID);
} }
if (originalCppCodeStylePreferences->tabSettings() != m_pageCppCodeStylePreferences->tabSettings()) { if (originalCppCodeStylePreferences->tabSettings() != m_pageCppCodeStylePreferences->tabSettings()) {
originalCppCodeStylePreferences->setTabSettings(m_pageCppCodeStylePreferences->tabSettings()); originalCppCodeStylePreferences->setTabSettings(m_pageCppCodeStylePreferences->tabSettings());
originalCppCodeStylePreferences->toSettings(QLatin1String(CppEditor::Constants::CPP_SETTINGS_ID)); originalCppCodeStylePreferences->toSettings(CppEditor::Constants::CPP_SETTINGS_ID);
} }
if (originalCppCodeStylePreferences->currentDelegate() != m_pageCppCodeStylePreferences->currentDelegate()) { if (originalCppCodeStylePreferences->currentDelegate() != m_pageCppCodeStylePreferences->currentDelegate()) {
originalCppCodeStylePreferences->setCurrentDelegate(m_pageCppCodeStylePreferences->currentDelegate()); originalCppCodeStylePreferences->setCurrentDelegate(m_pageCppCodeStylePreferences->currentDelegate());
originalCppCodeStylePreferences->toSettings(QLatin1String(CppEditor::Constants::CPP_SETTINGS_ID)); originalCppCodeStylePreferences->toSettings(CppEditor::Constants::CPP_SETTINGS_ID);
} }
m_codeStyleEditor->apply(); m_codeStyleEditor->apply();

View File

@@ -210,7 +210,7 @@ void CppEditorDocument::reparseWithPreferredParseContext(const QString &parseCon
setPreferredParseContext(parseContextId); setPreferredParseContext(parseContextId);
// Remember the setting // Remember the setting
const QString key = Constants::PREFERRED_PARSE_CONTEXT + filePath().toString(); const Key key = Constants::PREFERRED_PARSE_CONTEXT + keyFromString(filePath().toString());
Core::SessionManager::setValue(key, parseContextId); Core::SessionManager::setValue(key, parseContextId);
// Reprocess // Reprocess
@@ -277,7 +277,7 @@ void CppEditorDocument::applyPreferredParseContextFromSettings()
if (filePath().isEmpty()) if (filePath().isEmpty())
return; return;
const QString key = Constants::PREFERRED_PARSE_CONTEXT + filePath().toString(); const Key key = Constants::PREFERRED_PARSE_CONTEXT + keyFromString(filePath().toString());
const QString parseContextId = Core::SessionManager::value(key).toString(); const QString parseContextId = Core::SessionManager::value(key).toString();
setPreferredParseContext(parseContextId); setPreferredParseContext(parseContextId);
@@ -288,7 +288,7 @@ void CppEditorDocument::applyExtraPreprocessorDirectivesFromSettings()
if (filePath().isEmpty()) if (filePath().isEmpty())
return; return;
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + filePath().toString(); const Key key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + keyFromString(filePath().toString());
const QByteArray directives = Core::SessionManager::value(key).toString().toUtf8(); const QByteArray directives = Core::SessionManager::value(key).toString().toUtf8();
setExtraPreprocessorDirectives(directives); setExtraPreprocessorDirectives(directives);

View File

@@ -336,7 +336,7 @@ CppFileSettingsWidget::CppFileSettingsWidget(CppFileSettings *settings)
m_headerSuffixComboBox->addItem(suffix); m_headerSuffixComboBox->addItem(suffix);
} }
m_licenseTemplatePathChooser->setExpectedKind(PathChooser::File); m_licenseTemplatePathChooser->setExpectedKind(PathChooser::File);
m_licenseTemplatePathChooser->setHistoryCompleter(QLatin1String("Cpp.LicenseTemplate.History")); m_licenseTemplatePathChooser->setHistoryCompleter("Cpp.LicenseTemplate.History");
m_licenseTemplatePathChooser->addButton(Tr::tr("Edit..."), this, [this] { slotEdit(); }); m_licenseTemplatePathChooser->addButton(Tr::tr("Edit..."), this, [this] { slotEdit(); });
setSettings(*m_settings); setSettings(*m_settings);

View File

@@ -432,13 +432,13 @@ const bool kSyncDefault = false;
void CppIncludeHierarchyWidget::saveSettings(QSettings *settings, int position) void CppIncludeHierarchyWidget::saveSettings(QSettings *settings, int position)
{ {
const QString key = QString("IncludeHierarchy.%1.SyncWithEditor").arg(position); const Key key = keyFromString(QString("IncludeHierarchy.%1.SyncWithEditor").arg(position));
QtcSettings::setValueWithDefault(settings, key, m_toggleSync->isChecked(), kSyncDefault); QtcSettings::setValueWithDefault(settings, key, m_toggleSync->isChecked(), kSyncDefault);
} }
void CppIncludeHierarchyWidget::restoreSettings(QSettings *settings, int position) void CppIncludeHierarchyWidget::restoreSettings(QSettings *settings, int position)
{ {
const QString key = QString("IncludeHierarchy.%1.SyncWithEditor").arg(position); const Key key = keyFromString(QString("IncludeHierarchy.%1.SyncWithEditor").arg(position));
m_toggleSync->setChecked(settings->value(key, kSyncDefault).toBool()); m_toggleSync->setChecked(settings->value(key, kSyncDefault).toBool());
} }

View File

@@ -334,14 +334,13 @@ public:
bool insertOverrideReplacement = kInsertOVerrideReplacementDefault; bool insertOverrideReplacement = kInsertOVerrideReplacementDefault;
private: private:
using _ = QLatin1String; static Key group() { return "QuickFix/InsertVirtualMethods"; }
static QString group() { return _("QuickFix/InsertVirtualMethods"); } static Key insertVirtualKeywordKey() { return "insertKeywordVirtual"; }
static QString insertVirtualKeywordKey() { return _("insertKeywordVirtual"); } static Key insertOverrideReplacementKey() { return "insertOverrideReplacement"; }
static QString insertOverrideReplacementKey() { return _("insertOverrideReplacement"); } static Key overrideReplacementIndexKey() { return "overrideReplacementIndex"; }
static QString overrideReplacementIndexKey() { return _("overrideReplacementIndex"); } static Key userAddedOverrideReplacementsKey() { return "userAddedOverrideReplacements"; }
static QString userAddedOverrideReplacementsKey() { return _("userAddedOverrideReplacements"); } static Key implementationModeKey() { return "implementationMode"; }
static QString implementationModeKey() { return _("implementationMode"); } static Key hideReimplementedFunctionsKey() { return "hideReimplementedFunctions"; }
static QString hideReimplementedFunctionsKey() { return _("hideReimplementedFunctions"); }
}; };
class InsertVirtualMethodsModel : public QAbstractItemModel class InsertVirtualMethodsModel : public QAbstractItemModel

View File

@@ -26,7 +26,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(const FilePath &filePath, QWidget *
resize(400, 300); resize(400, 300);
setWindowTitle(Tr::tr("Additional C++ Preprocessor Directives")); setWindowTitle(Tr::tr("Additional C++ Preprocessor Directives"));
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath.toString(); const Key key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + keyFromString(m_filePath.toString());
const QString directives = Core::SessionManager::value(key).toString(); const QString directives = Core::SessionManager::value(key).toString();
m_editWidget = new TextEditor::SnippetEditorWidget; m_editWidget = new TextEditor::SnippetEditorWidget;
@@ -55,7 +55,7 @@ int CppPreProcessorDialog::exec()
if (QDialog::exec() == Rejected) if (QDialog::exec() == Rejected)
return Rejected; return Rejected;
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath.toString(); const Key key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + keyFromString(m_filePath.toString());
Core::SessionManager::setValue(key, extraPreprocessorDirectives()); Core::SessionManager::setValue(key, extraPreprocessorDirectives());
return Accepted; return Accepted;

View File

@@ -13,6 +13,8 @@
#include <QSettings> #include <QSettings>
#include <QtDebug> #include <QtDebug>
using namespace Utils;
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
@@ -64,7 +66,7 @@ const Utils::FilePath &CppQuickFixProjectsSettings::filePathOfSettingsFile() con
CppQuickFixProjectsSettings::CppQuickFixProjectsSettingsPtr CppQuickFixProjectsSettings::getSettings( CppQuickFixProjectsSettings::CppQuickFixProjectsSettingsPtr CppQuickFixProjectsSettings::getSettings(
ProjectExplorer::Project *project) ProjectExplorer::Project *project)
{ {
const QString key = "CppQuickFixProjectsSettings"; const Key key = "CppQuickFixProjectsSettings";
QVariant v = project->extraData(key); QVariant v = project->extraData(key);
if (v.isNull()) { if (v.isNull()) {
v = QVariant::fromValue( v = QVariant::fromValue(

View File

@@ -25,6 +25,7 @@ const bool kSortEditorDocumentOutlineDefault = true;
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
using namespace Utils;
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
@@ -128,7 +129,7 @@ CppToolsSettings::CppToolsSettings()
pool->loadCustomCodeStyles(); pool->loadCustomCodeStyles();
// load global settings (after built-in settings are added to the pool) // load global settings (after built-in settings are added to the pool)
d->m_globalCodeStyle->fromSettings(QLatin1String(Constants::CPP_SETTINGS_ID)); d->m_globalCodeStyle->fromSettings(Constants::CPP_SETTINGS_ID);
// mimetypes to be handled // mimetypes to be handled
TextEditorSettings::registerMimeTypeForLanguageId(Constants::C_SOURCE_MIMETYPE, Constants::CPP_SETTINGS_ID); TextEditorSettings::registerMimeTypeForLanguageId(Constants::C_SOURCE_MIMETYPE, Constants::CPP_SETTINGS_ID);
@@ -158,11 +159,10 @@ CppCodeStylePreferences *CppToolsSettings::cppCodeStyle()
return d->m_globalCodeStyle; return d->m_globalCodeStyle;
} }
static QString sortEditorDocumentOutlineKey() static Key sortEditorDocumentOutlineKey()
{ {
return QLatin1String(Constants::CPPEDITOR_SETTINGSGROUP) return Key(Constants::CPPEDITOR_SETTINGSGROUP)
+ QLatin1Char('/') + '/' + Constants::CPPEDITOR_SORT_EDITOR_DOCUMENT_OUTLINE;
+ QLatin1String(Constants::CPPEDITOR_SORT_EDITOR_DOCUMENT_OUTLINE);
} }
bool CppToolsSettings::sortedEditorDocumentOutline() bool CppToolsSettings::sortedEditorDocumentOutline()

View File

@@ -31,7 +31,7 @@ CvsSettings::CvsSettings()
binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX); binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX);
binaryPath.setExpectedKind(PathChooser::ExistingCommand); binaryPath.setExpectedKind(PathChooser::ExistingCommand);
binaryPath.setHistoryCompleter(QLatin1String("Cvs.Command.History")); binaryPath.setHistoryCompleter("Cvs.Command.History");
binaryPath.setDisplayName(Tr::tr("CVS Command")); binaryPath.setDisplayName(Tr::tr("CVS Command"));
binaryPath.setLabelText(Tr::tr("CVS command:")); binaryPath.setLabelText(Tr::tr("CVS command:"));

View File

@@ -34,7 +34,7 @@ CommonSettings &commonSettings()
CommonSettings::CommonSettings() CommonSettings::CommonSettings()
{ {
setAutoApply(false); setAutoApply(false);
const QString debugModeGroup("DebugMode"); const Key debugModeGroup("DebugMode");
useAlternatingRowColors.setSettingsKey(debugModeGroup, "UseAlternatingRowColours"); useAlternatingRowColors.setSettingsKey(debugModeGroup, "UseAlternatingRowColours");
useAlternatingRowColors.setLabelText(Tr::tr("Use alternating row colors in debug views")); useAlternatingRowColors.setLabelText(Tr::tr("Use alternating row colors in debug views"));
@@ -220,7 +220,7 @@ LocalsAndExpressionsSettings::LocalsAndExpressionsSettings()
{ {
setAutoApply(false); setAutoApply(false);
const QString debugModeGroup("DebugMode"); const Key debugModeGroup("DebugMode");
useDebuggingHelpers.setSettingsKey(debugModeGroup, "UseDebuggingHelper"); useDebuggingHelpers.setSettingsKey(debugModeGroup, "UseDebuggingHelper");
useDebuggingHelpers.setDefaultValue(true); useDebuggingHelpers.setDefaultValue(true);

View File

@@ -86,8 +86,8 @@ DebuggerSettings::DebuggerSettings() :
displayStringLimit{localsAndExpressionSettings().displayStringLimit}, displayStringLimit{localsAndExpressionSettings().displayStringLimit},
defaultArraySize{localsAndExpressionSettings().defaultArraySize} defaultArraySize{localsAndExpressionSettings().defaultArraySize}
{ {
const QString debugModeGroup("DebugMode"); const Key debugModeGroup("DebugMode");
const QString cdbSettingsGroup("CDB2"); const Key cdbSettingsGroup("CDB2");
settingsDialog.setLabelText(Tr::tr("Configure Debugger...")); settingsDialog.setLabelText(Tr::tr("Configure Debugger..."));
@@ -238,7 +238,7 @@ DebuggerSettings::DebuggerSettings() :
// //
// QML Tools // QML Tools
// //
const QString qmlInspectorGroup = "QML.Inspector"; const Key qmlInspectorGroup = "QML.Inspector";
showAppOnTop.setSettingsKey(qmlInspectorGroup, "QmlInspector.ShowAppOnTop"); showAppOnTop.setSettingsKey(qmlInspectorGroup, "QmlInspector.ShowAppOnTop");
@@ -288,7 +288,7 @@ QString DebuggerSettings::dump()
{ {
QStringList msg; QStringList msg;
settings().all.forEachAspect([&msg](BaseAspect *aspect) { settings().all.forEachAspect([&msg](BaseAspect *aspect) {
QString key = aspect->settingsKey(); Key key = aspect->settingsKey();
if (!key.isEmpty()) { if (!key.isEmpty()) {
const int pos = key.indexOf('/'); const int pos = key.indexOf('/');
if (pos >= 0) if (pos >= 0)

View File

@@ -78,7 +78,7 @@ DebuggerItem::DebuggerItem(const QVariant &id)
m_id = id; m_id = id;
} }
DebuggerItem::DebuggerItem(const QVariantMap &data) DebuggerItem::DebuggerItem(const Store &data)
{ {
m_id = data.value(DEBUGGER_INFORMATION_ID).toString(); m_id = data.value(DEBUGGER_INFORMATION_ID).toString();
m_command = FilePath::fromSettings(data.value(DEBUGGER_INFORMATION_COMMAND)); m_command = FilePath::fromSettings(data.value(DEBUGGER_INFORMATION_COMMAND));
@@ -345,9 +345,9 @@ bool DebuggerItem::operator==(const DebuggerItem &other) const
&& m_workingDirectory == other.m_workingDirectory; && m_workingDirectory == other.m_workingDirectory;
} }
QVariantMap DebuggerItem::toMap() const Store DebuggerItem::toMap() const
{ {
QVariantMap data; Store data;
data.insert(DEBUGGER_INFORMATION_DISPLAYNAME, m_unexpandedDisplayName); data.insert(DEBUGGER_INFORMATION_DISPLAYNAME, m_unexpandedDisplayName);
data.insert(DEBUGGER_INFORMATION_ID, m_id); data.insert(DEBUGGER_INFORMATION_ID, m_id);
data.insert(DEBUGGER_INFORMATION_COMMAND, m_command.toSettings()); data.insert(DEBUGGER_INFORMATION_COMMAND, m_command.toSettings());

View File

@@ -30,7 +30,7 @@ class DEBUGGER_EXPORT DebuggerItem
{ {
public: public:
DebuggerItem(); DebuggerItem();
DebuggerItem(const QVariantMap &data); DebuggerItem(const Utils::Store &data);
void createId(); void createId();
bool canClone() const { return true; } bool canClone() const { return true; }

View File

@@ -755,7 +755,7 @@ void DebuggerItemModel::readDebuggers(const FilePath &fileName, bool isSystem)
PersistentSettingsReader reader; PersistentSettingsReader reader;
if (!reader.load(fileName)) if (!reader.load(fileName))
return; return;
QVariantMap data = reader.restoreValues(); Store data = reader.restoreValues();
// Check version // Check version
int version = data.value(DEBUGGER_FILE_VERSION_KEY, 0).toInt(); int version = data.value(DEBUGGER_FILE_VERSION_KEY, 0).toInt();
@@ -764,10 +764,10 @@ void DebuggerItemModel::readDebuggers(const FilePath &fileName, bool isSystem)
int count = data.value(DEBUGGER_COUNT_KEY, 0).toInt(); int count = data.value(DEBUGGER_COUNT_KEY, 0).toInt();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
const QString key = DEBUGGER_DATA_KEY + QString::number(i); const Key key = DEBUGGER_DATA_KEY + Key::number(i);
if (!data.contains(key)) if (!data.contains(key))
continue; continue;
const QVariantMap dbMap = data.value(key).toMap(); const Store dbMap = data.value(key).value<Store>();
DebuggerItem item(dbMap); DebuggerItem item(dbMap);
if (isSystem) { if (isSystem) {
item.setAutoDetected(true); item.setAutoDetected(true);
@@ -811,7 +811,7 @@ void DebuggerItemModel::restoreDebuggers()
void DebuggerItemModel::saveDebuggers() void DebuggerItemModel::saveDebuggers()
{ {
QVariantMap data; Store data;
data.insert(DEBUGGER_FILE_VERSION_KEY, 1); data.insert(DEBUGGER_FILE_VERSION_KEY, 1);
int count = 0; int count = 0;
@@ -819,9 +819,9 @@ void DebuggerItemModel::saveDebuggers()
if (item.isGeneric()) // do not store generic debuggers, these get added automatically if (item.isGeneric()) // do not store generic debuggers, these get added automatically
return; return;
if (item.isValid() && item.engineType() != NoEngineType) { if (item.isValid() && item.engineType() != NoEngineType) {
QVariantMap tmp = item.toMap(); Store tmp = item.toMap();
if (!tmp.isEmpty()) { if (!tmp.isEmpty()) {
data.insert(DEBUGGER_DATA_KEY + QString::number(count), tmp); data.insert(DEBUGGER_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
++count; ++count;
} }
} }

View File

@@ -795,9 +795,9 @@ void DockerDevice::fromMap(const Store &map)
d->setData(data); d->setData(data);
} }
QVariantMap DockerDevice::toMap() const Store DockerDevice::toMap() const
{ {
QVariantMap map = ProjectExplorer::IDevice::toMap(); Store map = ProjectExplorer::IDevice::toMap();
DockerDeviceData data = d->data(); DockerDeviceData data = d->data();
map.insert(DockerDeviceDataRepoKey, data.repo); map.insert(DockerDeviceDataRepoKey, data.repo);

View File

@@ -155,7 +155,7 @@ BuildConsoleBuildStep::BuildConsoleBuildStep(BuildStepList *buildStepList, Id id
monFile.setLabelText(Tr::tr("Save IncrediBuild monitor file:")); monFile.setLabelText(Tr::tr("Save IncrediBuild monitor file:"));
monFile.setExpectedKind(PathChooser::Kind::Any); monFile.setExpectedKind(PathChooser::Kind::Any);
monFile.setBaseFileName(PathChooser::homePath()); monFile.setBaseFileName(PathChooser::homePath());
monFile.setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.MonFile.History")); monFile.setHistoryCompleter("IncrediBuild.BuildConsole.MonFile.History");
monFile.setToolTip(Tr::tr("Writes a copy of the build progress file (.ib_mon) to the specified " monFile.setToolTip(Tr::tr("Writes a copy of the build progress file (.ib_mon) to the specified "
"location. If only a folder name is given, a generated GUID will serve " "location. If only a folder name is given, a generated GUID will serve "
"as the file name. The full path of the saved Build Monitor will be " "as the file name. The full path of the saved Build Monitor will be "
@@ -169,7 +169,7 @@ BuildConsoleBuildStep::BuildConsoleBuildStep(BuildStepList *buildStepList, Id id
logFile.setLabelText(Tr::tr("Output Log file:")); logFile.setLabelText(Tr::tr("Output Log file:"));
logFile.setExpectedKind(PathChooser::Kind::SaveFile); logFile.setExpectedKind(PathChooser::Kind::SaveFile);
logFile.setBaseFileName(PathChooser::homePath()); logFile.setBaseFileName(PathChooser::homePath());
logFile.setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.LogFile.History")); logFile.setHistoryCompleter("IncrediBuild.BuildConsole.LogFile.History");
logFile.setToolTip(Tr::tr("Writes build output to a file.")); logFile.setToolTip(Tr::tr("Writes build output to a file."));
showCmd.setSettingsKey("IncrediBuild.BuildConsole.ShowCmd"); showCmd.setSettingsKey("IncrediBuild.BuildConsole.ShowCmd");

View File

@@ -12,6 +12,11 @@ namespace IncrediBuild::Internal {
const char CUSTOMCOMMANDBUILDER_COMMAND[] = "IncrediBuild.BuildConsole.%1.Command"; const char CUSTOMCOMMANDBUILDER_COMMAND[] = "IncrediBuild.BuildConsole.%1.Command";
const char CUSTOMCOMMANDBUILDER_ARGS[] = "IncrediBuild.BuildConsole.%1.Arguments"; const char CUSTOMCOMMANDBUILDER_ARGS[] = "IncrediBuild.BuildConsole.%1.Arguments";
static Key key(const QString &pattern, const QString &id)
{
return keyFromString(pattern.arg(id));
}
QString CommandBuilder::displayName() const QString CommandBuilder::displayName() const
{ {
return Tr::tr("Custom Command"); return Tr::tr("Custom Command");
@@ -19,14 +24,14 @@ QString CommandBuilder::displayName() const
void CommandBuilder::fromMap(const Store &map) void CommandBuilder::fromMap(const Store &map)
{ {
m_command = FilePath::fromSettings(map.value(QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id()))); m_command = FilePath::fromSettings(map.value(key(CUSTOMCOMMANDBUILDER_COMMAND, id())));
m_args = map.value(QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())).toString(); m_args = map.value(key(CUSTOMCOMMANDBUILDER_ARGS, id())).toString();
} }
void CommandBuilder::toMap(QVariantMap *map) const void CommandBuilder::toMap(Store *map) const
{ {
(*map)[QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())] = m_command.toSettings(); map->insert(key(CUSTOMCOMMANDBUILDER_COMMAND, id()), m_command.toSettings());
(*map)[QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())] = QVariant(m_args); map->insert(key(CUSTOMCOMMANDBUILDER_ARGS, id()), QVariant(m_args));
} }
void CommandBuilder::setCommand(const FilePath &command) void CommandBuilder::setCommand(const FilePath &command)

View File

@@ -21,7 +21,7 @@ public:
virtual QString displayName() const; virtual QString displayName() const;
virtual void fromMap(const Utils::Store &map); virtual void fromMap(const Utils::Store &map);
virtual void toMap(QVariantMap *map) const; virtual void toMap(Utils::Store *map) const;
virtual Utils::FilePath defaultCommand() const { return {}; } virtual Utils::FilePath defaultCommand() const { return {}; }
virtual QString defaultArguments() const { return QString(); } virtual QString defaultArguments() const { return QString(); }

View File

@@ -563,9 +563,9 @@ Client *BaseSettings::createClient(BaseClientInterface *interface) const
return new Client(interface); return new Client(interface);
} }
QVariantMap BaseSettings::toMap() const Store BaseSettings::toMap() const
{ {
QVariantMap map; Store map;
map.insert(typeIdKey, m_settingsTypeId.toSetting()); map.insert(typeIdKey, m_settingsTypeId.toSetting());
map.insert(nameKey, m_name); map.insert(nameKey, m_name);
map.insert(idKey, m_id); map.insert(idKey, m_id);
@@ -612,8 +612,8 @@ QList<BaseSettings *> LanguageClientSettings::fromSettings(QSettings *settingsIn
for (auto varList : for (auto varList :
{settingsIn->value(clientsKey).toList(), settingsIn->value(typedClientsKey).toList()}) { {settingsIn->value(clientsKey).toList(), settingsIn->value(typedClientsKey).toList()}) {
for (const QVariant &var : varList) { for (const QVariant &var : varList) {
const QMap<QString, QVariant> &map = var.toMap(); const Store map = var.value<Store>();
Utils::Id typeId = Utils::Id::fromSetting(map.value(typeIdKey)); Id typeId = Id::fromSetting(map.value(typeIdKey));
if (!typeId.isValid()) if (!typeId.isValid())
typeId = Constants::LANGUAGECLIENT_STDIO_SETTINGS_ID; typeId = Constants::LANGUAGECLIENT_STDIO_SETTINGS_ID;
if (BaseSettings *settings = generateSettings(typeId)) { if (BaseSettings *settings = generateSettings(typeId)) {
@@ -659,7 +659,7 @@ void LanguageClientSettings::toSettings(QSettings *settings,
settings->beginGroup(settingsGroupKey); settings->beginGroup(settingsGroupKey);
auto transform = [](const QList<BaseSettings *> &settings) { auto transform = [](const QList<BaseSettings *> &settings) {
return Utils::transform(settings, [](const BaseSettings *setting) { return Utils::transform(settings, [](const BaseSettings *setting) {
return QVariant(setting->toMap()); return QVariant::fromValue(setting->toMap());
}); });
}; };
auto isStdioSetting = Utils::equal(&BaseSettings::m_settingsTypeId, auto isStdioSetting = Utils::equal(&BaseSettings::m_settingsTypeId,
@@ -714,9 +714,9 @@ bool StdIOSettings::isValid() const
return BaseSettings::isValid() && !m_executable.isEmpty(); return BaseSettings::isValid() && !m_executable.isEmpty();
} }
QVariantMap StdIOSettings::toMap() const Store StdIOSettings::toMap() const
{ {
QVariantMap map = BaseSettings::toMap(); Store map = BaseSettings::toMap();
map.insert(executableKey, m_executable.toSettings()); map.insert(executableKey, m_executable.toSettings());
map.insert(argumentsKey, m_arguments); map.insert(argumentsKey, m_arguments);
return map; return map;

View File

@@ -78,18 +78,18 @@ public:
Command introspect(const Utils::FilePath &sourceDirectory) const; Command introspect(const Utils::FilePath &sourceDirectory) const;
static inline std::optional<Utils::FilePath> find() static std::optional<Utils::FilePath> find()
{ {
return ToolWrapper::findTool({"meson.py", "meson"}); return ToolWrapper::findTool({"meson.py", "meson"});
} }
static inline QString toolName() { return {"Meson"}; }; static QString toolName() { return {"Meson"}; }
}; };
template<> template<>
inline QVariantMap toVariantMap<MesonWrapper>(const MesonWrapper &meson) inline Utils::Store toVariantMap<MesonWrapper>(const MesonWrapper &meson)
{ {
QVariantMap data; Utils::Store data;
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name); data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings()); data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected); data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
@@ -98,7 +98,7 @@ inline QVariantMap toVariantMap<MesonWrapper>(const MesonWrapper &meson)
return data; return data;
} }
template<> template<>
inline MesonWrapper *fromVariantMap<MesonWrapper *>(const QVariantMap &data) inline MesonWrapper *fromVariantMap<MesonWrapper *>(const Utils::Store &data)
{ {
return new MesonWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(), return new MesonWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]), Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),

View File

@@ -14,17 +14,17 @@ class NinjaWrapper final : public ToolWrapper
public: public:
using ToolWrapper::ToolWrapper; using ToolWrapper::ToolWrapper;
static inline std::optional<Utils::FilePath> find() static std::optional<Utils::FilePath> find()
{ {
return ToolWrapper::findTool({"ninja", "ninja-build"}); return ToolWrapper::findTool({"ninja", "ninja-build"});
} }
static inline QString toolName() { return {"Ninja"}; }; static QString toolName() { return {"Ninja"}; }
}; };
template<> template<>
inline QVariantMap toVariantMap<NinjaWrapper>(const NinjaWrapper &meson) inline Utils::Store toVariantMap<NinjaWrapper>(const NinjaWrapper &meson)
{ {
QVariantMap data; Utils::Store data;
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name); data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings()); data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected); data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
@@ -33,7 +33,7 @@ inline QVariantMap toVariantMap<NinjaWrapper>(const NinjaWrapper &meson)
return data; return data;
} }
template<> template<>
inline NinjaWrapper *fromVariantMap<NinjaWrapper *>(const QVariantMap &data) inline NinjaWrapper *fromVariantMap<NinjaWrapper *>(const Utils::Store &data)
{ {
return new NinjaWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(), return new NinjaWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]), Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),

View File

@@ -22,7 +22,7 @@ ToolItemSettings::ToolItemSettings(QWidget *parent)
m_mesonPathChooser = new PathChooser; m_mesonPathChooser = new PathChooser;
m_mesonPathChooser->setExpectedKind(PathChooser::ExistingCommand); m_mesonPathChooser->setExpectedKind(PathChooser::ExistingCommand);
m_mesonPathChooser->setHistoryCompleter(QLatin1String("Meson.Command.History")); m_mesonPathChooser->setHistoryCompleter("Meson.Command.History");
using namespace Layouting; using namespace Layouting;

View File

@@ -7,20 +7,23 @@
#include "mesonprojectmanagertr.h" #include "mesonprojectmanagertr.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <utils/store.h>
#include <QGuiApplication> #include <QGuiApplication>
#include <QVariantMap>
#include <iterator> #include <iterator>
#include <vector> #include <vector>
using namespace Utils;
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
static QString entryName(int index) static Key entryName(int index)
{ {
return QString("%1%2").arg(Constants::ToolsSettings::ENTRY_KEY).arg(index); return Constants::ToolsSettings::ENTRY_KEY + Key::number(index);
} }
ToolsSettingsAccessor::ToolsSettingsAccessor() ToolsSettingsAccessor::ToolsSettingsAccessor()
@@ -34,16 +37,16 @@ void ToolsSettingsAccessor::saveMesonTools(const std::vector<MesonTools::Tool_t>
QWidget *parent) QWidget *parent)
{ {
using namespace Constants; using namespace Constants;
QVariantMap data; Store data;
int entry_count = 0; int entry_count = 0;
for (const MesonTools::Tool_t &tool : tools) { for (const MesonTools::Tool_t &tool : tools) {
auto asMeson = std::dynamic_pointer_cast<MesonWrapper>(tool); auto asMeson = std::dynamic_pointer_cast<MesonWrapper>(tool);
if (asMeson) if (asMeson)
data.insert(entryName(entry_count), toVariantMap<MesonWrapper>(*asMeson)); data.insert(entryName(entry_count), QVariant::fromValue(toVariantMap<MesonWrapper>(*asMeson)));
else { else {
auto asNinja = std::dynamic_pointer_cast<NinjaWrapper>(tool); auto asNinja = std::dynamic_pointer_cast<NinjaWrapper>(tool);
if (asNinja) if (asNinja)
data.insert(entryName(entry_count), toVariantMap<NinjaWrapper>(*asNinja)); data.insert(entryName(entry_count), QVariant::fromValue(toVariantMap<NinjaWrapper>(*asNinja)));
} }
entry_count++; entry_count++;
} }
@@ -58,14 +61,14 @@ std::vector<MesonTools::Tool_t> ToolsSettingsAccessor::loadMesonTools(QWidget *p
auto entry_count = data.value(ToolsSettings::ENTRY_COUNT, 0).toInt(); auto entry_count = data.value(ToolsSettings::ENTRY_COUNT, 0).toInt();
std::vector<MesonTools::Tool_t> result; std::vector<MesonTools::Tool_t> result;
for (auto toolIndex = 0; toolIndex < entry_count; toolIndex++) { for (auto toolIndex = 0; toolIndex < entry_count; toolIndex++) {
auto name = entryName(toolIndex); Key name = entryName(toolIndex);
if (data.contains(name)) { if (data.contains(name)) {
const auto map = data[name].toMap(); const auto map = data[name].toMap();
auto type = map.value(ToolsSettings::TOOL_TYPE_KEY, ToolsSettings::TOOL_TYPE_MESON); auto type = map.value(ToolsSettings::TOOL_TYPE_KEY, ToolsSettings::TOOL_TYPE_MESON);
if (type == ToolsSettings::TOOL_TYPE_NINJA) if (type == ToolsSettings::TOOL_TYPE_NINJA)
result.emplace_back(fromVariantMap<NinjaWrapper *>(data[name].toMap())); result.emplace_back(fromVariantMap<NinjaWrapper *>(data[name].value<Store>()));
else else
result.emplace_back(fromVariantMap<MesonWrapper *>(data[name].toMap())); result.emplace_back(fromVariantMap<MesonWrapper *>(data[name].value<Store>()));
} }
} }
return result; return result;

View File

@@ -5,6 +5,8 @@
#include <utils/process.h> #include <utils/process.h>
#include <QUuid>
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {

View File

@@ -7,14 +7,9 @@
#include <utils/commandline.h> #include <utils/commandline.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/id.h> #include <utils/id.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/store.h>
#include <QFileInfo>
#include <QUuid>
#include <QVariant>
#include <QVariantMap>
#include <optional> #include <optional>
@@ -32,17 +27,17 @@ public:
: m_cmd{exe, args} : m_cmd{exe, args}
, m_workDir{workDir} , m_workDir{workDir}
{} {}
inline const Utils::CommandLine &cmdLine() const { return m_cmd; } const Utils::CommandLine &cmdLine() const { return m_cmd; }
inline const Utils::FilePath &workDir() const { return m_workDir; } const Utils::FilePath &workDir() const { return m_workDir; }
inline Utils::FilePath executable() const { return m_cmd.executable(); } Utils::FilePath executable() const { return m_cmd.executable(); }
inline QStringList arguments() const { return m_cmd.splitArguments(); } QStringList arguments() const { return m_cmd.splitArguments(); }
inline QString toUserOutput() const { return m_cmd.toUserOutput(); }; QString toUserOutput() const { return m_cmd.toUserOutput(); }
}; };
class ToolWrapper class ToolWrapper
{ {
public: public:
virtual ~ToolWrapper(){}; virtual ~ToolWrapper() {}
ToolWrapper() = delete; ToolWrapper() = delete;
ToolWrapper(const QString &name, const Utils::FilePath &path, bool autoDetected = false); ToolWrapper(const QString &name, const Utils::FilePath &path, bool autoDetected = false);
ToolWrapper(const QString &name, ToolWrapper(const QString &name,
@@ -54,12 +49,12 @@ public:
ToolWrapper &operator=(const ToolWrapper &other) = default; ToolWrapper &operator=(const ToolWrapper &other) = default;
ToolWrapper &operator=(ToolWrapper &&other) = default; ToolWrapper &operator=(ToolWrapper &&other) = default;
inline const Version &version() const noexcept { return m_version; }; const Version &version() const noexcept { return m_version; }
inline bool isValid() const noexcept { return m_isValid; }; bool isValid() const noexcept { return m_isValid; }
inline bool autoDetected() const noexcept { return m_autoDetected; }; bool autoDetected() const noexcept { return m_autoDetected; }
inline Utils::Id id() const noexcept { return m_id; }; Utils::Id id() const noexcept { return m_id; }
inline Utils::FilePath exe() const noexcept { return m_exe; }; Utils::FilePath exe() const noexcept { return m_exe; }
inline QString name() const noexcept { return m_name; }; QString name() const noexcept { return m_name; }
inline void setName(const QString &newName) { m_name = newName; } inline void setName(const QString &newName) { m_name = newName; }
virtual void setExe(const Utils::FilePath &newExe); virtual void setExe(const Utils::FilePath &newExe);
@@ -69,9 +64,9 @@ public:
static std::optional<Utils::FilePath> findTool(const QStringList &exeNames); static std::optional<Utils::FilePath> findTool(const QStringList &exeNames);
template<typename T> template<typename T>
friend QVariantMap toVariantMap(const T &); friend Utils::Store toVariantMap(const T &);
template<typename T> template<typename T>
friend T fromVariantMap(const QVariantMap &); friend T fromVariantMap(const Utils::Store &);
protected: protected:
Version m_version; Version m_version;
@@ -83,9 +78,9 @@ protected:
}; };
template<typename T> template<typename T>
QVariantMap toVariantMap(const T &); Utils::Store toVariantMap(const T &);
template<typename T> template<typename T>
T fromVariantMap(const QVariantMap &); T fromVariantMap(const Utils::Store &);
} // namespace Internal } // namespace Internal
} // namespace MesonProjectManager } // namespace MesonProjectManager

View File

@@ -35,9 +35,9 @@ const char C_NIMBLETASKSTEP_TASKARGS[] = "Nim.NimbleTaskStep.TaskArgs";
// NimCompilerBuildStep // NimCompilerBuildStep
const char C_NIMCOMPILERBUILDSTEP_ID[] = "Nim.NimCompilerBuildStep"; const char C_NIMCOMPILERBUILDSTEP_ID[] = "Nim.NimCompilerBuildStep";
const QString C_NIMCOMPILERBUILDSTEP_USERCOMPILEROPTIONS = QStringLiteral("Nim.NimCompilerBuildStep.UserCompilerOptions"); const char C_NIMCOMPILERBUILDSTEP_USERCOMPILEROPTIONS[] = "Nim.NimCompilerBuildStep.UserCompilerOptions";
const QString C_NIMCOMPILERBUILDSTEP_DEFAULTBUILDOPTIONS = QStringLiteral("Nim.NimCompilerBuildStep.DefaultBuildOptions"); const char C_NIMCOMPILERBUILDSTEP_DEFAULTBUILDOPTIONS[] = "Nim.NimCompilerBuildStep.DefaultBuildOptions";
const QString C_NIMCOMPILERBUILDSTEP_TARGETNIMFILE = QStringLiteral("Nim.NimCompilerBuildStep.TargetNimFile"); const char C_NIMCOMPILERBUILDSTEP_TARGETNIMFILE[] = "Nim.NimCompilerBuildStep.TargetNimFile";
// NimCompilerCleanStep // NimCompilerCleanStep
const char C_NIMCOMPILERCLEANSTEP_ID[] = "Nim.NimCompilerCleanStep"; const char C_NIMCOMPILERCLEANSTEP_ID[] = "Nim.NimCompilerCleanStep";

View File

@@ -67,7 +67,7 @@ static void createGlobalCodeStyle()
pool->loadCustomCodeStyles(); pool->loadCustomCodeStyles();
// load global settings (after built-in settings are added to the pool) // load global settings (after built-in settings are added to the pool)
m_globalCodeStyle->fromSettings(QLatin1String(Nim::Constants::C_NIMLANGUAGE_ID)); m_globalCodeStyle->fromSettings(Nim::Constants::C_NIMLANGUAGE_ID);
TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_MIMETYPE, TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_MIMETYPE,
Nim::Constants::C_NIMLANGUAGE_ID); Nim::Constants::C_NIMLANGUAGE_ID);
@@ -111,7 +111,7 @@ public:
void apply() final void apply() final
{ {
QTC_ASSERT(m_globalCodeStyle, return); QTC_ASSERT(m_globalCodeStyle, return);
m_globalCodeStyle->toSettings(QLatin1String(Nim::Constants::C_NIMLANGUAGE_ID)); m_globalCodeStyle->toSettings(Nim::Constants::C_NIMLANGUAGE_ID);
} }
private: private:

View File

@@ -43,7 +43,7 @@ ClassDefinition::ClassDefinition(QWidget *parent) :
m_pluginSourceEdit = new QLineEdit; m_pluginSourceEdit = new QLineEdit;
m_iconPathChooser = new Utils::PathChooser; m_iconPathChooser = new Utils::PathChooser;
m_iconPathChooser->setExpectedKind(Utils::PathChooser::File); m_iconPathChooser->setExpectedKind(Utils::PathChooser::File);
m_iconPathChooser->setHistoryCompleter(QLatin1String("Qmake.Icon.History")); m_iconPathChooser->setHistoryCompleter("Qmake.Icon.History");
m_iconPathChooser->setPromptDialogTitle(Tr::tr("Select Icon")); m_iconPathChooser->setPromptDialogTitle(Tr::tr("Select Icon"));
m_iconPathChooser->setPromptDialogFilter(Tr::tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)")); m_iconPathChooser->setPromptDialogFilter(Tr::tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)"));
Form { Form {

View File

@@ -190,7 +190,7 @@ QmakeBuildConfiguration::~QmakeBuildConfiguration()
void QmakeBuildConfiguration::toMap(Store &map) const void QmakeBuildConfiguration::toMap(Store &map) const
{ {
BuildConfiguration::toMap(map); BuildConfiguration::toMap(map);
map.insert(QLatin1String(BUILD_CONFIGURATION_KEY), int(m_qmakeBuildConfiguration)); map.insert(BUILD_CONFIGURATION_KEY, int(m_qmakeBuildConfiguration));
} }
void QmakeBuildConfiguration::fromMap(const Store &map) void QmakeBuildConfiguration::fromMap(const Store &map)
@@ -199,7 +199,7 @@ void QmakeBuildConfiguration::fromMap(const Store &map)
if (hasError()) if (hasError())
return; return;
m_qmakeBuildConfiguration = QtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt()); m_qmakeBuildConfiguration = QtVersion::QmakeBuildConfigs(map.value(BUILD_CONFIGURATION_KEY).toInt());
m_lastKitState = LastKitState(kit()); m_lastKitState = LastKitState(kit());
} }

View File

@@ -75,7 +75,7 @@ bool ComponentNameDialog::go(QString *proposedName,
*proposedName = QLatin1String("MyComponent"); *proposedName = QLatin1String("MyComponent");
d.m_componentNameEdit->setText(*proposedName); d.m_componentNameEdit->setText(*proposedName);
d.m_pathEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory); d.m_pathEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
d.m_pathEdit->setHistoryCompleter(QLatin1String("QmlJs.Component.History")); d.m_pathEdit->setHistoryCompleter("QmlJs.Component.History");
d.m_pathEdit->setPath(*proposedPath); d.m_pathEdit->setPath(*proposedPath);
d.m_label->setText(Tr::tr("Property assignments for %1:").arg(oldFileName)); d.m_label->setText(Tr::tr("Property assignments for %1:").arg(oldFileName));
d.m_checkBox->setChecked(isUiFile); d.m_checkBox->setChecked(isUiFile);

View File

@@ -69,11 +69,11 @@ void QmlJSCodeStylePreferences::slotCurrentValueChanged(const QVariant &value)
emit currentCodeStyleSettingsChanged(value.value<QmlJSCodeStyleSettings>()); emit currentCodeStyleSettingsChanged(value.value<QmlJSCodeStyleSettings>());
} }
QVariantMap QmlJSCodeStylePreferences::toMap() const Store QmlJSCodeStylePreferences::toMap() const
{ {
QVariantMap map = ICodeStylePreferences::toMap(); Store map = ICodeStylePreferences::toMap();
if (!currentDelegate()) { if (!currentDelegate()) {
const QVariantMap dataMap = m_data.toMap(); const Store dataMap = m_data.toMap();
for (auto it = dataMap.begin(), end = dataMap.end(); it != end; ++it) for (auto it = dataMap.begin(), end = dataMap.end(); it != end; ++it)
map.insert(it.key(), it.value()); map.insert(it.key(), it.value());
} }

View File

@@ -27,7 +27,7 @@ namespace QmlJSTools {
QmlJSCodeStyleSettings::QmlJSCodeStyleSettings() = default; QmlJSCodeStyleSettings::QmlJSCodeStyleSettings() = default;
QVariantMap QmlJSCodeStyleSettings::toMap() const Store QmlJSCodeStyleSettings::toMap() const
{ {
return { return {
{lineLengthKey, lineLength} {lineLengthKey, lineLength}

View File

@@ -147,15 +147,15 @@ public:
QmlJSCodeStylePreferences *originalPreferences = QmlJSToolsSettings::globalCodeStyle(); QmlJSCodeStylePreferences *originalPreferences = QmlJSToolsSettings::globalCodeStyle();
if (originalPreferences->codeStyleSettings() != m_preferences.codeStyleSettings()) { if (originalPreferences->codeStyleSettings() != m_preferences.codeStyleSettings()) {
originalPreferences->setCodeStyleSettings(m_preferences.codeStyleSettings()); originalPreferences->setCodeStyleSettings(m_preferences.codeStyleSettings());
originalPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID)); originalPreferences->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
} }
if (originalPreferences->tabSettings() != m_preferences.tabSettings()) { if (originalPreferences->tabSettings() != m_preferences.tabSettings()) {
originalPreferences->setTabSettings(m_preferences.tabSettings()); originalPreferences->setTabSettings(m_preferences.tabSettings());
originalPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID)); originalPreferences->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
} }
if (originalPreferences->currentDelegate() != m_preferences.currentDelegate()) { if (originalPreferences->currentDelegate() != m_preferences.currentDelegate()) {
originalPreferences->setCurrentDelegate(m_preferences.currentDelegate()); originalPreferences->setCurrentDelegate(m_preferences.currentDelegate());
originalPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID)); originalPreferences->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
} }
} }

View File

@@ -68,7 +68,7 @@ QmlJSToolsSettings::QmlJSToolsSettings()
pool->loadCustomCodeStyles(); pool->loadCustomCodeStyles();
// load global settings (after built-in settings are added to the pool) // load global settings (after built-in settings are added to the pool)
m_globalCodeStyle->fromSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID)); m_globalCodeStyle->fromSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
// mimetypes to be handled // mimetypes to be handled
TextEditorSettings::registerMimeTypeForLanguageId(Constants::QML_MIMETYPE, Constants::QML_JS_SETTINGS_ID); TextEditorSettings::registerMimeTypeForLanguageId(Constants::QML_MIMETYPE, Constants::QML_JS_SETTINGS_ID);

View File

@@ -27,7 +27,7 @@ using namespace QmlPreview::Internal;
namespace QmlPreview { namespace QmlPreview {
static const QString QmlServerUrl = "QmlServerUrl"; static const Key QmlServerUrl = "QmlServerUrl";
class QmlPreviewRunner : public ProjectExplorer::RunWorker class QmlPreviewRunner : public ProjectExplorer::RunWorker
{ {

View File

@@ -62,7 +62,7 @@ QmlMultiLanguageAspect::QmlMultiLanguageAspect(AspectContainer *container)
setToolTip(Tr::tr("Reads translations from MultiLanguage plugin.")); setToolTip(Tr::tr("Reads translations from MultiLanguage plugin."));
setDefaultValue(!databaseFilePath().isEmpty()); setDefaultValue(!databaseFilePath().isEmpty());
QVariantMap getDefaultValues; Store getDefaultValues;
fromMap(getDefaultValues); fromMap(getDefaultValues);
addDataExtractor(this, &QmlMultiLanguageAspect::origin, &Data::origin); addDataExtractor(this, &QmlMultiLanguageAspect::origin, &Data::origin);

View File

@@ -682,9 +682,9 @@ void QtVersion::fromMap(const Store &map, const FilePath &filePath)
d->m_qmlRuntimePath.clear(); d->m_qmlRuntimePath.clear();
} }
QVariantMap QtVersion::toMap() const Store QtVersion::toMap() const
{ {
QVariantMap result; Store result;
result.insert(Constants::QTVERSIONID, uniqueId()); result.insert(Constants::QTVERSIONID, uniqueId());
d->m_data.unexpandedDisplayName.toMap(result, Constants::QTVERSIONNAME); d->m_data.unexpandedDisplayName.toMap(result, Constants::QTVERSIONNAME);
@@ -2323,7 +2323,7 @@ bool QtVersionFactory::canRestore(const QString &type)
return type == m_supportedType; return type == m_supportedType;
} }
QtVersion *QtVersionFactory::restore(const QString &type, const QVariantMap &data, const FilePath &filePath) QtVersion *QtVersionFactory::restore(const QString &type, const Store &data, const FilePath &filePath)
{ {
QTC_ASSERT(canRestore(type), return nullptr); QTC_ASSERT(canRestore(type), return nullptr);
QTC_ASSERT(m_creator, return nullptr); QTC_ASSERT(m_creator, return nullptr);

View File

@@ -96,7 +96,7 @@ FilePath ExamplesWelcomePage::copyToAlternativeLocation(const FilePath &proFile,
auto chooser = new PathChooser; auto chooser = new PathChooser;
txt->setBuddy(chooser); txt->setBuddy(chooser);
chooser->setExpectedKind(PathChooser::ExistingDirectory); chooser->setExpectedKind(PathChooser::ExistingDirectory);
chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History")); chooser->setHistoryCompleter("Qt.WritableExamplesDir.History");
const FilePath defaultRootDirectory = DocumentManager::projectsDirectory(); const FilePath defaultRootDirectory = DocumentManager::projectsDirectory();
QtcSettings *settings = ICore::settings(); QtcSettings *settings = ICore::settings();
chooser->setFilePath( chooser->setFilePath(

View File

@@ -5,7 +5,7 @@
#include "qtsupport_global.h" #include "qtsupport_global.h"
#include <QVariantMap> #include <utils/store.h>
namespace Utils { class FilePath; } namespace Utils { class FilePath; }
@@ -22,7 +22,7 @@ public:
static const QList<QtVersionFactory *> allQtVersionFactories(); static const QList<QtVersionFactory *> allQtVersionFactories();
bool canRestore(const QString &type); bool canRestore(const QString &type);
QtVersion *restore(const QString &type, const QVariantMap &data, const Utils::FilePath &workingDirectory); QtVersion *restore(const QString &type, const Utils::Store &data, const Utils::FilePath &workingDirectory);
/// factories with higher priority are asked first to identify /// factories with higher priority are asked first to identify
/// a qtversion, the priority of the desktop factory is 0 and /// a qtversion, the priority of the desktop factory is 0 and

View File

@@ -169,17 +169,17 @@ static bool restoreQtVersions()
if (!reader.load(filename)) if (!reader.load(filename))
return false; return false;
QVariantMap data = reader.restoreValues(); Store data = reader.restoreValues();
// Check version: // Check version:
const int version = data.value(QTVERSION_FILE_VERSION_KEY, 0).toInt(); const int version = data.value(QTVERSION_FILE_VERSION_KEY, 0).toInt();
if (version < 1) if (version < 1)
return false; return false;
const QString keyPrefix(QTVERSION_DATA_KEY); const Key keyPrefix(QTVERSION_DATA_KEY);
const QVariantMap::ConstIterator dcend = data.constEnd(); const Store::ConstIterator dcend = data.constEnd();
for (QVariantMap::ConstIterator it = data.constBegin(); it != dcend; ++it) { for (Store::ConstIterator it = data.constBegin(); it != dcend; ++it) {
const QString &key = it.key(); const Key &key = it.key();
if (!key.startsWith(keyPrefix)) if (!key.startsWith(keyPrefix))
continue; continue;
bool ok; bool ok;
@@ -187,7 +187,7 @@ static bool restoreQtVersions()
if (!ok || count < 0) if (!ok || count < 0)
continue; continue;
const QVariantMap qtversionMap = it.value().toMap(); const Store qtversionMap = it.value().value<Store>();
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString(); const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
bool restored = false; bool restored = false;
@@ -234,7 +234,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
const QList<QtVersionFactory *> factories = QtVersionFactory::allQtVersionFactories(); const QList<QtVersionFactory *> factories = QtVersionFactory::allQtVersionFactories();
PersistentSettingsReader reader; PersistentSettingsReader reader;
QVariantMap data; Store data;
if (reader.load(path)) if (reader.load(path))
data = reader.restoreValues(); data = reader.restoreValues();
@@ -250,10 +250,10 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
QStringList sdkVersions; QStringList sdkVersions;
const QString keyPrefix(QTVERSION_DATA_KEY); const Key keyPrefix(QTVERSION_DATA_KEY);
const QVariantMap::ConstIterator dcend = data.constEnd(); const Store::ConstIterator dcend = data.constEnd();
for (QVariantMap::ConstIterator it = data.constBegin(); it != dcend; ++it) { for (Store::ConstIterator it = data.constBegin(); it != dcend; ++it) {
const QString &key = it.key(); const Key &key = it.key();
if (!key.startsWith(keyPrefix)) if (!key.startsWith(keyPrefix))
continue; continue;
bool ok; bool ok;
@@ -261,7 +261,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
if (!ok || count < 0) if (!ok || count < 0)
continue; continue;
QVariantMap qtversionMap = it.value().toMap(); Store qtversionMap = it.value().value<Store>();
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString(); const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
const QString autoDetectionSource = qtversionMap.value("autodetectionSource").toString(); const QString autoDetectionSource = qtversionMap.value("autodetectionSource").toString();
sdkVersions << autoDetectionSource; sdkVersions << autoDetectionSource;
@@ -350,16 +350,16 @@ static void saveQtVersions()
if (!m_writer) if (!m_writer)
return; return;
QVariantMap data; Store data;
data.insert(QTVERSION_FILE_VERSION_KEY, 1); data.insert(QTVERSION_FILE_VERSION_KEY, 1);
int count = 0; int count = 0;
for (QtVersion *qtv : std::as_const(m_versions)) { for (QtVersion *qtv : std::as_const(m_versions)) {
QVariantMap tmp = qtv->toMap(); Store tmp = qtv->toMap();
if (tmp.isEmpty()) if (tmp.isEmpty())
continue; continue;
tmp.insert(QTVERSION_TYPE_KEY, qtv->type()); tmp.insert(QTVERSION_TYPE_KEY, qtv->type());
data.insert(QString::fromLatin1(QTVERSION_DATA_KEY) + QString::number(count), tmp); data.insert(QTVERSION_DATA_KEY + Key::number(count), QVariant::fromValue(tmp));
++count; ++count;
} }
m_writer->save(data, Core::ICore::dialogParent()); m_writer->save(data, Core::ICore::dialogParent());

View File

@@ -67,7 +67,7 @@ void setupColor(TerminalSettings *settings,
const QString &label, const QString &label,
const QColor &defaultColor) const QColor &defaultColor)
{ {
color.setSettingsKey(label); color.setSettingsKey(keyFromString(label));
color.setDefaultValue(defaultColor); color.setDefaultValue(defaultColor);
color.setToolTip(Tr::tr("The color used for %1.").arg(label)); color.setToolTip(Tr::tr("The color used for %1.").arg(label));
settings->registerAspect(&color); settings->registerAspect(&color);