forked from qt-creator/qt-creator
Device Support: Move some functions from IDeviceFactory to IDevice.
Now that we have a polymorphic device class, we don't need to attach all the virtual functions to the factory anymore. In addition, the isUserEditable() function is gone, because it is no longer needed in the presence of device-specific widgets. Change-Id: Ie8f0be95653cb83e1618885b08cdd2aacf5dda59 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -31,8 +31,22 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#include "maddedevice.h"
|
#include "maddedevice.h"
|
||||||
|
|
||||||
|
#include "maddedevicetester.h"
|
||||||
|
#include "maemoconstants.h"
|
||||||
|
|
||||||
|
#include <remotelinux/linuxdevicetestdialog.h>
|
||||||
|
#include <remotelinux/publickeydeploymentdialog.h>
|
||||||
|
#include <remotelinux/remotelinuxprocessesdialog.h>
|
||||||
|
#include <remotelinux/remotelinuxprocesslist.h>
|
||||||
|
#include <remotelinux/remotelinux_constants.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
using namespace RemoteLinux;
|
||||||
|
|
||||||
namespace Madde {
|
namespace Madde {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
const char MaddeDeviceTestActionId[] = "Madde.DeviceTestAction";
|
||||||
|
const char MaddeRemoteProcessesActionId[] = "Madde.RemoteProcessesAction";
|
||||||
|
|
||||||
MaddeDevice::Ptr MaddeDevice::create()
|
MaddeDevice::Ptr MaddeDevice::create()
|
||||||
{
|
{
|
||||||
@@ -64,5 +78,54 @@ ProjectExplorer::IDevice::Ptr MaddeDevice::clone() const
|
|||||||
return Ptr(new MaddeDevice(*this));
|
return Ptr(new MaddeDevice(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MaddeDevice::displayType() const
|
||||||
|
{
|
||||||
|
return maddeDisplayType(type());
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList MaddeDevice::actionIds() const
|
||||||
|
{
|
||||||
|
return QStringList() << QLatin1String(MaddeDeviceTestActionId)
|
||||||
|
<< QLatin1String(Constants::GenericDeployKeyToDeviceActionId)
|
||||||
|
<< QLatin1String(MaddeRemoteProcessesActionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MaddeDevice::displayNameForActionId(const QString &actionId) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(actionIds().contains(actionId), return QString());
|
||||||
|
|
||||||
|
if (actionId == QLatin1String(MaddeDeviceTestActionId))
|
||||||
|
return tr("Test");
|
||||||
|
if (actionId == QLatin1String(MaddeRemoteProcessesActionId))
|
||||||
|
return tr("Remote Processes...");
|
||||||
|
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
||||||
|
return tr("Deploy Public Key...");
|
||||||
|
return QString(); // Can't happen.
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog *MaddeDevice::createAction(const QString &actionId, QWidget *parent) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(actionIds().contains(actionId), return 0);
|
||||||
|
|
||||||
|
const LinuxDeviceConfiguration::ConstPtr device
|
||||||
|
= sharedFromThis().staticCast<const LinuxDeviceConfiguration>();
|
||||||
|
if (actionId == QLatin1String(MaddeDeviceTestActionId))
|
||||||
|
return new LinuxDeviceTestDialog(device, new MaddeDeviceTester, parent);
|
||||||
|
if (actionId == QLatin1String(MaddeRemoteProcessesActionId))
|
||||||
|
return new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device), parent);
|
||||||
|
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
||||||
|
return PublicKeyDeploymentDialog::createDialog(device, parent);
|
||||||
|
return 0; // Can't happen.
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MaddeDevice::maddeDisplayType(const QString &type)
|
||||||
|
{
|
||||||
|
if (type == QLatin1String(Maemo5OsType))
|
||||||
|
return tr("Maemo5/Fremantle");
|
||||||
|
if (type == QLatin1String(HarmattanOsType))
|
||||||
|
return tr("MeeGo 1.2 Harmattan");
|
||||||
|
return tr("Other MeeGo OS");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Madde
|
} // namespace Madde
|
||||||
|
@@ -34,11 +34,14 @@
|
|||||||
|
|
||||||
#include <remotelinux/linuxdeviceconfiguration.h>
|
#include <remotelinux/linuxdeviceconfiguration.h>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
namespace Madde {
|
namespace Madde {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MaddeDevice : public RemoteLinux::LinuxDeviceConfiguration
|
class MaddeDevice : public RemoteLinux::LinuxDeviceConfiguration
|
||||||
{
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(MaddeDevice)
|
||||||
public:
|
public:
|
||||||
typedef QSharedPointer<MaddeDevice> Ptr;
|
typedef QSharedPointer<MaddeDevice> Ptr;
|
||||||
typedef QSharedPointer<const MaddeDevice> ConstPtr;
|
typedef QSharedPointer<const MaddeDevice> ConstPtr;
|
||||||
@@ -47,7 +50,12 @@ public:
|
|||||||
static Ptr create(const QString &name, const QString &type, MachineType machineType,
|
static Ptr create(const QString &name, const QString &type, MachineType machineType,
|
||||||
Origin origin = ManuallyAdded, const QString &fingerprint = QString());
|
Origin origin = ManuallyAdded, const QString &fingerprint = QString());
|
||||||
|
|
||||||
|
QString displayType() const;
|
||||||
|
QStringList actionIds() const;
|
||||||
|
QString displayNameForActionId(const QString &actionId) const;
|
||||||
|
QDialog *createAction(const QString &actionId, QWidget *parent) const;
|
||||||
ProjectExplorer::IDevice::Ptr clone() const;
|
ProjectExplorer::IDevice::Ptr clone() const;
|
||||||
|
static QString maddeDisplayType(const QString &type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MaddeDevice();
|
MaddeDevice();
|
||||||
|
@@ -32,16 +32,9 @@
|
|||||||
#include "maddedeviceconfigurationfactory.h"
|
#include "maddedeviceconfigurationfactory.h"
|
||||||
|
|
||||||
#include "maddedevice.h"
|
#include "maddedevice.h"
|
||||||
#include "maddedevicetester.h"
|
|
||||||
#include "maemoconstants.h"
|
#include "maemoconstants.h"
|
||||||
#include "maemodeviceconfigwizard.h"
|
#include "maemodeviceconfigwizard.h"
|
||||||
|
|
||||||
#include <remotelinux/linuxdevicetestdialog.h>
|
|
||||||
#include <remotelinux/publickeydeploymentdialog.h>
|
|
||||||
#include <remotelinux/remotelinuxprocessesdialog.h>
|
|
||||||
#include <remotelinux/remotelinuxprocesslist.h>
|
|
||||||
#include <remotelinux/remotelinux_constants.h>
|
|
||||||
#include <remotelinux/genericlinuxdeviceconfigurationwidget.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -49,10 +42,6 @@ using namespace RemoteLinux;
|
|||||||
|
|
||||||
namespace Madde {
|
namespace Madde {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace {
|
|
||||||
const char MaddeDeviceTestActionId[] = "Madde.DeviceTestAction";
|
|
||||||
const char MaddeRemoteProcessesActionId[] = "Madde.RemoteProcessesAction";
|
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
MaddeDeviceConfigurationFactory::MaddeDeviceConfigurationFactory(QObject *parent)
|
MaddeDeviceConfigurationFactory::MaddeDeviceConfigurationFactory(QObject *parent)
|
||||||
: IDeviceFactory(parent)
|
: IDeviceFactory(parent)
|
||||||
@@ -69,13 +58,6 @@ IDeviceWizard *MaddeDeviceConfigurationFactory::createWizard(QWidget *parent) co
|
|||||||
return new MaemoDeviceConfigWizard(parent);
|
return new MaemoDeviceConfigWizard(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDeviceWidget *MaddeDeviceConfigurationFactory::createWidget(const IDevice::Ptr &device,
|
|
||||||
QWidget *parent) const
|
|
||||||
{
|
|
||||||
return new GenericLinuxDeviceConfigurationWidget(device.staticCast<LinuxDeviceConfiguration>(),
|
|
||||||
parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDevice::Ptr MaddeDeviceConfigurationFactory::loadDevice(const QVariantMap &map) const
|
IDevice::Ptr MaddeDeviceConfigurationFactory::loadDevice(const QVariantMap &map) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)), return MaddeDevice::Ptr());
|
QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)), return MaddeDevice::Ptr());
|
||||||
@@ -90,51 +72,5 @@ bool MaddeDeviceConfigurationFactory::supportsDeviceType(const QString &type) co
|
|||||||
|| type == QLatin1String(MeeGoOsType);
|
|| type == QLatin1String(MeeGoOsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaddeDeviceConfigurationFactory::displayNameForDeviceType(const QString &deviceType) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(supportsDeviceType(deviceType), return QString());
|
|
||||||
if (deviceType == QLatin1String(Maemo5OsType))
|
|
||||||
return tr("Maemo5/Fremantle");
|
|
||||||
if (deviceType == QLatin1String(HarmattanOsType))
|
|
||||||
return tr("MeeGo 1.2 Harmattan");
|
|
||||||
return tr("Other MeeGo OS");
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList MaddeDeviceConfigurationFactory::supportedDeviceActionIds() const
|
|
||||||
{
|
|
||||||
return QStringList() << QLatin1String(MaddeDeviceTestActionId)
|
|
||||||
<< QLatin1String(Constants::GenericDeployKeyToDeviceActionId)
|
|
||||||
<< QLatin1String(MaddeRemoteProcessesActionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MaddeDeviceConfigurationFactory::displayNameForActionId(const QString &actionId) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(supportedDeviceActionIds().contains(actionId));
|
|
||||||
|
|
||||||
if (actionId == QLatin1String(MaddeDeviceTestActionId))
|
|
||||||
return tr("Test");
|
|
||||||
if (actionId == QLatin1String(MaddeRemoteProcessesActionId))
|
|
||||||
return tr("Remote Processes...");
|
|
||||||
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
|
||||||
return tr("Deploy Public Key...");
|
|
||||||
return QString(); // Can't happen.
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog *MaddeDeviceConfigurationFactory::createDeviceAction(const QString &actionId,
|
|
||||||
const IDevice::ConstPtr &device, QWidget *parent) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(supportedDeviceActionIds().contains(actionId));
|
|
||||||
|
|
||||||
const LinuxDeviceConfiguration::ConstPtr lDevice
|
|
||||||
= device.staticCast<const LinuxDeviceConfiguration>();
|
|
||||||
if (actionId == QLatin1String(MaddeDeviceTestActionId))
|
|
||||||
return new LinuxDeviceTestDialog(lDevice, new MaddeDeviceTester, parent);
|
|
||||||
if (actionId == QLatin1String(MaddeRemoteProcessesActionId))
|
|
||||||
return new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(lDevice), parent);
|
|
||||||
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
|
||||||
return PublicKeyDeploymentDialog::createDialog(lDevice, parent);
|
|
||||||
return 0; // Can't happen.
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Madde
|
} // namespace Madde
|
||||||
|
@@ -45,15 +45,8 @@ public:
|
|||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
ProjectExplorer::IDeviceWizard *createWizard(QWidget *parent) const;
|
ProjectExplorer::IDeviceWizard *createWizard(QWidget *parent) const;
|
||||||
ProjectExplorer::IDeviceWidget *createWidget(
|
|
||||||
const ProjectExplorer::IDevice::Ptr &device, QWidget *parent = 0) const;
|
|
||||||
ProjectExplorer::IDevice::Ptr loadDevice(const QVariantMap &map) const;
|
ProjectExplorer::IDevice::Ptr loadDevice(const QVariantMap &map) const;
|
||||||
bool supportsDeviceType(const QString &type) const;
|
bool supportsDeviceType(const QString &type) const;
|
||||||
QString displayNameForDeviceType(const QString &deviceType) const;
|
|
||||||
QStringList supportedDeviceActionIds() const;
|
|
||||||
QString displayNameForActionId(const QString &actionId) const;
|
|
||||||
QDialog *createDeviceAction(const QString &actionId,
|
|
||||||
const ProjectExplorer::IDevice::ConstPtr &device, QWidget *parent) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -41,7 +41,6 @@
|
|||||||
#include "maemoconstants.h"
|
#include "maemoconstants.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
|
||||||
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
|
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
|
||||||
#include <remotelinux/linuxdevicetestdialog.h>
|
#include <remotelinux/linuxdevicetestdialog.h>
|
||||||
#include <remotelinux/sshkeydeployer.h>
|
#include <remotelinux/sshkeydeployer.h>
|
||||||
@@ -106,11 +105,11 @@ public:
|
|||||||
setTitle(tr("General Information"));
|
setTitle(tr("General Information"));
|
||||||
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
||||||
|
|
||||||
m_ui->osTypeComboBox->addItem(DeviceManager::displayNameForDeviceType(QLatin1String(Maemo5OsType)),
|
m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(QLatin1String(Maemo5OsType)),
|
||||||
QLatin1String(Maemo5OsType));
|
QLatin1String(Maemo5OsType));
|
||||||
m_ui->osTypeComboBox->addItem(DeviceManager::displayNameForDeviceType(QLatin1String(HarmattanOsType)),
|
m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(QLatin1String(HarmattanOsType)),
|
||||||
QLatin1String(HarmattanOsType));
|
QLatin1String(HarmattanOsType));
|
||||||
m_ui->osTypeComboBox->addItem(DeviceManager::displayNameForDeviceType(QLatin1String(MeeGoOsType)),
|
m_ui->osTypeComboBox->addItem(MaddeDevice::maddeDisplayType(QLatin1String(MeeGoOsType)),
|
||||||
QLatin1String(MeeGoOsType));
|
QLatin1String(MeeGoOsType));
|
||||||
|
|
||||||
QButtonGroup *buttonGroup = new QButtonGroup(this);
|
QButtonGroup *buttonGroup = new QButtonGroup(this);
|
||||||
|
@@ -332,13 +332,6 @@ const IDeviceFactory *DeviceManager::factoryForDeviceType(const QString &type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceManager::displayNameForDeviceType(const QString &type)
|
|
||||||
{
|
|
||||||
if (const IDeviceFactory * const factory = factoryForDeviceType(type))
|
|
||||||
return factory->displayNameForDeviceType(type);
|
|
||||||
return tr("Unknown OS");
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceManager::DeviceManager(bool doLoad) : d(new DeviceManagerPrivate)
|
DeviceManager::DeviceManager(bool doLoad) : d(new DeviceManagerPrivate)
|
||||||
{
|
{
|
||||||
if (doLoad)
|
if (doLoad)
|
||||||
@@ -428,4 +421,25 @@ IDevice::Id DeviceManager::unusedId() const
|
|||||||
return IDevice::invalidId();
|
return IDevice::invalidId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDevice::Ptr DeviceManager::fromRawPointer(IDevice *device) const
|
||||||
|
{
|
||||||
|
foreach (const IDevice::Ptr &devPtr, d->devices) {
|
||||||
|
if (devPtr == device)
|
||||||
|
return devPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this == instance() && d->clonedInstance)
|
||||||
|
return d->clonedInstance->fromRawPointer(device);
|
||||||
|
|
||||||
|
qWarning("%s: Device not found.", Q_FUNC_INFO);
|
||||||
|
return IDevice::Ptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
IDevice::ConstPtr DeviceManager::fromRawPointer(const IDevice *device) const
|
||||||
|
{
|
||||||
|
// The const_cast is safe, because we convert the Ptr back to a ConstPtr before returning it.
|
||||||
|
return fromRawPointer(const_cast<IDevice *>(device));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -50,6 +50,7 @@ class PROJECTEXPLORER_EXPORT DeviceManager : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class Internal::DeviceSettingsWidget;
|
friend class Internal::DeviceSettingsWidget;
|
||||||
|
friend class IDevice;
|
||||||
public:
|
public:
|
||||||
~DeviceManager();
|
~DeviceManager();
|
||||||
|
|
||||||
@@ -70,7 +71,6 @@ public:
|
|||||||
void removeDevice(int index);
|
void removeDevice(int index);
|
||||||
|
|
||||||
static const IDeviceFactory *factoryForDeviceType(const QString &type);
|
static const IDeviceFactory *factoryForDeviceType(const QString &type);
|
||||||
static QString displayNameForDeviceType(const QString &type);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void deviceAdded(const QSharedPointer<const IDevice> &device);
|
void deviceAdded(const QSharedPointer<const IDevice> &device);
|
||||||
@@ -100,6 +100,10 @@ private:
|
|||||||
static void replaceInstance();
|
static void replaceInstance();
|
||||||
static void removeClonedInstance();
|
static void removeClonedInstance();
|
||||||
|
|
||||||
|
// For IDevice.
|
||||||
|
IDevice::Ptr fromRawPointer(IDevice *device) const;
|
||||||
|
IDevice::ConstPtr fromRawPointer(const IDevice *device) const;
|
||||||
|
|
||||||
static QString settingsFilePath();
|
static QString settingsFilePath();
|
||||||
static void copy(const DeviceManager *source, DeviceManager *target, bool deep);
|
static void copy(const DeviceManager *source, DeviceManager *target, bool deep);
|
||||||
|
|
||||||
|
@@ -104,10 +104,8 @@ QVariant DeviceManagerModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
const IDevice::ConstPtr device = d->devices.at(index.row());
|
const IDevice::ConstPtr device = d->devices.at(index.row());
|
||||||
QString name = device->displayName();
|
QString name = device->displayName();
|
||||||
if (d->deviceManager->defaultDevice(device->type()) == device) {
|
if (d->deviceManager->defaultDevice(device->type()) == device)
|
||||||
name = tr("%1 (default for %2)").arg(name,
|
name = tr("%1 (default for %2)").arg(name, device->displayType());
|
||||||
d->deviceManager->displayNameForDeviceType(device->type()));
|
|
||||||
}
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/portlist.h>
|
#include <utils/portlist.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
@@ -115,6 +116,7 @@ DeviceSettingsWidget::~DeviceSettingsWidget()
|
|||||||
DeviceManager::replaceInstance();
|
DeviceManager::replaceInstance();
|
||||||
}
|
}
|
||||||
DeviceManager::removeClonedInstance();
|
DeviceManager::removeClonedInstance();
|
||||||
|
delete m_configWidget;
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +183,7 @@ void DeviceSettingsWidget::displayCurrent()
|
|||||||
const IDevice::ConstPtr ¤t = currentDevice();
|
const IDevice::ConstPtr ¤t = currentDevice();
|
||||||
m_ui->defaultDeviceButton->setEnabled(
|
m_ui->defaultDeviceButton->setEnabled(
|
||||||
m_deviceManager->defaultDevice(current->type()) != current);
|
m_deviceManager->defaultDevice(current->type()) != current);
|
||||||
m_ui->osTypeValueLabel->setText(DeviceManager::displayNameForDeviceType(current->type()));
|
m_ui->osTypeValueLabel->setText(current->displayType());
|
||||||
m_ui->autoDetectionValueLabel->setText(current->isAutoDetected()
|
m_ui->autoDetectionValueLabel->setText(current->isAutoDetected()
|
||||||
? tr("Yes (fingerprint is '%1')").arg(current->fingerprint()) : tr("No"));
|
? tr("Yes (fingerprint is '%1')").arg(current->fingerprint()) : tr("No"));
|
||||||
m_nameValidator->setDisplayName(current->displayName());
|
m_nameValidator->setDisplayName(current->displayName());
|
||||||
@@ -234,36 +236,26 @@ void DeviceSettingsWidget::currentDeviceChanged(int index)
|
|||||||
delete m_configWidget;
|
delete m_configWidget;
|
||||||
m_configWidget = 0;
|
m_configWidget = 0;
|
||||||
m_additionalActionButtons.clear();
|
m_additionalActionButtons.clear();
|
||||||
m_ui->generalGroupBox->setEnabled(false);
|
QTC_ASSERT(index >= -1 && index < m_deviceManager->deviceCount(), return);
|
||||||
m_ui->osSpecificGroupBox->setEnabled(false);
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
m_ui->removeConfigButton->setEnabled(false);
|
m_ui->removeConfigButton->setEnabled(false);
|
||||||
clearDetails();
|
clearDetails();
|
||||||
m_ui->defaultDeviceButton->setEnabled(false);
|
m_ui->defaultDeviceButton->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
m_ui->removeConfigButton->setEnabled(true);
|
m_ui->removeConfigButton->setEnabled(true);
|
||||||
const IDeviceFactory * const factory = factoryForCurrentDevice();
|
const IDevice::ConstPtr device = m_deviceManager->deviceAt(index);
|
||||||
if (factory) {
|
foreach (const QString &actionId, device->actionIds()) {
|
||||||
const QStringList &actionIds = factory->supportedDeviceActionIds();
|
QPushButton * const button = new QPushButton(device->displayNameForActionId(actionId));
|
||||||
foreach (const QString &actionId, actionIds) {
|
m_additionalActionButtons << button;
|
||||||
QPushButton * const button = new QPushButton(
|
connect(button, SIGNAL(clicked()), m_additionalActionsMapper, SLOT(map()));
|
||||||
factory->displayNameForActionId(actionId));
|
m_additionalActionsMapper->setMapping(button, actionId);
|
||||||
m_additionalActionButtons << button;
|
m_ui->buttonsLayout->insertWidget(m_ui->buttonsLayout->count() - 1, button);
|
||||||
connect(button, SIGNAL(clicked()), m_additionalActionsMapper, SLOT(map()));
|
|
||||||
m_additionalActionsMapper->setMapping(button, actionId);
|
|
||||||
m_ui->buttonsLayout->insertWidget(m_ui->buttonsLayout->count() - 1, button);
|
|
||||||
}
|
|
||||||
if (!m_ui->osSpecificGroupBox->layout())
|
|
||||||
new QVBoxLayout(m_ui->osSpecificGroupBox);
|
|
||||||
m_configWidget = factory->createWidget(m_deviceManager->mutableDeviceAt(currentIndex()),
|
|
||||||
m_ui->osSpecificGroupBox);
|
|
||||||
if (m_configWidget) {
|
|
||||||
m_ui->osSpecificGroupBox->layout()->addWidget(m_configWidget);
|
|
||||||
m_ui->osSpecificGroupBox->setEnabled(factory->isUserEditable());
|
|
||||||
}
|
|
||||||
m_ui->generalGroupBox->setEnabled(factory->isUserEditable());
|
|
||||||
}
|
}
|
||||||
m_ui->configurationComboBox->setCurrentIndex(index);
|
if (!m_ui->osSpecificGroupBox->layout())
|
||||||
|
new QVBoxLayout(m_ui->osSpecificGroupBox);
|
||||||
|
m_configWidget = m_deviceManager->mutableDeviceAt(index)->createWidget();
|
||||||
|
if (m_configWidget)
|
||||||
|
m_ui->osSpecificGroupBox->layout()->addWidget(m_configWidget);
|
||||||
displayCurrent();
|
displayCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,17 +267,11 @@ void DeviceSettingsWidget::clearDetails()
|
|||||||
m_ui->autoDetectionValueLabel->clear();
|
m_ui->autoDetectionValueLabel->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IDeviceFactory *DeviceSettingsWidget::factoryForCurrentDevice() const
|
|
||||||
{
|
|
||||||
Q_ASSERT(currentDevice());
|
|
||||||
return DeviceManager::factoryForDeviceType(currentDevice()->type());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceSettingsWidget::handleAdditionalActionRequest(const QString &actionId)
|
void DeviceSettingsWidget::handleAdditionalActionRequest(const QString &actionId)
|
||||||
{
|
{
|
||||||
const IDeviceFactory * const factory = factoryForCurrentDevice();
|
const IDevice::ConstPtr &device = currentDevice();
|
||||||
Q_ASSERT(factory);
|
QTC_ASSERT(device, return);
|
||||||
QDialog * const action = factory->createDeviceAction(actionId, currentDevice(), this);
|
QDialog * const action = device->createAction(actionId, this);
|
||||||
if (action)
|
if (action)
|
||||||
action->exec();
|
action->exec();
|
||||||
delete action;
|
delete action;
|
||||||
|
@@ -44,7 +44,6 @@ QT_END_NAMESPACE
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class IDevice;
|
class IDevice;
|
||||||
class DeviceManager;
|
class DeviceManager;
|
||||||
class IDeviceFactory;
|
|
||||||
class IDeviceWidget;
|
class IDeviceWidget;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -77,7 +76,6 @@ private:
|
|||||||
void clearDetails();
|
void clearDetails();
|
||||||
QString parseTestOutput();
|
QString parseTestOutput();
|
||||||
void fillInValues();
|
void fillInValues();
|
||||||
const IDeviceFactory *factoryForCurrentDevice() const;
|
|
||||||
|
|
||||||
Ui::DeviceSettingsWidget *m_ui;
|
Ui::DeviceSettingsWidget *m_ui;
|
||||||
DeviceManager * const m_deviceManager;
|
DeviceManager * const m_deviceManager;
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#include "idevice.h"
|
#include "idevice.h"
|
||||||
|
|
||||||
|
#include "devicemanager.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -91,7 +93,37 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \fn ProjectExplorer::IDevice::Ptr ProjectExploer::IDevice::clone() const
|
* \fn QString ProjectExplorer::IDevice::displayType() const
|
||||||
|
* \brief Prints a representation of the device's type suitable for displaying to a user.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn ProjectExplorer::IDeviceWidget *ProjectExplorer::IDevice::createWidget() const
|
||||||
|
* \brief Creates a widget that displays device information not part of the IDevice base class.
|
||||||
|
* The widget can also be used to let the user change these attributes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn QStringList ProjectExplorer::IDevice::actionIds() const
|
||||||
|
* \brief Returns a list of ids representing actions that can be run on this device.
|
||||||
|
* These actions will be available in the "Devices" options page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn QString ProjectExplorer::IDevice::displayNameForActionId(const QString &actionId) const
|
||||||
|
* \brief A human-readable string for the given id. Will be displayed on a button which,
|
||||||
|
* when clicked, starts the respective action.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn QDialog *ProjectExplorer::IDevice::createAction(const QString &actionId) const
|
||||||
|
* \brief Produces a dialog implementing the respective action. The dialog is supposed to be
|
||||||
|
* modal, so implementers must make sure to make whatever it does interruptible as
|
||||||
|
* to not needlessly block the UI.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \fn ProjectExplorer::IDevice::Ptr ProjectExplorer::IDevice::clone() const
|
||||||
* \brief Creates an identical copy of a device object.
|
* \brief Creates an identical copy of a device object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -218,4 +250,14 @@ QVariantMap IDevice::toMap() const
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDevice::Ptr IDevice::sharedFromThis()
|
||||||
|
{
|
||||||
|
return DeviceManager::instance()->fromRawPointer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDevice::ConstPtr IDevice::sharedFromThis() const
|
||||||
|
{
|
||||||
|
return DeviceManager::instance()->fromRawPointer(this);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -35,10 +35,17 @@
|
|||||||
#include <projectexplorer/projectexplorer_export.h>
|
#include <projectexplorer/projectexplorer_export.h>
|
||||||
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QStringList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QDialog;
|
||||||
|
class QWidget;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal { class IDevicePrivate; }
|
namespace Internal { class IDevicePrivate; }
|
||||||
|
class IDeviceWidget;
|
||||||
|
|
||||||
// See cpp file for documentation.
|
// See cpp file for documentation.
|
||||||
class PROJECTEXPLORER_EXPORT IDevice
|
class PROJECTEXPLORER_EXPORT IDevice
|
||||||
@@ -62,6 +69,11 @@ public:
|
|||||||
QString fingerprint() const;
|
QString fingerprint() const;
|
||||||
Id internalId() const;
|
Id internalId() const;
|
||||||
|
|
||||||
|
virtual QString displayType() const = 0;
|
||||||
|
virtual IDeviceWidget *createWidget() = 0;
|
||||||
|
virtual QStringList actionIds() const = 0;
|
||||||
|
virtual QString displayNameForActionId(const QString &actionId) const = 0;
|
||||||
|
virtual QDialog *createAction(const QString &actionId, QWidget *parent = 0) const = 0;
|
||||||
virtual void fromMap(const QVariantMap &map);
|
virtual void fromMap(const QVariantMap &map);
|
||||||
virtual Ptr clone() const = 0;
|
virtual Ptr clone() const = 0;
|
||||||
|
|
||||||
@@ -74,6 +86,9 @@ protected:
|
|||||||
IDevice(const QString &type, Origin origin, const QString fingerprint = QString());
|
IDevice(const QString &type, Origin origin, const QString fingerprint = QString());
|
||||||
IDevice(const IDevice &other);
|
IDevice(const IDevice &other);
|
||||||
|
|
||||||
|
Ptr sharedFromThis();
|
||||||
|
ConstPtr sharedFromThis() const;
|
||||||
|
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -36,16 +36,13 @@
|
|||||||
#include <projectexplorer/projectexplorer_export.h>
|
#include <projectexplorer/projectexplorer_export.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QDialog;
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class IDeviceWidget;
|
|
||||||
class IDeviceWizard;
|
class IDeviceWizard;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -77,49 +74,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual IDevice::Ptr loadDevice(const QVariantMap &map) const = 0;
|
virtual IDevice::Ptr loadDevice(const QVariantMap &map) const = 0;
|
||||||
|
|
||||||
/*!
|
|
||||||
A widget that can configure the device this factory supports.
|
|
||||||
*/
|
|
||||||
virtual IDeviceWidget *createWidget(const IDevice::Ptr &device, QWidget *parent = 0) const = 0;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns true iff this factory supports the given device type.
|
Returns true iff this factory supports the given device type.
|
||||||
*/
|
*/
|
||||||
virtual bool supportsDeviceType(const QString &type) const = 0;
|
virtual bool supportsDeviceType(const QString &type) const = 0;
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a human-readable string for the given device type, if this factory supports that type.
|
|
||||||
*/
|
|
||||||
virtual QString displayNameForDeviceType(const QString &type) const = 0;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a list of ids representing actions that can be run on devices
|
|
||||||
that this factory supports. These actions will be available in the "Devices"
|
|
||||||
options page.
|
|
||||||
*/
|
|
||||||
virtual QStringList supportedDeviceActionIds() const = 0;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
A human-readable string for the given id. Will be displayed on a button which, when clicked,
|
|
||||||
starts the respective action.
|
|
||||||
*/
|
|
||||||
virtual QString displayNameForActionId(const QString &actionId) const = 0;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
True iff the user should be allowed to edit the devices created by this
|
|
||||||
factory. Returns true by default. Override if your factory creates fixed configurations
|
|
||||||
for which later editing makes no sense.
|
|
||||||
*/
|
|
||||||
virtual bool isUserEditable() const { return true; }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Produces a dialog implementing the respective action. The dialog is supposed to be
|
|
||||||
modal, so implementers must make sure to make it interruptible as to not needlessly
|
|
||||||
block the UI.
|
|
||||||
*/
|
|
||||||
virtual QDialog *createDeviceAction(const QString &actionId, const IDevice::ConstPtr &device,
|
|
||||||
QWidget *parent = 0) const = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IDeviceFactory(QObject *parent) : QObject(parent) { }
|
IDeviceFactory(QObject *parent) : QObject(parent) { }
|
||||||
};
|
};
|
||||||
|
@@ -32,12 +32,7 @@
|
|||||||
#include "genericlinuxdeviceconfigurationfactory.h"
|
#include "genericlinuxdeviceconfigurationfactory.h"
|
||||||
|
|
||||||
#include "genericlinuxdeviceconfigurationwizard.h"
|
#include "genericlinuxdeviceconfigurationwizard.h"
|
||||||
#include "genericlinuxdeviceconfigurationwidget.h"
|
|
||||||
#include "linuxdeviceconfiguration.h"
|
#include "linuxdeviceconfiguration.h"
|
||||||
#include "linuxdevicetestdialog.h"
|
|
||||||
#include "publickeydeploymentdialog.h"
|
|
||||||
#include "remotelinuxprocessesdialog.h"
|
|
||||||
#include "remotelinuxprocesslist.h"
|
|
||||||
#include "remotelinux_constants.h"
|
#include "remotelinux_constants.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -61,13 +56,6 @@ IDeviceWizard *GenericLinuxDeviceConfigurationFactory::createWizard(QWidget *par
|
|||||||
return new GenericLinuxDeviceConfigurationWizard(parent);
|
return new GenericLinuxDeviceConfigurationWizard(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDeviceWidget *GenericLinuxDeviceConfigurationFactory::createWidget(const IDevice::Ptr &device,
|
|
||||||
QWidget *parent) const
|
|
||||||
{
|
|
||||||
return new GenericLinuxDeviceConfigurationWidget(device.staticCast<LinuxDeviceConfiguration>(),
|
|
||||||
parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDevice::Ptr GenericLinuxDeviceConfigurationFactory::loadDevice(const QVariantMap &map) const
|
IDevice::Ptr GenericLinuxDeviceConfigurationFactory::loadDevice(const QVariantMap &map) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)),
|
QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)),
|
||||||
@@ -82,46 +70,4 @@ bool GenericLinuxDeviceConfigurationFactory::supportsDeviceType(const QString &d
|
|||||||
return deviceType == QLatin1String(Constants::GenericLinuxOsType);
|
return deviceType == QLatin1String(Constants::GenericLinuxOsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericLinuxDeviceConfigurationFactory::displayNameForDeviceType(const QString &deviceType) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(supportsDeviceType(deviceType), return QString());
|
|
||||||
return tr("Generic Linux");
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList GenericLinuxDeviceConfigurationFactory::supportedDeviceActionIds() const
|
|
||||||
{
|
|
||||||
return QStringList() << QLatin1String(Constants::GenericTestDeviceActionId)
|
|
||||||
<< QLatin1String(Constants::GenericDeployKeyToDeviceActionId)
|
|
||||||
<< QLatin1String(Constants::GenericRemoteProcessesActionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GenericLinuxDeviceConfigurationFactory::displayNameForActionId(const QString &actionId) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(supportedDeviceActionIds().contains(actionId), return QString());
|
|
||||||
|
|
||||||
if (actionId == QLatin1String(Constants::GenericTestDeviceActionId))
|
|
||||||
return tr("Test");
|
|
||||||
if (actionId == QLatin1String(Constants::GenericRemoteProcessesActionId))
|
|
||||||
return tr("Remote Processes...");
|
|
||||||
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
|
||||||
return tr("Deploy Public Key...");
|
|
||||||
return QString(); // Can't happen.
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog *GenericLinuxDeviceConfigurationFactory::createDeviceAction(const QString &actionId,
|
|
||||||
const IDevice::ConstPtr &device, QWidget *parent) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(supportedDeviceActionIds().contains(actionId), return 0);
|
|
||||||
|
|
||||||
const LinuxDeviceConfiguration::ConstPtr lDevice
|
|
||||||
= device.staticCast<const LinuxDeviceConfiguration>();
|
|
||||||
if (actionId == QLatin1String(Constants::GenericTestDeviceActionId))
|
|
||||||
return new LinuxDeviceTestDialog(lDevice, new GenericLinuxDeviceTester, parent);
|
|
||||||
if (actionId == QLatin1String(Constants::GenericRemoteProcessesActionId))
|
|
||||||
return new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(lDevice, parent));
|
|
||||||
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
|
||||||
return PublicKeyDeploymentDialog::createDialog(lDevice, parent);
|
|
||||||
return 0; // Can't happen.
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
@@ -48,15 +48,8 @@ public:
|
|||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
ProjectExplorer::IDeviceWizard *createWizard(QWidget *parent) const;
|
ProjectExplorer::IDeviceWizard *createWizard(QWidget *parent) const;
|
||||||
ProjectExplorer::IDeviceWidget *createWidget(const ProjectExplorer::IDevice::Ptr &device,
|
|
||||||
QWidget *parent = 0) const;
|
|
||||||
ProjectExplorer::IDevice::Ptr loadDevice(const QVariantMap &map) const;
|
ProjectExplorer::IDevice::Ptr loadDevice(const QVariantMap &map) const;
|
||||||
bool supportsDeviceType(const QString &deviceType) const;
|
bool supportsDeviceType(const QString &deviceType) const;
|
||||||
QString displayNameForDeviceType(const QString &deviceType) const;
|
|
||||||
QStringList supportedDeviceActionIds() const;
|
|
||||||
QString displayNameForActionId(const QString &actionId) const;
|
|
||||||
QDialog *createDeviceAction(const QString &actionId,
|
|
||||||
const ProjectExplorer::IDevice::ConstPtr &device, QWidget *parent) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
@@ -31,6 +31,11 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#include "linuxdeviceconfiguration.h"
|
#include "linuxdeviceconfiguration.h"
|
||||||
|
|
||||||
|
#include "genericlinuxdeviceconfigurationwidget.h"
|
||||||
|
#include "linuxdevicetestdialog.h"
|
||||||
|
#include "publickeydeploymentdialog.h"
|
||||||
|
#include "remotelinuxprocessesdialog.h"
|
||||||
|
#include "remotelinuxprocesslist.h"
|
||||||
#include "remotelinux_constants.h"
|
#include "remotelinux_constants.h"
|
||||||
|
|
||||||
#include <utils/portlist.h>
|
#include <utils/portlist.h>
|
||||||
@@ -84,6 +89,52 @@ LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &na
|
|||||||
return Ptr(new LinuxDeviceConfiguration(name, type, machineType, origin, fingerprint));
|
return Ptr(new LinuxDeviceConfiguration(name, type, machineType, origin, fingerprint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString LinuxDeviceConfiguration::displayType() const
|
||||||
|
{
|
||||||
|
return tr("Generic Linux");
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::IDeviceWidget *LinuxDeviceConfiguration::createWidget()
|
||||||
|
{
|
||||||
|
return new GenericLinuxDeviceConfigurationWidget(sharedFromThis()
|
||||||
|
.staticCast<LinuxDeviceConfiguration>());
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList LinuxDeviceConfiguration::actionIds() const
|
||||||
|
{
|
||||||
|
return QStringList() << QLatin1String(Constants::GenericTestDeviceActionId)
|
||||||
|
<< QLatin1String(Constants::GenericDeployKeyToDeviceActionId)
|
||||||
|
<< QLatin1String(Constants::GenericRemoteProcessesActionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LinuxDeviceConfiguration::displayNameForActionId(const QString &actionId) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(actionIds().contains(actionId), return QString());
|
||||||
|
|
||||||
|
if (actionId == QLatin1String(Constants::GenericTestDeviceActionId))
|
||||||
|
return tr("Test");
|
||||||
|
if (actionId == QLatin1String(Constants::GenericRemoteProcessesActionId))
|
||||||
|
return tr("Remote Processes...");
|
||||||
|
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
||||||
|
return tr("Deploy Public Key...");
|
||||||
|
return QString(); // Can't happen.
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog *LinuxDeviceConfiguration::createAction(const QString &actionId, QWidget *parent) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(actionIds().contains(actionId), return 0);
|
||||||
|
|
||||||
|
const LinuxDeviceConfiguration::ConstPtr device
|
||||||
|
= sharedFromThis().staticCast<const LinuxDeviceConfiguration>();
|
||||||
|
if (actionId == QLatin1String(Constants::GenericTestDeviceActionId))
|
||||||
|
return new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent);
|
||||||
|
if (actionId == QLatin1String(Constants::GenericRemoteProcessesActionId))
|
||||||
|
return new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device, parent));
|
||||||
|
if (actionId == QLatin1String(Constants::GenericDeployKeyToDeviceActionId))
|
||||||
|
return PublicKeyDeploymentDialog::createDialog(device, parent);
|
||||||
|
return 0; // Can't happen.
|
||||||
|
}
|
||||||
|
|
||||||
LinuxDeviceConfiguration::LinuxDeviceConfiguration() : d(new LinuxDeviceConfigurationPrivate)
|
LinuxDeviceConfiguration::LinuxDeviceConfiguration() : d(new LinuxDeviceConfigurationPrivate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class SshConnectionParameters;
|
class SshConnectionParameters;
|
||||||
class PortList;
|
class PortList;
|
||||||
@@ -48,6 +50,7 @@ class LinuxDeviceConfigurationPrivate;
|
|||||||
|
|
||||||
class REMOTELINUX_EXPORT LinuxDeviceConfiguration : public ProjectExplorer::IDevice
|
class REMOTELINUX_EXPORT LinuxDeviceConfiguration : public ProjectExplorer::IDevice
|
||||||
{
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(LinuxDeviceConfiguration)
|
||||||
public:
|
public:
|
||||||
typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
|
typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
|
||||||
typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
|
typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
|
||||||
@@ -70,6 +73,11 @@ public:
|
|||||||
static Ptr create(const QString &name, const QString &type, MachineType machineType,
|
static Ptr create(const QString &name, const QString &type, MachineType machineType,
|
||||||
Origin origin = ManuallyAdded, const QString &fingerprint = QString());
|
Origin origin = ManuallyAdded, const QString &fingerprint = QString());
|
||||||
|
|
||||||
|
QString displayType() const;
|
||||||
|
ProjectExplorer::IDeviceWidget *createWidget();
|
||||||
|
QStringList actionIds() const;
|
||||||
|
QString displayNameForActionId(const QString &actionId) const;
|
||||||
|
QDialog *createAction(const QString &actionId, QWidget *parent) const;
|
||||||
void fromMap(const QVariantMap &map);
|
void fromMap(const QVariantMap &map);
|
||||||
ProjectExplorer::IDevice::Ptr clone() const;
|
ProjectExplorer::IDevice::Ptr clone() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user