diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp index dca99a23b53..7440257eead 100644 --- a/src/plugins/fakevim/fakevimactions.cpp +++ b/src/plugins/fakevim/fakevimactions.cpp @@ -29,13 +29,13 @@ namespace FakeVim::Internal { #ifdef FAKEVIM_STANDALONE -void FvBaseAspect::setSettingsKey(const QString &group, const QString &key) +void FvBaseAspect::setSettingsKey(const Key &group, const Key &key) { m_settingsGroup = group; m_settingsKey = key; } -QString FvBaseAspect::settingsKey() const +Key FvBaseAspect::settingsKey() const { return m_settingsKey; } @@ -244,14 +244,14 @@ FakeVimSettings::FakeVimSettings() FakeVimSettings::~FakeVimSettings() = default; -FvBaseAspect *FakeVimSettings::item(const QString &name) +FvBaseAspect *FakeVimSettings::item(const Key &name) { return m_nameToAspect.value(name, nullptr); } QString FakeVimSettings::trySetValue(const QString &name, const QString &value) { - FvBaseAspect *aspect = m_nameToAspect.value(name, nullptr); + FvBaseAspect *aspect = m_nameToAspect.value(keyFromString(name), nullptr); if (!aspect) return Tr::tr("Unknown option: %1").arg(name); if (aspect == &tabStop || aspect == &shiftWidth) { @@ -266,7 +266,7 @@ QString FakeVimSettings::trySetValue(const QString &name, const QString &value) void FakeVimSettings::setup(FvBaseAspect *aspect, const QVariant &value, const Key &settingsKey, - const QString &shortName, + const Key &shortName, const QString &labelText) { aspect->setSettingsKey("FakeVim", settingsKey); diff --git a/src/plugins/fakevim/fakevimactions.h b/src/plugins/fakevim/fakevimactions.h index 18baecafecf..29d4bbd7052 100644 --- a/src/plugins/fakevim/fakevimactions.h +++ b/src/plugins/fakevim/fakevimactions.h @@ -24,6 +24,13 @@ namespace Utils { class FilePath {}; } namespace FakeVim::Internal { #ifdef FAKEVIM_STANDALONE + +#ifdef QTC_USE_STORE +using Key = QByteArray; +#else +using Key = QString; +#endif + class FvBaseAspect { public: @@ -34,19 +41,15 @@ public: virtual void setDefaultVariantValue(const QVariant &) {} virtual QVariant variantValue() const { return {}; } virtual QVariant defaultVariantValue() const { return {}; } -#ifdef QTC_USE_STORE - void setSettingsKey(const QString &group, const QByteArray &key); -#else - void setSettingsKey(const QString &group, const QString &key); -#endif - QString settingsKey() const; + void setSettingsKey(const Key &group, const Key &key); + Key settingsKey() const; void setCheckable(bool) {} void setDisplayName(const QString &) {} void setToolTip(const QString &) {} private: - QString m_settingsGroup; - QString m_settingsKey; + Key m_settingsGroup; + Key m_settingsKey; }; template @@ -104,7 +107,7 @@ public: FakeVimSettings(); ~FakeVimSettings(); - FvBaseAspect *item(const QString &name); + FvBaseAspect *item(const Utils::Key &name); QString trySetValue(const QString &name, const QString &value); FvBoolAspect useFakeVim; @@ -161,7 +164,7 @@ public: private: void setup(FvBaseAspect *aspect, const QVariant &value, const Utils::Key &settingsKey, - const QString &shortName, + const Utils::Key &shortName, const QString &label); QHash m_nameToAspect; diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 8a9adac4415..4a5d8e0415b 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -6125,7 +6125,7 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd) if (!error.isEmpty()) showMessage(MessageError, error); } else { - QString optionName = cmd.args; + Utils::Key optionName = Utils::keyFromString(cmd.args); bool toggleOption = optionName.endsWith('!'); bool printOption = !toggleOption && optionName.endsWith('?'); diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h index 0b615e1657e..4532fa374cf 100644 --- a/src/plugins/fakevim/fakevimhandler.h +++ b/src/plugins/fakevim/fakevimhandler.h @@ -38,8 +38,7 @@ struct Range struct ExCommand { ExCommand() = default; - ExCommand(const QString &cmd, const QString &args = QString(), - const Range &range = Range()); + ExCommand(const QString &cmd, const QString &args = {}, const Range &range = {}); bool matches(const QString &min, const QString &full) const; diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 9284fa572b6..35c2314359f 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -376,22 +376,21 @@ void BuildConfiguration::toMap(Store &map) const { ProjectConfiguration::toMap(map); - map.insert(QLatin1String(Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY), d->m_clearSystemEnvironment); - map.insert(QLatin1String(Constants::USER_ENVIRONMENT_CHANGES_KEY), + map.insert(Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY, d->m_clearSystemEnvironment); + map.insert(Constants::USER_ENVIRONMENT_CHANGES_KEY, EnvironmentItem::toStringList(d->m_userEnvironmentChanges)); - map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), 2); - map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(0), d->m_buildSteps.toMap()); - map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(1), d->m_cleanSteps.toMap()); + 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(PARSE_STD_OUT_KEY, d->m_parseStdOut); - map.insert(CUSTOM_PARSERS_KEY, transform(d->m_customParsers,&Utils::Id::toSetting)); + map.insert(CUSTOM_PARSERS_KEY, transform(d->m_customParsers, &Id::toSetting)); } void BuildConfiguration::fromMap(const Store &map) { - d->m_clearSystemEnvironment = map.value(QLatin1String(Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY)) - .toBool(); + d->m_clearSystemEnvironment = map.value(Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY).toBool(); d->m_userEnvironmentChanges = EnvironmentItem::fromStringList( map.value(Constants::USER_ENVIRONMENT_CHANGES_KEY).toStringList()); @@ -400,14 +399,14 @@ void BuildConfiguration::fromMap(const Store &map) d->m_buildSteps.clear(); d->m_cleanSteps.clear(); - int maxI = map.value(QLatin1String(BUILD_STEP_LIST_COUNT), 0).toInt(); + int maxI = map.value(BUILD_STEP_LIST_COUNT, 0).toInt(); for (int i = 0; i < maxI; ++i) { - QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(i)).toMap(); + Store data = map.value(BUILD_STEP_LIST_PREFIX + Key::number(i)).value(); if (data.isEmpty()) { qWarning() << "No data for build step list" << i << "found!"; continue; } - Utils::Id id = idFromMap(data); + Id id = idFromMap(data); if (id == Constants::BUILDSTEPS_BUILD) { if (!d->m_buildSteps.fromMap(data)) qWarning() << "Failed to restore build step list"; @@ -420,7 +419,7 @@ void BuildConfiguration::fromMap(const Store &map) } d->m_parseStdOut = map.value(PARSE_STD_OUT_KEY).toBool(); - d->m_customParsers = transform(map.value(CUSTOM_PARSERS_KEY).toList(), &Utils::Id::fromSetting); + d->m_customParsers = transform(map.value(CUSTOM_PARSERS_KEY).toList(), &Id::fromSetting); ProjectConfiguration::fromMap(map); setToolTip(d->m_tooltipAspect()); diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp index 805c1fcf5b6..d624fd5ad9f 100644 --- a/src/plugins/projectexplorer/buildsteplist.cpp +++ b/src/plugins/projectexplorer/buildsteplist.cpp @@ -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), data); + map.insert(STEPS_PREFIX + Key::number(i), QVariant::fromValue(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)).toMap()); + Store bsData(map.value(STEPS_PREFIX + Key::number(i)).value()); if (bsData.isEmpty()) { qWarning() << "No step data found for" << i << "(continuing)."; continue; diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp index 1e574b4815f..7cfe6faba4f 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp @@ -225,7 +225,8 @@ QWidget *CustomWizardFieldPage::registerPathChooser(const QString &fieldName, pathChooser->setExpectedKind(PathChooser::Command); else if (expectedKind == QLatin1String("any")) pathChooser->setExpectedKind(PathChooser::Any); - pathChooser->setHistoryCompleter("PE.Custom." + m_parameters->id.name() + '.' + field.name); + pathChooser->setHistoryCompleter("PE.Custom." + m_parameters->id.name() + + '.' + keyFromString(field.name)); registerField(fieldName, pathChooser, "path", SIGNAL(rawPathChanged(QString))); // Connect to completeChanged() for derived classes that reimplement isComplete() diff --git a/src/plugins/projectexplorer/deployconfiguration.cpp b/src/plugins/projectexplorer/deployconfiguration.cpp index a5e8d16738c..39a0c08bcea 100644 --- a/src/plugins/projectexplorer/deployconfiguration.cpp +++ b/src/plugins/projectexplorer/deployconfiguration.cpp @@ -53,15 +53,15 @@ QWidget *DeployConfiguration::createConfigWidget() void DeployConfiguration::toMap(Store &map) const { ProjectConfiguration::toMap(map); - map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), 1); - map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0'), m_stepList.toMap()); + map.insert(BUILD_STEP_LIST_COUNT, 1); + map.insert(Key(BUILD_STEP_LIST_PREFIX) + '0', QVariant::fromValue(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(f.localFilePath().toString(), f.remoteDirectory()); + deployData.insert(keyFromString(f.localFilePath().toString()), f.remoteDirectory()); } - map.insert(DEPLOYMENT_DATA, deployData); + map.insert(DEPLOYMENT_DATA, QVariant::fromValue(deployData)); } void DeployConfiguration::fromMap(const Store &map) @@ -70,12 +70,12 @@ void DeployConfiguration::fromMap(const Store &map) if (hasError()) return; - int maxI = map.value(QLatin1String(BUILD_STEP_LIST_COUNT), 0).toInt(); + int maxI = map.value(BUILD_STEP_LIST_COUNT, 0).toInt(); if (maxI != 1) { reportError(); return; } - Store data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0')).toMap(); + Store data = map.value(Key(BUILD_STEP_LIST_PREFIX) + '0').value(); if (!data.isEmpty()) { m_stepList.clear(); if (!m_stepList.fromMap(data)) { @@ -91,9 +91,9 @@ void DeployConfiguration::fromMap(const Store &map) } m_usesCustomDeploymentData = map.value(USES_DEPLOYMENT_DATA, false).toBool(); - const Store deployData = map.value(DEPLOYMENT_DATA).toMap(); + const Store deployData = map.value(DEPLOYMENT_DATA).value(); for (auto it = deployData.begin(); it != deployData.end(); ++it) - m_customDeploymentData.addFile(FilePath::fromString(it.key()), it.value().toString()); + m_customDeploymentData.addFile(FilePath::fromString(stringFromKey(it.key())), it.value().toString()); } bool DeployConfiguration::isActive() const diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp index 2c5acf105b2..7aad3a4e1cf 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp @@ -111,7 +111,7 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser, processFilterLineEdit = new FancyLineEdit(q); processFilterLineEdit->setPlaceholderText(Tr::tr("Filter")); processFilterLineEdit->setFocus(Qt::TabFocusReason); - processFilterLineEdit->setHistoryCompleter(QLatin1String("DeviceProcessDialogFilter"), + processFilterLineEdit->setHistoryCompleter("DeviceProcessDialogFilter", true /*restoreLastItemFromHistory*/); processFilterLineEdit->setFiltering(true); diff --git a/src/plugins/projectexplorer/environmentaspect.cpp b/src/plugins/projectexplorer/environmentaspect.cpp index a083e545a3c..89d75e36195 100644 --- a/src/plugins/projectexplorer/environmentaspect.cpp +++ b/src/plugins/projectexplorer/environmentaspect.cpp @@ -135,15 +135,15 @@ void EnvironmentAspect::setSupportForBuildEnvironment(Target *target) void EnvironmentAspect::fromMap(const Store &map) { - m_base = map.value(QLatin1String(BASE_KEY), -1).toInt(); - m_userChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(CHANGES_KEY)).toStringList()); + m_base = map.value(BASE_KEY, -1).toInt(); + m_userChanges = EnvironmentItem::fromStringList(map.value(CHANGES_KEY).toStringList()); m_printOnRun = map.value(PRINT_ON_RUN_KEY).toBool(); } void EnvironmentAspect::toMap(Store &data) const { - data.insert(QLatin1String(BASE_KEY), m_base); - data.insert(QLatin1String(CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userChanges)); + data.insert(BASE_KEY, m_base); + data.insert(CHANGES_KEY, EnvironmentItem::toStringList(m_userChanges)); data.insert(PRINT_ON_RUN_KEY, m_printOnRun); } diff --git a/src/plugins/projectexplorer/extraabi.cpp b/src/plugins/projectexplorer/extraabi.cpp index 48a8b325e4f..baf7bd49b8b 100644 --- a/src/plugins/projectexplorer/extraabi.cpp +++ b/src/plugins/projectexplorer/extraabi.cpp @@ -8,7 +8,8 @@ #include #include -#include +#include +#include #include #include @@ -28,7 +29,7 @@ class AbiFlavorUpgraderV0 : public VersionUpgrader public: AbiFlavorUpgraderV0() : VersionUpgrader(0, "") { } - QVariantMap upgrade(const QVariantMap &data) override { return data; } + Store upgrade(const Store &data) override { return data; } }; class AbiFlavorAccessor : public UpgradingSettingsAccessor @@ -51,9 +52,9 @@ public: void ExtraAbi::load() { AbiFlavorAccessor accessor; - const QVariantMap data = accessor.restoreSettings(Core::ICore::dialogParent()).value("Flavors").toMap(); + const Store data = accessor.restoreSettings(Core::ICore::dialogParent()).value("Flavors").value(); for (auto it = data.constBegin(); it != data.constEnd(); ++it) { - const QString flavor = it.key(); + const Key flavor = it.key(); if (flavor.isEmpty()) continue; @@ -67,7 +68,7 @@ void ExtraAbi::load() oses.push_back(os); } - Abi::registerOsFlavor(oses, flavor); + Abi::registerOsFlavor(oses, stringFromKey(flavor)); } } diff --git a/src/plugins/projectexplorer/importwidget.cpp b/src/plugins/projectexplorer/importwidget.cpp index 623476b6748..1aa6064dc59 100644 --- a/src/plugins/projectexplorer/importwidget.cpp +++ b/src/plugins/projectexplorer/importwidget.cpp @@ -36,7 +36,7 @@ ImportWidget::ImportWidget(QWidget *parent) : layout->addWidget(m_pathChooser); m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); - m_pathChooser->setHistoryCompleter(QLatin1String("Import.SourceDir.History")); + m_pathChooser->setHistoryCompleter("Import.SourceDir.History"); auto importButton = new QPushButton(Tr::tr("Import"), widget); layout->addWidget(importButton); diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index 8f7f82da8f2..78b038681e9 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -47,23 +47,24 @@ MakeStep::MakeStep(BuildStepList *parent, Id id) setCommandLineProvider([this] { return effectiveMakeCommand(Execution); }); - m_makeCommandAspect.setSettingsKey(id.withSuffix(MAKE_COMMAND_SUFFIX).toString()); + // FIXME: Replace with id.name() + MAKE_COMMAND_SUFFIX after the Key/Store transition + m_makeCommandAspect.setSettingsKey(keyFromString(id.withSuffix(MAKE_COMMAND_SUFFIX).toString())); m_makeCommandAspect.setExpectedKind(PathChooser::ExistingCommand); m_makeCommandAspect.setBaseFileName(PathChooser::homePath()); m_makeCommandAspect.setHistoryCompleter("PE.MakeCommand.History"); - m_userArgumentsAspect.setSettingsKey(id.withSuffix(MAKE_ARGUMENTS_SUFFIX).toString()); + m_userArgumentsAspect.setSettingsKey(keyFromString(id.withSuffix(MAKE_ARGUMENTS_SUFFIX).toString())); m_userArgumentsAspect.setLabelText(Tr::tr("Make arguments:")); m_userArgumentsAspect.setDisplayStyle(StringAspect::LineEditDisplay); - m_jobCountAspect.setSettingsKey(id.withSuffix(JOBCOUNT_SUFFIX).toString()); + m_jobCountAspect.setSettingsKey(keyFromString(id.withSuffix(JOBCOUNT_SUFFIX).toString())); m_jobCountAspect.setLabel(Tr::tr("Parallel jobs:")); m_jobCountAspect.setRange(1, 999); m_jobCountAspect.setValue(defaultJobCount()); m_jobCountAspect.setDefaultValue(defaultJobCount()); const QString text = Tr::tr("Override MAKEFLAGS"); - m_overrideMakeflagsAspect.setSettingsKey(id.withSuffix(OVERRIDE_MAKEFLAGS_SUFFIX).toString()); + m_overrideMakeflagsAspect.setSettingsKey(keyFromString(id.withSuffix(OVERRIDE_MAKEFLAGS_SUFFIX).toString())); m_overrideMakeflagsAspect.setLabel(text, BoolAspect::LabelPlacement::AtCheckBox); m_nonOverrideWarning.setText("

" + @@ -71,11 +72,11 @@ MakeStep::MakeStep(BuildStepList *parent, Id id) .arg(text) + "

"); m_nonOverrideWarning.setIconType(InfoLabel::Warning); - m_disabledForSubdirsAspect.setSettingsKey(id.withSuffix(".disabledForSubdirs").toString()); + m_disabledForSubdirsAspect.setSettingsKey(keyFromString(id.withSuffix(".disabledForSubdirs").toString())); m_disabledForSubdirsAspect.setLabel(Tr::tr("Disable in subdirectories:")); m_disabledForSubdirsAspect.setToolTip(Tr::tr("Runs this step only for a top-level build.")); - m_buildTargetsAspect.setSettingsKey(id.withSuffix(BUILD_TARGETS_SUFFIX).toString()); + m_buildTargetsAspect.setSettingsKey(keyFromString(id.withSuffix(BUILD_TARGETS_SUFFIX).toString())); m_buildTargetsAspect.setLabelText(Tr::tr("Targets:")); const auto updateMakeLabel = [this] {