diff options
author | hjk <hjk@qt.io> | 2019-02-20 19:13:28 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-02-21 13:20:16 +0000 |
commit | 9e965409d1cbe6270c6a994bfe41d61a154d1d77 (patch) | |
tree | c7099baa704c1d3b0ddf01250e6757b132394ebf /src/plugins/remotelinux | |
parent | 317ab497936cc6c32da80bd0d3de58975bb308f1 (diff) |
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 <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/remotelinux')
-rw-r--r-- | src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp | 57 | ||||
-rw-r--r-- | src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.h | 45 | ||||
-rw-r--r-- | src/plugins/remotelinux/linuxdevice.cpp | 25 | ||||
-rw-r--r-- | src/plugins/remotelinux/linuxdevice.h | 14 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinux.pro | 2 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinux.qbs | 2 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinuxplugin.cpp | 4 |
7 files changed, 41 insertions, 108 deletions
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 <coreplugin/icore.h> - -#include <utils/qtcassert.h> - -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 <projectexplorer/devicesupport/idevicefactory.h> - -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 <coreplugin/icore.h> #include <coreplugin/id.h> #include <coreplugin/messagemanager.h> #include <projectexplorer/devicesupport/sshdeviceprocesslist.h> @@ -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 <projectexplorer/devicesupport/idevice.h> +#include <projectexplorer/devicesupport/idevicefactory.h> #include <QCoreApplication> @@ -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; |