Qnx: Remove RunControlFactory

Registering the main runWorkers is enough.

Change-Id: I0d2d148c6247e403463b548ca05993e18b0d88ee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-07-01 19:13:06 +02:00
parent 9d8b8ba65d
commit 9bcbf4eec3
8 changed files with 54 additions and 185 deletions

View File

@@ -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 \

View File

@@ -76,8 +76,6 @@ QtcPlugin {
"qnxrunconfiguration.h",
"qnxrunconfigurationfactory.cpp",
"qnxrunconfigurationfactory.h",
"qnxruncontrolfactory.cpp",
"qnxruncontrolfactory.h",
"qnxutils.cpp",
"qnxutils.h",
"qnx_export.h",

View File

@@ -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();

View File

@@ -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;

View File

@@ -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 "qnxdeployconfigurationfactory.h"
#include "qnxrunconfigurationfactory.h"
#include "qnxqtversionfactory.h"
#include "qnxsettingspage.h"
#include "qnxconfigurationmanager.h"
#include "qnxconstants.h"
#include "qnxdebugsupport.h"
#include "qnxdeployconfigurationfactory.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 "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

View File

@@ -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

View File

@@ -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

View File

@@ -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