QmlProjectManager: Use setup pattern for QmlProjectRunConfiguration

Change-Id: Ib69a09c65a4755312663286fddbd891c4f7c49ce
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-18 10:23:11 +01:00
parent 6467797af2
commit f52cf6b564
3 changed files with 21 additions and 17 deletions

View File

@@ -102,7 +102,6 @@ static void clearAlwaysOpenWithMode()
class QmlProjectPluginPrivate
{
public:
QmlProjectRunConfigurationFactory runConfigFactory;
QPointer<QMessageBox> lastMessageBox;
QdsLandingPage *landingPage = nullptr;
QdsLandingPageWidget *landingPageWidget = nullptr;
@@ -274,6 +273,8 @@ private:
void QmlProjectPlugin::initialize()
{
setupQmlProjectRunConfiguration();
d = new QmlProjectPluginPrivate;
if (!qmlDesignerEnabled()) {

View File

@@ -1,10 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmlbuildsystem.h"
#include "qmlprojectrunconfiguration.h"
#include "qmlmainfileaspect.h"
#include "qmlmultilanguageaspect.h"
#include "qmlproject.h"
#include "qmlprojectmanagerconstants.h"
#include "qmlprojectmanagertr.h"
@@ -13,6 +13,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/environmentaspect.h>
@@ -20,6 +21,7 @@
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h>
@@ -318,11 +320,20 @@ FilePath QmlProjectRunConfiguration::mainScript() const
// QmlProjectRunConfigurationFactory
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
: FixedRunConfigurationFactory(Tr::tr("QML Runtime"), false)
class QmlProjectRunConfigurationFactory final : public FixedRunConfigurationFactory
{
registerRunConfiguration<QmlProjectRunConfiguration>(Constants::QML_RUNCONFIG_ID);
addSupportedProjectType(Constants::QML_PROJECT_ID);
public:
QmlProjectRunConfigurationFactory()
: FixedRunConfigurationFactory(Tr::tr("QML Runtime"), false)
{
registerRunConfiguration<QmlProjectRunConfiguration>(Constants::QML_RUNCONFIG_ID);
addSupportedProjectType(Constants::QML_PROJECT_ID);
}
};
void setupQmlProjectRunConfiguration()
{
static QmlProjectRunConfigurationFactory theQmlProjectRunConfigurationFactory;
}
} // QmlProjectManager::Internal

View File

@@ -3,16 +3,8 @@
#pragma once
#include <projectexplorer/runconfiguration.h>
namespace QmlProjectManager::Internal {
namespace QmlProjectManager {
namespace Internal {
void setupQmlProjectRunConfiguration();
class QmlProjectRunConfigurationFactory final : public ProjectExplorer::FixedRunConfigurationFactory
{
public:
QmlProjectRunConfigurationFactory();
};
} // namespace Internal
} // namespace QmlProjectManager
} // QmlProjectManager::Internal