summaryrefslogtreecommitdiff
path: root/src/plugins/winrt
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-01-15 08:33:33 +0100
committerhjk <hjk@qt.io>2019-01-16 09:31:45 +0000
commitaeb3600eef2fabf3157600748d6b3aa5533885ab (patch)
treeb45a2f29c85445394d94b7800237ef7ce671e566 /src/plugins/winrt
parent09d54fded310b24fdc9f8c6322686d9fa25d8c8d (diff)
downloadqt-creator-aeb3600eef2fabf3157600748d6b3aa5533885ab.tar.gz
WinRt: Streamline WinRt device construction
Remove create() and init() functions and ctors except default constructor. Change-Id: I2746ca88bc1e63bdfb05d027c0816b3c8af5ea35 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/winrt')
-rw-r--r--src/plugins/winrt/winrtdevice.cpp18
-rw-r--r--src/plugins/winrt/winrtdevice.h12
-rw-r--r--src/plugins/winrt/winrtdevicefactory.cpp6
3 files changed, 8 insertions, 28 deletions
diff --git a/src/plugins/winrt/winrtdevice.cpp b/src/plugins/winrt/winrtdevice.cpp
index 483c2e142c..5f6478a72f 100644
--- a/src/plugins/winrt/winrtdevice.cpp
+++ b/src/plugins/winrt/winrtdevice.cpp
@@ -44,24 +44,6 @@ namespace Internal {
WinRtDevice::WinRtDevice()
{
- initFreePorts();
-}
-
-WinRtDevice::WinRtDevice(Core::Id internalId, int deviceId)
- : m_deviceId(deviceId)
-{
- setupId(AutoDetected, internalId);
- initFreePorts();
-}
-
-WinRtDevice::WinRtDevice(const WinRtDevice &other)
- : IDevice(other), m_deviceId(other.m_deviceId)
-{
- initFreePorts();
-}
-
-void WinRtDevice::initFreePorts()
-{
Utils::PortList portList;
portList.addRange(Utils::Port(ProjectExplorer::Constants::DESKTOP_PORT_START),
Utils::Port(ProjectExplorer::Constants::DESKTOP_PORT_END));
diff --git a/src/plugins/winrt/winrtdevice.h b/src/plugins/winrt/winrtdevice.h
index 8332ee7a48..96cca4dc38 100644
--- a/src/plugins/winrt/winrtdevice.h
+++ b/src/plugins/winrt/winrtdevice.h
@@ -32,11 +32,12 @@ namespace Internal {
class WinRtDevice : public ProjectExplorer::IDevice
{
- friend class WinRtDeviceFactory;
public:
typedef QSharedPointer<WinRtDevice> Ptr;
typedef QSharedPointer<const WinRtDevice> ConstPtr;
+ static Ptr create() { return Ptr(new WinRtDevice); }
+
QString displayType() const override;
ProjectExplorer::IDeviceWidget *createWidget() override;
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
@@ -47,16 +48,11 @@ public:
static QString displayNameForType(Core::Id type);
int deviceId() const { return m_deviceId; }
-
-protected:
- WinRtDevice();
- WinRtDevice(Core::Id internalId, int deviceId);
- WinRtDevice(const WinRtDevice &other);
+ void setDeviceId(int deviceId) { m_deviceId = deviceId; }
private:
- void initFreePorts();
+ WinRtDevice();
-private:
int m_deviceId = -1;
};
diff --git a/src/plugins/winrt/winrtdevicefactory.cpp b/src/plugins/winrt/winrtdevicefactory.cpp
index 61895c9c51..52b6dac69d 100644
--- a/src/plugins/winrt/winrtdevicefactory.cpp
+++ b/src/plugins/winrt/winrtdevicefactory.cpp
@@ -63,7 +63,7 @@ WinRtDeviceFactory::WinRtDeviceFactory(Core::Id deviceType)
this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection);
}
setDisplayName(WinRtDevice::displayNameForType(deviceType));
- setConstructionFunction([] { return IDevice::Ptr(new WinRtDevice); });
+ setConstructionFunction(&WinRtDevice::create);
setCombinedIcon(":/winrt/images/winrtdevicesmall.png",
":/winrt/images/winrtdevice.png");
}
@@ -281,7 +281,9 @@ void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const
continue;
}
- WinRtDevice *device = new WinRtDevice(internalId, deviceId);
+ auto device = WinRtDevice::create();
+ device->setupId(IDevice::AutoDetected, internalId);
+ device->setDeviceId(deviceId);
device->setType(deviceType);
device->setMachineType(machineType);
device->setDisplayName(name);