2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2020-01-06 14:48:51 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "qmlprojectmanager_global.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
|
|
|
|
|
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IEditor;
|
|
|
|
|
}
|
2020-01-08 11:01:30 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2020-01-06 14:48:51 +01:00
|
|
|
class QComboBox;
|
2020-01-08 11:01:30 +01:00
|
|
|
QT_END_NAMESPACE
|
2020-01-06 14:48:51 +01:00
|
|
|
|
|
|
|
|
namespace QmlProjectManager {
|
|
|
|
|
|
|
|
|
|
class QmlProject;
|
|
|
|
|
class QmlBuildSystem;
|
|
|
|
|
|
2020-09-18 12:11:40 +02:00
|
|
|
class QMLPROJECTMANAGER_EXPORT QmlMainFileAspect : public Utils::BaseAspect
|
2020-01-06 14:48:51 +01:00
|
|
|
{
|
2019-12-10 16:25:41 +01:00
|
|
|
Q_OBJECT
|
2022-04-08 11:35:54 +02:00
|
|
|
|
2020-01-06 14:48:51 +01:00
|
|
|
public:
|
2023-07-13 12:09:31 +02:00
|
|
|
explicit QmlMainFileAspect(Utils::AspectContainer *container = nullptr);
|
2020-01-06 14:48:51 +01:00
|
|
|
~QmlMainFileAspect() override;
|
|
|
|
|
|
|
|
|
|
enum MainScriptSource {
|
|
|
|
|
FileInEditor,
|
|
|
|
|
FileInProjectFile,
|
|
|
|
|
FileInSettings
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-08 11:35:54 +02:00
|
|
|
struct Data : BaseAspect::Data
|
|
|
|
|
{
|
2023-01-06 09:47:53 +01:00
|
|
|
Utils::FilePath mainScript;
|
|
|
|
|
Utils::FilePath currentFile;
|
2022-04-08 11:35:54 +02:00
|
|
|
};
|
|
|
|
|
|
2023-05-02 17:20:57 +02:00
|
|
|
void addToLayout(Layouting::LayoutItem &parent) final;
|
2023-08-23 16:53:06 +02:00
|
|
|
void toMap(Utils::Store &map) const final;
|
|
|
|
|
void fromMap(const Utils::Store &map) final;
|
2020-01-06 14:48:51 +01:00
|
|
|
|
|
|
|
|
void updateFileComboBox();
|
|
|
|
|
MainScriptSource mainScriptSource() const;
|
|
|
|
|
void setMainScript(int index);
|
|
|
|
|
|
2023-07-13 12:09:31 +02:00
|
|
|
void setTarget(ProjectExplorer::Target *target);
|
2020-01-06 14:48:51 +01:00
|
|
|
void setScriptSource(MainScriptSource source, const QString &settingsPath = QString());
|
|
|
|
|
|
2023-01-06 09:47:53 +01:00
|
|
|
Utils::FilePath mainScript() const;
|
|
|
|
|
Utils::FilePath currentFile() const;
|
2020-01-06 14:48:51 +01:00
|
|
|
void changeCurrentFile(Core::IEditor *editor = nullptr);
|
|
|
|
|
bool isQmlFilePresent();
|
|
|
|
|
QmlBuildSystem *qmlBuildSystem() const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ProjectExplorer::Target *m_target = nullptr;
|
|
|
|
|
QPointer<QComboBox> m_fileListCombo;
|
|
|
|
|
QStandardItemModel m_fileListModel;
|
|
|
|
|
QString m_scriptFile;
|
|
|
|
|
// absolute path to current file (if being used)
|
2023-01-06 09:47:53 +01:00
|
|
|
Utils::FilePath m_currentFileFilename;
|
2020-01-06 14:48:51 +01:00
|
|
|
// absolute path to selected main script (if being used)
|
2023-01-06 09:47:53 +01:00
|
|
|
Utils::FilePath m_mainScriptFilename;
|
2020-01-06 14:48:51 +01:00
|
|
|
};
|
|
|
|
|
|
2023-01-06 09:47:53 +01:00
|
|
|
} // QmlProjectManager
|