forked from qt-creator/qt-creator
QmlProjectManager: De-export QmlProjectRunConfiguration
Change-Id: I728c4f40f9cc4b559e18fcef10289eddcd5e87bf Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -82,7 +82,7 @@ void QmlMainFileAspect::addToLayout(LayoutBuilder &builder)
|
|||||||
connect(m_fileListCombo, QOverload<int>::of(&QComboBox::activated),
|
connect(m_fileListCombo, QOverload<int>::of(&QComboBox::activated),
|
||||||
this, &QmlMainFileAspect::setMainScript);
|
this, &QmlMainFileAspect::setMainScript);
|
||||||
|
|
||||||
builder.addItems(QmlProjectRunConfiguration::tr("Main QML file:"), m_fileListCombo.data());
|
builder.addItems(tr("Main QML file:"), m_fileListCombo.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlMainFileAspect::toMap(QVariantMap &map) const
|
void QmlMainFileAspect::toMap(QVariantMap &map) const
|
||||||
@@ -92,8 +92,7 @@ void QmlMainFileAspect::toMap(QVariantMap &map) const
|
|||||||
|
|
||||||
void QmlMainFileAspect::fromMap(const QVariantMap &map)
|
void QmlMainFileAspect::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
m_scriptFile = map.value(Constants::QML_MAINSCRIPT_KEY,
|
m_scriptFile = map.value(Constants::QML_MAINSCRIPT_KEY, M_CURRENT_FILE).toString();
|
||||||
M_CURRENT_FILE).toString();
|
|
||||||
|
|
||||||
if (m_scriptFile == M_CURRENT_FILE)
|
if (m_scriptFile == M_CURRENT_FILE)
|
||||||
setScriptSource(FileInEditor);
|
setScriptSource(FileInEditor);
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "qmlproject.h"
|
#include "qmlproject.h"
|
||||||
#include "qmlprojectmanagerconstants.h"
|
#include "qmlprojectmanagerconstants.h"
|
||||||
#include "qmlmainfileaspect.h"
|
#include "qmlmainfileaspect.h"
|
||||||
|
#include "qmlmainfileaspect.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
@@ -58,9 +59,30 @@ using namespace QtSupport;
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
// QmlProjectRunConfiguration
|
// QmlProjectRunConfiguration
|
||||||
|
|
||||||
|
class QmlProjectRunConfiguration final : public RunConfiguration
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectRunConfiguration)
|
||||||
|
|
||||||
|
public:
|
||||||
|
QmlProjectRunConfiguration(Target *target, Core::Id id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Runnable runnable() const final;
|
||||||
|
QString disabledReason() const final;
|
||||||
|
bool isEnabled() const final;
|
||||||
|
|
||||||
|
QString mainScript() const;
|
||||||
|
Utils::FilePath qmlScenePath() const;
|
||||||
|
QString commandLineArguments() const;
|
||||||
|
|
||||||
|
BaseStringAspect *m_qmlViewerAspect = nullptr;
|
||||||
|
QmlMainFileAspect *m_qmlMainFileAspect = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||||
: RunConfiguration(target, id)
|
: RunConfiguration(target, id)
|
||||||
{
|
{
|
||||||
@@ -203,7 +225,7 @@ QString QmlProjectRunConfiguration::mainScript() const
|
|||||||
return m_qmlMainFileAspect->mainScript();
|
return m_qmlMainFileAspect->mainScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Internal {
|
// QmlProjectRunConfigurationFactory
|
||||||
|
|
||||||
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
|
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
|
||||||
: FixedRunConfigurationFactory(QmlProjectRunConfiguration::tr("QML Scene"), false)
|
: FixedRunConfigurationFactory(QmlProjectRunConfiguration::tr("QML Scene"), false)
|
||||||
|
@@ -25,40 +25,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmlprojectmanager_global.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class BaseStringAspect;
|
|
||||||
}
|
|
||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
|
|
||||||
class QmlMainFileAspect;
|
|
||||||
|
|
||||||
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QmlProjectRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorer::Runnable runnable() const final;
|
|
||||||
QString disabledReason() const final;
|
|
||||||
bool isEnabled() const final;
|
|
||||||
|
|
||||||
QString mainScript() const;
|
|
||||||
Utils::FilePath qmlScenePath() const;
|
|
||||||
QString commandLineArguments() const;
|
|
||||||
|
|
||||||
ProjectExplorer::BaseStringAspect *m_qmlViewerAspect = nullptr;
|
|
||||||
QmlMainFileAspect *m_qmlMainFileAspect = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlProjectRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
class QmlProjectRunConfigurationFactory final : public ProjectExplorer::FixedRunConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProjectRunConfigurationFactory();
|
QmlProjectRunConfigurationFactory();
|
||||||
|
Reference in New Issue
Block a user