forked from qt-creator/qt-creator
Utils: Temporarily introdce Key Id::toKey()
To avoid complications on the user code side during the Key/Store transition. Change-Id: I49ae9d496c9c1ee07f17245616fdefefe9abfc2e Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -158,6 +158,16 @@ QString Id::toString() const
|
|||||||
return QString::fromUtf8(stringFromId.value(m_id).str);
|
return QString::fromUtf8(stringFromId.value(m_id).str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \internal */
|
||||||
|
Key Id::toKey() const
|
||||||
|
{
|
||||||
|
#ifdef QTC_USE_STORE
|
||||||
|
return name();
|
||||||
|
#else
|
||||||
|
return toString();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Creates an id from a string representation.
|
Creates an id from a string representation.
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include "storekey.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -30,6 +32,7 @@ public:
|
|||||||
|
|
||||||
QByteArray name() const;
|
QByteArray name() const;
|
||||||
QString toString() const; // Avoid.
|
QString toString() const; // Avoid.
|
||||||
|
Key toKey() const; // FIXME: Replace uses with .name() after Store/key transition.
|
||||||
QVariant toSetting() const; // Good to use.
|
QVariant toSetting() const; // Good to use.
|
||||||
QString suffixAfter(Id baseId) const;
|
QString suffixAfter(Id baseId) const;
|
||||||
bool isValid() const { return m_id; }
|
bool isValid() const { return m_id; }
|
||||||
|
|||||||
@@ -78,15 +78,15 @@ void TestProjectSettings::load()
|
|||||||
m_activeTestFrameworks.clear();
|
m_activeTestFrameworks.clear();
|
||||||
m_activeTestTools.clear();
|
m_activeTestTools.clear();
|
||||||
if (activeFrameworks.isValid()) {
|
if (activeFrameworks.isValid()) {
|
||||||
const QMap<QString, QVariant> frameworksMap = activeFrameworks.toMap();
|
const Store frameworksMap = storeFromVariant(activeFrameworks);
|
||||||
for (ITestFramework *framework : registeredFrameworks) {
|
for (ITestFramework *framework : registeredFrameworks) {
|
||||||
const Id id = framework->id();
|
const Id id = framework->id();
|
||||||
bool active = frameworksMap.value(id.toString(), framework->active()).toBool();
|
bool active = frameworksMap.value(id.toKey(), framework->active()).toBool();
|
||||||
m_activeTestFrameworks.insert(framework, active);
|
m_activeTestFrameworks.insert(framework, active);
|
||||||
}
|
}
|
||||||
for (ITestTool *testTool : registeredTestTools) {
|
for (ITestTool *testTool : registeredTestTools) {
|
||||||
const Id id = testTool->id();
|
const Id id = testTool->id();
|
||||||
bool active = frameworksMap.value(id.toString(), testTool->active()).toBool();
|
bool active = frameworksMap.value(id.toKey(), testTool->active()).toBool();
|
||||||
m_activeTestTools.insert(testTool, active);
|
m_activeTestTools.insert(testTool, active);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -87,24 +87,19 @@ void IosDsymBuildStep::toMap(Store &map) const
|
|||||||
{
|
{
|
||||||
AbstractProcessStep::toMap(map);
|
AbstractProcessStep::toMap(map);
|
||||||
|
|
||||||
// FIXME: Clean up after QVariantMap -> Utils::Store transition
|
map.insert(id().toKey() + ARGUMENTS_PARTIAL_KEY, arguments());
|
||||||
// This is map.insert(id().name() + ARGUMENTS_PARTIAL_KEY), arguments())
|
map.insert(id().toKey() + USE_DEFAULT_ARGS_PARTIAL_KEY, isDefault());
|
||||||
map.insert(keyFromString(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString()),
|
map.insert(id().toKey() + CLEAN_PARTIAL_KEY, m_clean);
|
||||||
arguments());
|
map.insert(id().toKey() + COMMAND_PARTIAL_KEY, command().toSettings());
|
||||||
map.insert(keyFromString(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString()),
|
|
||||||
isDefault());
|
|
||||||
map.insert(keyFromString(id().withSuffix(CLEAN_PARTIAL_KEY).toString()), m_clean);
|
|
||||||
map.insert(keyFromString(id().withSuffix(COMMAND_PARTIAL_KEY).toString()), command().toSettings());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosDsymBuildStep::fromMap(const Store &map)
|
void IosDsymBuildStep::fromMap(const Store &map)
|
||||||
{
|
{
|
||||||
QVariant bArgs = map.value(keyFromString(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString()));
|
QVariant bArgs = map.value(id().toKey() + ARGUMENTS_PARTIAL_KEY);
|
||||||
m_arguments = bArgs.toStringList();
|
m_arguments = bArgs.toStringList();
|
||||||
bool useDefaultArguments = map.value(
|
bool useDefaultArguments = map.value(id().toKey() + USE_DEFAULT_ARGS_PARTIAL_KEY).toBool();
|
||||||
keyFromString(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString())).toBool();
|
m_clean = map.value(id().toKey() + CLEAN_PARTIAL_KEY, m_clean).toBool();
|
||||||
m_clean = map.value(keyFromString(id().withSuffix(CLEAN_PARTIAL_KEY).toString()), m_clean).toBool();
|
m_command = FilePath::fromSettings(map.value(id().toKey() + COMMAND_PARTIAL_KEY));
|
||||||
m_command = FilePath::fromSettings(map.value(keyFromString(id().withSuffix(COMMAND_PARTIAL_KEY).toString())));
|
|
||||||
if (useDefaultArguments) {
|
if (useDefaultArguments) {
|
||||||
m_command = defaultCommand();
|
m_command = defaultCommand();
|
||||||
m_arguments = defaultArguments();
|
m_arguments = defaultArguments();
|
||||||
|
|||||||
@@ -48,23 +48,23 @@ MakeStep::MakeStep(BuildStepList *parent, Id id)
|
|||||||
setCommandLineProvider([this] { return effectiveMakeCommand(Execution); });
|
setCommandLineProvider([this] { return effectiveMakeCommand(Execution); });
|
||||||
|
|
||||||
// FIXME: Replace with id.name() + MAKE_COMMAND_SUFFIX after the Key/Store transition
|
// 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.setSettingsKey(id.toKey() + MAKE_COMMAND_SUFFIX);
|
||||||
m_makeCommandAspect.setExpectedKind(PathChooser::ExistingCommand);
|
m_makeCommandAspect.setExpectedKind(PathChooser::ExistingCommand);
|
||||||
m_makeCommandAspect.setBaseFileName(PathChooser::homePath());
|
m_makeCommandAspect.setBaseFileName(PathChooser::homePath());
|
||||||
m_makeCommandAspect.setHistoryCompleter("PE.MakeCommand.History");
|
m_makeCommandAspect.setHistoryCompleter("PE.MakeCommand.History");
|
||||||
|
|
||||||
m_userArgumentsAspect.setSettingsKey(keyFromString(id.withSuffix(MAKE_ARGUMENTS_SUFFIX).toString()));
|
m_userArgumentsAspect.setSettingsKey(id.toKey() + MAKE_ARGUMENTS_SUFFIX);
|
||||||
m_userArgumentsAspect.setLabelText(Tr::tr("Make arguments:"));
|
m_userArgumentsAspect.setLabelText(Tr::tr("Make arguments:"));
|
||||||
m_userArgumentsAspect.setDisplayStyle(StringAspect::LineEditDisplay);
|
m_userArgumentsAspect.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
|
|
||||||
m_jobCountAspect.setSettingsKey(keyFromString(id.withSuffix(JOBCOUNT_SUFFIX).toString()));
|
m_jobCountAspect.setSettingsKey(id.toKey() + JOBCOUNT_SUFFIX);
|
||||||
m_jobCountAspect.setLabel(Tr::tr("Parallel jobs:"));
|
m_jobCountAspect.setLabel(Tr::tr("Parallel jobs:"));
|
||||||
m_jobCountAspect.setRange(1, 999);
|
m_jobCountAspect.setRange(1, 999);
|
||||||
m_jobCountAspect.setValue(defaultJobCount());
|
m_jobCountAspect.setValue(defaultJobCount());
|
||||||
m_jobCountAspect.setDefaultValue(defaultJobCount());
|
m_jobCountAspect.setDefaultValue(defaultJobCount());
|
||||||
|
|
||||||
const QString text = Tr::tr("Override MAKEFLAGS");
|
const QString text = Tr::tr("Override MAKEFLAGS");
|
||||||
m_overrideMakeflagsAspect.setSettingsKey(keyFromString(id.withSuffix(OVERRIDE_MAKEFLAGS_SUFFIX).toString()));
|
m_overrideMakeflagsAspect.setSettingsKey(id.toKey() + OVERRIDE_MAKEFLAGS_SUFFIX);
|
||||||
m_overrideMakeflagsAspect.setLabel(text, BoolAspect::LabelPlacement::AtCheckBox);
|
m_overrideMakeflagsAspect.setLabel(text, BoolAspect::LabelPlacement::AtCheckBox);
|
||||||
|
|
||||||
m_nonOverrideWarning.setText("<html><body><p>" +
|
m_nonOverrideWarning.setText("<html><body><p>" +
|
||||||
@@ -72,11 +72,11 @@ MakeStep::MakeStep(BuildStepList *parent, Id id)
|
|||||||
.arg(text) + "</p></body></html>");
|
.arg(text) + "</p></body></html>");
|
||||||
m_nonOverrideWarning.setIconType(InfoLabel::Warning);
|
m_nonOverrideWarning.setIconType(InfoLabel::Warning);
|
||||||
|
|
||||||
m_disabledForSubdirsAspect.setSettingsKey(keyFromString(id.withSuffix(".disabledForSubdirs").toString()));
|
m_disabledForSubdirsAspect.setSettingsKey(id.toKey() + ".disabledForSubdirs");
|
||||||
m_disabledForSubdirsAspect.setLabel(Tr::tr("Disable in subdirectories:"));
|
m_disabledForSubdirsAspect.setLabel(Tr::tr("Disable in subdirectories:"));
|
||||||
m_disabledForSubdirsAspect.setToolTip(Tr::tr("Runs this step only for a top-level build."));
|
m_disabledForSubdirsAspect.setToolTip(Tr::tr("Runs this step only for a top-level build."));
|
||||||
|
|
||||||
m_buildTargetsAspect.setSettingsKey(keyFromString(id.withSuffix(BUILD_TARGETS_SUFFIX).toString()));
|
m_buildTargetsAspect.setSettingsKey(id.toKey() + BUILD_TARGETS_SUFFIX);
|
||||||
m_buildTargetsAspect.setLabelText(Tr::tr("Targets:"));
|
m_buildTargetsAspect.setLabelText(Tr::tr("Targets:"));
|
||||||
|
|
||||||
const auto updateMakeLabel = [this] {
|
const auto updateMakeLabel = [this] {
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ void GlobalOrProjectAspect::fromMap(const Store &map)
|
|||||||
{
|
{
|
||||||
if (m_projectSettings)
|
if (m_projectSettings)
|
||||||
m_projectSettings->fromMap(map);
|
m_projectSettings->fromMap(map);
|
||||||
m_useGlobalSettings = map.value(keyFromString(id().toString() + ".UseGlobalSettings"), true).toBool();
|
m_useGlobalSettings = map.value(id().toKey() + ".UseGlobalSettings", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalOrProjectAspect::toMap(Store &map) const
|
void GlobalOrProjectAspect::toMap(Store &map) const
|
||||||
{
|
{
|
||||||
if (m_projectSettings)
|
if (m_projectSettings)
|
||||||
m_projectSettings->toMap(map);
|
m_projectSettings->toMap(map);
|
||||||
map.insert(keyFromString(id().toString() + ".UseGlobalSettings"), m_useGlobalSettings);
|
map.insert(id().toKey() + ".UseGlobalSettings", m_useGlobalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalOrProjectAspect::toActiveMap(Store &data) const
|
void GlobalOrProjectAspect::toActiveMap(Store &data) const
|
||||||
|
|||||||
Reference in New Issue
Block a user