DeviceSupport: Add canAutoDetectPorts() method

Use case: Devices such as Desktop device can
automatically choose an available port.

Change-Id: I6515425da3ae861b62d103885e2fde0e542d21d0
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
Aurindam Jana
2013-04-18 09:31:22 +02:00
parent 55de6a9fb9
commit 23be3df051
6 changed files with 16 additions and 1 deletions

View File

@@ -288,7 +288,7 @@ bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k); ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
if (dev.isNull()) if (dev.isNull())
return false; return false;
return dev->portsGatheringMethod().isNull(); // We know the free ports... return dev->canAutoDetectPorts();
} }
QString DebuggerRunConfigurationAspect::displayName() const QString DebuggerRunConfigurationAspect::displayName() const

View File

@@ -90,6 +90,11 @@ void DesktopDevice::executeAction(Core::Id actionId, QWidget *parent) const
Q_UNUSED(parent); Q_UNUSED(parent);
} }
bool DesktopDevice::canAutoDetectPorts() const
{
return true;
}
bool DesktopDevice::canCreateProcessModel() const bool DesktopDevice::canCreateProcessModel() const
{ {
return true; return true;

View File

@@ -50,6 +50,7 @@ public:
QList<Core::Id> actionIds() const; QList<Core::Id> actionIds() const;
QString displayNameForActionId(Core::Id actionId) const; QString displayNameForActionId(Core::Id actionId) const;
void executeAction(Core::Id actionId, QWidget *parent = 0) const; void executeAction(Core::Id actionId, QWidget *parent = 0) const;
bool canAutoDetectPorts() const;
bool canCreateProcessModel() const; bool canCreateProcessModel() const;
DeviceProcessList *createProcessListModel(QObject *parent) const; DeviceProcessList *createProcessListModel(QObject *parent) const;

View File

@@ -112,6 +112,9 @@ public:
virtual void executeAction(Core::Id actionId, QWidget *parent = 0) const = 0; virtual void executeAction(Core::Id actionId, QWidget *parent = 0) const = 0;
virtual DeviceProcessSupport::Ptr processSupport() const; virtual DeviceProcessSupport::Ptr processSupport() const;
// Devices that can auto detect ports need not return a ports gathering method. Such devices can
// obtain a free port on demand. eg: Desktop device.
virtual bool canAutoDetectPorts() const { return false; }
virtual PortsGatheringMethod::Ptr portsGatheringMethod() const; virtual PortsGatheringMethod::Ptr portsGatheringMethod() const;
virtual bool canCreateProcessModel() const { return false; } virtual bool canCreateProcessModel() const { return false; }
virtual DeviceProcessList *createProcessListModel(QObject *parent = 0) const; virtual DeviceProcessList *createProcessListModel(QObject *parent = 0) const;

View File

@@ -249,6 +249,11 @@ DeviceProcessSupport::Ptr LinuxDevice::processSupport() const
return DeviceProcessSupport::Ptr(new LinuxDeviceProcessSupport); return DeviceProcessSupport::Ptr(new LinuxDeviceProcessSupport);
} }
bool LinuxDevice::canAutoDetectPorts() const
{
return true;
}
PortsGatheringMethod::Ptr LinuxDevice::portsGatheringMethod() const PortsGatheringMethod::Ptr LinuxDevice::portsGatheringMethod() const
{ {
return LinuxPortsGatheringMethod::Ptr(new LinuxPortsGatheringMethod); return LinuxPortsGatheringMethod::Ptr(new LinuxPortsGatheringMethod);

View File

@@ -69,6 +69,7 @@ public:
ProjectExplorer::IDevice::Ptr clone() const; ProjectExplorer::IDevice::Ptr clone() const;
ProjectExplorer::DeviceProcessSupport::Ptr processSupport() const; ProjectExplorer::DeviceProcessSupport::Ptr processSupport() const;
bool canAutoDetectPorts() const;
ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const; ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const;
bool canCreateProcessModel() const { return true; } bool canCreateProcessModel() const { return true; }
ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const; ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const;