Commit 88d413e0 authored by hjk's avatar hjk Committed by Christian Kandeler
Browse files

remotelinux/projectexplorer: move UsedPortsGatherer to projectexplorer



Change-Id: Iafd7f109de3076375e667aff0c429405cef07b55
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent bc1f0916
......@@ -27,6 +27,7 @@
**
**
**************************************************************************/
#ifndef MADDEDEVICE_H
#define MADDEDEVICE_H
......
......@@ -35,11 +35,11 @@
#include <projectexplorer/target.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
using namespace ProjectExplorer;
using namespace RemoteLinux;
using namespace QSsh;
namespace Madde {
......
......@@ -36,8 +36,6 @@
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/portlist.h>
#include <QSharedPointer>
namespace ProjectExplorer { class Profile; }
namespace QSsh { class SshConnection; }
namespace Utils { class FileName; }
......@@ -49,6 +47,7 @@ class MaemoRemoteMounter;
class MaemoDeploymentMounter : public QObject
{
Q_OBJECT
public:
explicit MaemoDeploymentMounter(QObject *parent = 0);
~MaemoDeploymentMounter();
......
......@@ -33,8 +33,9 @@
#include "maemoglobal.h"
#include "maddedevice.h"
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocessrunner.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <utils/qtcassert.h>
#include <QTimer>
......@@ -52,7 +53,7 @@ MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent)
m_utfsServerTimer(new QTimer(this)),
m_mountProcess(new SshRemoteProcessRunner(this)),
m_unmountProcess(new SshRemoteProcessRunner(this)),
m_portsGatherer(new RemoteLinuxUsedPortsGatherer(this)),
m_portsGatherer(new DeviceUsedPortsGatherer(this)),
m_state(Inactive)
{
connect(m_utfsServerTimer, SIGNAL(timeout()), SLOT(handleUtfsServerTimeout()));
......
......@@ -45,8 +45,7 @@
QT_FORWARD_DECLARE_CLASS(QTimer)
namespace QSsh { class SshRemoteProcessRunner; }
namespace RemoteLinux { class RemoteLinuxUsedPortsGatherer; }
namespace ProjectExplorer { class DeviceUsedPortsGatherer; }
namespace Madde {
namespace Internal {
......@@ -54,6 +53,7 @@ namespace Internal {
class MaemoRemoteMounter : public QObject
{
Q_OBJECT
public:
MaemoRemoteMounter(QObject *parent = 0);
~MaemoRemoteMounter();
......@@ -120,7 +120,7 @@ private:
typedef QSharedPointer<QProcess> ProcPtr;
QList<ProcPtr> m_utfsServers;
RemoteLinux::RemoteLinuxUsedPortsGatherer * const m_portsGatherer;
ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer;
Utils::FileName m_maddeRoot;
State m_state;
......
......@@ -27,7 +27,7 @@
**
**************************************************************************/
#include "remotelinuxusedportsgatherer.h"
#include "deviceusedportsgatherer.h"
#include <utils/portlist.h>
#include <utils/qtcassert.h>
......@@ -35,16 +35,13 @@
#include <ssh/sshconnectionmanager.h>
#include <ssh/sshremoteprocess.h>
#include <QString>
using namespace ProjectExplorer;
using namespace QSsh;
using namespace Utils;
namespace RemoteLinux {
namespace ProjectExplorer {
namespace Internal {
class RemoteLinuxUsedPortsGathererPrivate
class DeviceUsedPortsGathererPrivate
{
public:
SshConnection *connection;
......@@ -58,21 +55,19 @@ class RemoteLinuxUsedPortsGathererPrivate
} // namespace Internal
using namespace Internal;
RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) :
QObject(parent), d(new RemoteLinuxUsedPortsGathererPrivate)
DeviceUsedPortsGatherer::DeviceUsedPortsGatherer(QObject *parent) :
QObject(parent), d(new Internal::DeviceUsedPortsGathererPrivate)
{
d->connection = 0;
}
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
DeviceUsedPortsGatherer::~DeviceUsedPortsGatherer()
{
stop();
delete d;
}
void RemoteLinuxUsedPortsGatherer::start(const IDevice::ConstPtr &devConf)
void DeviceUsedPortsGatherer::start(const IDevice::ConstPtr &devConf)
{
QTC_ASSERT(!d->connection, return);
d->portsToCheck = devConf->freePorts();
......@@ -87,7 +82,7 @@ void RemoteLinuxUsedPortsGatherer::start(const IDevice::ConstPtr &devConf)
d->connection->connectToHost();
}
void RemoteLinuxUsedPortsGatherer::handleConnectionEstablished()
void DeviceUsedPortsGatherer::handleConnectionEstablished()
{
QString command = d->command;
if (command.isEmpty()) {
......@@ -113,7 +108,7 @@ void RemoteLinuxUsedPortsGatherer::handleConnectionEstablished()
d->process->start();
}
void RemoteLinuxUsedPortsGatherer::stop()
void DeviceUsedPortsGatherer::stop()
{
if (!d->connection)
return;
......@@ -128,7 +123,7 @@ void RemoteLinuxUsedPortsGatherer::stop()
d->connection = 0;
}
int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
int DeviceUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
{
while (freePorts->hasMore()) {
const int port = freePorts->getNext();
......@@ -138,17 +133,17 @@ int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
return -1;
}
QList<int> RemoteLinuxUsedPortsGatherer::usedPorts() const
QList<int> DeviceUsedPortsGatherer::usedPorts() const
{
return d->usedPorts;
}
void RemoteLinuxUsedPortsGatherer::setCommand(const QString &command)
void DeviceUsedPortsGatherer::setCommand(const QString &command)
{
d->command = command;
}
void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
void DeviceUsedPortsGatherer::setupUsedPorts()
{
QList<QByteArray> portStrings = d->remoteStdout.split('\n');
portStrings.removeFirst();
......@@ -168,7 +163,7 @@ void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
emit portListReady();
}
void RemoteLinuxUsedPortsGatherer::handleConnectionError()
void DeviceUsedPortsGatherer::handleConnectionError()
{
if (!d->connection)
return;
......@@ -176,7 +171,7 @@ void RemoteLinuxUsedPortsGatherer::handleConnectionError()
stop();
}
void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
void DeviceUsedPortsGatherer::handleProcessClosed(int exitStatus)
{
if (!d->connection)
return;
......@@ -208,16 +203,16 @@ void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
stop();
}
void RemoteLinuxUsedPortsGatherer::handleRemoteStdOut()
void DeviceUsedPortsGatherer::handleRemoteStdOut()
{
if (d->process)
d->remoteStdout += d->process->readAllStandardOutput();
}
void RemoteLinuxUsedPortsGatherer::handleRemoteStdErr()
void DeviceUsedPortsGatherer::handleRemoteStdErr()
{
if (d->process)
d->remoteStderr += d->process->readAllStandardError();
}
} // namespace RemoteLinux
} // namespace ProjectExplorer
......@@ -26,34 +26,25 @@
**
**
**************************************************************************/
#ifndef REMOTELINUXUSEDPORTSGATHERER_H
#define REMOTELINUXUSEDPORTSGATHERER_H
#include "remotelinux_export.h"
#ifndef DEVICEUSEDPORTSGATHERER_H
#define DEVICEUSEDPORTSGATHERER_H
#include <projectexplorer/devicesupport/idevice.h>
#include <QList>
#include <QObject>
#include <QSharedPointer>
QT_FORWARD_DECLARE_CLASS(QString)
#include "idevice.h"
namespace Utils { class PortList; }
namespace RemoteLinux {
namespace Internal {
class RemoteLinuxUsedPortsGathererPrivate;
} // namespace Internal
namespace ProjectExplorer {
namespace Internal { class DeviceUsedPortsGathererPrivate; }
class REMOTELINUX_EXPORT RemoteLinuxUsedPortsGatherer : public QObject
class PROJECTEXPLORER_EXPORT DeviceUsedPortsGatherer : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(RemoteLinuxUsedPortsGatherer)
public:
explicit RemoteLinuxUsedPortsGatherer(QObject *parent = 0);
~RemoteLinuxUsedPortsGatherer();
explicit DeviceUsedPortsGatherer(QObject *parent = 0);
~DeviceUsedPortsGatherer();
void start(const ProjectExplorer::IDevice::ConstPtr &devConf);
void stop();
int getNextFreePort(Utils::PortList *freePorts) const; // returns -1 if no more are left
......@@ -75,9 +66,9 @@ private slots:
private:
void setupUsedPorts();
Internal::RemoteLinuxUsedPortsGathererPrivate * const d;
Internal::DeviceUsedPortsGathererPrivate * const d;
};
} // namespace RemoteLinux
} // namespace ProjectExplorer
#endif // REMOTELINUXUSEDPORTSGATHERER_H
#endif // DEVICEUSEDPORTSGATHERER_H
......@@ -124,7 +124,8 @@ HEADERS += projectexplorer.h \
devicesupport/deviceprocesslist.h \
devicesupport/deviceprocessesdialog.h \
devicesupport/devicesettingswidget.h \
devicesupport/devicesettingspage.h
devicesupport/devicesettingspage.h \
devicesupport/deviceusedportsgatherer.h
SOURCES += projectexplorer.cpp \
abi.cpp \
......@@ -225,7 +226,8 @@ SOURCES += projectexplorer.cpp \
devicesupport/deviceprocesslist.cpp \
devicesupport/deviceprocessesdialog.cpp \
devicesupport/devicesettingswidget.cpp \
devicesupport/devicesettingspage.cpp
devicesupport/devicesettingspage.cpp \
devicesupport/deviceusedportsgatherer.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
......
......@@ -304,6 +304,8 @@ QtcPlugin {
"devicesupport/devicesettingswidget.cpp",
"devicesupport/devicesettingswidget.h",
"devicesupport/devicesettingswidget.ui",
"devicesupport/deviceusedportsgatherer.cpp",
"devicesupport/deviceusedportsgatherer.h",
"devicesupport/idevicewidget.h",
"devicesupport/idevicefactory.cpp",
"devicesupport/idevicefactory.h"
......
......@@ -35,8 +35,6 @@
#include "qnxrunconfiguration.h"
#include "qnxconstants.h"
#include <remotelinux/remotelinuxusedportsgatherer.h>
using namespace Qnx;
using namespace Qnx::Internal;
......
......@@ -36,7 +36,6 @@
#include "qnxconstants.h"
#include <debugger/debuggerengine.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <utils/qtcassert.h>
using namespace Qnx;
......
......@@ -37,11 +37,11 @@
#include "qnxdeviceconfigurationwizardpages.h"
#include "qnxdeviceconfiguration.h"
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/linuxdevicetestdialog.h>
#include <remotelinux/linuxdevicetester.h>
#include <utils/portlist.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <ssh/sshconnection.h>
using namespace ProjectExplorer;
......
......@@ -40,13 +40,12 @@ namespace QSsh { class SshConnectionParameters; }
namespace Utils { class PortList; }
namespace RemoteLinux {
namespace Internal {
class LinuxDeviceConfigurationPrivate;
} // namespace Internal
namespace Internal { class LinuxDeviceConfigurationPrivate; }
class REMOTELINUX_EXPORT LinuxDeviceConfiguration : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::LinuxDeviceConfiguration)
public:
typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
......
......@@ -27,10 +27,10 @@
**
**
**************************************************************************/
#include "linuxdevicetester.h"
#include "remotelinuxusedportsgatherer.h"
#include "linuxdevicetester.h"
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <utils/qtcassert.h>
#include <ssh/sshremoteprocess.h>
#include <ssh/sshconnection.h>
......@@ -54,7 +54,7 @@ public:
IDevice::ConstPtr deviceConfiguration;
SshConnection *connection;
SshRemoteProcess::Ptr process;
RemoteLinuxUsedPortsGatherer portsGatherer;
DeviceUsedPortsGatherer portsGatherer;
State state;
};
......@@ -113,7 +113,7 @@ void GenericLinuxDeviceTester::stopTest()
setFinished(TestFailure);
}
RemoteLinuxUsedPortsGatherer *GenericLinuxDeviceTester::usedPortsGatherer() const
DeviceUsedPortsGatherer *GenericLinuxDeviceTester::usedPortsGatherer() const
{
return &d->portsGatherer;
}
......
......@@ -35,16 +35,12 @@
#include <projectexplorer/devicesupport/idevice.h>
namespace QSsh {
class SshConnection;
}
namespace ProjectExplorer { class DeviceUsedPortsGatherer; }
namespace QSsh { class SshConnection; }
namespace RemoteLinux {
class RemoteLinuxUsedPortsGatherer;
namespace Internal {
class GenericLinuxDeviceTesterPrivate;
}
namespace Internal { class GenericLinuxDeviceTesterPrivate; }
class REMOTELINUX_EXPORT AbstractLinuxDeviceTester : public QObject
{
......@@ -77,7 +73,7 @@ public:
void testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration);
void stopTest();
RemoteLinuxUsedPortsGatherer *usedPortsGatherer() const;
ProjectExplorer::DeviceUsedPortsGatherer *usedPortsGatherer() const;
private slots:
void handleConnected();
......
......@@ -44,7 +44,6 @@ HEADERS += \
remotelinuxenvironmentreader.h \
sshkeydeployer.h \
typespecificdeviceconfigurationlistmodel.h \
remotelinuxusedportsgatherer.h \
remotelinuxutils.h \
deploymentsettingsassistant.h \
remotelinuxdeployconfigurationwidget.h \
......@@ -92,7 +91,6 @@ SOURCES += \
remotelinuxenvironmentreader.cpp \
sshkeydeployer.cpp \
typespecificdeviceconfigurationlistmodel.cpp \
remotelinuxusedportsgatherer.cpp \
remotelinuxutils.cpp \
deploymentsettingsassistant.cpp \
remotelinuxdeployconfigurationwidget.cpp \
......
......@@ -87,7 +87,6 @@ QtcPlugin {
"remotelinuxrunconfigurationwidget.cpp",
"remotelinuxrunconfigurationwidget.h",
"remotelinuxruncontrol.h",
"remotelinuxusedportsgatherer.cpp",
"remotelinuxutils.cpp",
"remotelinuxutils.h",
"startgdbserverdialog.cpp",
......@@ -105,7 +104,6 @@ QtcPlugin {
"remotelinuxenvironmentreader.cpp",
"remotelinuxenvironmentreader.h",
"remotelinuxpackageinstaller.h",
"remotelinuxusedportsgatherer.h",
"sshkeydeployer.cpp",
"sshkeydeployer.h",
"typespecificdeviceconfigurationlistmodel.cpp",
......
......@@ -31,10 +31,10 @@
#include "linuxdeviceconfiguration.h"
#include "remotelinuxrunconfiguration.h"
#include "remotelinuxusedportsgatherer.h"
#include <projectexplorer/target.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
......@@ -74,7 +74,7 @@ public:
state(Inactive)
{ }
RemoteLinuxUsedPortsGatherer portsGatherer;
DeviceUsedPortsGatherer portsGatherer;
IDevice::ConstPtr devConfig;
const QString remoteExecutable;
const QString appArguments;
......@@ -119,7 +119,7 @@ IDevice::ConstPtr AbstractRemoteLinuxApplicationRunner::devConfig() const
return d->devConfig;
}
RemoteLinuxUsedPortsGatherer *AbstractRemoteLinuxApplicationRunner::usedPortsGatherer() const
DeviceUsedPortsGatherer *AbstractRemoteLinuxApplicationRunner::usedPortsGatherer() const
{
return &d->portsGatherer;
}
......
......@@ -26,26 +26,22 @@
**
**
**************************************************************************/
#ifndef REMOTELINUXAPPLICATIONRUNNER_H
#define REMOTELINUXAPPLICATIONRUNNER_H
#include "remotelinux_export.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <QObject>
#include <QSharedPointer>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
namespace QSsh { class SshConnection; }
namespace Utils { class PortList; }
namespace RemoteLinux {
class RemoteLinuxRunConfiguration;
class RemoteLinuxUsedPortsGatherer;
namespace Internal {
class AbstractRemoteLinuxApplicationRunnerPrivate;
}
namespace Internal { class AbstractRemoteLinuxApplicationRunnerPrivate; }
class REMOTELINUX_EXPORT AbstractRemoteLinuxApplicationRunner : public QObject
{
......@@ -63,7 +59,7 @@ public:
ProjectExplorer::IDevice::ConstPtr devConfig() const;
QSsh::SshConnection *connection() const;
RemoteLinuxUsedPortsGatherer *usedPortsGatherer() const;
ProjectExplorer::DeviceUsedPortsGatherer *usedPortsGatherer() const;
Utils::PortList *freePorts();
QString remoteExecutable() const;
QString arguments() const;
......
......@@ -31,13 +31,13 @@
#include "remotelinuxapplicationrunner.h"
#include "remotelinuxrunconfiguration.h"
#include "remotelinuxusedportsgatherer.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerprofileinformation.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <projectexplorer/profile.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
......
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