Device support: Make device testing a "well-known" concept.

This entails the following:
    - Rename AbstractLinuxDeviceTester to DeviceTester and
      move it up into ProjectExplorer. The class stays
      unchanged, as there was nothing Linux-specific about it.
      The same goes for the associated dialog.
    - Move the createDeviceTester() function from LinuxDevice
      to IDevice and introduce IDevice::hasDeviceTester() to
      enable generic code to make use of this feature.
    - Move device testing out of the list of opaque
      device-specific actions; instead, the device settings widget
      now uses the device tester directly, if applicable.
Rationale:
    - Device testing, just like remote process listing (if not more so),
      is a general concept that implementors of device classes will
      probably want to implement (and they should be encouraged to do so).
      Without the mechanism provided here, they would all need to put
      basically the same code into the actionIds(), displayNameForActionId()
      and executeAction() functions.

This patch is the natural extension of b90e3bbd8b.

Change-Id: I94f2badb4ceeda9f5cd3b066c13626bb4f65505d
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
Christian Kandeler
2013-06-27 17:12:08 +02:00
parent d6062643c3
commit 5bca241afb
27 changed files with 122 additions and 130 deletions

View File

@@ -31,7 +31,6 @@
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include <remotelinux/linuxdevicetestdialog.h>
#include <remotelinux/publickeydeploymentdialog.h>
#include <remotelinux/remotelinux_constants.h>
#include <utils/qtcassert.h>
@@ -111,7 +110,7 @@ QSize MaddeDevice::packageManagerIconSize(Core::Id type)
return QSize();
}
AbstractLinuxDeviceTester *MaddeDevice::createDeviceTester() const
DeviceTester *MaddeDevice::createDeviceTester() const
{
return new MaddeDeviceTester;
}

View File

@@ -58,7 +58,7 @@ public:
static QSize packageManagerIconSize(Core::Id type);
RemoteLinux::AbstractLinuxDeviceTester *createDeviceTester() const;
ProjectExplorer::DeviceTester *createDeviceTester() const;
private:
MaddeDevice();

View File

@@ -47,7 +47,7 @@ const char QmlToolingDirectory[] = "/usr/lib/qt4/plugins/qmltooling";
} // anonymous namespace
MaddeDeviceTester::MaddeDeviceTester(QObject *parent)
: AbstractLinuxDeviceTester(parent),
: ProjectExplorer::DeviceTester(parent),
m_genericTester(new GenericLinuxDeviceTester(this)),
m_state(Inactive),
m_processRunner(0)
@@ -68,8 +68,8 @@ void MaddeDeviceTester::testDevice(const ProjectExplorer::IDevice::ConstPtr &dev
m_state = GenericTest;
connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString)));
connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString)));
connect(m_genericTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)),
SLOT(handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)));
connect(m_genericTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)),
SLOT(handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult)));
m_genericTester->testDevice(deviceConfiguration);
}

View File

@@ -38,7 +38,7 @@ class SshRemoteProcessRunner;
namespace Madde {
namespace Internal {
class MaddeDeviceTester : public RemoteLinux::AbstractLinuxDeviceTester
class MaddeDeviceTester : public ProjectExplorer::DeviceTester
{
Q_OBJECT
@@ -50,7 +50,7 @@ public:
void stopTest();
private slots:
void handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result);
void handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult result);
void handleConnectionError();
void handleProcessFinished(int exitStatus);
@@ -66,7 +66,7 @@ private:
RemoteLinux::GenericLinuxDeviceTester * const m_genericTester;
State m_state;
TestResult m_result;
ProjectExplorer::DeviceTester::TestResult m_result;
QSsh::SshRemoteProcessRunner *m_processRunner;
ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration;
};

View File

@@ -40,7 +40,6 @@
#include "maemoglobal.h"
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/linuxdevicetestdialog.h>
#include <remotelinux/sshkeydeployer.h>
#include <utils/fileutils.h>
#include <ssh/sshkeygenerator.h>
@@ -553,7 +552,6 @@ MaemoDeviceConfigWizard::~MaemoDeviceConfigWizard()
IDevice::Ptr MaemoDeviceConfigWizard::device()
{
bool doTest;
QString freePortsSpec;
QSsh::SshConnectionParameters sshParams;
sshParams.userName = defaultUser();
@@ -564,24 +562,16 @@ IDevice::Ptr MaemoDeviceConfigWizard::device()
sshParams.password.clear();
sshParams.timeout = 30;
freePortsSpec = QLatin1String("13219,14168");
doTest = false;
} else {
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
sshParams.privateKeyFile = d->wizardData.privateKeyFilePath;
sshParams.timeout = 10;
freePortsSpec = QLatin1String("10000-10100");
doTest = true;
}
const MaddeDevice::Ptr device = MaddeDevice::create(d->wizardData.configName,
d->wizardData.deviceType, d->wizardData.machineType);
device->setFreePorts(PortList::fromString(freePortsSpec));
device->setSshParameters(sshParams);
if (doTest) {
// Might be called after accept.
QWidget *parent = isVisible() ? this : static_cast<QWidget *>(0);
LinuxDeviceTestDialog dlg(device, new MaddeDeviceTester(this), parent);
dlg.exec();
}
return device;
}

View File

@@ -34,6 +34,7 @@
#include "devicemanager.h"
#include "devicemanagermodel.h"
#include "deviceprocessesdialog.h"
#include "devicetestdialog.h"
#include "idevice.h"
#include "idevicefactory.h"
#include "idevicewidget.h"
@@ -167,6 +168,8 @@ void DeviceSettingsWidget::addDevice()
m_deviceManager->addDevice(device);
m_ui->removeConfigButton->setEnabled(true);
m_ui->configurationComboBox->setCurrentIndex(m_deviceManagerModel->indexOf(device));
if (device->hasDeviceTester())
testDevice();
}
void DeviceSettingsWidget::removeDevice()
@@ -262,6 +265,14 @@ void DeviceSettingsWidget::setDefaultDevice()
m_ui->defaultDeviceButton->setEnabled(false);
}
void DeviceSettingsWidget::testDevice()
{
const IDevice::ConstPtr &device = currentDevice();
QTC_ASSERT(device && device->hasDeviceTester(), return);
DeviceTestDialog dlg(device, this);
dlg.exec();
}
void DeviceSettingsWidget::handleDeviceUpdated(Id id)
{
const int index = m_deviceManagerModel->indexForId(id);
@@ -286,6 +297,13 @@ void DeviceSettingsWidget::currentDeviceChanged(int index)
setDeviceInfoWidgetsEnabled(true);
m_ui->removeConfigButton->setEnabled(true);
if (device->hasDeviceTester()) {
QPushButton * const button = new QPushButton(tr("Test"));
m_additionalActionButtons << button;
connect(button, SIGNAL(clicked()), SLOT(testDevice()));
m_ui->buttonsLayout->insertWidget(m_ui->buttonsLayout->count() - 1, button);
}
if (device->canCreateProcessModel()) {
QPushButton * const button = new QPushButton(tr("Show Running Processes"));
m_additionalActionButtons << button;

View File

@@ -68,6 +68,7 @@ private slots:
void removeDevice();
void deviceNameEditingFinished();
void setDefaultDevice();
void testDevice();
void handleAdditionalActionRequest(int actionId);
void handleProcessListRequested();

View File

@@ -26,8 +26,8 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "linuxdevicetestdialog.h"
#include "ui_linuxdevicetestdialog.h"
#include "devicetestdialog.h"
#include "ui_devicetestdialog.h"
#include <QBrush>
#include <QColor>
@@ -35,72 +35,70 @@
#include <QPushButton>
#include <QTextCharFormat>
namespace RemoteLinux {
namespace ProjectExplorer {
namespace Internal {
class LinuxDeviceTestDialogPrivate {
class DeviceTestDialog::DeviceTestDialogPrivate
{
public:
LinuxDeviceTestDialogPrivate(AbstractLinuxDeviceTester *tester)
DeviceTestDialogPrivate(DeviceTester *tester)
: deviceTester(tester), finished(false)
{
}
Ui::LinuxDeviceTestDialog ui;
AbstractLinuxDeviceTester * const deviceTester;
Ui::DeviceTestDialog ui;
DeviceTester * const deviceTester;
bool finished;
};
} // namespace Internal
using namespace Internal;
LinuxDeviceTestDialog::LinuxDeviceTestDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration,
AbstractLinuxDeviceTester *deviceTester, QWidget *parent)
: QDialog(parent), d(new LinuxDeviceTestDialogPrivate(deviceTester))
DeviceTestDialog::DeviceTestDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration,
QWidget *parent)
: QDialog(parent), d(new DeviceTestDialogPrivate(deviceConfiguration->createDeviceTester()))
{
d->ui.setupUi(this);
d->deviceTester->setParent(this);
connect(d->deviceTester, SIGNAL(progressMessage(QString)), SLOT(handleProgressMessage(QString)));
connect(d->deviceTester, SIGNAL(errorMessage(QString)), SLOT(handleErrorMessage(QString)));
connect(d->deviceTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)),
SLOT(handleTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)));
connect(d->deviceTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)),
SLOT(handleTestFinished(ProjectExplorer::DeviceTester::TestResult)));
d->deviceTester->testDevice(deviceConfiguration);
}
LinuxDeviceTestDialog::~LinuxDeviceTestDialog()
DeviceTestDialog::~DeviceTestDialog()
{
delete d;
}
void LinuxDeviceTestDialog::reject()
void DeviceTestDialog::reject()
{
if (!d->finished)
d->deviceTester->stopTest();
QDialog::reject();
}
void LinuxDeviceTestDialog::handleProgressMessage(const QString &message)
void DeviceTestDialog::handleProgressMessage(const QString &message)
{
addText(message, QLatin1String("black"), false);
}
void LinuxDeviceTestDialog::handleErrorMessage(const QString &message)
void DeviceTestDialog::handleErrorMessage(const QString &message)
{
addText(message, QLatin1String("red"), false);
}
void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestResult result)
void DeviceTestDialog::handleTestFinished(ProjectExplorer::DeviceTester::TestResult result)
{
d->finished = true;
d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
if (result == AbstractLinuxDeviceTester::TestSuccess)
if (result == ProjectExplorer::DeviceTester::TestSuccess)
addText(tr("Device test finished successfully."), QLatin1String("blue"), true);
else
addText(tr("Device test failed."), QLatin1String("red"), true);
}
void LinuxDeviceTestDialog::addText(const QString &text, const QString &color, bool bold)
void DeviceTestDialog::addText(const QString &text, const QString &color, bool bold)
{
QTextCharFormat format = d->ui.textEdit->currentCharFormat();
format.setForeground(QBrush(QColor(color)));
@@ -111,4 +109,5 @@ void LinuxDeviceTestDialog::addText(const QString &text, const QString &color, b
d->ui.textEdit->appendPlainText(text);
}
} // namespace RemoteLinux
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -26,42 +26,39 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef LINUXDEVICETESTDIALOG_H
#define LINUXDEVICETESTDIALOG_H
#ifndef DEVICETESTDIALOG_H
#define DEVICETESTDIALOG_H
#include "linuxdevicetester.h"
#include "remotelinux_export.h"
#include "idevice.h"
#include <QDialog>
namespace RemoteLinux {
namespace ProjectExplorer {
namespace Internal {
class LinuxDeviceTestDialogPrivate;
} // namespace Internal
class REMOTELINUX_EXPORT LinuxDeviceTestDialog : public QDialog
class DeviceTestDialog : public QDialog
{
Q_OBJECT
public:
// Note: The dialog takes ownership of deviceTester
LinuxDeviceTestDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration,
AbstractLinuxDeviceTester * deviceTester, QWidget *parent = 0);
~LinuxDeviceTestDialog();
DeviceTestDialog(const IDevice::ConstPtr &deviceConfiguration, QWidget *parent = 0);
~DeviceTestDialog();
void reject();
private slots:
void handleProgressMessage(const QString &message);
void handleErrorMessage(const QString &message);
void handleTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result);
void handleTestFinished(ProjectExplorer::DeviceTester::TestResult result);
private:
void addText(const QString &text, const QString &color, bool bold);
Internal::LinuxDeviceTestDialogPrivate * const d;
class DeviceTestDialogPrivate;
DeviceTestDialogPrivate * const d;
};
} // namespace RemoteLinux
} // namespace Internal
} // namespace ProjectExplorer
#endif // LINUXDEVICETESTDIALOG_H
#endif // Include guard.

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RemoteLinux::Internal::LinuxDeviceTestDialog</class>
<widget class="QDialog" name="RemoteLinux::Internal::LinuxDeviceTestDialog">
<class>ProjectExplorer::Internal::DeviceTestDialog</class>
<widget class="QDialog" name="ProjectExplorer::Internal::DeviceTestDialog">
<property name="geometry">
<rect>
<x>0</x>
@@ -38,7 +38,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>RemoteLinux::Internal::LinuxDeviceTestDialog</receiver>
<receiver>ProjectExplorer::Internal::DeviceTestDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@@ -54,7 +54,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>RemoteLinux::Internal::LinuxDeviceTestDialog</receiver>
<receiver>ProjectExplorer::Internal::DeviceTestDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

View File

@@ -194,6 +194,7 @@ public:
PortsGatheringMethod::~PortsGatheringMethod() { }
DeviceProcessSupport::~DeviceProcessSupport() { }
DeviceTester::DeviceTester(QObject *parent) : QObject(parent) { }
IDevice::IDevice() : d(new Internal::IDevicePrivate)
{ }
@@ -268,6 +269,12 @@ DeviceProcessList *IDevice::createProcessListModel(QObject *parent) const
return 0;
}
DeviceTester *IDevice::createDeviceTester() const
{
QTC_ASSERT(false, qDebug("This should not have been called..."));
return 0;
}
IDevice::DeviceState IDevice::deviceState() const
{
return d->deviceState;

View File

@@ -35,11 +35,11 @@
#include <QAbstractSocket>
#include <QList>
#include <QObject>
#include <QSharedPointer>
#include <QVariantMap>
QT_BEGIN_NAMESPACE
class QObject;
class QWidget;
QT_END_NAMESPACE
@@ -52,6 +52,7 @@ class DeviceProcessList;
namespace Internal { class IDevicePrivate; }
class IDeviceWidget;
class DeviceTester;
class PROJECTEXPLORER_EXPORT DeviceProcessSupport
{
@@ -73,7 +74,6 @@ public:
virtual QList<int> usedPorts(const QByteArray &commandOutput) const = 0;
};
// See cpp file for documentation.
class PROJECTEXPLORER_EXPORT IDevice
{
@@ -118,6 +118,8 @@ public:
virtual PortsGatheringMethod::Ptr portsGatheringMethod() const;
virtual bool canCreateProcessModel() const { return false; }
virtual DeviceProcessList *createProcessListModel(QObject *parent = 0) const;
virtual bool hasDeviceTester() const { return false; }
virtual DeviceTester *createDeviceTester() const;
enum DeviceState { DeviceReadyToUse, DeviceConnected, DeviceDisconnected, DeviceStateUnknown };
DeviceState deviceState() const;
@@ -159,6 +161,26 @@ private:
friend class DeviceManager;
};
class PROJECTEXPLORER_EXPORT DeviceTester : public QObject
{
Q_OBJECT
public:
enum TestResult { TestSuccess, TestFailure };
virtual void testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration) = 0;
virtual void stopTest() = 0;
signals:
void progressMessage(const QString &message);
void errorMessage(const QString &message);
void finished(ProjectExplorer::DeviceTester::TestResult result);
protected:
explicit DeviceTester(QObject *parent = 0);
};
} // namespace ProjectExplorer
#endif // IDEVICE_H

View File

@@ -121,6 +121,7 @@ HEADERS += projectexplorer.h \
devicesupport/deviceprocessesdialog.h \
devicesupport/devicesettingswidget.h \
devicesupport/devicesettingspage.h \
devicesupport/devicetestdialog.h \
devicesupport/deviceusedportsgatherer.h \
devicesupport/deviceapplicationrunner.h \
devicesupport/localprocesslist.h \
@@ -237,6 +238,7 @@ SOURCES += projectexplorer.cpp \
devicesupport/deviceprocessesdialog.cpp \
devicesupport/devicesettingswidget.cpp \
devicesupport/devicesettingspage.cpp \
devicesupport/devicetestdialog.cpp \
devicesupport/deviceusedportsgatherer.cpp \
devicesupport/deviceapplicationrunner.cpp \
devicesupport/localprocesslist.cpp \
@@ -257,6 +259,7 @@ FORMS += processstep.ui \
codestylesettingspropertiespage.ui \
devicesupport/devicefactoryselectiondialog.ui \
devicesupport/devicesettingswidget.ui \
devicesupport/devicetestdialog.ui \
devicesupport/desktopdeviceconfigurationwidget.ui
WINSOURCES += \

View File

@@ -269,6 +269,9 @@ QtcPlugin {
"devicesupport/devicesettingswidget.cpp",
"devicesupport/devicesettingswidget.h",
"devicesupport/devicesettingswidget.ui",
"devicesupport/devicetestdialog.cpp",
"devicesupport/devicetestdialog.h",
"devicesupport/devicetestdialog.ui",
"devicesupport/deviceusedportsgatherer.cpp",
"devicesupport/deviceusedportsgatherer.h",
"devicesupport/idevice.cpp",

View File

@@ -187,7 +187,7 @@ ProjectExplorer::DeviceProcessList *QnxDeviceConfiguration::createProcessListMod
return new QnxDeviceProcessList(sharedFromThis(), parent);
}
RemoteLinux::AbstractLinuxDeviceTester *QnxDeviceConfiguration::createDeviceTester() const
ProjectExplorer::DeviceTester *QnxDeviceConfiguration::createDeviceTester() const
{
return new QnxDeviceTester;
}

View File

@@ -54,7 +54,7 @@ public:
ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const;
ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const;
RemoteLinux::AbstractLinuxDeviceTester *createDeviceTester() const;
ProjectExplorer::DeviceTester *createDeviceTester() const;
QString displayType() const;

View File

@@ -37,7 +37,6 @@
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/linuxdevicetestdialog.h>
#include <utils/portlist.h>
using namespace ProjectExplorer;
@@ -76,8 +75,5 @@ IDevice::Ptr QnxDeviceConfigurationWizard::device()
device->setSshParameters(sshParams);
device->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
RemoteLinux::LinuxDeviceTestDialog dlg(device, device->createDeviceTester(), this);
dlg.exec();
return device;
}

View File

@@ -38,7 +38,7 @@ using namespace Qnx;
using namespace Qnx::Internal;
QnxDeviceTester::QnxDeviceTester(QObject *parent)
: RemoteLinux::AbstractLinuxDeviceTester(parent)
: ProjectExplorer::DeviceTester(parent)
, m_result(TestSuccess)
, m_state(Inactive)
, m_currentCommandIndex(-1)
@@ -70,8 +70,8 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::ConstPtr &devic
connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString)));
connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString)));
connect(m_genericTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)),
SLOT(handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)));
connect(m_genericTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)),
SLOT(handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult)));
m_state = GenericTest;
m_genericTester->testDevice(deviceConfiguration);
@@ -96,7 +96,7 @@ void QnxDeviceTester::stopTest()
setFinished();
}
void QnxDeviceTester::handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result)
void QnxDeviceTester::handleGenericTestFinished(TestResult result)
{
QTC_ASSERT(m_state == GenericTest, return);

View File

@@ -43,7 +43,7 @@ class SshRemoteProcessRunner;
namespace Qnx {
namespace Internal {
class QnxDeviceTester : public RemoteLinux::AbstractLinuxDeviceTester
class QnxDeviceTester : public ProjectExplorer::DeviceTester
{
Q_OBJECT
public:
@@ -53,7 +53,7 @@ public:
void stopTest();
private slots:
void handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result);
void handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult result);
void handleProcessFinished(int exitStatus);
void handleConnectionError();
@@ -70,7 +70,7 @@ private:
RemoteLinux::GenericLinuxDeviceTester *m_genericTester;
ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration;
TestResult m_result;
ProjectExplorer::DeviceTester::TestResult m_result;
State m_state;
int m_currentCommandIndex;

View File

@@ -31,8 +31,6 @@
#include "genericlinuxdeviceconfigurationwizardpages.h"
#include "linuxdevice.h"
#include "linuxdevicetestdialog.h"
#include "linuxdevicetester.h"
#include "remotelinux_constants.h"
#include <utils/portlist.h>
@@ -91,10 +89,6 @@ IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device()
Core::Id(Constants::GenericLinuxOsType), IDevice::Hardware);
device->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
device->setSshParameters(sshParams);
// Might be called after accept.
QWidget *parent = isVisible() ? this : static_cast<QWidget *>(0);
LinuxDeviceTestDialog dlg(device, new GenericLinuxDeviceTester(this), parent);
dlg.exec();
return device;
}

View File

@@ -30,7 +30,7 @@
#include "linuxdevice.h"
#include "genericlinuxdeviceconfigurationwidget.h"
#include "linuxdevicetestdialog.h"
#include "linuxdevicetester.h"
#include "publickeydeploymentdialog.h"
#include "remotelinux_constants.h"
@@ -192,16 +192,13 @@ ProjectExplorer::IDeviceWidget *LinuxDevice::createWidget()
QList<Core::Id> LinuxDevice::actionIds() const
{
return QList<Core::Id>() << Core::Id(Constants::GenericTestDeviceActionId)
<< Core::Id(Constants::GenericDeployKeyToDeviceActionId);
return QList<Core::Id>() << Core::Id(Constants::GenericDeployKeyToDeviceActionId);
}
QString LinuxDevice::displayNameForActionId(Core::Id actionId) const
{
QTC_ASSERT(actionIds().contains(actionId), return QString());
if (actionId == Constants::GenericTestDeviceActionId)
return tr("Test");
if (actionId == Constants::GenericDeployKeyToDeviceActionId)
return tr("Deploy Public Key...");
return QString(); // Can't happen.
@@ -213,9 +210,7 @@ void LinuxDevice::executeAction(Core::Id actionId, QWidget *parent) const
QDialog *d = 0;
const LinuxDevice::ConstPtr device = sharedFromThis().staticCast<const LinuxDevice>();
if (actionId == Constants::GenericTestDeviceActionId)
d = new LinuxDeviceTestDialog(device, createDeviceTester(), parent);
else if (actionId == Constants::GenericDeployKeyToDeviceActionId)
if (actionId == Constants::GenericDeployKeyToDeviceActionId)
d = PublicKeyDeploymentDialog::createDialog(device, parent);
if (d)
d->exec();
@@ -264,7 +259,7 @@ DeviceProcessList *LinuxDevice::createProcessListModel(QObject *parent) const
return new LinuxDeviceProcessList(sharedFromThis(), parent);
}
AbstractLinuxDeviceTester *LinuxDevice::createDeviceTester() const
DeviceTester *LinuxDevice::createDeviceTester() const
{
return new GenericLinuxDeviceTester;
}

View File

@@ -41,7 +41,6 @@ namespace Utils { class PortList; }
namespace RemoteLinux {
namespace Internal { class LinuxDevicePrivate; }
class AbstractLinuxDeviceTester;
class REMOTELINUX_EXPORT LinuxDeviceProcessSupport : public ProjectExplorer::DeviceProcessSupport
{
@@ -74,7 +73,8 @@ public:
ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const;
bool canCreateProcessModel() const { return true; }
ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const;
virtual AbstractLinuxDeviceTester *createDeviceTester() const;
bool hasDeviceTester() const { return true; }
ProjectExplorer::DeviceTester *createDeviceTester() const;
protected:
LinuxDevice() {}

View File

@@ -61,13 +61,8 @@ public:
using namespace Internal;
AbstractLinuxDeviceTester::AbstractLinuxDeviceTester(QObject *parent) : QObject(parent)
{
}
GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
: AbstractLinuxDeviceTester(parent), d(new GenericLinuxDeviceTesterPrivate)
: DeviceTester(parent), d(new GenericLinuxDeviceTesterPrivate)
{
}

View File

@@ -44,27 +44,7 @@ namespace Internal {
class GenericLinuxDeviceTesterPrivate;
}
class REMOTELINUX_EXPORT AbstractLinuxDeviceTester : public QObject
{
Q_OBJECT
public:
enum TestResult { TestSuccess, TestFailure };
virtual void testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration) = 0;
virtual void stopTest() = 0;
signals:
void progressMessage(const QString &message);
void errorMessage(const QString &message);
void finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result);
protected:
explicit AbstractLinuxDeviceTester(QObject *parent = 0);
};
class REMOTELINUX_EXPORT GenericLinuxDeviceTester : public AbstractLinuxDeviceTester
class REMOTELINUX_EXPORT GenericLinuxDeviceTester : public ProjectExplorer::DeviceTester
{
Q_OBJECT
@@ -85,7 +65,7 @@ private slots:
void handlePortListReady();
private:
void setFinished(TestResult result);
void setFinished(ProjectExplorer::DeviceTester::TestResult result);
Internal::GenericLinuxDeviceTesterPrivate * const d;
};

View File

@@ -35,7 +35,6 @@ HEADERS += \
packageuploader.h \
linuxdevicetester.h \
remotelinux_constants.h \
linuxdevicetestdialog.h \
remotelinuxenvironmentreader.h \
sshkeydeployer.h \
typespecificdeviceconfigurationlistmodel.h \
@@ -81,7 +80,6 @@ SOURCES += \
remotelinuxpackageinstaller.cpp \
packageuploader.cpp \
linuxdevicetester.cpp \
linuxdevicetestdialog.cpp \
remotelinuxenvironmentreader.cpp \
sshkeydeployer.cpp \
typespecificdeviceconfigurationlistmodel.cpp \
@@ -98,7 +96,6 @@ SOURCES += \
FORMS += \
genericlinuxdeviceconfigurationwizardsetuppage.ui \
linuxdevicetestdialog.ui \
remotelinuxdeployconfigurationwidget.ui \
genericlinuxdeviceconfigurationwidget.ui \
remotelinuxcheckforfreediskspacestepwidget.ui

View File

@@ -46,9 +46,6 @@ QtcPlugin {
"genericremotelinuxdeploystepfactory.h",
"linuxdevice.cpp",
"linuxdevice.h",
"linuxdevicetestdialog.cpp",
"linuxdevicetestdialog.h",
"linuxdevicetestdialog.ui",
"linuxdevicetester.cpp",
"linuxdevicetester.h",
"packageuploader.cpp",

View File

@@ -34,7 +34,6 @@ namespace Constants {
const char GenericLinuxOsType[] = "GenericLinuxOsType";
const char GenericTestDeviceActionId[] = "RemoteLinux.GenericTestDeviceAction";
const char GenericDeployKeyToDeviceActionId[] = "RemoteLinux.GenericDeployKeyToDeviceAction";
const char EMBEDDED_LINUX_QT[] = "RemoteLinux.EmbeddedLinuxQt";