forked from qt-creator/qt-creator
Device support: Remove fallbacks for Creator < 2.6.
A grace period of two minor versions seems enough. Change-Id: If29ddae40b0ed70ba6c26a2990e958f2859c03b9 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
@@ -153,10 +153,6 @@ void DeviceManager::load()
|
|||||||
QList<IDevice::Ptr> userDevices;
|
QList<IDevice::Ptr> userDevices;
|
||||||
if (reader.load(settingsFilePath(QLatin1String("/qtcreator/devices.xml"))))
|
if (reader.load(settingsFilePath(QLatin1String("/qtcreator/devices.xml"))))
|
||||||
userDevices = fromMap(reader.restoreValues().value(QLatin1String(DeviceManagerKey)).toMap());
|
userDevices = fromMap(reader.restoreValues().value(QLatin1String(DeviceManagerKey)).toMap());
|
||||||
else if (reader.load(settingsFilePath(QLatin1String("/devices.xml"))))
|
|
||||||
userDevices = fromMap(reader.restoreValues().value(QLatin1String(DeviceManagerKey)).toMap());
|
|
||||||
else
|
|
||||||
userDevices = loadPre2_6();
|
|
||||||
// Insert devices into the model. Prefer the higher device version when there are multiple
|
// Insert devices into the model. Prefer the higher device version when there are multiple
|
||||||
// devices with the same id.
|
// devices with the same id.
|
||||||
foreach (IDevice::Ptr device, userDevices) {
|
foreach (IDevice::Ptr device, userDevices) {
|
||||||
@@ -176,35 +172,6 @@ void DeviceManager::load()
|
|||||||
ensureOneDefaultDevicePerType();
|
ensureOneDefaultDevicePerType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove in 2.8
|
|
||||||
QList<IDevice::Ptr> DeviceManager::loadPre2_6()
|
|
||||||
{
|
|
||||||
QList<IDevice::Ptr> devices;
|
|
||||||
QSettings *settings = Core::ICore::settings();
|
|
||||||
settings->beginGroup(QLatin1String("MaemoDeviceConfigs"));
|
|
||||||
const QVariantHash defaultDevsHash = settings->value(QLatin1String("DefaultConfigs")).toHash();
|
|
||||||
for (QVariantHash::ConstIterator it = defaultDevsHash.constBegin();
|
|
||||||
it != defaultDevsHash.constEnd(); ++it) {
|
|
||||||
d->defaultDevices.insert(Core::Id(it.key()), Core::Id(it.value().toString()));
|
|
||||||
}
|
|
||||||
int count = settings->beginReadArray(QLatin1String("ConfigList"));
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
settings->setArrayIndex(i);
|
|
||||||
QVariantMap map;
|
|
||||||
foreach (const QString &key, settings->childKeys())
|
|
||||||
map.insert(key, settings->value(key));
|
|
||||||
const IDeviceFactory * const factory = restoreFactory(map);
|
|
||||||
if (!factory)
|
|
||||||
continue;
|
|
||||||
IDevice::Ptr device = factory->restore(map);
|
|
||||||
QTC_ASSERT(device, continue);
|
|
||||||
devices << device;
|
|
||||||
}
|
|
||||||
settings->endArray();
|
|
||||||
settings->endGroup();
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<IDevice::Ptr> DeviceManager::fromMap(const QVariantMap &map)
|
QList<IDevice::Ptr> DeviceManager::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
QList<IDevice::Ptr> devices;
|
QList<IDevice::Ptr> devices;
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ private:
|
|||||||
DeviceManager(bool isInstance = false);
|
DeviceManager(bool isInstance = false);
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
QList<IDevice::Ptr> loadPre2_6();
|
|
||||||
static const IDeviceFactory *restoreFactory(const QVariantMap &map);
|
static const IDeviceFactory *restoreFactory(const QVariantMap &map);
|
||||||
QList<IDevice::Ptr> fromMap(const QVariantMap &map);
|
QList<IDevice::Ptr> fromMap(const QVariantMap &map);
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user