Plugins: And more Store and Key

After this one, is compiles with the opt-in macro. Not changed yet,
though.

Change-Id: I29a66ecb5daa71d0d97566b81fd9f47d92f6368a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-08-25 13:19:26 +02:00
parent c9fd5465eb
commit d7d78df9da
46 changed files with 246 additions and 245 deletions

View File

@@ -131,18 +131,18 @@ void IosDevice::fromMap(const Store &map)
IDevice::fromMap(map);
m_extraInfo.clear();
const QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap();
const Store vMap = map.value(Constants::EXTRA_INFO_KEY).value<Store>();
for (auto i = vMap.cbegin(), end = vMap.cend(); i != end; ++i)
m_extraInfo.insert(i.key(), i.value().toString());
m_extraInfo.insert(stringFromKey(i.key()), i.value().toString());
}
QVariantMap IosDevice::toMap() const
Store IosDevice::toMap() const
{
QVariantMap res = IDevice::toMap();
QVariantMap vMap;
Store res = IDevice::toMap();
Store vMap;
for (auto i = m_extraInfo.cbegin(), end = m_extraInfo.cend(); i != end; ++i)
vMap.insert(i.key(), i.value());
res.insert(QLatin1String(Constants::EXTRA_INFO_KEY), vMap);
vMap.insert(keyFromString(i.key()), i.value());
res.insert(Constants::EXTRA_INFO_KEY, QVariant::fromValue(vMap));
return res;
}
@@ -153,7 +153,7 @@ QString IosDevice::deviceName() const
QString IosDevice::uniqueDeviceID() const
{
return id().suffixAfter(Utils::Id(Constants::IOS_DEVICE_ID));
return id().suffixAfter(Id(Constants::IOS_DEVICE_ID));
}
QString IosDevice::uniqueInternalDeviceId() const
@@ -543,9 +543,9 @@ IosDeviceFactory::IosDeviceFactory()
setConstructionFunction([] { return IDevice::Ptr(new IosDevice); });
}
bool IosDeviceFactory::canRestore(const QVariantMap &map) const
bool IosDeviceFactory::canRestore(const Store &map) const
{
QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap();
Store vMap = map.value(Constants::EXTRA_INFO_KEY).value<Store>();
if (vMap.isEmpty() || vMap.value(kDeviceName).toString() == QLatin1String("*unknown*"))
return false; // transient device (probably generated during an activation)
return true;

View File

@@ -8,10 +8,6 @@
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/idevicefactory.h>
#include <QVariantMap>
#include <QMap>
#include <QString>
#include <QStringList>
#include <QTimer>
namespace Ios {
@@ -61,7 +57,7 @@ class IosDeviceFactory final : public ProjectExplorer::IDeviceFactory
public:
IosDeviceFactory();
bool canRestore(const QVariantMap &map) const override;
bool canRestore(const Utils::Store &map) const override;
};
class IosDeviceManager : public QObject

View File

@@ -87,22 +87,24 @@ void IosDsymBuildStep::toMap(Store &map) const
{
AbstractProcessStep::toMap(map);
map.insert(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString(),
// FIXME: Clean up after QVariantMap -> Utils::Store transition
// This is map.insert(id().name() + ARGUMENTS_PARTIAL_KEY), arguments())
map.insert(keyFromString(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString()),
arguments());
map.insert(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString(),
map.insert(keyFromString(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString()),
isDefault());
map.insert(id().withSuffix(CLEAN_PARTIAL_KEY).toString(), m_clean);
map.insert(id().withSuffix(COMMAND_PARTIAL_KEY).toString(), command().toSettings());
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)
{
QVariant bArgs = map.value(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString());
QVariant bArgs = map.value(keyFromString(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString()));
m_arguments = bArgs.toStringList();
bool useDefaultArguments = map.value(
id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString()).toBool();
m_clean = map.value(id().withSuffix(CLEAN_PARTIAL_KEY).toString(), m_clean).toBool();
m_command = FilePath::fromSettings(map.value(id().withSuffix(COMMAND_PARTIAL_KEY).toString()));
keyFromString(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString())).toBool();
m_clean = map.value(keyFromString(id().withSuffix(CLEAN_PARTIAL_KEY).toString()), m_clean).toBool();
m_command = FilePath::fromSettings(map.value(keyFromString(id().withSuffix(COMMAND_PARTIAL_KEY).toString())));
if (useDefaultArguments) {
m_command = defaultCommand();
m_arguments = defaultArguments();

View File

@@ -40,7 +40,7 @@ using namespace Utils;
namespace Ios::Internal {
const QLatin1String deviceTypeKey("Ios.device_type");
const char deviceTypeKey[] = "Ios.device_type";
static QString displayName(const SimulatorInfo &device)
{
@@ -210,7 +210,7 @@ void IosDeviceTypeAspect::fromMap(const Store &map)
{
bool deviceTypeIsInt;
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap()))
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).value<Store>()))
updateDeviceType();
m_runConfiguration->update();
@@ -218,7 +218,7 @@ void IosDeviceTypeAspect::fromMap(const Store &map)
void IosDeviceTypeAspect::toMap(Store &map) const
{
map.insert(deviceTypeKey, deviceType().toMap());
map.insert(deviceTypeKey, QVariant::fromValue(deviceType().toMap()));
}
QString IosRunConfiguration::disabledReason() const

View File

@@ -17,11 +17,11 @@ using namespace Utils;
namespace Ios::Internal {
const QLatin1String iosDeviceTypeDisplayNameKey("displayName");
const QLatin1String iosDeviceTypeTypeKey("type");
const QLatin1String iosDeviceTypeIdentifierKey("identifier");
const char iosDeviceTypeDisplayNameKey[] = "displayName";
const char iosDeviceTypeTypeKey[] = "type";
const char iosDeviceTypeIdentifierKey[] = "identifier";
IosSimulator::IosSimulator(Utils::Id id)
IosSimulator::IosSimulator(Id id)
: m_lastPort(Constants::IOS_SIMULATOR_PORT_START)
{
setupId(IDevice::AutoDetected, id);
@@ -83,9 +83,9 @@ bool IosDeviceType::fromMap(const Store &map)
&& (type != IosDeviceType::SimulatedDevice || !identifier.isEmpty());
}
QVariantMap IosDeviceType::toMap() const
Store IosDeviceType::toMap() const
{
QVariantMap res;
Store res;
res[iosDeviceTypeDisplayNameKey] = displayName;
res[iosDeviceTypeTypeKey] = type;
res[iosDeviceTypeIdentifierKey] = identifier;