diff --git a/src/plugins/madde/maddedeviceconfigurationfactory.cpp b/src/plugins/madde/maddedeviceconfigurationfactory.cpp index 0f550e1b665..2f3f2fb384e 100644 --- a/src/plugins/madde/maddedeviceconfigurationfactory.cpp +++ b/src/plugins/madde/maddedeviceconfigurationfactory.cpp @@ -48,19 +48,19 @@ MaddeDeviceConfigurationFactory::MaddeDeviceConfigurationFactory(QObject *parent { } -QString MaddeDeviceConfigurationFactory::displayName() const +QString MaddeDeviceConfigurationFactory::displayNameForId(Core::Id type) const { - return tr("Device with MADDE support (Fremantle, Harmattan, MeeGo)"); + return MaddeDevice::maddeDisplayType(type); } -bool MaddeDeviceConfigurationFactory::canCreate() const +QList MaddeDeviceConfigurationFactory::availableCreationIds() const { - return true; + return QList() << Core::Id(Maemo5OsType) << Core::Id(HarmattanOsType) << Core::Id(MeeGoOsType); } -IDevice::Ptr MaddeDeviceConfigurationFactory::create() const +IDevice::Ptr MaddeDeviceConfigurationFactory::create(Core::Id id) const { - MaemoDeviceConfigWizard wizard; + MaemoDeviceConfigWizard wizard(id); if (wizard.exec() != QDialog::Accepted) return IDevice::Ptr(); return wizard.device(); diff --git a/src/plugins/madde/maddedeviceconfigurationfactory.h b/src/plugins/madde/maddedeviceconfigurationfactory.h index ebeed4a64a7..b57d8a5dbc5 100644 --- a/src/plugins/madde/maddedeviceconfigurationfactory.h +++ b/src/plugins/madde/maddedeviceconfigurationfactory.h @@ -43,9 +43,10 @@ class MaddeDeviceConfigurationFactory : public ProjectExplorer::IDeviceFactory public: MaddeDeviceConfigurationFactory(QObject *parent = 0); - QString displayName() const; - bool canCreate() const; - ProjectExplorer::IDevice::Ptr create() const; + QString displayNameForId(Core::Id type) const; + QList availableCreationIds() const; + + ProjectExplorer::IDevice::Ptr create(Core::Id id) const; bool canRestore(const QVariantMap &map) const; ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const; }; diff --git a/src/plugins/madde/maemodeviceconfigwizard.cpp b/src/plugins/madde/maemodeviceconfigwizard.cpp index 40628569ebb..65df2f67e3d 100644 --- a/src/plugins/madde/maemodeviceconfigwizard.cpp +++ b/src/plugins/madde/maemodeviceconfigwizard.cpp @@ -99,21 +99,13 @@ class MaemoDeviceConfigWizardStartPage : public QWizardPage Q_OBJECT public: - MaemoDeviceConfigWizardStartPage(QWidget *parent = 0) + explicit MaemoDeviceConfigWizardStartPage(QWidget *parent = 0) : QWizardPage(parent), m_ui(new Ui::MaemoDeviceConfigWizardStartPage) { m_ui->setupUi(this); setTitle(tr("General Information")); setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(Core::Id(Maemo5OsType)), - QVariant::fromValue(Core::Id(Maemo5OsType))); - const QVariant harmattanIdVariant = QVariant::fromValue(Core::Id(HarmattanOsType)); - m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(Core::Id(HarmattanOsType)), - harmattanIdVariant); - m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(Core::Id(MeeGoOsType)), - QVariant::fromValue(Core::Id(MeeGoOsType))); - QButtonGroup *buttonGroup = new QButtonGroup(this); buttonGroup->setExclusive(true); buttonGroup->addButton(m_ui->hwButton); @@ -121,7 +113,6 @@ public: connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(handleMachineTypeChanged())); m_ui->nameLineEdit->setText(tr("MeeGo Device")); - m_ui->osTypeComboBox->setCurrentIndex(m_ui->osTypeComboBox->findData(harmattanIdVariant)); m_ui->hwButton->setChecked(true); handleMachineTypeChanged(); m_ui->hostNameLineEdit->setText(defaultHost(machineType())); @@ -134,6 +125,12 @@ public: SIGNAL(completeChanged())); } + void setDeviceType(Core::Id type) + { + m_deviceType = type; + m_ui->nameLineEdit->setText(tr("%1 Device").arg(MaddeDevice::maddeDisplayType(m_deviceType))); + } + virtual bool isComplete() const { return !configName().isEmpty() && !hostName().isEmpty(); @@ -150,7 +147,7 @@ public: Core::Id deviceType() const { - return m_ui->osTypeComboBox->itemData(m_ui->osTypeComboBox->currentIndex()).value(); + return m_deviceType; } LinuxDeviceConfiguration::MachineType machineType() const @@ -177,6 +174,7 @@ private slots: private: const QScopedPointer m_ui; + Core::Id m_deviceType; }; class MaemoDeviceConfigWizardPreviousKeySetupCheckPage : public QWizardPage @@ -540,11 +538,12 @@ struct MaemoDeviceConfigWizardPrivate }; -MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(QWidget *parent) +MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(Core::Id id, QWidget *parent) : QWizard(parent), d(new MaemoDeviceConfigWizardPrivate(this)) { setWindowTitle(tr("New Device Configuration Setup")); setPage(StartPageId, &d->startPage); + d->startPage.setDeviceType(id); setPage(PreviousKeySetupCheckPageId, &d->previousKeySetupPage); setPage(ReuseKeysCheckPageId, &d->reuseKeysCheckPage); setPage(KeyCreationPageId, &d->keyCreationPage); diff --git a/src/plugins/madde/maemodeviceconfigwizard.h b/src/plugins/madde/maemodeviceconfigwizard.h index 04ffd6893bb..bea425307df 100644 --- a/src/plugins/madde/maemodeviceconfigwizard.h +++ b/src/plugins/madde/maemodeviceconfigwizard.h @@ -46,7 +46,7 @@ class MaemoDeviceConfigWizard : public QWizard Q_OBJECT public: - explicit MaemoDeviceConfigWizard(QWidget *parent = 0); + explicit MaemoDeviceConfigWizard(Core::Id id, QWidget *parent = 0); ~MaemoDeviceConfigWizard(); ProjectExplorer::IDevice::Ptr device(); diff --git a/src/plugins/madde/maemodeviceconfigwizardstartpage.ui b/src/plugins/madde/maemodeviceconfigwizardstartpage.ui index 94e3cc836aa..370fc5baeab 100644 --- a/src/plugins/madde/maemodeviceconfigwizardstartpage.ui +++ b/src/plugins/madde/maemodeviceconfigwizardstartpage.ui @@ -7,13 +7,16 @@ 0 0 721 - 176 + 136 WizardPage + + QFormLayout::AllNonFixedFieldsGrow + @@ -25,40 +28,13 @@ - - - The system running on the device: - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - The kind of device: - + @@ -89,24 +65,24 @@ - + The device's host name or IP address: - + - + The SSH server port: - + diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 26d50dac49f..8daf180e6a9 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -31,13 +31,12 @@ **************************************************************************/ #include "desktopdevice.h" +#include "projectexplorerconstants.h" #include namespace ProjectExplorer { -const Core::Id DesktopDevice::Id = Core::Id("Desktop Device"); - IDevice::DeviceInfo DesktopDevice::deviceInformation() const { return DeviceInfo(); @@ -74,7 +73,8 @@ IDevice::Ptr DesktopDevice::clone() const return Ptr(new DesktopDevice(*this)); } -DesktopDevice::DesktopDevice() : IDevice(Core::Id("Desktop"), IDevice::AutoDetected, Id) +DesktopDevice::DesktopDevice() : IDevice(Core::Id(Constants::DESKTOP_DEVICE_TYPE), IDevice::AutoDetected, + Core::Id(Constants::DESKTOP_DEVICE_ID)) { setDisplayName(QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Run locally")); } diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.h b/src/plugins/projectexplorer/devicesupport/desktopdevice.h index 9300c02ae4d..c1782bc653c 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.h @@ -56,8 +56,6 @@ public: IDevice::Ptr clone() const; - static const Core::Id Id; - protected: DesktopDevice(); DesktopDevice(const DesktopDevice &other); diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.cpp index 6968e5dcd4c..15e9c01d0e6 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.cpp @@ -32,13 +32,24 @@ #include "desktopdevicefactory.h" #include "desktopdevice.h" +#include "projectexplorerconstants.h" namespace ProjectExplorer { namespace Internal { -QString DesktopDeviceFactory::displayName() const +DesktopDeviceFactory::DesktopDeviceFactory(QObject *parent) : IDeviceFactory(parent) +{ } + +QString DesktopDeviceFactory::displayNameForId(Core::Id type) const { - return tr("Desktop"); + if (type == Core::Id(Constants::DESKTOP_DEVICE_TYPE)) + return tr("Desktop"); + return QString(); +} + +QList DesktopDeviceFactory::availableCreationIds() const +{ + return QList() << Core::Id(Constants::DESKTOP_DEVICE_TYPE); } bool DesktopDeviceFactory::canCreate() const @@ -46,14 +57,15 @@ bool DesktopDeviceFactory::canCreate() const return false; } -IDevice::Ptr DesktopDeviceFactory::create() const +IDevice::Ptr DesktopDeviceFactory::create(Core::Id id) const { + Q_UNUSED(id); return IDevice::Ptr(); } bool DesktopDeviceFactory::canRestore(const QVariantMap &map) const { - return IDevice::idFromMap(map) == DesktopDevice::Id; + return IDevice::idFromMap(map) == Core::Id(Constants::DESKTOP_DEVICE_ID); } IDevice::Ptr DesktopDeviceFactory::restore(const QVariantMap &map) const @@ -62,8 +74,5 @@ IDevice::Ptr DesktopDeviceFactory::restore(const QVariantMap &map) const return IDevice::Ptr(new DesktopDevice); } -DesktopDeviceFactory::DesktopDeviceFactory(QObject *parent) : IDeviceFactory(parent) -{ } - } // namespace Internal } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.h b/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.h index 5395d6949f8..79b5127e513 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevicefactory.h @@ -45,10 +45,11 @@ class DesktopDeviceFactory : public IDeviceFactory public: explicit DesktopDeviceFactory(QObject *parent = 0); - QString displayName() const; + QString displayNameForId(Core::Id type) const; + QList availableCreationIds() const; bool canCreate() const; - IDevice::Ptr create() const; + IDevice::Ptr create(Core::Id id) const; bool canRestore(const QVariantMap &map) const; IDevice::Ptr restore(const QVariantMap &map) const; }; diff --git a/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp b/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp index c8093c70eef..26a03d8e31a 100644 --- a/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp @@ -54,8 +54,11 @@ DeviceFactorySelectionDialog::DeviceFactorySelectionDialog(QWidget *parent) : foreach (const IDeviceFactory * const factory, factories) { if (!factory->canCreate()) continue; - m_factories << factory; - ui->listWidget->addItem(factory->displayName()); + foreach (Core::Id id, factory->availableCreationIds()) { + QListWidgetItem *item = new QListWidgetItem(factory->displayNameForId(id)); + item->setData(Qt::UserRole, QVariant::fromValue(id)); + ui->listWidget->addItem(item); + } } connect(ui->listWidget, SIGNAL(itemSelectionChanged()), SLOT(handleItemSelectionChanged())); @@ -73,9 +76,12 @@ void DeviceFactorySelectionDialog::handleItemSelectionChanged() ->setEnabled(!ui->listWidget->selectedItems().isEmpty()); } -const IDeviceFactory *DeviceFactorySelectionDialog::selectedFactory() const +Core::Id DeviceFactorySelectionDialog::selectedId() const { - return m_factories.at(ui->listWidget->row(ui->listWidget->selectedItems().first())); + QList selected = ui->listWidget->selectedItems(); + if (selected.isEmpty()) + return Core::Id(); + return selected.at(0)->data(Qt::UserRole).value(); } } // namespace Internal diff --git a/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.h b/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.h index f56ce34ba81..579807a1f8e 100644 --- a/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.h +++ b/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.h @@ -33,6 +33,8 @@ #ifndef DEVICEFACTORYSELECTIONDIALOG_H #define DEVICEFACTORYSELECTIONDIALOG_H +#include + #include #include @@ -49,13 +51,12 @@ class DeviceFactorySelectionDialog : public QDialog public: explicit DeviceFactorySelectionDialog(QWidget *parent = 0); ~DeviceFactorySelectionDialog(); - const IDeviceFactory *selectedFactory() const; + Core::Id selectedId() const; private: Q_SLOT void handleItemSelectionChanged(); Ui::DeviceFactorySelectionDialog *ui; - QList m_factories; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp index 6c0d9003edd..352b4d58e63 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "devicemanagermodel.h" -#include "desktopdevice.h" +#include "../projectexplorerconstants.h" #include "devicemanager.h" #include @@ -127,7 +127,7 @@ void DeviceManagerModel::handleDeviceListChanged() for (int i = 0; i < d->deviceManager->deviceCount(); ++i) { IDevice::ConstPtr dev = d->deviceManager->deviceAt(i); - if (dev->id() == DesktopDevice::Id) + if (dev->id() == Core::Id(Constants::DESKTOP_DEVICE_ID)) continue; d->devices << dev; } diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp index 0d0debdf5d0..e62275919dd 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp @@ -169,7 +169,13 @@ void DeviceSettingsWidget::addDevice() if (d.exec() != QDialog::Accepted) return; - IDevice::Ptr device = d.selectedFactory()->create(); + Core::Id toCreate = d.selectedId(); + if (!toCreate.isValid()) + return; + IDeviceFactory *factory = IDeviceFactory::find(toCreate); + if (!factory) + return; + IDevice::Ptr device = factory->create(toCreate); if (device.isNull()) return; diff --git a/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp b/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp new file mode 100644 index 00000000000..6cd07b4dbc8 --- /dev/null +++ b/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp @@ -0,0 +1,58 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "idevicefactory.h" + +#include + +namespace ProjectExplorer { + +bool IDeviceFactory::canCreate() const +{ + return !availableCreationIds().isEmpty(); +} + +IDeviceFactory *IDeviceFactory::find(Core::Id type) +{ + QList factories + = ExtensionSystem::PluginManager::instance()->getObjects(); + foreach (IDeviceFactory *factory, factories) { + if (factory->availableCreationIds().contains(type)) + return factory; + } + return 0; +} + +IDeviceFactory::IDeviceFactory(QObject *parent) : QObject(parent) +{ } + +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/idevicefactory.h b/src/plugins/projectexplorer/devicesupport/idevicefactory.h index b4fdda6fffe..a523a26822a 100644 --- a/src/plugins/projectexplorer/devicesupport/idevicefactory.h +++ b/src/plugins/projectexplorer/devicesupport/idevicefactory.h @@ -60,20 +60,24 @@ class PROJECTEXPLORER_EXPORT IDeviceFactory : public QObject public: /*! - A short, one-line description of what kind of device this factory supports. + A short, one-line description of what the device type. */ - virtual QString displayName() const = 0; + virtual QString displayNameForId(Core::Id type) const = 0; + /*! + A list of device types this factory can create. + */ + virtual QList availableCreationIds() const = 0; /*! Check whether this factory can create new devices. This is used to hide auto-detect-only factories from the listing of possible devices to create. */ - virtual bool canCreate() const = 0; + virtual bool canCreate() const; /*! Create a new device. This may or may not open a wizard. */ - virtual IDevice::Ptr create() const = 0; + virtual IDevice::Ptr create(Core::Id id) const = 0; /*! Check whether this factory can restore a device from the given serialized state. @@ -86,8 +90,10 @@ public: */ virtual IDevice::Ptr restore(const QVariantMap &map) const = 0; + static IDeviceFactory *find(Core::Id type); + protected: - IDeviceFactory(QObject *parent) : QObject(parent) { } + IDeviceFactory(QObject *parent = 0); }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 1efaa4f6e8f..8ae852501d0 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1131,7 +1131,7 @@ void ProjectExplorerPlugin::extensionsInitialized() bool ProjectExplorerPlugin::delayedInitialize() { DeviceManager *dm = DeviceManager::instance(); - if (dm->find(DesktopDevice::Id).isNull()) + if (dm->find(Core::Id(Constants::DESKTOP_DEVICE_ID)).isNull()) DeviceManager::instance()->addDevice(IDevice::Ptr(new DesktopDevice)); return true; diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 1c586140db5..7a22c3bf2f8 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -200,6 +200,7 @@ SOURCES += projectexplorer.cpp \ devicesupport/idevice.cpp \ devicesupport/desktopdevice.cpp \ devicesupport/desktopdevicefactory.cpp \ + devicesupport/idevicefactory.cpp \ devicesupport/devicemanager.cpp \ devicesupport/devicemanagermodel.cpp \ devicesupport/devicefactoryselectiondialog.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 3df35b7a889..2ccda10a1db 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -285,6 +285,7 @@ QtcPlugin { "devicesupport/devicesettingswidget.h", "devicesupport/devicesettingswidget.ui", "devicesupport/idevicewidget.h", + "devicesupport/idevicefactory.cpp", "devicesupport/idevicefactory.h" ] diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index c2021f993c6..04fcd6cf176 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -232,6 +232,10 @@ const int QML_DEFAULT_DEBUG_SERVER_PORT = 3768; // Default directory to run custom (build) commands in. const char DEFAULT_WORKING_DIR[] = "%{buildDir}"; +// Desktop Device related ids: +const char DESKTOP_DEVICE_ID[] = "Desktop Device"; +const char DESKTOP_DEVICE_TYPE[] = "Desktop"; + } // namespace Constants // Run modes diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index e6f2cc12ecb..1acb4f73fc1 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -545,7 +544,7 @@ void Target::updateDeviceState() ProjectExplorer::IDevice::ConstPtr Target::currentDevice() const { - return DeviceManager::instance()->find(ProjectExplorer::DesktopDevice::Id); + return DeviceManager::instance()->find(ProjectExplorer::Constants::DESKTOP_DEVICE_ID); } void Target::setEnabled(bool enabled) diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.cpp b/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.cpp index db3d93a7880..b561ec0c946 100644 --- a/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.cpp @@ -42,9 +42,16 @@ namespace Internal { SymbianIDeviceFactory::SymbianIDeviceFactory(QObject *parent) : IDeviceFactory(parent) { } -QString SymbianIDeviceFactory::displayName() const +QString SymbianIDeviceFactory::displayNameForId(Core::Id type) const { - return tr("Symbian Device"); + if (type == deviceType()) + return tr("Symbian Device"); + return QString(); +} + +QList SymbianIDeviceFactory::availableCreationIds() const +{ + return QList() << deviceType(); } bool SymbianIDeviceFactory::canCreate() const @@ -52,8 +59,9 @@ bool SymbianIDeviceFactory::canCreate() const return false; } -ProjectExplorer::IDevice::Ptr SymbianIDeviceFactory::create() const +ProjectExplorer::IDevice::Ptr SymbianIDeviceFactory::create(Core::Id id) const { + Q_UNUSED(id); return ProjectExplorer::IDevice::Ptr(); } diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.h b/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.h index 2b4e5340cb3..040edd0c964 100644 --- a/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.h +++ b/src/plugins/qt4projectmanager/qt-s60/symbianidevicefactory.h @@ -45,9 +45,11 @@ class SymbianIDeviceFactory : public ProjectExplorer::IDeviceFactory public: SymbianIDeviceFactory(QObject *parent = 0); - QString displayName() const; + QString displayNameForId(Core::Id type) const; + QList availableCreationIds() const; + bool canCreate() const; - ProjectExplorer::IDevice::Ptr create() const; + ProjectExplorer::IDevice::Ptr create(Core::Id id) const; bool canRestore(const QVariantMap &map) const; ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const; diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp index 163939b1b39..9716d0e4969 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp @@ -46,18 +46,20 @@ GenericLinuxDeviceConfigurationFactory::GenericLinuxDeviceConfigurationFactory(Q { } -QString GenericLinuxDeviceConfigurationFactory::displayName() const +QString GenericLinuxDeviceConfigurationFactory::displayNameForId(Core::Id type) const { + QTC_ASSERT(type == Core::Id(Constants::GenericLinuxOsType), return QString()); return tr("Generic Linux Device"); } -bool GenericLinuxDeviceConfigurationFactory::canCreate() const +QList GenericLinuxDeviceConfigurationFactory::availableCreationIds() const { - return true; + return QList() << Core::Id(Constants::GenericLinuxOsType); } -IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create() const +IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create(Core::Id id) const { + QTC_ASSERT(id == Core::Id(Constants::GenericLinuxOsType), return IDevice::Ptr()); GenericLinuxDeviceConfigurationWizard wizard; if (wizard.exec() != QDialog::Accepted) return IDevice::Ptr(); diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h index 0b8d5ccea19..01b979c2eb5 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h @@ -46,9 +46,10 @@ class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationFactory public: GenericLinuxDeviceConfigurationFactory(QObject *parent = 0); - QString displayName() const; - bool canCreate() const; - ProjectExplorer::IDevice::Ptr create() const; + QString displayNameForId(Core::Id type) const; + QList availableCreationIds() const; + + ProjectExplorer::IDevice::Ptr create(Core::Id id) const; bool canRestore(const QVariantMap &map) const; ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const; };