Commit 23be3df0 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

DeviceSupport: Add canAutoDetectPorts() method



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

Change-Id: I6515425da3ae861b62d103885e2fde0e542d21d0
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
parent 55de6a9f
......@@ -288,7 +288,7 @@ bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(k);
if (dev.isNull())
return false;
return dev->portsGatheringMethod().isNull(); // We know the free ports...
return dev->canAutoDetectPorts();
}
QString DebuggerRunConfigurationAspect::displayName() const
......
......@@ -90,6 +90,11 @@ void DesktopDevice::executeAction(Core::Id actionId, QWidget *parent) const
Q_UNUSED(parent);
}
bool DesktopDevice::canAutoDetectPorts() const
{
return true;
}
bool DesktopDevice::canCreateProcessModel() const
{
return true;
......
......@@ -50,6 +50,7 @@ public:
QList<Core::Id> actionIds() const;
QString displayNameForActionId(Core::Id actionId) const;
void executeAction(Core::Id actionId, QWidget *parent = 0) const;
bool canAutoDetectPorts() const;
bool canCreateProcessModel() const;
DeviceProcessList *createProcessListModel(QObject *parent) const;
......
......@@ -112,6 +112,9 @@ public:
virtual void executeAction(Core::Id actionId, QWidget *parent = 0) const = 0;
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 bool canCreateProcessModel() const { return false; }
virtual DeviceProcessList *createProcessListModel(QObject *parent = 0) const;
......
......@@ -249,6 +249,11 @@ DeviceProcessSupport::Ptr LinuxDevice::processSupport() const
return DeviceProcessSupport::Ptr(new LinuxDeviceProcessSupport);
}
bool LinuxDevice::canAutoDetectPorts() const
{
return true;
}
PortsGatheringMethod::Ptr LinuxDevice::portsGatheringMethod() const
{
return LinuxPortsGatheringMethod::Ptr(new LinuxPortsGatheringMethod);
......
......@@ -69,6 +69,7 @@ public:
ProjectExplorer::IDevice::Ptr clone() const;
ProjectExplorer::DeviceProcessSupport::Ptr processSupport() const;
bool canAutoDetectPorts() const;
ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const;
bool canCreateProcessModel() const { return true; }
ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const;
......
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