forked from qt-creator/qt-creator
DeviceFactory: Allow for querying supported device types
Allow to query the DeviceFactory for device types it can create as well as the display names to use for those types. Also allow to create any of the supported device types. The MaddeDeviceFactory makes use of the information to set the correct type in the wizard. Change-Id: I8c05ecd467e5bb1b151a84a8d62ef98a57849605 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -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<Core::Id> MaddeDeviceConfigurationFactory::availableCreationIds() const
|
||||
{
|
||||
return true;
|
||||
return QList<Core::Id>() << 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();
|
||||
|
@@ -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<Core::Id> availableCreationIds() const;
|
||||
|
||||
ProjectExplorer::IDevice::Ptr create(Core::Id id) const;
|
||||
bool canRestore(const QVariantMap &map) const;
|
||||
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const;
|
||||
};
|
||||
|
@@ -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<Core::Id>();
|
||||
return m_deviceType;
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::MachineType machineType() const
|
||||
@@ -177,6 +174,7 @@ private slots:
|
||||
|
||||
private:
|
||||
const QScopedPointer<Ui::MaemoDeviceConfigWizardStartPage> 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);
|
||||
|
@@ -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();
|
||||
|
@@ -7,13 +7,16 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>721</width>
|
||||
<height>176</height>
|
||||
<height>136</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
@@ -25,40 +28,13 @@
|
||||
<widget class="QLineEdit" name="nameLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="maemoVersionLabel">
|
||||
<property name="text">
|
||||
<string>The system running on the device:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="osTypeComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="typeLabel">
|
||||
<property name="text">
|
||||
<string>The kind of device:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="emulatorButton">
|
||||
@@ -89,24 +65,24 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="hostNameLabel">
|
||||
<property name="text">
|
||||
<string>The device's host name or IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="hostNameLineEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="sshPortLabel">
|
||||
<property name="text">
|
||||
<string>The SSH server port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sshPortSpinBox"/>
|
||||
|
@@ -31,13 +31,12 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "desktopdevice.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
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"));
|
||||
}
|
||||
|
@@ -56,8 +56,6 @@ public:
|
||||
|
||||
IDevice::Ptr clone() const;
|
||||
|
||||
static const Core::Id Id;
|
||||
|
||||
protected:
|
||||
DesktopDevice();
|
||||
DesktopDevice(const DesktopDevice &other);
|
||||
|
@@ -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<Core::Id> DesktopDeviceFactory::availableCreationIds() const
|
||||
{
|
||||
return QList<Core::Id>() << 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
|
||||
|
@@ -45,10 +45,11 @@ class DesktopDeviceFactory : public IDeviceFactory
|
||||
public:
|
||||
explicit DesktopDeviceFactory(QObject *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
QString displayNameForId(Core::Id type) const;
|
||||
QList<Core::Id> 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;
|
||||
};
|
||||
|
@@ -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<QListWidgetItem *> selected = ui->listWidget->selectedItems();
|
||||
if (selected.isEmpty())
|
||||
return Core::Id();
|
||||
return selected.at(0)->data(Qt::UserRole).value<Core::Id>();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#ifndef DEVICEFACTORYSELECTIONDIALOG_H
|
||||
#define DEVICEFACTORYSELECTIONDIALOG_H
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QDialog>
|
||||
|
||||
@@ -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<const IDeviceFactory *> m_factories;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -31,7 +31,7 @@
|
||||
**************************************************************************/
|
||||
#include "devicemanagermodel.h"
|
||||
|
||||
#include "desktopdevice.h"
|
||||
#include "../projectexplorerconstants.h"
|
||||
#include "devicemanager.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
58
src/plugins/projectexplorer/devicesupport/idevicefactory.cpp
Normal file
58
src/plugins/projectexplorer/devicesupport/idevicefactory.cpp
Normal file
@@ -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 <extensionsystem/pluginmanager.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
bool IDeviceFactory::canCreate() const
|
||||
{
|
||||
return !availableCreationIds().isEmpty();
|
||||
}
|
||||
|
||||
IDeviceFactory *IDeviceFactory::find(Core::Id type)
|
||||
{
|
||||
QList<IDeviceFactory *> factories
|
||||
= ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
|
||||
foreach (IDeviceFactory *factory, factories) {
|
||||
if (factory->availableCreationIds().contains(type))
|
||||
return factory;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
IDeviceFactory::IDeviceFactory(QObject *parent) : QObject(parent)
|
||||
{ }
|
||||
|
||||
} // namespace ProjectExplorer
|
@@ -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<Core::Id> 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
|
||||
|
@@ -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;
|
||||
|
@@ -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 \
|
||||
|
@@ -285,6 +285,7 @@ QtcPlugin {
|
||||
"devicesupport/devicesettingswidget.h",
|
||||
"devicesupport/devicesettingswidget.ui",
|
||||
"devicesupport/idevicewidget.h",
|
||||
"devicesupport/idevicefactory.cpp",
|
||||
"devicesupport/idevicefactory.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
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include <limits>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/devicesupport/desktopdevice.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -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)
|
||||
|
@@ -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<Core::Id> SymbianIDeviceFactory::availableCreationIds() const
|
||||
{
|
||||
return QList<Core::Id>() << 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();
|
||||
}
|
||||
|
||||
|
@@ -45,9 +45,11 @@ class SymbianIDeviceFactory : public ProjectExplorer::IDeviceFactory
|
||||
public:
|
||||
SymbianIDeviceFactory(QObject *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
QString displayNameForId(Core::Id type) const;
|
||||
QList<Core::Id> 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;
|
||||
|
||||
|
@@ -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<Core::Id> GenericLinuxDeviceConfigurationFactory::availableCreationIds() const
|
||||
{
|
||||
return true;
|
||||
return QList<Core::Id>() << 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();
|
||||
|
@@ -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<Core::Id> availableCreationIds() const;
|
||||
|
||||
ProjectExplorer::IDevice::Ptr create(Core::Id id) const;
|
||||
bool canRestore(const QVariantMap &map) const;
|
||||
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user