From 9e965409d1cbe6270c6a994bfe41d61a154d1d77 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 20 Feb 2019 19:13:28 +0100 Subject: [PATCH] Move IDeviceFactory closer to IDevice implementation Except for the DesktopDevice, which is kind of special. Also try a bit to make (and partially fail at doing so) naming and code structure (#include, use of namespaces) more similar to each other. Change-Id: I9fe266e706b72c14f59ff03ca1ae02dba3adcc71 Reviewed-by: Christian Kandeler --- src/plugins/android/android.pro | 2 - src/plugins/android/android.qbs | 2 - src/plugins/android/androiddevice.cpp | 13 + src/plugins/android/androiddevice.h | 8 + src/plugins/android/androiddevicefactory.cpp | 45 --- src/plugins/android/androiddevicefactory.h | 41 --- src/plugins/android/androidplugin.cpp | 1 - src/plugins/baremetal/baremetal.pro | 2 - src/plugins/baremetal/baremetal.qbs | 1 - src/plugins/baremetal/baremetaldevice.cpp | 24 ++ src/plugins/baremetal/baremetaldevice.h | 11 + .../baremetaldeviceconfigurationfactory.cpp | 58 ---- .../baremetaldeviceconfigurationfactory.h | 45 --- src/plugins/baremetal/baremetalplugin.cpp | 4 +- src/plugins/ios/ios.pro | 4 - src/plugins/ios/ios.qbs | 4 - src/plugins/ios/iosdevice.cpp | 22 ++ src/plugins/ios/iosdevice.h | 11 +- src/plugins/ios/iosdevicefactory.cpp | 54 ---- src/plugins/ios/iosdevicefactory.h | 43 --- src/plugins/ios/iosplugin.cpp | 3 +- src/plugins/ios/iossimulator.cpp | 12 + src/plugins/ios/iossimulator.h | 11 +- src/plugins/ios/iossimulatorfactory.cpp | 47 --- src/plugins/ios/iossimulatorfactory.h | 41 --- src/plugins/qnx/qnxdevice.cpp | 32 +- src/plugins/qnx/qnxdevice.h | 16 +- src/plugins/qnx/qnxdevicefactory.cpp | 23 -- src/plugins/qnx/qnxdevicefactory.h | 11 - .../qnx/qnxdeviceprocesssignaloperation.h | 4 +- ...genericlinuxdeviceconfigurationfactory.cpp | 57 ---- .../genericlinuxdeviceconfigurationfactory.h | 45 --- src/plugins/remotelinux/linuxdevice.cpp | 25 ++ src/plugins/remotelinux/linuxdevice.h | 14 + src/plugins/remotelinux/remotelinux.pro | 2 - src/plugins/remotelinux/remotelinux.qbs | 2 - src/plugins/remotelinux/remotelinuxplugin.cpp | 4 +- src/plugins/winrt/winrt.pro | 2 - src/plugins/winrt/winrt.qbs | 2 - src/plugins/winrt/winrtdevice.cpp | 269 ++++++++++++++++ src/plugins/winrt/winrtdevice.h | 24 ++ src/plugins/winrt/winrtdevicefactory.cpp | 304 ------------------ src/plugins/winrt/winrtdevicefactory.h | 56 ---- src/plugins/winrt/winrtplugin.cpp | 1 - 44 files changed, 492 insertions(+), 910 deletions(-) delete mode 100644 src/plugins/android/androiddevicefactory.cpp delete mode 100644 src/plugins/android/androiddevicefactory.h delete mode 100644 src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp delete mode 100644 src/plugins/baremetal/baremetaldeviceconfigurationfactory.h delete mode 100644 src/plugins/ios/iosdevicefactory.cpp delete mode 100644 src/plugins/ios/iosdevicefactory.h delete mode 100644 src/plugins/ios/iossimulatorfactory.cpp delete mode 100644 src/plugins/ios/iossimulatorfactory.h delete mode 100644 src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp delete mode 100644 src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h delete mode 100644 src/plugins/winrt/winrtdevicefactory.cpp delete mode 100644 src/plugins/winrt/winrtdevicefactory.h diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro index 11f36185fe2..905a20e6f66 100644 --- a/src/plugins/android/android.pro +++ b/src/plugins/android/android.pro @@ -23,7 +23,6 @@ HEADERS += \ androidcreatekeystorecertificate.h \ javaparser.h \ androidplugin.h \ - androiddevicefactory.h \ androiddevice.h \ androidgdbserverkitinformation.h \ androidqmltoolingsupport.h \ @@ -70,7 +69,6 @@ SOURCES += \ androidcreatekeystorecertificate.cpp \ javaparser.cpp \ androidplugin.cpp \ - androiddevicefactory.cpp \ androiddevice.cpp \ androidgdbserverkitinformation.cpp \ androidqmltoolingsupport.cpp \ diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs index 0b8b925504d..0bade6bc138 100644 --- a/src/plugins/android/android.qbs +++ b/src/plugins/android/android.qbs @@ -46,8 +46,6 @@ Project { "androiddevicedialog.ui", "androiddevice.cpp", "androiddevice.h", - "androiddevicefactory.cpp", - "androiddevicefactory.h", "androiderrormessage.h", "androiderrormessage.cpp", "androidextralibrarylistmodel.cpp", diff --git a/src/plugins/android/androiddevice.cpp b/src/plugins/android/androiddevice.cpp index e33c3e3d12d..d342485b5c0 100644 --- a/src/plugins/android/androiddevice.cpp +++ b/src/plugins/android/androiddevice.cpp @@ -103,5 +103,18 @@ QUrl AndroidDevice::toolControlChannel(const ControlChannelHint &) const return url; } + +// Factory + +AndroidDeviceFactory::AndroidDeviceFactory() + : ProjectExplorer::IDeviceFactory(Constants::ANDROID_DEVICE_TYPE) +{ + setObjectName(QLatin1String("AndroidDeviceFactory")); + setDisplayName(tr("Android Device")); + setCombinedIcon(":/android/images/androiddevicesmall.png", + ":/android/images/androiddevice.png"); + setConstructionFunction(&AndroidDevice::create); +} + } // namespace Internal } // namespace Android diff --git a/src/plugins/android/androiddevice.h b/src/plugins/android/androiddevice.h index 22a0e53df1f..75ba519a06c 100644 --- a/src/plugins/android/androiddevice.h +++ b/src/plugins/android/androiddevice.h @@ -26,6 +26,7 @@ #pragma once #include +#include namespace Android { namespace Internal { @@ -50,5 +51,12 @@ private: QUrl toolControlChannel(const ControlChannelHint &) const override; }; +class AndroidDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT +public: + AndroidDeviceFactory(); +}; + } // namespace Internal } // namespace Android diff --git a/src/plugins/android/androiddevicefactory.cpp b/src/plugins/android/androiddevicefactory.cpp deleted file mode 100644 index 19a4679491a..00000000000 --- a/src/plugins/android/androiddevicefactory.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BogDan Vatra -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "androiddevicefactory.h" -#include "androiddevice.h" - -#include "androidconstants.h" - -namespace Android { -namespace Internal { - -AndroidDeviceFactory::AndroidDeviceFactory() - : ProjectExplorer::IDeviceFactory(Constants::ANDROID_DEVICE_TYPE) -{ - setObjectName(QLatin1String("AndroidDeviceFactory")); - setDisplayName(tr("Android Device")); - setCombinedIcon(":/android/images/androiddevicesmall.png", - ":/android/images/androiddevice.png"); - setConstructionFunction(&AndroidDevice::create); -} - -} // namespace Internal -} // namespace Android diff --git a/src/plugins/android/androiddevicefactory.h b/src/plugins/android/androiddevicefactory.h deleted file mode 100644 index 10e97bcd0ec..00000000000 --- a/src/plugins/android/androiddevicefactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BogDan Vatra -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace Android { -namespace Internal { - -class AndroidDeviceFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT -public: - AndroidDeviceFactory(); -}; - -} // namespace Internal -} // namespace Android diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp index 10cb97b12fa..47e7a146c89 100644 --- a/src/plugins/android/androidplugin.cpp +++ b/src/plugins/android/androidplugin.cpp @@ -30,7 +30,6 @@ #include "androiddebugsupport.h" #include "androiddeployqtstep.h" #include "androiddevice.h" -#include "androiddevicefactory.h" #include "androidgdbserverkitinformation.h" #include "androidmanager.h" #include "androidmanifesteditorfactory.h" diff --git a/src/plugins/baremetal/baremetal.pro b/src/plugins/baremetal/baremetal.pro index 886cc982841..9af653b43ea 100644 --- a/src/plugins/baremetal/baremetal.pro +++ b/src/plugins/baremetal/baremetal.pro @@ -11,7 +11,6 @@ SOURCES += baremetalplugin.cpp \ baremetaldeviceconfigurationwizardpages.cpp \ baremetaldeviceconfigurationwizard.cpp \ baremetaldeviceconfigurationwidget.cpp \ - baremetaldeviceconfigurationfactory.cpp \ baremetaldebugsupport.cpp \ gdbserverproviderprocess.cpp \ gdbserverproviderssettingspage.cpp \ @@ -28,7 +27,6 @@ HEADERS += baremetalplugin.h \ baremetaldevice.h \ baremetalrunconfiguration.h \ baremetalgdbcommandsdeploystep.h \ - baremetaldeviceconfigurationfactory.h \ baremetaldeviceconfigurationwidget.h \ baremetaldeviceconfigurationwizard.h \ baremetaldeviceconfigurationwizardpages.h \ diff --git a/src/plugins/baremetal/baremetal.qbs b/src/plugins/baremetal/baremetal.qbs index 04c1b228b10..3ac05a12761 100644 --- a/src/plugins/baremetal/baremetal.qbs +++ b/src/plugins/baremetal/baremetal.qbs @@ -16,7 +16,6 @@ QtcPlugin { "baremetalconstants.h", "baremetalcustomrunconfiguration.cpp", "baremetalcustomrunconfiguration.h", "baremetaldevice.cpp", "baremetaldevice.h", - "baremetaldeviceconfigurationfactory.cpp", "baremetaldeviceconfigurationfactory.h", "baremetaldeviceconfigurationwidget.cpp", "baremetaldeviceconfigurationwidget.h", "baremetaldeviceconfigurationwizard.cpp", "baremetaldeviceconfigurationwizard.h", "baremetaldeviceconfigurationwizardpages.cpp", "baremetaldeviceconfigurationwizardpages.h", diff --git a/src/plugins/baremetal/baremetaldevice.cpp b/src/plugins/baremetal/baremetaldevice.cpp index 2be3a4dadd6..3af318cd9d1 100644 --- a/src/plugins/baremetal/baremetaldevice.cpp +++ b/src/plugins/baremetal/baremetaldevice.cpp @@ -25,7 +25,10 @@ ****************************************************************************/ #include "baremetaldevice.h" + +#include "baremetalconstants.h" #include "baremetaldeviceconfigurationwidget.h" +#include "baremetaldeviceconfigurationwizard.h" #include "defaultgdbserverprovider.h" #include "gdbserverprovidermanager.h" #include "gdbserverproviderprocess.h" @@ -160,5 +163,26 @@ BareMetalDevice::BareMetalDevice(const BareMetalDevice &other) setGdbServerProviderId(other.gdbServerProviderId()); } + +// Factory + +BareMetalDeviceFactory::BareMetalDeviceFactory() + : IDeviceFactory(Constants::BareMetalOsType) +{ + setDisplayName(tr("Bare Metal Device")); + setCombinedIcon(":/baremetal/images/baremetaldevicesmall.png", + ":/baremetal/images/baremetaldevice.png"); + setCanCreate(true); + setConstructionFunction(&BareMetalDevice::create); +} + +IDevice::Ptr BareMetalDeviceFactory::create() const +{ + BareMetalDeviceConfigurationWizard wizard; + if (wizard.exec() != QDialog::Accepted) + return IDevice::Ptr(); + return wizard.device(); +} + } //namespace Internal } //namespace BareMetal diff --git a/src/plugins/baremetal/baremetaldevice.h b/src/plugins/baremetal/baremetaldevice.h index 50f099f8e4c..5048e93ffb3 100644 --- a/src/plugins/baremetal/baremetaldevice.h +++ b/src/plugins/baremetal/baremetaldevice.h @@ -27,6 +27,7 @@ #pragma once #include +#include namespace BareMetal { namespace Internal { @@ -69,5 +70,15 @@ private: QString m_gdbServerProviderId; }; +class BareMetalDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT + +public: + BareMetalDeviceFactory(); + + ProjectExplorer::IDevice::Ptr create() const override; +}; + } //namespace Internal } //namespace BareMetal diff --git a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp b/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp deleted file mode 100644 index 779f9305ad3..00000000000 --- a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Tim Sander -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "baremetaldeviceconfigurationfactory.h" - -#include "baremetaldeviceconfigurationwizard.h" -#include "baremetalconstants.h" -#include "baremetaldevice.h" - -#include - -using namespace ProjectExplorer; - -namespace BareMetal { -namespace Internal { - -BareMetalDeviceConfigurationFactory::BareMetalDeviceConfigurationFactory() - : IDeviceFactory(Constants::BareMetalOsType) -{ - setDisplayName(tr("Bare Metal Device")); - setCombinedIcon(":/baremetal/images/baremetaldevicesmall.png", - ":/baremetal/images/baremetaldevice.png"); - setCanCreate(true); - setConstructionFunction(&BareMetalDevice::create); -} - -IDevice::Ptr BareMetalDeviceConfigurationFactory::create() const -{ - BareMetalDeviceConfigurationWizard wizard; - if (wizard.exec() != QDialog::Accepted) - return IDevice::Ptr(); - return wizard.device(); -} - -} // namespace Internal -} // namespace BareMetal diff --git a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h b/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h deleted file mode 100644 index 5415491d90c..00000000000 --- a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Tim Sander -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace BareMetal { -namespace Internal { - -class BareMetalDeviceConfigurationFactory - : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT - -public: - BareMetalDeviceConfigurationFactory(); - - ProjectExplorer::IDevice::Ptr create() const override; -}; - -} // namespace Internal -} // namespace BareMetal diff --git a/src/plugins/baremetal/baremetalplugin.cpp b/src/plugins/baremetal/baremetalplugin.cpp index 42290772e4e..302e71ede4f 100644 --- a/src/plugins/baremetal/baremetalplugin.cpp +++ b/src/plugins/baremetal/baremetalplugin.cpp @@ -27,7 +27,7 @@ #include "baremetalplugin.h" #include "baremetalconstants.h" #include "baremetalcustomrunconfiguration.h" -#include "baremetaldeviceconfigurationfactory.h" +#include "baremetaldevice.h" #include "baremetaldebugsupport.h" #include "baremetalrunconfiguration.h" @@ -49,7 +49,7 @@ namespace Internal { class BareMetalPluginRunData { public: - BareMetalDeviceConfigurationFactory deviceConfigurationFactory; + BareMetalDeviceFactory deviceFactory; BareMetalRunConfigurationFactory runConfigurationFactory; BareMetalCustomRunConfigurationFactory customRunConfigurationFactory; GdbServerProvidersSettingsPage gdbServerProviderSettinsPage; diff --git a/src/plugins/ios/ios.pro b/src/plugins/ios/ios.pro index a6bf22abf80..6ded641b9c3 100644 --- a/src/plugins/ios/ios.pro +++ b/src/plugins/ios/ios.pro @@ -17,10 +17,8 @@ HEADERS += \ iosdsymbuildstep.h \ iosqtversion.h \ iosplugin.h \ - iosdevicefactory.h \ iosdevice.h \ iossimulator.h \ - iossimulatorfactory.h \ iosprobe.h \ iosbuildstep.h \ iostoolhandler.h \ @@ -43,10 +41,8 @@ SOURCES += \ iosdsymbuildstep.cpp \ iosqtversion.cpp \ iosplugin.cpp \ - iosdevicefactory.cpp \ iosdevice.cpp \ iossimulator.cpp \ - iossimulatorfactory.cpp \ iosprobe.cpp \ iosbuildstep.cpp \ iostoolhandler.cpp \ diff --git a/src/plugins/ios/ios.qbs b/src/plugins/ios/ios.qbs index 223b7705add..e1dca5ff545 100644 --- a/src/plugins/ios/ios.qbs +++ b/src/plugins/ios/ios.qbs @@ -36,8 +36,6 @@ QtcPlugin { "iosdeploystepwidget.ui", "iosdevice.cpp", "iosdevice.h", - "iosdevicefactory.cpp", - "iosdevicefactory.h", "iosdsymbuildstep.cpp", "iosdsymbuildstep.h", "iosplugin.cpp", @@ -58,8 +56,6 @@ QtcPlugin { "iossettingswidget.ui", "iossimulator.cpp", "iossimulator.h", - "iossimulatorfactory.cpp", - "iossimulatorfactory.h", "iostoolhandler.cpp", "iostoolhandler.h", "simulatorcontrol.cpp", diff --git a/src/plugins/ios/iosdevice.cpp b/src/plugins/ios/iosdevice.cpp index abb94ffe24e..53d956fa76a 100644 --- a/src/plugins/ios/iosdevice.cpp +++ b/src/plugins/ios/iosdevice.cpp @@ -547,5 +547,27 @@ IosDevice::ConstPtr IosKitAspect::device(Kit *kit) return res; } + +// Factory + +IosDeviceFactory::IosDeviceFactory() + : IDeviceFactory(Constants::IOS_DEVICE_ID) +{ + setObjectName(QLatin1String("IosDeviceFactory")); + setDisplayName(IosDevice::name()); + setCombinedIcon(":/ios/images/iosdevicesmall.png", + ":/ios/images/iosdevice.png"); + setConstructionFunction([] { return IDevice::Ptr(new IosDevice); }); +} + +bool IosDeviceFactory::canRestore(const QVariantMap &map) const +{ + QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap(); + if (vMap.isEmpty() + || vMap.value(QLatin1String("deviceName")).toString() == QLatin1String("*unknown*")) + return false; // transient device (probably generated during an activation) + return true; +} + } // namespace Internal } // namespace Ios diff --git a/src/plugins/ios/iosdevice.h b/src/plugins/ios/iosdevice.h index 990227827ff..afd2cbecfce 100644 --- a/src/plugins/ios/iosdevice.h +++ b/src/plugins/ios/iosdevice.h @@ -28,11 +28,11 @@ #include "iostoolhandler.h" #include +#include #include #include #include -#include #include #include @@ -79,6 +79,15 @@ protected: mutable quint16 m_lastPort; }; +class IosDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT +public: + IosDeviceFactory(); + + bool canRestore(const QVariantMap &map) const override; +}; + class IosDeviceManager : public QObject { Q_OBJECT public: diff --git a/src/plugins/ios/iosdevicefactory.cpp b/src/plugins/ios/iosdevicefactory.cpp deleted file mode 100644 index 6370cbce409..00000000000 --- a/src/plugins/ios/iosdevicefactory.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iosdevicefactory.h" -#include "iosdevice.h" - -#include "iosconstants.h" - -namespace Ios { -namespace Internal { - -IosDeviceFactory::IosDeviceFactory() - : ProjectExplorer::IDeviceFactory(Constants::IOS_DEVICE_ID) -{ - setObjectName(QLatin1String("IosDeviceFactory")); - setDisplayName(IosDevice::name()); - setCombinedIcon(":/ios/images/iosdevicesmall.png", - ":/ios/images/iosdevice.png"); - setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosDevice); }); -} - -bool IosDeviceFactory::canRestore(const QVariantMap &map) const -{ - QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap(); - if (vMap.isEmpty() - || vMap.value(QLatin1String("deviceName")).toString() == QLatin1String("*unknown*")) - return false; // transient device (probably generated during an activation) - return true; -} - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosdevicefactory.h b/src/plugins/ios/iosdevicefactory.h deleted file mode 100644 index cdf3d61ffd5..00000000000 --- a/src/plugins/ios/iosdevicefactory.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace Ios { -namespace Internal { - -class IosDeviceFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT -public: - IosDeviceFactory(); - - bool canRestore(const QVariantMap &map) const override; -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iosplugin.cpp b/src/plugins/ios/iosplugin.cpp index b7c7172eae7..b2f3e482acf 100644 --- a/src/plugins/ios/iosplugin.cpp +++ b/src/plugins/ios/iosplugin.cpp @@ -30,13 +30,12 @@ #include "iosconfigurations.h" #include "iosconstants.h" #include "iosdeploystep.h" -#include "iosdevicefactory.h" +#include "iosdevice.h" #include "iosdsymbuildstep.h" #include "iosqtversion.h" #include "iosrunner.h" #include "iossettingspage.h" #include "iossimulator.h" -#include "iossimulatorfactory.h" #include "iostoolhandler.h" #include "iosrunconfiguration.h" diff --git a/src/plugins/ios/iossimulator.cpp b/src/plugins/ios/iossimulator.cpp index 259c5334f2c..7033d59f785 100644 --- a/src/plugins/ios/iossimulator.cpp +++ b/src/plugins/ios/iossimulator.cpp @@ -281,5 +281,17 @@ QDebug operator <<(QDebug debug, const IosDeviceType &deviceType) return debug; } +// Factory + +IosSimulatorFactory::IosSimulatorFactory() + : ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE) +{ + setObjectName(QLatin1String("IosSimulatorFactory")); + setDisplayName(tr("iOS Simulator")); + setCombinedIcon(":/ios/images/iosdevicesmall.png", + ":/ios/images/iosdevice.png"); + setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); }); +} + } // namespace Internal } // namespace Ios diff --git a/src/plugins/ios/iossimulator.h b/src/plugins/ios/iossimulator.h index d4652dfe4ba..b7bea6d6294 100644 --- a/src/plugins/ios/iossimulator.h +++ b/src/plugins/ios/iossimulator.h @@ -26,11 +26,11 @@ #pragma once #include +#include + #include -#include #include -#include namespace ProjectExplorer { class Kit; } namespace Ios { @@ -87,6 +87,13 @@ private: mutable quint16 m_lastPort; }; +class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT +public: + IosSimulatorFactory(); +}; + namespace IosKitInformation { IosSimulator::ConstPtr simulator(ProjectExplorer::Kit *kit); } // namespace IosKitInformation diff --git a/src/plugins/ios/iossimulatorfactory.cpp b/src/plugins/ios/iossimulatorfactory.cpp deleted file mode 100644 index 163bfac1b44..00000000000 --- a/src/plugins/ios/iossimulatorfactory.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "iossimulatorfactory.h" - -#include "iosconstants.h" -#include "iossimulator.h" - -#include - -namespace Ios { -namespace Internal { - -IosSimulatorFactory::IosSimulatorFactory() - : ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE) -{ - setObjectName(QLatin1String("IosSimulatorFactory")); - setDisplayName(tr("iOS Simulator")); - setCombinedIcon(":/ios/images/iosdevicesmall.png", - ":/ios/images/iosdevice.png"); - setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); }); -} - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/ios/iossimulatorfactory.h b/src/plugins/ios/iossimulatorfactory.h deleted file mode 100644 index 5d05c7b370f..00000000000 --- a/src/plugins/ios/iossimulatorfactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace Ios { -namespace Internal { - -class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT -public: - IosSimulatorFactory(); -}; - -} // namespace Internal -} // namespace Ios diff --git a/src/plugins/qnx/qnxdevice.cpp b/src/plugins/qnx/qnxdevice.cpp index 49cd195ccdb..9b4a7542ffe 100644 --- a/src/plugins/qnx/qnxdevice.cpp +++ b/src/plugins/qnx/qnxdevice.cpp @@ -24,11 +24,14 @@ ****************************************************************************/ #include "qnxdevice.h" + +#include "qnxconstants.h" #include "qnxdevicetester.h" #include "qnxdeviceprocesslist.h" #include "qnxdeviceprocesssignaloperation.h" #include "qnxdeployqtlibrariesdialog.h" #include "qnxdeviceprocess.h" +#include "qnxdevicewizard.h" #include @@ -46,8 +49,7 @@ using namespace ProjectExplorer; using namespace Utils; namespace Qnx { - -using namespace Internal; +namespace Internal { const char QnxVersionKey[] = "QnxVersion"; @@ -179,4 +181,30 @@ DeviceProcessSignalOperation::Ptr QnxDevice::signalOperation() const new QnxDeviceProcessSignalOperation(sshParameters())); } +// Factory + +QnxDeviceFactory::QnxDeviceFactory() + : ProjectExplorer::IDeviceFactory(Constants::QNX_QNX_OS_TYPE) +{ + setDisplayName(tr("QNX Device")); + setCombinedIcon(":/qnx/images/qnxdevicesmall.png", + ":/qnx/images/qnxdevice.png"); + setCanCreate(true); + setConstructionFunction(&QnxDevice::create); +} + +ProjectExplorer::IDevice::Ptr QnxDeviceFactory::create() const +{ + QnxDeviceWizard wizard; + if (wizard.exec() != QDialog::Accepted) + return ProjectExplorer::IDevice::Ptr(); + return wizard.device(); +} + +Core::Id QnxDeviceFactory::deviceType() +{ + return Core::Id(Constants::QNX_QNX_OS_TYPE); +} + +} // namespace Internal } // namespace Qnx diff --git a/src/plugins/qnx/qnxdevice.h b/src/plugins/qnx/qnxdevice.h index 5a120d92b15..ea0eab27378 100644 --- a/src/plugins/qnx/qnxdevice.h +++ b/src/plugins/qnx/qnxdevice.h @@ -30,8 +30,9 @@ #include namespace Qnx { +namespace Internal { -class QNX_EXPORT QnxDevice : public RemoteLinux::LinuxDevice +class QnxDevice : public RemoteLinux::LinuxDevice { Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::QnxDevice) @@ -69,4 +70,17 @@ private: mutable int m_versionNumber = 0; }; +class QnxDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT + +public: + QnxDeviceFactory(); + + ProjectExplorer::IDevice::Ptr create() const override; + + static Core::Id deviceType(); +}; + +} // namespace Internal } // namespace Qnx diff --git a/src/plugins/qnx/qnxdevicefactory.cpp b/src/plugins/qnx/qnxdevicefactory.cpp index 02e2e454659..61ade82636d 100644 --- a/src/plugins/qnx/qnxdevicefactory.cpp +++ b/src/plugins/qnx/qnxdevicefactory.cpp @@ -34,28 +34,5 @@ namespace Qnx { namespace Internal { -QnxDeviceFactory::QnxDeviceFactory() - : ProjectExplorer::IDeviceFactory(Constants::QNX_QNX_OS_TYPE) -{ - setDisplayName(tr("QNX Device")); - setCombinedIcon(":/qnx/images/qnxdevicesmall.png", - ":/qnx/images/qnxdevice.png"); - setCanCreate(true); - setConstructionFunction(&QnxDevice::create); -} - -ProjectExplorer::IDevice::Ptr QnxDeviceFactory::create() const -{ - QnxDeviceWizard wizard; - if (wizard.exec() != QDialog::Accepted) - return ProjectExplorer::IDevice::Ptr(); - return wizard.device(); -} - -Core::Id QnxDeviceFactory::deviceType() -{ - return Core::Id(Constants::QNX_QNX_OS_TYPE); -} - } // namespace Internal } // namespace Qnx diff --git a/src/plugins/qnx/qnxdevicefactory.h b/src/plugins/qnx/qnxdevicefactory.h index 9b08ec5efe3..2c9b9998c57 100644 --- a/src/plugins/qnx/qnxdevicefactory.h +++ b/src/plugins/qnx/qnxdevicefactory.h @@ -30,17 +30,6 @@ namespace Qnx { namespace Internal { -class QnxDeviceFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT - -public: - QnxDeviceFactory(); - - ProjectExplorer::IDevice::Ptr create() const override; - - static Core::Id deviceType(); -}; } // namespace Internal } // namespace Qnx diff --git a/src/plugins/qnx/qnxdeviceprocesssignaloperation.h b/src/plugins/qnx/qnxdeviceprocesssignaloperation.h index b51eb9c847b..be3795bba0c 100644 --- a/src/plugins/qnx/qnxdeviceprocesssignaloperation.h +++ b/src/plugins/qnx/qnxdeviceprocesssignaloperation.h @@ -28,8 +28,6 @@ #include namespace Qnx { -class QnxDevice; - namespace Internal { class QnxDeviceProcessSignalOperation : public RemoteLinux::RemoteLinuxSignalOperation @@ -42,7 +40,7 @@ private: QString killProcessByNameCommandLine(const QString &filePath) const override; QString interruptProcessByNameCommandLine(const QString &filePath) const override; - friend class Qnx::QnxDevice; + friend class QnxDevice; }; } // namespace Internal diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp deleted file mode 100644 index f044da4f4d1..00000000000 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "genericlinuxdeviceconfigurationfactory.h" - -#include "genericlinuxdeviceconfigurationwizard.h" -#include "linuxdevice.h" -#include "remotelinux_constants.h" - -#include - -#include - -using namespace ProjectExplorer; - -namespace RemoteLinux { - -GenericLinuxDeviceConfigurationFactory::GenericLinuxDeviceConfigurationFactory() - : IDeviceFactory(Constants::GenericLinuxOsType) -{ - setDisplayName(tr("Generic Linux Device")); - setIcon(QIcon()); - setCanCreate(true); - setConstructionFunction(&LinuxDevice::create); -} - -IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create() const -{ - GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::mainWindow()); - if (wizard.exec() != QDialog::Accepted) - return IDevice::Ptr(); - return wizard.device(); -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h deleted file mode 100644 index 889840b3375..00000000000 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "remotelinux_export.h" - -#include - -namespace RemoteLinux { - -class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationFactory - : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT - -public: - GenericLinuxDeviceConfigurationFactory(); - - ProjectExplorer::IDevice::Ptr create() const override; -}; - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index aa291079f22..21097cc74d0 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -26,6 +26,7 @@ #include "linuxdevice.h" #include "genericlinuxdeviceconfigurationwidget.h" +#include "genericlinuxdeviceconfigurationwizard.h" #include "linuxdeviceprocess.h" #include "linuxdevicetester.h" #include "publickeydeploymentdialog.h" @@ -33,6 +34,7 @@ #include "remotelinuxsignaloperation.h" #include "remotelinuxenvironmentreader.h" +#include #include #include #include @@ -284,4 +286,27 @@ bool LinuxDevice::supportsRSync() const return extraData("RemoteLinux.SupportsRSync").toBool(); } + +namespace Internal { + +// Factory + +LinuxDeviceFactory::LinuxDeviceFactory() + : IDeviceFactory(Constants::GenericLinuxOsType) +{ + setDisplayName(tr("Generic Linux Device")); + setIcon(QIcon()); + setCanCreate(true); + setConstructionFunction(&LinuxDevice::create); +} + +IDevice::Ptr LinuxDeviceFactory::create() const +{ + GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::mainWindow()); + if (wizard.exec() != QDialog::Accepted) + return IDevice::Ptr(); + return wizard.device(); +} + +} } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 6f00a58d142..21a86170459 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -28,6 +28,7 @@ #include "remotelinux_export.h" #include +#include #include @@ -66,4 +67,17 @@ protected: LinuxDevice(); }; +namespace Internal { + +class LinuxDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT + +public: + LinuxDeviceFactory(); + + ProjectExplorer::IDevice::Ptr create() const override; +}; + +} // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index b1cab71cfa7..338461b28b8 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -12,7 +12,6 @@ HEADERS += \ remotelinuxrunconfiguration.h \ publickeydeploymentdialog.h \ genericlinuxdeviceconfigurationwizard.h \ - genericlinuxdeviceconfigurationfactory.h \ remotelinuxdebugsupport.h \ genericlinuxdeviceconfigurationwizardpages.h \ abstractremotelinuxdeploystep.h \ @@ -55,7 +54,6 @@ SOURCES += \ remotelinuxrunconfiguration.cpp \ publickeydeploymentdialog.cpp \ genericlinuxdeviceconfigurationwizard.cpp \ - genericlinuxdeviceconfigurationfactory.cpp \ remotelinuxdebugsupport.cpp \ genericlinuxdeviceconfigurationwizardpages.cpp \ abstractremotelinuxdeploystep.cpp \ diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index 7eebf0b3f80..f353997fdb9 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -33,8 +33,6 @@ Project { "genericdirectuploadservice.h", "genericdirectuploadstep.cpp", "genericdirectuploadstep.h", - "genericlinuxdeviceconfigurationfactory.cpp", - "genericlinuxdeviceconfigurationfactory.h", "genericlinuxdeviceconfigurationwidget.cpp", "genericlinuxdeviceconfigurationwidget.h", "genericlinuxdeviceconfigurationwidget.ui", diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index e305e472e20..00fbf0f9a06 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -26,7 +26,7 @@ #include "remotelinuxplugin.h" #include "embeddedlinuxqtversion.h" -#include "genericlinuxdeviceconfigurationfactory.h" +#include "linuxdevice.h" #include "remotelinux_constants.h" #include "remotelinuxqmltoolingsupport.h" #include "remotelinuxcustomrunconfiguration.h" @@ -67,7 +67,7 @@ public: class RemoteLinuxPluginPrivate { public: - GenericLinuxDeviceConfigurationFactory deviceConfigurationFactory; + LinuxDeviceFactory linuxDeviceFactory; RemoteLinuxRunConfigurationFactory runConfigurationFactory; RemoteLinuxCustomRunConfigurationFactory customRunConfigurationFactory; RemoteLinuxDeployConfigurationFactory deployConfigurationFactory; diff --git a/src/plugins/winrt/winrt.pro b/src/plugins/winrt/winrt.pro index 313dbba1899..1d6a7608fe1 100644 --- a/src/plugins/winrt/winrt.pro +++ b/src/plugins/winrt/winrt.pro @@ -5,7 +5,6 @@ HEADERS += \ winrtdebugsupport.h \ winrtdeployconfiguration.h \ winrtdevice.h \ - winrtdevicefactory.h \ winrtpackagedeploymentstep.h \ winrtphoneqtversion.h \ winrtplugin.h \ @@ -18,7 +17,6 @@ SOURCES += \ winrtdebugsupport.cpp \ winrtdeployconfiguration.cpp \ winrtdevice.cpp \ - winrtdevicefactory.cpp \ winrtpackagedeploymentstep.cpp \ winrtphoneqtversion.cpp \ winrtplugin.cpp \ diff --git a/src/plugins/winrt/winrt.qbs b/src/plugins/winrt/winrt.qbs index 14efb1421d7..f511a9c31a2 100644 --- a/src/plugins/winrt/winrt.qbs +++ b/src/plugins/winrt/winrt.qbs @@ -20,8 +20,6 @@ QtcPlugin { "winrtdeployconfiguration.h", "winrtdevice.cpp", "winrtdevice.h", - "winrtdevicefactory.cpp", - "winrtdevicefactory.h", "winrtpackagedeploymentstep.cpp", "winrtpackagedeploymentstep.h", "winrtphoneqtversion.cpp", diff --git a/src/plugins/winrt/winrtdevice.cpp b/src/plugins/winrt/winrtdevice.cpp index 5f6478a72f5..809ab115688 100644 --- a/src/plugins/winrt/winrtdevice.cpp +++ b/src/plugins/winrt/winrtdevice.cpp @@ -25,23 +25,39 @@ #include "winrtdevice.h" #include "winrtconstants.h" +#include "winrtqtversion.h" + +#include #include #include #include #include + +#include + #include #include #include #include +#include +#include #include +using QtSupport::BaseQtVersion; +using QtSupport::QtVersionManager; + + +using namespace Core; using namespace ProjectExplorer; +using namespace Utils; namespace WinRt { namespace Internal { +Q_LOGGING_CATEGORY(winrtDeviceLog, "qtc.winrt.deviceParser", QtWarningMsg) + WinRtDevice::WinRtDevice() { Utils::PortList portList; @@ -109,5 +125,258 @@ QString WinRtDevice::displayNameForType(Core::Id type) return QString(); } + +// Factory + +WinRtDeviceFactory::WinRtDeviceFactory(Core::Id deviceType) + : ProjectExplorer::IDeviceFactory(deviceType) +{ + if (allPrerequisitesLoaded()) { + onPrerequisitesLoaded(); + } else { + connect(DeviceManager::instance(), &DeviceManager::devicesLoaded, + this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); + connect(QtVersionManager::instance(), + &QtVersionManager::qtVersionsLoaded, + this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); + } + setDisplayName(WinRtDevice::displayNameForType(deviceType)); + setConstructionFunction(&WinRtDevice::create); + setCombinedIcon(":/winrt/images/winrtdevicesmall.png", + ":/winrt/images/winrtdevice.png"); +} + +void WinRtDeviceFactory::autoDetect() +{ + qCDebug(winrtDeviceLog) << __FUNCTION__; + MessageManager::write(tr("Running Windows Runtime device detection.")); + const QString runnerFilePath = findRunnerFilePath(); + if (runnerFilePath.isEmpty()) { + MessageManager::write(tr("No winrtrunner.exe found.")); + return; + } + + if (!m_process) { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Creating process"; + m_process = new Utils::QtcProcess(this); + connect(m_process, &QProcess::errorOccurred, this, &WinRtDeviceFactory::onProcessError); + connect(m_process, + static_cast(&QProcess::finished), + this, &WinRtDeviceFactory::onProcessFinished); + } + + const QString args = QStringLiteral("--list-devices"); + m_process->setCommand(runnerFilePath, args); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Starting process" << runnerFilePath + << "with arguments" << args; + MessageManager::write(runnerFilePath + QLatin1Char(' ') + args); + m_process->start(); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Process started"; +} + +void WinRtDeviceFactory::onPrerequisitesLoaded() +{ + if (!allPrerequisitesLoaded() || m_initialized) + return; + + qCDebug(winrtDeviceLog) << __FUNCTION__; + m_initialized = true; + disconnect(DeviceManager::instance(), &DeviceManager::devicesLoaded, + this, &WinRtDeviceFactory::onPrerequisitesLoaded); + disconnect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded, + this, &WinRtDeviceFactory::onPrerequisitesLoaded); + autoDetect(); + connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged, + this, &WinRtDeviceFactory::autoDetect); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Done"; +} + +void WinRtDeviceFactory::onProcessError() +{ + MessageManager::write(tr("Error while executing winrtrunner: %1") + .arg(m_process->errorString()), MessageManager::Flash); +} + +void WinRtDeviceFactory::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Exit code:" << exitCode <<"\tExit status:" + << exitStatus; + if (exitStatus == QProcess::CrashExit) { + // already handled in onProcessError + return; + } + + if (exitCode != 0) { + MessageManager::write(tr("winrtrunner returned with exit code %1.") + .arg(exitCode), MessageManager::Flash); + return; + } + + const QByteArray stdOut = m_process->readAllStandardOutput(); + const QByteArray stdErr = m_process->readAllStandardError(); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "winrtrunner's stdout:" << stdOut; + if (!stdErr.isEmpty()) + qCDebug(winrtDeviceLog) << __FUNCTION__ << "winrtrunner's stderr:" << stdErr; + parseRunnerOutput(stdOut); +} + +bool WinRtDeviceFactory::allPrerequisitesLoaded() +{ + return QtVersionManager::isLoaded() && DeviceManager::instance()->isLoaded(); +} + +QString WinRtDeviceFactory::findRunnerFilePath() const +{ + qCDebug(winrtDeviceLog) << __FUNCTION__; + const QString winRtRunnerExe = QStringLiteral("/winrtrunner.exe"); + const QList winrtVersions + = QtVersionManager::sortVersions( + QtVersionManager::versions(BaseQtVersion::isValidPredicate([](const BaseQtVersion *v) { + return v->type() == QLatin1String(Constants::WINRT_WINRTQT) + || v->type() == QLatin1String(Constants::WINRT_WINPHONEQT); + }))); + QString filePath; + BaseQtVersion *qt = nullptr; + for (BaseQtVersion *v : winrtVersions) { + if (!qt || qt->qtVersion() < v->qtVersion()) { + QFileInfo fi(v->binPath().toString() + winRtRunnerExe); + if (fi.isFile() && fi.isExecutable()) { + qt = v; + filePath = fi.absoluteFilePath(); + } + } + } + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Found" << filePath; + return filePath; +} + +static int extractDeviceId(QByteArray *line) +{ + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Line:" << *line; + int pos = line->indexOf(' '); + if (pos < 0) { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not find space, returning -1"; + return -1; + } + bool ok; + int id = line->left(pos).toInt(&ok); + if (!ok) { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not extract ID"; + return -1; + } + line->remove(0, pos + 1); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Found ID" << id; + return id; +} + +static IDevice::MachineType machineTypeFromLine(const QByteArray &line) +{ + return line.contains("Emulator ") ? IDevice::Emulator : IDevice::Hardware; +} + +/* + * The output of "winrtrunner --list-devices" looks like this: + * + * Available devices: + * Appx: + * 0 local + * Phone: + * 0 Device + * 1 Emulator 8.1 WVGA 4 inch 512MB + * 2 Emulator 8.1 WVGA 4 inch + * 3 Emulator 8.1 WXGA 4 inch + * 4 Emulator 8.1 720P 4.7 inch + * 5 Emulator 8.1 1080P 5.5 inch + * 6 Emulator 8.1 1080P 6 inch + * 7 WE8.1H Emulator WVGA 512MB + * 8 WE8.1H Emulator WVGA + * 9 WE8.1H Emulator WXGA + * 10 WE8.1H Emulator 720P + * 11 WE8.1H Emulator 1080P + * Xap: + * 0 Device + * 1 Emulator WVGA 512MB + * 2 Emulator WVGA + * 3 Emulator WXGA + * 4 Emulator 720P + */ +void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const +{ + qCDebug(winrtDeviceLog) << __FUNCTION__; + ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance(); + enum State { StartState, AppxState, PhoneState, XapState }; + State state = StartState; + int numFound = 0; + int numSkipped = 0; + foreach (QByteArray line, output.split('\n')) { + line = line.trimmed(); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Line:" << line; + if (line == "Appx:") { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = AppxState"; + state = AppxState; + } else if (line == "Phone:") { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = PhoneState"; + state = PhoneState; + } else if (line == "Xap:") { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = XapState"; + state = XapState; + } else { + const int deviceId = extractDeviceId(&line); + if (deviceId < 0) { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not extract device ID"; + continue; + } + + const IDevice::MachineType machineType = machineTypeFromLine(line); + Core::Id deviceType; + QString name; + QString internalName = QStringLiteral("WinRT."); + if (state == AppxState) { + internalName += QStringLiteral("appx."); + deviceType = Constants::WINRT_DEVICE_TYPE_LOCAL; + name = tr("Windows Runtime local UI"); + } else if (state == PhoneState) { + internalName += QStringLiteral("phone."); + name = QString::fromLocal8Bit(line); + if (machineType == IDevice::Emulator) + deviceType = Constants::WINRT_DEVICE_TYPE_EMULATOR; + else + deviceType = Constants::WINRT_DEVICE_TYPE_PHONE; + } else if (state == XapState) { + internalName += QStringLiteral("xap."); + name = QString::fromLocal8Bit(line); + if (machineType == IDevice::Emulator) + deviceType = Constants::WINRT_DEVICE_TYPE_EMULATOR; + else + deviceType = Constants::WINRT_DEVICE_TYPE_PHONE; + } + internalName += QString::number(deviceId); + const Core::Id internalId = Core::Id::fromString(internalName); + ++numFound; + if (DeviceManager::instance()->find(internalId)) { + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Skipping device with ID" << deviceId; + ++numSkipped; + continue; + } + + auto device = WinRtDevice::create(); + device->setupId(IDevice::AutoDetected, internalId); + device->setDeviceId(deviceId); + device->setType(deviceType); + device->setMachineType(machineType); + device->setDisplayName(name); + deviceManager->addDevice(ProjectExplorer::IDevice::ConstPtr(device)); + qCDebug(winrtDeviceLog) << __FUNCTION__ << "Added device" << name << "(internal name:" + << internalName << ")"; + } + } + QString message = tr("Found %n Windows Runtime devices.", 0, numFound); + if (const int numNew = numFound - numSkipped) { + message += QLatin1Char(' '); + message += tr("%n of them are new.", 0, numNew); + } + MessageManager::write(message); +} + } // Internal } // WinRt diff --git a/src/plugins/winrt/winrtdevice.h b/src/plugins/winrt/winrtdevice.h index 96cca4dc381..f461fc3282f 100644 --- a/src/plugins/winrt/winrtdevice.h +++ b/src/plugins/winrt/winrtdevice.h @@ -26,6 +26,9 @@ #pragma once #include +#include + +#include namespace WinRt { namespace Internal { @@ -56,5 +59,26 @@ private: int m_deviceId = -1; }; +class WinRtDeviceFactory : public ProjectExplorer::IDeviceFactory +{ + Q_OBJECT +public: + explicit WinRtDeviceFactory(Core::Id deviceType); + + void autoDetect(); + void onPrerequisitesLoaded(); + +private: + void onProcessError(); + void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); + + static bool allPrerequisitesLoaded(); + QString findRunnerFilePath() const; + void parseRunnerOutput(const QByteArray &output) const; + + Utils::QtcProcess *m_process = nullptr; + bool m_initialized = false; +}; + } // Internal } // WinRt diff --git a/src/plugins/winrt/winrtdevicefactory.cpp b/src/plugins/winrt/winrtdevicefactory.cpp deleted file mode 100644 index 52b6dac69da..00000000000 --- a/src/plugins/winrt/winrtdevicefactory.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "winrtdevicefactory.h" - -#include "winrtconstants.h" -#include "winrtdevice.h" -#include "winrtqtversion.h" - -#include -#include -#include - -#include - -#include -#include -#include - -using Core::MessageManager; -using ProjectExplorer::DeviceManager; -using ProjectExplorer::IDevice; -using QtSupport::BaseQtVersion; -using QtSupport::QtVersionManager; - -Q_LOGGING_CATEGORY(winrtDeviceLog, "qtc.winrt.deviceParser", QtWarningMsg) - -namespace WinRt { -namespace Internal { - -WinRtDeviceFactory::WinRtDeviceFactory(Core::Id deviceType) - : ProjectExplorer::IDeviceFactory(deviceType) -{ - if (allPrerequisitesLoaded()) { - onPrerequisitesLoaded(); - } else { - connect(DeviceManager::instance(), &DeviceManager::devicesLoaded, - this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); - connect(QtVersionManager::instance(), - &QtVersionManager::qtVersionsLoaded, - this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection); - } - setDisplayName(WinRtDevice::displayNameForType(deviceType)); - setConstructionFunction(&WinRtDevice::create); - setCombinedIcon(":/winrt/images/winrtdevicesmall.png", - ":/winrt/images/winrtdevice.png"); -} - -void WinRtDeviceFactory::autoDetect() -{ - qCDebug(winrtDeviceLog) << __FUNCTION__; - MessageManager::write(tr("Running Windows Runtime device detection.")); - const QString runnerFilePath = findRunnerFilePath(); - if (runnerFilePath.isEmpty()) { - MessageManager::write(tr("No winrtrunner.exe found.")); - return; - } - - if (!m_process) { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Creating process"; - m_process = new Utils::QtcProcess(this); - connect(m_process, &QProcess::errorOccurred, this, &WinRtDeviceFactory::onProcessError); - connect(m_process, - static_cast(&QProcess::finished), - this, &WinRtDeviceFactory::onProcessFinished); - } - - const QString args = QStringLiteral("--list-devices"); - m_process->setCommand(runnerFilePath, args); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Starting process" << runnerFilePath - << "with arguments" << args; - MessageManager::write(runnerFilePath + QLatin1Char(' ') + args); - m_process->start(); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Process started"; -} - -void WinRtDeviceFactory::onPrerequisitesLoaded() -{ - if (!allPrerequisitesLoaded() || m_initialized) - return; - - qCDebug(winrtDeviceLog) << __FUNCTION__; - m_initialized = true; - disconnect(DeviceManager::instance(), &DeviceManager::devicesLoaded, - this, &WinRtDeviceFactory::onPrerequisitesLoaded); - disconnect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded, - this, &WinRtDeviceFactory::onPrerequisitesLoaded); - autoDetect(); - connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged, - this, &WinRtDeviceFactory::autoDetect); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Done"; -} - -void WinRtDeviceFactory::onProcessError() -{ - MessageManager::write(tr("Error while executing winrtrunner: %1") - .arg(m_process->errorString()), MessageManager::Flash); -} - -void WinRtDeviceFactory::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) -{ - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Exit code:" << exitCode <<"\tExit status:" - << exitStatus; - if (exitStatus == QProcess::CrashExit) { - // already handled in onProcessError - return; - } - - if (exitCode != 0) { - MessageManager::write(tr("winrtrunner returned with exit code %1.") - .arg(exitCode), MessageManager::Flash); - return; - } - - const QByteArray stdOut = m_process->readAllStandardOutput(); - const QByteArray stdErr = m_process->readAllStandardError(); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "winrtrunner's stdout:" << stdOut; - if (!stdErr.isEmpty()) - qCDebug(winrtDeviceLog) << __FUNCTION__ << "winrtrunner's stderr:" << stdErr; - parseRunnerOutput(stdOut); -} - -bool WinRtDeviceFactory::allPrerequisitesLoaded() -{ - return QtVersionManager::isLoaded() && DeviceManager::instance()->isLoaded(); -} - -QString WinRtDeviceFactory::findRunnerFilePath() const -{ - qCDebug(winrtDeviceLog) << __FUNCTION__; - const QString winRtRunnerExe = QStringLiteral("/winrtrunner.exe"); - const QList winrtVersions - = QtVersionManager::sortVersions( - QtVersionManager::versions(BaseQtVersion::isValidPredicate([](const BaseQtVersion *v) { - return v->type() == QLatin1String(Constants::WINRT_WINRTQT) - || v->type() == QLatin1String(Constants::WINRT_WINPHONEQT); - }))); - QString filePath; - BaseQtVersion *qt = nullptr; - for (BaseQtVersion *v : winrtVersions) { - if (!qt || qt->qtVersion() < v->qtVersion()) { - QFileInfo fi(v->binPath().toString() + winRtRunnerExe); - if (fi.isFile() && fi.isExecutable()) { - qt = v; - filePath = fi.absoluteFilePath(); - } - } - } - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Found" << filePath; - return filePath; -} - -static int extractDeviceId(QByteArray *line) -{ - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Line:" << *line; - int pos = line->indexOf(' '); - if (pos < 0) { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not find space, returning -1"; - return -1; - } - bool ok; - int id = line->left(pos).toInt(&ok); - if (!ok) { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not extract ID"; - return -1; - } - line->remove(0, pos + 1); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Found ID" << id; - return id; -} - -static IDevice::MachineType machineTypeFromLine(const QByteArray &line) -{ - return line.contains("Emulator ") ? IDevice::Emulator : IDevice::Hardware; -} - -/* - * The output of "winrtrunner --list-devices" looks like this: - * - * Available devices: - * Appx: - * 0 local - * Phone: - * 0 Device - * 1 Emulator 8.1 WVGA 4 inch 512MB - * 2 Emulator 8.1 WVGA 4 inch - * 3 Emulator 8.1 WXGA 4 inch - * 4 Emulator 8.1 720P 4.7 inch - * 5 Emulator 8.1 1080P 5.5 inch - * 6 Emulator 8.1 1080P 6 inch - * 7 WE8.1H Emulator WVGA 512MB - * 8 WE8.1H Emulator WVGA - * 9 WE8.1H Emulator WXGA - * 10 WE8.1H Emulator 720P - * 11 WE8.1H Emulator 1080P - * Xap: - * 0 Device - * 1 Emulator WVGA 512MB - * 2 Emulator WVGA - * 3 Emulator WXGA - * 4 Emulator 720P - */ -void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const -{ - qCDebug(winrtDeviceLog) << __FUNCTION__; - ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance(); - enum State { StartState, AppxState, PhoneState, XapState }; - State state = StartState; - int numFound = 0; - int numSkipped = 0; - foreach (QByteArray line, output.split('\n')) { - line = line.trimmed(); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Line:" << line; - if (line == "Appx:") { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = AppxState"; - state = AppxState; - } else if (line == "Phone:") { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = PhoneState"; - state = PhoneState; - } else if (line == "Xap:") { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = XapState"; - state = XapState; - } else { - const int deviceId = extractDeviceId(&line); - if (deviceId < 0) { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not extract device ID"; - continue; - } - - const IDevice::MachineType machineType = machineTypeFromLine(line); - Core::Id deviceType; - QString name; - QString internalName = QStringLiteral("WinRT."); - if (state == AppxState) { - internalName += QStringLiteral("appx."); - deviceType = Constants::WINRT_DEVICE_TYPE_LOCAL; - name = tr("Windows Runtime local UI"); - } else if (state == PhoneState) { - internalName += QStringLiteral("phone."); - name = QString::fromLocal8Bit(line); - if (machineType == IDevice::Emulator) - deviceType = Constants::WINRT_DEVICE_TYPE_EMULATOR; - else - deviceType = Constants::WINRT_DEVICE_TYPE_PHONE; - } else if (state == XapState) { - internalName += QStringLiteral("xap."); - name = QString::fromLocal8Bit(line); - if (machineType == IDevice::Emulator) - deviceType = Constants::WINRT_DEVICE_TYPE_EMULATOR; - else - deviceType = Constants::WINRT_DEVICE_TYPE_PHONE; - } - internalName += QString::number(deviceId); - const Core::Id internalId = Core::Id::fromString(internalName); - ++numFound; - if (DeviceManager::instance()->find(internalId)) { - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Skipping device with ID" << deviceId; - ++numSkipped; - continue; - } - - auto device = WinRtDevice::create(); - device->setupId(IDevice::AutoDetected, internalId); - device->setDeviceId(deviceId); - device->setType(deviceType); - device->setMachineType(machineType); - device->setDisplayName(name); - deviceManager->addDevice(ProjectExplorer::IDevice::ConstPtr(device)); - qCDebug(winrtDeviceLog) << __FUNCTION__ << "Added device" << name << "(internal name:" - << internalName << ")"; - } - } - QString message = tr("Found %n Windows Runtime devices.", 0, numFound); - if (const int numNew = numFound - numSkipped) { - message += QLatin1Char(' '); - message += tr("%n of them are new.", 0, numNew); - } - MessageManager::write(message); -} - -} // Internal -} // WinRt diff --git a/src/plugins/winrt/winrtdevicefactory.h b/src/plugins/winrt/winrtdevicefactory.h deleted file mode 100644 index 32a42a65c45..00000000000 --- a/src/plugins/winrt/winrtdevicefactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include -#include - -namespace WinRt { -namespace Internal { - -class WinRtDeviceFactory : public ProjectExplorer::IDeviceFactory -{ - Q_OBJECT -public: - explicit WinRtDeviceFactory(Core::Id deviceType); - - void autoDetect(); - void onPrerequisitesLoaded(); - -private: - void onProcessError(); - void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); - - static bool allPrerequisitesLoaded(); - QString findRunnerFilePath() const; - void parseRunnerOutput(const QByteArray &output) const; - - Utils::QtcProcess *m_process = nullptr; - bool m_initialized = false; -}; - -} // Internal -} // WinRt diff --git a/src/plugins/winrt/winrtplugin.cpp b/src/plugins/winrt/winrtplugin.cpp index d1479014ad0..496b7e33085 100644 --- a/src/plugins/winrt/winrtplugin.cpp +++ b/src/plugins/winrt/winrtplugin.cpp @@ -26,7 +26,6 @@ #include "winrtplugin.h" #include "winrtconstants.h" #include "winrtdevice.h" -#include "winrtdevicefactory.h" #include "winrtdeployconfiguration.h" #include "winrtqtversion.h" #include "winrtphoneqtversion.h"