aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprojectmanager
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-03-13 12:22:44 +0100
committerhjk <hjk@qt.io>2019-03-19 15:56:17 +0000
commit1bc10248c06bf7248ca9c4e05013b492edc3210a (patch)
tree30e88bbfddb986de5ee36c60779603d03d4535e4 /src/plugins/qmlprojectmanager
parent404b284e8f234ca5c27d4a3f4db1af68cb799545 (diff)
ProjectExplorer: Introduce a SimpleRunWorkerFactory template
... and use in as replacement for RunConfiguration::addRunWorkerFactory. It is still convenient to have a simple way to set up run worker factories for the typical "just run for this configuration" case, but it's even better if it follows the nowadays predominant pattern of keeping factories in the plugin's pimpl. Also, it turned out there were two copies of QmlProjectRunconfigurationFactory code, one is enough. Change-Id: I0b28c4ea18d0f52165a49f6133dc8687a3b9c7cf Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprojectmanager')
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectplugin.cpp15
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectplugin.h2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp43
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h40
5 files changed, 13 insertions, 89 deletions
diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
index 6e460d3e0b9..b2079c9f31d 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
@@ -25,12 +25,13 @@
#include "qmlprojectplugin.h"
#include "qmlproject.h"
-#include "qmlprojectrunconfigurationfactory.h"
+#include "qmlprojectrunconfiguration.h"
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
#include <projectexplorer/projectmanager.h>
+#include <projectexplorer/runcontrol.h>
#include <qmljstools/qmljstoolsconstants.h>
@@ -39,16 +40,24 @@ using namespace ProjectExplorer;
namespace QmlProjectManager {
namespace Internal {
+class QmlProjectPluginPrivate
+{
+public:
+ QmlProjectRunConfigurationFactory runConfigFactory;
+ SimpleRunWorkerFactory<QmlProjectRunConfiguration, SimpleTargetRunner>
+ runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
+};
+
QmlProjectPlugin::~QmlProjectPlugin()
{
- delete m_rcFactory;
+ delete d;
}
bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
{
Q_UNUSED(errorMessage)
- m_rcFactory = new QmlProjectRunConfigurationFactory;
+ d = new QmlProjectPluginPrivate;
ProjectManager::registerProjectType<QmlProject>(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
Core::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png", "qmlproject");
diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.h b/src/plugins/qmlprojectmanager/qmlprojectplugin.h
index d08738cfa99..10a407216db 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectplugin.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.h
@@ -43,7 +43,7 @@ private:
bool initialize(const QStringList &arguments, QString *errorString) final;
void extensionsInitialized() final {}
- class QmlProjectRunConfigurationFactory *m_rcFactory = nullptr;
+ class QmlProjectPluginPrivate *d = nullptr;
};
} // namespace Internal
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
index fc10cfde177..412cbb94c79 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
@@ -459,8 +459,6 @@ QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
registerRunConfiguration<QmlProjectRunConfiguration>
("QmlProjectManager.QmlRunConfiguration.QmlScene");
addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID);
-
- addRunWorkerFactory<SimpleTargetRunner>(ProjectExplorer::Constants::NORMAL_RUN_MODE);
}
} // namespace Internal
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp
deleted file mode 100644
index e5abbcc0b3d..00000000000
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp
+++ /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.
-**
-****************************************************************************/
-
-#include "qmlprojectrunconfigurationfactory.h"
-#include "qmlprojectmanagerconstants.h"
-#include "qmlproject.h"
-#include "qmlprojectrunconfiguration.h"
-
-namespace QmlProjectManager {
-namespace Internal {
-
-QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory() :
- ProjectExplorer::FixedRunConfigurationFactory(QmlProjectRunConfiguration::tr("QML Scene"), false)
-{
- registerRunConfiguration<QmlProjectRunConfiguration>(Constants::QML_SCENE_RC_ID);
- addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID);
-}
-
-} // namespace Internal
-} // namespace QmlProjectManager
-
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h
deleted file mode 100644
index 0a94d3c4f32..00000000000
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h
+++ /dev/null
@@ -1,40 +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 <projectexplorer/runconfiguration.h>
-
-namespace QmlProjectManager {
-namespace Internal {
-
-class QmlProjectRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
-{
-public:
- QmlProjectRunConfigurationFactory();
-};
-
-} // namespace Internal
-} // namespace QmlProjectManager