diff options
author | hjk <hjk@qt.io> | 2017-07-01 19:13:06 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-07-03 13:02:07 +0000 |
commit | 9bcbf4eec315910fc456e307498544d136b416cf (patch) | |
tree | 98b9dc88e2656542999f596bf2ee74aa34cb3bf0 | |
parent | 9d8b8ba65d94c72c06d1f9dcdbef05f3f5da1662 (diff) |
Qnx: Remove RunControlFactory
Registering the main runWorkers is enough.
Change-Id: I0d2d148c6247e403463b548ca05993e18b0d88ee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | src/plugins/qnx/qnx.pro | 2 | ||||
-rw-r--r-- | src/plugins/qnx/qnx.qbs | 2 | ||||
-rw-r--r-- | src/plugins/qnx/qnxanalyzesupport.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qnx/qnxanalyzesupport.h | 6 | ||||
-rw-r--r-- | src/plugins/qnx/qnxplugin.cpp | 54 | ||||
-rw-r--r-- | src/plugins/qnx/qnxplugin.h | 9 | ||||
-rw-r--r-- | src/plugins/qnx/qnxruncontrolfactory.cpp | 109 | ||||
-rw-r--r-- | src/plugins/qnx/qnxruncontrolfactory.h | 47 |
8 files changed, 52 insertions, 183 deletions
diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index b50f4b27fb..bcfad2f36e 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -8,7 +8,6 @@ SOURCES += qnxplugin.cpp \ qnxdevicefactory.cpp \ qnxdevicewizard.cpp \ qnxrunconfiguration.cpp \ - qnxruncontrolfactory.cpp \ qnxanalyzesupport.cpp \ qnxdebugsupport.cpp \ qnxdeploystepfactory.cpp \ @@ -41,7 +40,6 @@ HEADERS += qnxplugin.h\ qnxdevicefactory.h \ qnxdevicewizard.h \ qnxrunconfiguration.h \ - qnxruncontrolfactory.h \ qnxanalyzesupport.h \ qnxdebugsupport.h \ qnxdeploystepfactory.h \ diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index eee52f0f5d..b617fc1b6a 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -76,8 +76,6 @@ QtcPlugin { "qnxrunconfiguration.h", "qnxrunconfigurationfactory.cpp", "qnxrunconfigurationfactory.h", - "qnxruncontrolfactory.cpp", - "qnxruncontrolfactory.h", "qnxutils.cpp", "qnxutils.h", "qnx_export.h", diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 5215010790..c4a0d71d94 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -75,9 +75,11 @@ private: // QnxDebugSupport -QnxAnalyzeSupport::QnxAnalyzeSupport(RunControl *runControl) +QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) : RunWorker(runControl) { + runControl->createWorker(runControl->runMode()); + setDisplayName("QnxAnalyzeSupport"); appendMessage(tr("Preparing remote side..."), Utils::LogMessageFormat); @@ -99,7 +101,7 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(RunControl *runControl) // m_outputParser.processOutput(msg); } -void QnxAnalyzeSupport::start() +void QnxQmlProfilerSupport::start() { // runControl()->notifyRemoteSetupDone(m_qmlPort); reportStarted(); diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h index cb049866f8..9fbd11d0fe 100644 --- a/src/plugins/qnx/qnxanalyzesupport.h +++ b/src/plugins/qnx/qnxanalyzesupport.h @@ -30,14 +30,12 @@ namespace Qnx { namespace Internal { -class Slog2InfoRunner; - -class QnxAnalyzeSupport : public ProjectExplorer::RunWorker +class QnxQmlProfilerSupport : public ProjectExplorer::RunWorker { Q_OBJECT public: - explicit QnxAnalyzeSupport(ProjectExplorer::RunControl *runControl); + explicit QnxQmlProfilerSupport(ProjectExplorer::RunControl *runControl); private: void start() override; diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index 2826b24cee..a1f1cffc9c 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -25,38 +25,49 @@ #include "qnxplugin.h" -#include "qnxconstants.h" +#include "qnxanalyzesupport.h" #include "qnxattachdebugsupport.h" -#include "qnxdevicefactory.h" -#include "qnxruncontrolfactory.h" -#include "qnxdeploystepfactory.h" +#include "qnxconfigurationmanager.h" +#include "qnxconstants.h" +#include "qnxdebugsupport.h" #include "qnxdeployconfigurationfactory.h" -#include "qnxrunconfigurationfactory.h" +#include "qnxdeploystepfactory.h" +#include "qnxdevice.h" +#include "qnxdevicefactory.h" +#include "qnxqtversion.h" #include "qnxqtversionfactory.h" +#include "qnxrunconfiguration.h" +#include "qnxrunconfigurationfactory.h" #include "qnxsettingspage.h" -#include "qnxconfigurationmanager.h" #include "qnxtoolchain.h" -#include "qnxattachdebugsupport.h" +#include "qnxutils.h" #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/icontext.h> #include <coreplugin/icore.h> + #include <projectexplorer/kitinformation.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/taskhub.h> #include <projectexplorer/kitmanager.h> +#include <projectexplorer/environmentaspect.h> +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/project.h> +#include <projectexplorer/target.h> +#include <projectexplorer/toolchain.h> + +#include <qtsupport/qtkitinformation.h> #include <QAction> #include <QtPlugin> using namespace ProjectExplorer; -using namespace Qnx::Internal; -QnxPlugin::QnxPlugin() : m_debugSeparator(0) , m_attachToQnxApplication(0) -{ } +namespace Qnx { +namespace Internal { bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString) { @@ -67,13 +78,29 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString) addAutoReleasedObject(new QnxConfigurationManager); addAutoReleasedObject(new QnxQtVersionFactory); addAutoReleasedObject(new QnxDeviceFactory); - addAutoReleasedObject(new QnxRunControlFactory); addAutoReleasedObject(new QnxDeployStepFactory); addAutoReleasedObject(new QnxDeployConfigurationFactory); addAutoReleasedObject(new QnxRunConfigurationFactory); addAutoReleasedObject(new QnxSettingsPage); - // Handle Qcc Compiler + auto constraint = [](RunConfiguration *runConfig) { + if (!runConfig->isEnabled() + || !runConfig->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) { + return false; + } + + auto dev = DeviceKitInformation::device(runConfig->target()->kit()) + .dynamicCast<const QnxDevice>(); + return !dev.isNull(); + }; + + RunControl::registerWorker<SimpleTargetRunner> + (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint); + RunControl::registerWorker<QnxDebugSupport> + (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint); + RunControl::registerWorker<QnxQmlProfilerSupport> + (ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint); + addAutoReleasedObject(new QnxToolChainFactory); return true; @@ -118,3 +145,6 @@ void QnxPlugin::updateDebuggerActions() m_attachToQnxApplication->setVisible(false && hasValidQnxKit); // FIXME m_debugSeparator->setVisible(false && hasValidQnxKit); // FIXME QTCREATORBUG-16608 } + +} // Internal +} // Qnx diff --git a/src/plugins/qnx/qnxplugin.h b/src/plugins/qnx/qnxplugin.h index 1fd1367cb8..798251810c 100644 --- a/src/plugins/qnx/qnxplugin.h +++ b/src/plugins/qnx/qnxplugin.h @@ -40,18 +40,17 @@ class QnxPlugin : public ExtensionSystem::IPlugin Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Qnx.json") public: - QnxPlugin(); + QnxPlugin() {} bool initialize(const QStringList &arguments, QString *errorString); void extensionsInitialized(); ShutdownFlag aboutToShutdown(); -private slots: +private: void updateDebuggerActions(); -private: - QAction *m_debugSeparator; - QAction *m_attachToQnxApplication; + QAction *m_debugSeparator = nullptr; + QAction *m_attachToQnxApplication = nullptr; }; } // namespace Internal diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp deleted file mode 100644 index 18a44abd0b..0000000000 --- a/src/plugins/qnx/qnxruncontrolfactory.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BlackBerry Limited. All rights reserved. -** Contact: KDAB (info@kdab.com) -** -** 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 "qnxruncontrolfactory.h" -#include "qnxconstants.h" -#include "qnxrunconfiguration.h" -#include "qnxdebugsupport.h" -#include "qnxdevice.h" -#include "qnxanalyzesupport.h" -#include "qnxqtversion.h" -#include "slog2inforunner.h" -#include "qnxutils.h" - -#include <debugger/debuggerruncontrol.h> -#include <debugger/debuggerrunconfigurationaspect.h> -#include <debugger/debuggerstartparameters.h> -#include <debugger/debuggerkitinformation.h> -#include <debugger/analyzer/analyzermanager.h> -#include <projectexplorer/environmentaspect.h> -#include <projectexplorer/buildconfiguration.h> -#include <projectexplorer/project.h> -#include <projectexplorer/target.h> -#include <projectexplorer/toolchain.h> -#include <qtsupport/qtkitinformation.h> -#include <utils/portlist.h> - -using namespace Debugger; -using namespace ProjectExplorer; - -namespace Qnx { -namespace Internal { - -QnxRunControlFactory::QnxRunControlFactory(QObject *parent) - : IRunControlFactory(parent) -{ -} - -bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const -{ - if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE - && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE - && mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { - return false; - } - - if (!runConfiguration->isEnabled() - || !runConfiguration->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) { - return false; - } - - const QnxDevice::ConstPtr dev = DeviceKitInformation::device(runConfiguration->target()->kit()) - .dynamicCast<const QnxDevice>(); - if (dev.isNull()) - return false; - - return true; -} - -RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id mode, QString *) -{ - QTC_ASSERT(canRun(runConfig, mode), return 0); - - if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) { - auto runControl = new RunControl(runConfig, mode); - (void) new SimpleTargetRunner(runControl); - return runControl; - } - - if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) { - auto runControl = new RunControl(runConfig, mode); - (void) new QnxDebugSupport(runControl); - return runControl; - } - - if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { - RunControl *runControl = new RunControl(runConfig, mode); - runControl->createWorker(mode); - (void) new QnxAnalyzeSupport(runControl); - return runControl; - } - - QTC_CHECK(false); - return 0; -} - -} // namespace Internal -} // namespace Qnx diff --git a/src/plugins/qnx/qnxruncontrolfactory.h b/src/plugins/qnx/qnxruncontrolfactory.h deleted file mode 100644 index af19a7f3dd..0000000000 --- a/src/plugins/qnx/qnxruncontrolfactory.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BlackBerry Limited. All rights reserved. -** Contact: KDAB (info@kdab.com) -** -** 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 <projectexplorer/runconfiguration.h> - -namespace Qnx { -namespace Internal { - -class QnxRunControlFactory : public ProjectExplorer::IRunControlFactory -{ - Q_OBJECT - -public: - explicit QnxRunControlFactory(QObject *parent = 0); - - bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, - Core::Id mode) const override; - ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, - Core::Id mode, QString *errorMessage) override; -}; - -} // namespace Internal -} // namespace Qnx |