Commit 047973c3 authored by hjk's avatar hjk
Browse files

remotelinux: use IDevice base class when appropriate



Change-Id: I6f68f85d50500e4995ab51ee374f8ba5c31d334d
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 5ae9f32d
......@@ -26,16 +26,13 @@
**
**
**************************************************************************/
#include "remotelinuxprocesslist.h"
#include "linuxdeviceconfiguration.h"
#include "remotelinuxprocesslist.h"
#include <utils/qtcassert.h>
#include <ssh/sshremoteprocessrunner.h>
#include <QByteArray>
#include <QString>
using namespace ProjectExplorer;
using namespace QSsh;
namespace RemoteLinux {
......@@ -55,14 +52,14 @@ static QString visualizeNull(QString s)
class AbstractRemoteLinuxProcessListPrivate
{
public:
AbstractRemoteLinuxProcessListPrivate(const LinuxDeviceConfiguration::ConstPtr &devConf)
AbstractRemoteLinuxProcessListPrivate(const IDevice::ConstPtr &devConf)
: deviceConfiguration(devConf),
state(Inactive)
{
}
const LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
const IDevice::ConstPtr deviceConfiguration;
SshRemoteProcessRunner process;
QList<RemoteProcess> remoteProcesses;
QString errorMsg;
......@@ -73,17 +70,12 @@ public:
using namespace Internal;
AbstractRemoteLinuxProcessList::AbstractRemoteLinuxProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig,
AbstractRemoteLinuxProcessList::AbstractRemoteLinuxProcessList(const IDevice::ConstPtr &devConfig,
QObject *parent)
: QAbstractTableModel(parent), d(new AbstractRemoteLinuxProcessListPrivate(devConfig))
{
}
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxProcessList::deviceConfiguration() const
{
return d->deviceConfiguration;
}
AbstractRemoteLinuxProcessList::~AbstractRemoteLinuxProcessList()
{
delete d;
......@@ -224,7 +216,7 @@ void AbstractRemoteLinuxProcessList::setFinished()
}
GenericRemoteLinuxProcessList::GenericRemoteLinuxProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig,
GenericRemoteLinuxProcessList::GenericRemoteLinuxProcessList(const IDevice::ConstPtr &devConfig,
QObject *parent)
: AbstractRemoteLinuxProcessList(devConfig, parent)
{
......
......@@ -31,12 +31,13 @@
#include "remotelinux_export.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <QAbstractTableModel>
#include <QList>
#include <QSharedPointer>
namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal {
class AbstractRemoteLinuxProcessListPrivate;
......@@ -70,11 +71,9 @@ signals:
void processKilled();
protected:
AbstractRemoteLinuxProcessList(const QSharedPointer<const LinuxDeviceConfiguration> &devConfig,
AbstractRemoteLinuxProcessList(const ProjectExplorer::IDevice::ConstPtr &devConfig,
QObject *parent = 0);
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
private slots:
void handleConnectionError();
void handleRemoteProcessFinished(int exitStatus);
......@@ -101,7 +100,7 @@ class REMOTELINUX_EXPORT GenericRemoteLinuxProcessList : public AbstractRemoteLi
{
Q_OBJECT
public:
GenericRemoteLinuxProcessList(const QSharedPointer<const LinuxDeviceConfiguration> &devConfig,
GenericRemoteLinuxProcessList(const ProjectExplorer::IDevice::ConstPtr &devConfig,
QObject *parent = 0);
protected:
......
......@@ -26,9 +26,8 @@
**
**
**************************************************************************/
#include "remotelinuxusedportsgatherer.h"
#include "linuxdeviceconfiguration.h"
#include "remotelinuxusedportsgatherer.h"
#include <utils/portlist.h>
#include <utils/qtcassert.h>
......@@ -38,6 +37,7 @@
#include <QString>
using namespace ProjectExplorer;
using namespace QSsh;
using namespace Utils;
......@@ -72,7 +72,7 @@ RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
delete d;
}
void RemoteLinuxUsedPortsGatherer::start(const LinuxDeviceConfiguration::ConstPtr &devConf)
void RemoteLinuxUsedPortsGatherer::start(const IDevice::ConstPtr &devConf)
{
QTC_ASSERT(!d->connection, return);
d->portsToCheck = devConf->freePorts();
......
......@@ -31,6 +31,8 @@
#include "remotelinux_export.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <QList>
#include <QObject>
#include <QSharedPointer>
......@@ -40,7 +42,6 @@ QT_FORWARD_DECLARE_CLASS(QString)
namespace Utils { class PortList; }
namespace RemoteLinux {
class LinuxDeviceConfiguration;
namespace Internal {
class RemoteLinuxUsedPortsGathererPrivate;
......@@ -53,7 +54,7 @@ class REMOTELINUX_EXPORT RemoteLinuxUsedPortsGatherer : public QObject
public:
explicit RemoteLinuxUsedPortsGatherer(QObject *parent = 0);
~RemoteLinuxUsedPortsGatherer();
void start(const QSharedPointer<const LinuxDeviceConfiguration> &devConf);
void start(const ProjectExplorer::IDevice::ConstPtr &devConf);
void stop();
int getNextFreePort(Utils::PortList *freePorts) const; // returns -1 if no more are left
QList<int> usedPorts() const;
......
......@@ -31,7 +31,6 @@
#include "startgdbserverdialog.h"
#include "remotelinuxprocesslist.h"
#include "linuxdeviceconfiguration.h"
#include "remotelinuxusedportsgatherer.h"
#include <coreplugin/icore.h>
......@@ -84,11 +83,10 @@ class StartGdbServerDialogPrivate
public:
StartGdbServerDialogPrivate(StartGdbServerDialog *q);
LinuxDeviceConfiguration::ConstPtr currentDevice() const
IDevice::ConstPtr currentDevice() const
{
Profile *profile = profileChooser->currentProfile();
IDevice::ConstPtr device = DeviceProfileInformation::device(profile);
return device.dynamicCast<const LinuxDeviceConfiguration>();
return DeviceProfileInformation::device(profile);
}
StartGdbServerDialog *q;
......@@ -203,7 +201,7 @@ StartGdbServerDialog::~StartGdbServerDialog()
void StartGdbServerDialog::attachToDevice()
{
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
IDevice::ConstPtr device = d->currentDevice();
// TODO: display error on non-matching device.
if (!device)
return;
......@@ -248,7 +246,7 @@ void StartGdbServerDialog::attachToProcess()
return;
d->attachProcessButton->setEnabled(false);
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
IDevice::ConstPtr device = d->currentDevice();
if (!device)
return;
PortList ports = device->freePorts();
......@@ -352,7 +350,7 @@ void StartGdbServerDialog::handleProcessErrorOutput()
void StartGdbServerDialog::reportOpenPort(int port)
{
logMessage(tr("Port %1 is now accessible.").arg(port));
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
IDevice::ConstPtr device = d->currentDevice();
QString channel = QString("%1:%2").arg(device->sshParameters().host).arg(port);
logMessage(tr("Server started on %1").arg(channel));
......@@ -375,7 +373,7 @@ void StartGdbServerDialog::handleProcessClosed(int status)
void StartGdbServerDialog::startGdbServerOnPort(int port, int pid)
{
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
IDevice::ConstPtr device = d->currentDevice();
connect(&d->runner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
connect(&d->runner, SIGNAL(processStarted()), SLOT(handleProcessStarted()));
connect(&d->runner, SIGNAL(readyReadStandardOutput()), SLOT(handleProcessOutputAvailable()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment