forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/11.0' into qds/dev
Conflicts: src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp src/plugins/qmlprojectmanager/cmakegen/generatecmakelists.cpp tests/auto/qml/qmlprojectmanager/fileformat/fileformat.qbs tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp Change-Id: I257f1908917bcc58805619b53b6866f2f73ca544
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
add_qtc_plugin(QmlProjectManager
|
||||
CONDITION TARGET Qt5::QuickWidgets
|
||||
CONDITION TARGET Qt::QuickWidgets
|
||||
PLUGIN_CLASS QmlProjectPlugin
|
||||
DEPENDS QmlJS Qt5::QuickWidgets Utils
|
||||
DEPENDS QmlJS Qt::QuickWidgets Utils
|
||||
PLUGIN_DEPENDS Core ProjectExplorer QtSupport QmlDesignerBase
|
||||
SOURCES
|
||||
qmlprojectgen/qmlprojectgenerator.cpp qmlprojectgen/qmlprojectgenerator.h
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlbuildsystem.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "../qmlprojectconstants.h"
|
||||
|
||||
#include <QtCore5Compat/qtextcodec.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/session.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -26,7 +27,6 @@
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include "projectitem/qmlprojectitem.h"
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#include "texteditor/textdocument.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
namespace QmlProjectManager {
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakeprojectconverter.h"
|
||||
#include "cmakeprojectconverterdialog.h"
|
||||
#include "generatecmakelists.h"
|
||||
@@ -11,7 +12,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmlprojectmanager/qmlprojectmanagerconstants.h>
|
||||
@@ -41,10 +42,10 @@ void CmakeProjectConverter::generateMenuEntry(QObject *parent)
|
||||
Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.ConvertToCmakeProject");
|
||||
exportMenu->addAction(cmd, QmlProjectManager::Constants::G_EXPORT_CONVERT);
|
||||
|
||||
action->setEnabled(isProjectConvertable(ProjectExplorer::SessionManager::startupProject()));
|
||||
QObject::connect(ProjectExplorer::SessionManager::instance(),
|
||||
&ProjectExplorer::SessionManager::startupProjectChanged, [action]() {
|
||||
action->setEnabled(isProjectConvertable(ProjectExplorer::SessionManager::startupProject()));
|
||||
action->setEnabled(isProjectConvertable(ProjectExplorer::ProjectManager::startupProject()));
|
||||
QObject::connect(ProjectExplorer::ProjectManager::instance(),
|
||||
&ProjectExplorer::ProjectManager::startupProjectChanged, [action]() {
|
||||
action->setEnabled(isProjectConvertable(ProjectExplorer::ProjectManager::startupProject()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@ bool CmakeProjectConverter::isProjectCurrentFormat(const ProjectExplorer::Projec
|
||||
|
||||
void CmakeProjectConverter::onConvertProject()
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject();
|
||||
const QmlProjectManager::QmlProject *qmlProject =
|
||||
qobject_cast<const QmlProjectManager::QmlProject*>(project);
|
||||
if (qmlProject) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "generatecmakelists.h"
|
||||
|
||||
#include "generatecmakelistsconstants.h"
|
||||
#include "cmakegeneratordialog.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
@@ -10,9 +11,9 @@
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmlprojectmanager/qmlmainfileaspect.h>
|
||||
@@ -86,7 +87,7 @@ const QString MENU_ITEM_GENERATE = Tr::tr("Generate CMake Build Files...");
|
||||
|
||||
const QmlBuildSystem *getBuildSystem()
|
||||
{
|
||||
auto project = ProjectExplorer::SessionManager::startupProject();
|
||||
auto project = ProjectExplorer::ProjectManager::startupProject();
|
||||
if (project && project->activeTarget() && project->activeTarget()->buildSystem()) {
|
||||
return qobject_cast<QmlProjectManager::QmlBuildSystem *>(
|
||||
project->activeTarget()->buildSystem());
|
||||
@@ -114,8 +115,8 @@ void generateMenuEntry(QObject *parent)
|
||||
exportMenu->addAction(cmd, QmlProjectManager::Constants::G_EXPORT_GENERATE);
|
||||
|
||||
action->setEnabled(false);
|
||||
QObject::connect(ProjectExplorer::SessionManager::instance(),
|
||||
&ProjectExplorer::SessionManager::startupProjectChanged,
|
||||
QObject::connect(ProjectExplorer::ProjectManager::instance(),
|
||||
&ProjectExplorer::ProjectManager::startupProjectChanged,
|
||||
[action]() {
|
||||
if (auto buildSystem = getBuildSystem())
|
||||
action->setEnabled(!buildSystem->qtForMCUs());
|
||||
@@ -125,8 +126,7 @@ void generateMenuEntry(QObject *parent)
|
||||
void onGenerateCmakeLists()
|
||||
{
|
||||
trackUsage("generateCMakeProjectDialogOpened");
|
||||
|
||||
FilePath rootDir = ProjectExplorer::SessionManager::startupProject()->projectDirectory();
|
||||
FilePath rootDir = ProjectExplorer::ProjectManager::startupProject()->projectDirectory();
|
||||
|
||||
int projectDirErrors = isProjectCorrectlyFormed(rootDir);
|
||||
if (projectDirErrors != NoError) {
|
||||
@@ -340,7 +340,7 @@ const char ADD_SUBDIR[] = "add_subdirectory(%1)\n";
|
||||
void CmakeFileGenerator::generateMainCmake(const FilePath &rootDir)
|
||||
{
|
||||
//TODO startupProject() may be a terrible way to try to get "current project". It's not necessarily the same thing at all.
|
||||
QString projectName = ProjectExplorer::SessionManager::startupProject()->displayName();
|
||||
QString projectName = ProjectExplorer::ProjectManager::startupProject()->displayName();
|
||||
QString appName = projectName + "App";
|
||||
|
||||
QString fileSection = "";
|
||||
@@ -559,7 +559,7 @@ bool CmakeFileGenerator::isDirBlacklisted(const FilePath &dir)
|
||||
bool CmakeFileGenerator::includeFile(const FilePath &filePath)
|
||||
{
|
||||
if (m_checkFileIsInProject) {
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject();
|
||||
if (!project->isKnownFile(filePath))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ QRegularExpression qdsVerRegexp(R"x(qdsVersion: "(.*)")x");
|
||||
const Utils::FilePaths rootCmakeFiles(ProjectExplorer::Project *project)
|
||||
{
|
||||
if (!project)
|
||||
project = ProjectExplorer::SessionManager::startupProject();
|
||||
project = ProjectExplorer::ProjectManager::startupProject();
|
||||
if (!project)
|
||||
return {};
|
||||
return project->projectDirectory().dirEntries({QList<QString>({"CMakeLists.txt"}), QDir::Files});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "qmlprojectmanager_global.h"
|
||||
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ QmlMainFileAspect::~QmlMainFileAspect()
|
||||
delete m_fileListCombo;
|
||||
}
|
||||
|
||||
void QmlMainFileAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||
void QmlMainFileAspect::addToLayout(Layouting::LayoutItem &parent)
|
||||
{
|
||||
QTC_ASSERT(!m_fileListCombo, delete m_fileListCombo);
|
||||
m_fileListCombo = new QComboBox;
|
||||
@@ -67,7 +67,7 @@ void QmlMainFileAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||
this, &QmlMainFileAspect::updateFileComboBox);
|
||||
connect(m_fileListCombo, &QComboBox::activated, this, &QmlMainFileAspect::setMainScript);
|
||||
|
||||
builder.addItems({Tr::tr("Main QML file:"), m_fileListCombo.data()});
|
||||
parent.addItems({Tr::tr("Main QML file:"), m_fileListCombo.data()});
|
||||
}
|
||||
|
||||
void QmlMainFileAspect::toMap(QVariantMap &map) const
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
Utils::FilePath currentFile;
|
||||
};
|
||||
|
||||
void addToLayout(Utils::Layouting::LayoutBuilder &builder) final;
|
||||
void addToLayout(Layouting::LayoutItem &parent) final;
|
||||
void toMap(QVariantMap &map) const final;
|
||||
void fromMap(const QVariantMap &map) final;
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
static bool isMultilanguagePresent()
|
||||
@@ -114,7 +114,7 @@ void QmlMultiLanguageAspect::fromMap(const QVariantMap &map)
|
||||
|
||||
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current()
|
||||
{
|
||||
if (auto project = ProjectExplorer::SessionManager::startupProject())
|
||||
if (auto project = ProjectExplorer::ProjectManager::startupProject())
|
||||
return current(project);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
@@ -22,6 +22,21 @@
|
||||
#include "qmlprojectmanagerconstants.h"
|
||||
#include "qmlprojectmanagertr.h"
|
||||
#include "utils/algorithm.h"
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/infobar.h>
|
||||
#include <utils/process.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextCodec>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
@@ -37,15 +52,11 @@ QmlProject::QmlProject(const Utils::FilePath &fileName)
|
||||
setNeedsBuildConfigurations(false);
|
||||
setBuildSystemCreator([](Target *t) { return new QmlBuildSystem(t); });
|
||||
|
||||
// FIXME: why checking this?
|
||||
// this should not even be the case. if that's possible, then what?
|
||||
// what are the follow-up actions?
|
||||
if (!QmlProject::isQtDesignStudio())
|
||||
return;
|
||||
|
||||
if (allowOnlySingleProject()) {
|
||||
Core::EditorManager::closeAllDocuments();
|
||||
SessionManager::closeAllProjects();
|
||||
if (QmlProject::isQtDesignStudio()) {
|
||||
if (allowOnlySingleProject()) {
|
||||
EditorManager::closeAllDocuments();
|
||||
ProjectManager::closeAllProjects();
|
||||
}
|
||||
}
|
||||
|
||||
connect(this, &QmlProject::anyParsingFinished, this, &QmlProject::parsingFinished);
|
||||
@@ -150,7 +161,7 @@ bool QmlProject::setKitWithVersion(const int qtMajorVersion, const QList<Kit *>
|
||||
}
|
||||
|
||||
if (target)
|
||||
SessionManager::setActiveTarget(this, target, SetActive::NoCascade);
|
||||
target->project()->setActiveTarget(target, SetActive::NoCascade);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -237,7 +248,7 @@ bool QmlProject::allowOnlySingleProject()
|
||||
{
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
auto key = "QML/Designer/AllowMultipleProjects";
|
||||
return !settings->value(key, false).toBool();
|
||||
return !settings->value(QString::fromUtf8(key), false).toBool();
|
||||
}
|
||||
|
||||
} // namespace QmlProjectManager
|
||||
|
||||
@@ -9,6 +9,7 @@ QtcPlugin {
|
||||
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "QmlDesignerBase" }
|
||||
Depends { name: "QtSupport" }
|
||||
Depends { name: "TextEditor" }
|
||||
|
||||
@@ -25,7 +26,6 @@ QtcPlugin {
|
||||
"qmlprojectconstants.h",
|
||||
"qmlprojectmanager_global.h", "qmlprojectmanagertr.h",
|
||||
"qmlprojectmanagerconstants.h",
|
||||
"qmlprojectnodes.cpp", "qmlprojectnodes.h",
|
||||
"qmlprojectplugin.cpp", "qmlprojectplugin.h",
|
||||
"qmlprojectrunconfiguration.cpp", "qmlprojectrunconfiguration.h",
|
||||
project.ide_source_tree + "/src/share/3rdparty/studiofonts/studiofonts.qrc"
|
||||
@@ -39,7 +39,7 @@ QtcPlugin {
|
||||
"qmlbuildsystem.cpp", "qmlbuildsystem.h",
|
||||
"projectitem/filefilteritems.cpp", "projectitem/filefilteritems.h",
|
||||
"projectitem/qmlprojectitem.cpp", "projectitem/qmlprojectitem.h",
|
||||
"projectitem/converters.h",
|
||||
"projectitem/converters.cpp", "projectitem/converters.h",
|
||||
"projectnode/qmlprojectnodes.cpp", "projectnode/qmlprojectnodes.h"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/fsengine/fileiconprovider.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/process.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDesktopServices>
|
||||
@@ -115,10 +115,10 @@ void QmlProjectPlugin::openQDS(const Utils::FilePath &fileName)
|
||||
qputenv(Constants::enviromentLaunchedQDS, "true");
|
||||
//-a and -client arguments help to append project to open design studio application
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
qdsStarted = Utils::QtcProcess::startDetached(
|
||||
qdsStarted = Utils::Process::startDetached(
|
||||
{"/usr/bin/open", {"-a", qdsPath.path(), fileName.toString()}});
|
||||
else
|
||||
qdsStarted = Utils::QtcProcess::startDetached({qdsPath, {"-client", fileName.toString()}});
|
||||
qdsStarted = Utils::Process::startDetached({qdsPath, {"-client", fileName.toString()}});
|
||||
|
||||
if (!qdsStarted) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
@@ -180,7 +180,7 @@ const Utils::FilePath findQmlProjectUpwards(const Utils::FilePath &folder)
|
||||
static bool findAndOpenProject(const Utils::FilePath &filePath)
|
||||
{
|
||||
ProjectExplorer::Project *project
|
||||
= ProjectExplorer::SessionManager::projectForFile(filePath);
|
||||
= ProjectExplorer::ProjectManager::projectForFile(filePath);
|
||||
|
||||
if (project) {
|
||||
if (project->projectFilePath().suffix() == "qmlproject") {
|
||||
@@ -436,7 +436,7 @@ void QmlProjectPlugin::updateQmlLandingPageProjectInfo(const Utils::FilePath &pr
|
||||
|
||||
Utils::FilePath QmlProjectPlugin::projectFilePath()
|
||||
{
|
||||
auto project = ProjectExplorer::SessionManager::startupProject();
|
||||
auto project = ProjectExplorer::ProjectManager::startupProject();
|
||||
const QmlProjectManager::QmlProject *qmlProject = qobject_cast<const QmlProjectManager::QmlProject*>(project);
|
||||
if (qmlProject) {
|
||||
return qmlProject->projectFilePath();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmldesignerbase/qmldesignerbaseplugin.h>
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/process.h>
|
||||
#include <utils/winutils.h>
|
||||
|
||||
#include <qmljstools/qmljstoolsconstants.h>
|
||||
@@ -289,7 +289,7 @@ void QmlProjectRunConfiguration::createQtVersionAspect()
|
||||
if (!newTarget)
|
||||
newTarget = project->addTargetForKit(kits.first());
|
||||
|
||||
SessionManager::setActiveTarget(project, newTarget, SetActive::Cascade);
|
||||
project->setActiveTarget(newTarget, SetActive::Cascade);
|
||||
|
||||
/* Reset the aspect. We changed the target and this aspect should not change. */
|
||||
m_qtversionAspect->blockSignals(true);
|
||||
|
||||
Reference in New Issue
Block a user