forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/10.0' into qds/dev
bigger conflicts resolved at: src/plugins/qmldesigner/CMakeLists.txt src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp Change-Id: I08e2a109d8e37cbd77225129854e9e633725bfc7
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
add_qtc_plugin(QmlProjectManager
|
||||
CONDITION TARGET Qt5::QuickWidgets
|
||||
CONDITION TARGET Qt::QuickWidgets
|
||||
PROPERTIES COMPILE_WARNING_AS_ERROR ON
|
||||
PLUGIN_CLASS QmlProjectPlugin
|
||||
DEPENDS QmlJS Qt5::QuickWidgets
|
||||
DEPENDS QmlJS Qt::QuickWidgets
|
||||
PLUGIN_DEPENDS Core ProjectExplorer QtSupport QmlDesignerBase
|
||||
SOURCES
|
||||
fileformat/filefilteritems.cpp fileformat/filefilteritems.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "checkablefiletreeitem.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef CHECKABLEFILETREEITEM_H
|
||||
#define CHECKABLEFILETREEITEM_H
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakegeneratordialog.h"
|
||||
#include "cmakegeneratordialogtreemodel.h"
|
||||
#include "generatecmakelistsconstants.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
#include <utils/detailswidget.h>
|
||||
@@ -25,12 +26,9 @@ CmakeGeneratorDialog::CmakeGeneratorDialog(const FilePath &rootDir, const FilePa
|
||||
m_rootDir(rootDir),
|
||||
m_files(files)
|
||||
{
|
||||
setWindowTitle(QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"Select Files to Generate"));
|
||||
setWindowTitle(Tr::tr("Select Files to Generate"));
|
||||
|
||||
QLabel *mainLabel = new QLabel(QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"Start CMakeFiles.txt generation"),
|
||||
this);
|
||||
QLabel *mainLabel = new QLabel(Tr::tr("Start CMakeFiles.txt generation"), this);
|
||||
mainLabel->setMargin(30);
|
||||
|
||||
QVBoxLayout *dialogLayout = new QVBoxLayout(this);
|
||||
@@ -75,8 +73,7 @@ QWidget* CmakeGeneratorDialog::createDetailsWidget()
|
||||
DetailsWidget *advancedWidget = new DetailsWidget(this);
|
||||
advancedWidget->setMinimumWidth(600);
|
||||
advancedWidget->setWidget(advancedInnerWidget);
|
||||
advancedWidget->setSummaryText(QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"Advanced Options"));
|
||||
advancedWidget->setSummaryText(Tr::tr("Advanced Options"));
|
||||
connect(advancedWidget, &DetailsWidget::expanded, this, &CmakeGeneratorDialog::advancedVisibilityChanged);
|
||||
|
||||
return advancedWidget;
|
||||
@@ -107,10 +104,8 @@ FilePaths CmakeGeneratorDialog::getFilePaths()
|
||||
return paths;
|
||||
}
|
||||
|
||||
const QString FILE_CREATE_NOTIFICATION = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"File %1 will be created.\n");
|
||||
const QString FILE_OVERWRITE_NOTIFICATION = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"File %1 will be overwritten.\n");
|
||||
const QString FILE_CREATE_NOTIFICATION = Tr::tr("File %1 will be created.\n");
|
||||
const QString FILE_OVERWRITE_NOTIFICATION = Tr::tr("File %1 will be overwritten.\n");
|
||||
|
||||
void CmakeGeneratorDialog::refreshNotificationText()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
|
||||
#ifndef CMAKEGENERATORDIALOG_H
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakegeneratordialogtreemodel.h"
|
||||
#include "generatecmakelistsconstants.h"
|
||||
#include "checkablefiletreeitem.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -49,11 +50,9 @@ QVariant CMakeGeneratorDialogTreeModel::data(const QModelIndex &index, int role)
|
||||
}
|
||||
else if (role == Qt::ToolTipRole) {
|
||||
if (node->isFile())
|
||||
return QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"This file already exists and will be overwritten.");
|
||||
return Tr::tr("This file already exists and will be overwritten.");
|
||||
if (!node->toFilePath().exists())
|
||||
return QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"This file or folder will be created.");
|
||||
return Tr::tr("This file or folder will be created.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef CMAKEGENERATORDIALOGTREEMODEL_H
|
||||
#define CMAKEGENERATORDIALOGTREEMODEL_H
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// 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"
|
||||
#include "generatecmakelistsconstants.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
@@ -25,16 +26,11 @@ using namespace QmlProjectManager::GenerateCmake::Constants;
|
||||
namespace QmlProjectManager {
|
||||
namespace GenerateCmake {
|
||||
|
||||
const QString MENU_ITEM_CONVERT = QCoreApplication::translate("QmlDesigner::CmakeProjectConverter",
|
||||
"Export as Latest Project Format...");
|
||||
const QString ERROR_TITLE = QCoreApplication::translate("QmlDesigner::CmakeProjectConverter",
|
||||
"Creating Project");
|
||||
const QString SUCCESS_TITLE = QCoreApplication::translate("QmlDesigner::CmakeProjectConverter",
|
||||
"Creating Project");
|
||||
const QString ERROR_TEXT = QCoreApplication::translate("QmlDesigner::CmakeProjectConverter",
|
||||
"Creating project failed.\n%1");
|
||||
const QString SUCCESS_TEXT = QCoreApplication::translate("QmlDesigner::CmakeProjectConverter",
|
||||
"Creating project succeeded.");
|
||||
const QString MENU_ITEM_CONVERT = Tr::tr("Export as Latest Project Format...");
|
||||
const QString ERROR_TITLE = Tr::tr("Creating Project");
|
||||
const QString SUCCESS_TITLE = Tr::tr("Creating Project");
|
||||
const QString ERROR_TEXT = Tr::tr("Creating project failed.\n%1");
|
||||
const QString SUCCESS_TEXT = Tr::tr("Creating project succeeded.");
|
||||
|
||||
void CmakeProjectConverter::generateMenuEntry(QObject *parent)
|
||||
{
|
||||
@@ -173,8 +169,7 @@ bool CmakeProjectConverter::isDirBlacklisted(const Utils::FilePath &dir) const
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString ERROR_CANNOT_WRITE_DIR = QCoreApplication::translate("QmlDesigner::CmakeProjectConverter",
|
||||
"Unable to write to directory\n%1.");
|
||||
const QString ERROR_CANNOT_WRITE_DIR = Tr::tr("Unable to write to directory\n%1.");
|
||||
|
||||
bool CmakeProjectConverter::performSanityCheck()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef CMAKEPROJECTCONVERTER_H
|
||||
#define CMAKEPROJECTCONVERTER_H
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakeprojectconverterdialog.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
|
||||
@@ -10,7 +11,6 @@
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
|
||||
@@ -31,17 +31,9 @@ static bool dirValidationFunction(FancyLineEdit *editor, QString *)
|
||||
return FilePath::fromString(editor->text()).isWritableDir();
|
||||
}
|
||||
|
||||
const QString EXPLANATION_TEXT = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"This process creates a copy of the existing project. The new project's folder structure is adjusted for CMake build process and necessary related new files are generated.\n\nThe new project can be opened in Qt Creator using the main CMakeLists.txt file.");
|
||||
|
||||
const QString PROJECT_NAME_LABEL = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Name:");
|
||||
|
||||
const QString PARENT_DIR_LABEL = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Create in:");
|
||||
const QString EXPLANATION_TEXT = Tr::tr("This process creates a copy of the existing project. The new project's folder structure is adjusted for CMake build process and necessary related new files are generated.\n\nThe new project can be opened in Qt Creator using the main CMakeLists.txt file.");
|
||||
const QString PROJECT_NAME_LABEL = Tr::tr("Name:");
|
||||
const QString PARENT_DIR_LABEL = Tr::tr("Create in:");
|
||||
|
||||
CmakeProjectConverterDialog::CmakeProjectConverterDialog(const QmlProjectManager::QmlProject *oldProject)
|
||||
: QDialog()
|
||||
@@ -122,28 +114,14 @@ const QString CmakeProjectConverterDialog::startsWithBlacklisted(const QString &
|
||||
return {};
|
||||
}
|
||||
|
||||
const QString ERROR_TEXT_NAME_EMPTY = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Name is empty.");
|
||||
const QString ERROR_TEXT_NAME_BAD_START = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Name must not start with \"%1\".");
|
||||
const QString ERROR_TEXT_NAME_LOWERCASE_START = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Name must begin with a capital letter");
|
||||
const QString ERROR_TEXT_NAME_BAD_CHARACTERS = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Name must contain only letters, numbers or characters - _.");
|
||||
const QString ERROR_TEXT_NAME_EMPTY = Tr::tr("Name is empty.");
|
||||
const QString ERROR_TEXT_NAME_BAD_START = Tr::tr("Name must not start with \"%1\".");
|
||||
const QString ERROR_TEXT_NAME_LOWERCASE_START = Tr::tr("Name must begin with a capital letter");
|
||||
const QString ERROR_TEXT_NAME_BAD_CHARACTERS = Tr::tr("Name must contain only letters, numbers or characters - _.");
|
||||
|
||||
const QString ERROR_DIR_NOT_DIR = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Target is not a directory.");
|
||||
const QString ERROR_DIR_NOT_WRITABLE = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Cannot write to target directory.");
|
||||
const QString ERROR_DIR_EXISTS = QCoreApplication::translate(
|
||||
"QmlDesigner::CmakeProjectConverterDialog",
|
||||
"Project directory already exists.");
|
||||
const QString ERROR_DIR_NOT_DIR = Tr::tr("Target is not a directory.");
|
||||
const QString ERROR_DIR_NOT_WRITABLE = Tr::tr("Cannot write to target directory.");
|
||||
const QString ERROR_DIR_EXISTS = Tr::tr("Project directory already exists.");
|
||||
|
||||
const QString CmakeProjectConverterDialog::errorText() const
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
|
||||
#ifndef CMAKEPROJECTCONVERTERDIALOG_H
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// 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"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
@@ -56,8 +57,7 @@ enum ProjectDirectoryError {
|
||||
MissingEnvHeader = 1<<12
|
||||
};
|
||||
|
||||
const QString MENU_ITEM_GENERATE = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"Generate CMake Build Files...");
|
||||
const QString MENU_ITEM_GENERATE = Tr::tr("Generate CMake Build Files...");
|
||||
|
||||
const QmlBuildSystem *getBuildSystem()
|
||||
{
|
||||
@@ -76,8 +76,7 @@ void generateMenuEntry(QObject *parent)
|
||||
Core::ActionContainer *exportMenu = Core::ActionManager::createMenu(
|
||||
QmlProjectManager::Constants::EXPORT_MENU);
|
||||
|
||||
exportMenu->menu()->setTitle(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateCmake", "Export Project"));
|
||||
exportMenu->menu()->setTitle(Tr::tr("Export Project"));
|
||||
menu->addMenu(exportMenu, Core::Constants::G_FILE_EXPORT);
|
||||
|
||||
exportMenu->appendGroup(QmlProjectManager::Constants::G_EXPORT_GENERATE);
|
||||
@@ -168,14 +167,10 @@ int isProjectCorrectlyFormed(const FilePath &rootDir)
|
||||
return errors;
|
||||
}
|
||||
|
||||
const QString WARNING_MISSING_STRUCTURE_FATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"The project is not properly structured for automatically generating CMake files.\n\nAborting process.\n\nThe following files or directories are missing:\n\n%1");
|
||||
//const QString WARNING_MISSING_STRUCTURE_NONFATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
// "The project is not properly structured for automatically generating CMake files.\n\nThe following files or directories are missing and may be created:\n\n%1");
|
||||
const QString WARNING_TITLE_FATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
"Cannot Generate CMake Files");
|
||||
//const QString WARNING_TITLE_NONFATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake",
|
||||
// "Problems with Generating CMake Files");
|
||||
const QString WARNING_MISSING_STRUCTURE_FATAL = Tr::tr("The project is not properly structured for automatically generating CMake files.\n\nAborting process.\n\nThe following files or directories are missing:\n\n%1");
|
||||
//const QString WARNING_MISSING_STRUCTURE_NONFATAL = Tr::tr("The project is not properly structured for automatically generating CMake files.\n\nThe following files or directories are missing and may be created:\n\n%1");
|
||||
const QString WARNING_TITLE_FATAL = Tr::tr("Cannot Generate CMake Files");
|
||||
//const QString WARNING_TITLE_NONFATAL = Tr::tr("Problems with Generating CMake Files");
|
||||
|
||||
void showProjectDirErrorDialog(int error)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef GENERATECMAKELISTSCONSTANTS_H
|
||||
#define GENERATECMAKELISTSCONSTANTS_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "filefilteritems.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprojectfileformat.h"
|
||||
#include "qmlprojectitem.h"
|
||||
|
||||
#include "filefilteritems.h"
|
||||
#include "qmlprojectitem.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
|
||||
#include <qmljs/qmljssimplereader.h>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QVariant>
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
enum {
|
||||
debug = false
|
||||
};
|
||||
@@ -108,7 +115,7 @@ std::unique_ptr<QmlProjectItem> QmlProjectFileFormat::parseProjectFile(const Uti
|
||||
|
||||
const auto targetDirectoryPropery = rootNode->property("targetDirectory");
|
||||
if (targetDirectoryPropery.isValid())
|
||||
projectItem->setTargetDirectory(targetDirectoryPropery.value.toString());
|
||||
projectItem->setTargetDirectory(FilePath::fromSettings(targetDirectoryPropery.value));
|
||||
|
||||
const auto qtForMCUProperty = rootNode->property("qtForMCUs");
|
||||
if (qtForMCUProperty.isValid() && qtForMCUProperty.value.toBool())
|
||||
@@ -183,7 +190,7 @@ std::unique_ptr<QmlProjectItem> QmlProjectFileFormat::parseProjectFile(const Uti
|
||||
}
|
||||
|
||||
if (errorMessage)
|
||||
*errorMessage = tr("Invalid root element: %1").arg(rootNode->name());
|
||||
*errorMessage = Tr::tr("Invalid root element: %1").arg(rootNode->name());
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -14,8 +14,6 @@ class QmlProjectItem;
|
||||
|
||||
class QmlProjectFileFormat
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectFileFormat)
|
||||
|
||||
public:
|
||||
static std::unique_ptr<QmlProjectItem> parseProjectFile(const Utils::FilePath &fileName,
|
||||
QString *errorMessage = nullptr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprojectitem.h"
|
||||
#include "filefilteritems.h"
|
||||
@@ -8,10 +8,12 @@
|
||||
|
||||
#include <QDir>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmlProjectManager {
|
||||
|
||||
// kind of initialization
|
||||
void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
|
||||
void QmlProjectItem::setSourceDirectory(const FilePath &directoryPath)
|
||||
{
|
||||
if (m_sourceDirectory == directoryPath)
|
||||
return;
|
||||
@@ -19,7 +21,7 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
|
||||
m_sourceDirectory = directoryPath;
|
||||
|
||||
for (auto &fileFilter : m_content) {
|
||||
fileFilter->setDefaultDirectory(directoryPath);
|
||||
fileFilter->setDefaultDirectory(directoryPath.toFSPathString());
|
||||
connect(fileFilter.get(),
|
||||
&FileFilterBaseItem::filesChanged,
|
||||
this,
|
||||
@@ -27,7 +29,7 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProjectItem::setTargetDirectory(const QString &directoryPath)
|
||||
void QmlProjectItem::setTargetDirectory(const FilePath &directoryPath)
|
||||
{
|
||||
m_targetDirectory = directoryPath;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "filefilteritems.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
@@ -21,10 +22,10 @@ class QmlProjectItem : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QString sourceDirectory() const { return m_sourceDirectory; }
|
||||
void setSourceDirectory(const QString &directoryPath);
|
||||
QString targetDirectory() const { return m_targetDirectory; }
|
||||
void setTargetDirectory(const QString &directoryPath);
|
||||
const Utils::FilePath &sourceDirectory() const { return m_sourceDirectory; }
|
||||
void setSourceDirectory(const Utils::FilePath &directoryPath);
|
||||
const Utils::FilePath &targetDirectory() const { return m_targetDirectory; }
|
||||
void setTargetDirectory(const Utils::FilePath &directoryPath);
|
||||
|
||||
bool qtForMCUs() const { return m_qtForMCUs; }
|
||||
void setQtForMCUs(bool qtForMCUs);
|
||||
@@ -80,8 +81,8 @@ signals:
|
||||
void qmlFilesChanged(const QSet<QString> &, const QSet<QString> &);
|
||||
|
||||
protected:
|
||||
QString m_sourceDirectory;
|
||||
QString m_targetDirectory;
|
||||
Utils::FilePath m_sourceDirectory;
|
||||
Utils::FilePath m_targetDirectory;
|
||||
QStringList m_importPaths;
|
||||
QStringList m_fileSelectors;
|
||||
bool m_multilanguageSupport;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "projectfilecontenttools.h"
|
||||
|
||||
#include "qmlprojectmanagertr.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
@@ -40,7 +42,7 @@ const QString qdsVersion(const Utils::FilePath &projectFilePath)
|
||||
return version;
|
||||
}
|
||||
|
||||
return QObject::tr("Unknown");
|
||||
return Tr::tr("Unknown");
|
||||
}
|
||||
|
||||
QRegularExpression quickRegexp("(quickVersion:)\\s*\"(\\d+.\\d+)\"",
|
||||
@@ -50,7 +52,7 @@ QRegularExpression qt6Regexp("(qt6Project:)\\s*\"*(true|false)\"*",
|
||||
|
||||
const QString qtVersion(const Utils::FilePath &projectFilePath)
|
||||
{
|
||||
const QString defaultReturn = QObject::tr("Unknown");
|
||||
const QString defaultReturn = Tr::tr("Unknown");
|
||||
const QString data = readFileContents(projectFilePath);
|
||||
|
||||
// First check if quickVersion is contained in the project file
|
||||
@@ -61,8 +63,8 @@ const QString qtVersion(const Utils::FilePath &projectFilePath)
|
||||
// If quickVersion wasn't found check for qt6Project
|
||||
match = qt6Regexp.match(data);
|
||||
if (match.hasMatch())
|
||||
return match.captured(2).contains("true", Qt::CaseInsensitive) ? QObject::tr("Qt 6")
|
||||
: QObject::tr("Qt 5");
|
||||
return match.captured(2).contains("true", Qt::CaseInsensitive) ? Tr::tr("Qt 6")
|
||||
: Tr::tr("Qt 5");
|
||||
|
||||
return defaultReturn;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qdslandingpage.h"
|
||||
#include "projectfilecontenttools.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qdslandingpagetheme.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlmainfileaspect.h"
|
||||
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectmanagerconstants.h"
|
||||
#include "qmlprojectmanagertr.h"
|
||||
|
||||
#include <qmljstools/qmljstoolsconstants.h>
|
||||
|
||||
@@ -29,11 +30,11 @@ using namespace Utils;
|
||||
namespace QmlProjectManager {
|
||||
|
||||
const char M_CURRENT_FILE[] = "CurrentFile";
|
||||
const char CURRENT_FILE[] = QT_TRANSLATE_NOOP("QmlManager", "<Current File>");
|
||||
const char CURRENT_FILE[] = QT_TRANSLATE_NOOP("QtC::QmlProjectManager", "<Current File>");
|
||||
|
||||
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
|
||||
static bool caseInsensitiveLessThan(const FilePath &s1, const FilePath &s2)
|
||||
{
|
||||
return s1.toLower() < s2.toLower();
|
||||
return s1.toString().toCaseFolded() < s2.toString().toCaseFolded();
|
||||
}
|
||||
|
||||
QmlMainFileAspect::QmlMainFileAspect(Target *target)
|
||||
@@ -54,7 +55,7 @@ QmlMainFileAspect::~QmlMainFileAspect()
|
||||
delete m_fileListCombo;
|
||||
}
|
||||
|
||||
void QmlMainFileAspect::addToLayout(LayoutBuilder &builder)
|
||||
void QmlMainFileAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||
{
|
||||
QTC_ASSERT(!m_fileListCombo, delete m_fileListCombo);
|
||||
m_fileListCombo = new QComboBox;
|
||||
@@ -66,7 +67,7 @@ void QmlMainFileAspect::addToLayout(LayoutBuilder &builder)
|
||||
this, &QmlMainFileAspect::updateFileComboBox);
|
||||
connect(m_fileListCombo, &QComboBox::activated, this, &QmlMainFileAspect::setMainScript);
|
||||
|
||||
builder.addItems({tr("Main QML file:"), m_fileListCombo.data()});
|
||||
builder.addItems({Tr::tr("Main QML file:"), m_fileListCombo.data()});
|
||||
}
|
||||
|
||||
void QmlMainFileAspect::toMap(QVariantMap &map) const
|
||||
@@ -88,12 +89,12 @@ void QmlMainFileAspect::fromMap(const QVariantMap &map)
|
||||
|
||||
void QmlMainFileAspect::updateFileComboBox()
|
||||
{
|
||||
QDir projectDir(m_target->project()->projectDirectory().toString());
|
||||
const FilePath projectDir = m_target->project()->projectDirectory();
|
||||
|
||||
if (mainScriptSource() == FileInProjectFile) {
|
||||
const QString mainScriptInFilePath = projectDir.relativeFilePath(mainScript());
|
||||
const FilePath mainScriptInFilePath = projectDir.relativeChildPath(mainScript());
|
||||
m_fileListModel.clear();
|
||||
m_fileListModel.appendRow(new QStandardItem(mainScriptInFilePath));
|
||||
m_fileListModel.appendRow(new QStandardItem(mainScriptInFilePath.toString()));
|
||||
if (m_fileListCombo)
|
||||
m_fileListCombo->setEnabled(false);
|
||||
return;
|
||||
@@ -105,27 +106,25 @@ void QmlMainFileAspect::updateFileComboBox()
|
||||
m_fileListModel.appendRow(new QStandardItem(CURRENT_FILE));
|
||||
QModelIndex currentIndex;
|
||||
|
||||
QStringList sortedFiles = Utils::transform(m_target->project()->files(Project::SourceFiles),
|
||||
&Utils::FilePath::toString);
|
||||
FilePaths sortedFiles = m_target->project()->files(Project::SourceFiles);
|
||||
|
||||
// make paths relative to project directory
|
||||
QStringList relativeFiles;
|
||||
for (const QString &fn : std::as_const(sortedFiles))
|
||||
relativeFiles += projectDir.relativeFilePath(fn);
|
||||
FilePaths relativeFiles;
|
||||
for (const FilePath &fn : std::as_const(sortedFiles))
|
||||
relativeFiles += projectDir.relativeChildPath(fn);
|
||||
sortedFiles = relativeFiles;
|
||||
|
||||
std::stable_sort(sortedFiles.begin(), sortedFiles.end(), caseInsensitiveLessThan);
|
||||
|
||||
QString mainScriptPath;
|
||||
FilePath mainScriptPath;
|
||||
if (mainScriptSource() != FileInEditor)
|
||||
mainScriptPath = projectDir.relativeFilePath(mainScript());
|
||||
mainScriptPath = projectDir.relativeChildPath(mainScript());
|
||||
|
||||
for (const QString &fn : std::as_const(sortedFiles)) {
|
||||
QFileInfo fileInfo(fn);
|
||||
if (fileInfo.suffix() != "qml")
|
||||
for (const FilePath &fn : std::as_const(sortedFiles)) {
|
||||
if (fn.suffixView() != u"qml")
|
||||
continue;
|
||||
|
||||
auto item = new QStandardItem(fn);
|
||||
auto item = new QStandardItem(fn.toString());
|
||||
m_fileListModel.appendRow(item);
|
||||
|
||||
if (mainScriptPath == fn)
|
||||
@@ -169,7 +168,7 @@ void QmlMainFileAspect::setScriptSource(MainScriptSource source, const QString &
|
||||
m_mainScriptFilename.clear();
|
||||
} else { // FileInSettings
|
||||
m_scriptFile = settingsPath;
|
||||
m_mainScriptFilename = m_target->project()->projectDirectory().toString() + '/' + m_scriptFile;
|
||||
m_mainScriptFilename = m_target->project()->projectDirectory() / m_scriptFile;
|
||||
}
|
||||
|
||||
emit changed();
|
||||
@@ -179,14 +178,11 @@ void QmlMainFileAspect::setScriptSource(MainScriptSource source, const QString &
|
||||
/**
|
||||
Returns absolute path to main script file.
|
||||
*/
|
||||
QString QmlMainFileAspect::mainScript() const
|
||||
FilePath QmlMainFileAspect::mainScript() const
|
||||
{
|
||||
if (!qmlBuildSystem()->mainFile().isEmpty()) {
|
||||
const QString pathInProject = qmlBuildSystem()->mainFile();
|
||||
if (QFileInfo(pathInProject).isAbsolute())
|
||||
return pathInProject;
|
||||
else
|
||||
return QDir(qmlBuildSystem()->canonicalProjectDir().toString()).absoluteFilePath(pathInProject);
|
||||
const FilePath pathInProject = qmlBuildSystem()->mainFile();
|
||||
return qmlBuildSystem()->canonicalProjectDir().resolvePath(pathInProject);
|
||||
}
|
||||
|
||||
if (!m_mainScriptFilename.isEmpty())
|
||||
@@ -195,7 +191,7 @@ QString QmlMainFileAspect::mainScript() const
|
||||
return m_currentFileFilename;
|
||||
}
|
||||
|
||||
QString QmlMainFileAspect::currentFile() const
|
||||
FilePath QmlMainFileAspect::currentFile() const
|
||||
{
|
||||
return m_currentFileFilename;
|
||||
}
|
||||
@@ -206,7 +202,7 @@ void QmlMainFileAspect::changeCurrentFile(Core::IEditor *editor)
|
||||
editor = EditorManager::currentEditor();
|
||||
|
||||
if (editor)
|
||||
m_currentFileFilename = editor->document()->filePath().toString();
|
||||
m_currentFileFilename = editor->document()->filePath();
|
||||
|
||||
emit changed();
|
||||
}
|
||||
@@ -218,7 +214,7 @@ bool QmlMainFileAspect::isQmlFilePresent()
|
||||
IDocument *document = EditorManager::currentDocument();
|
||||
const MimeType mainScriptMimeType = mimeTypeForFile(mainScript());
|
||||
if (document) {
|
||||
m_currentFileFilename = document->filePath().toString();
|
||||
m_currentFileFilename = document->filePath();
|
||||
if (mainScriptMimeType.matchesName(ProjectExplorer::Constants::QML_MIMETYPE)
|
||||
|| mainScriptMimeType.matchesName(ProjectExplorer::Constants::QMLUI_MIMETYPE)) {
|
||||
qmlFileFound = true;
|
||||
@@ -228,13 +224,13 @@ bool QmlMainFileAspect::isQmlFilePresent()
|
||||
|| mainScriptMimeType.matchesName(QmlJSTools::Constants::QMLPROJECT_MIMETYPE)) {
|
||||
// find a qml file with lowercase filename. This is slow, but only done
|
||||
// in initialization/other border cases.
|
||||
const auto files = m_target->project()->files(Project::SourceFiles);
|
||||
const FilePaths files = m_target->project()->files(Project::SourceFiles);
|
||||
for (const FilePath &filename : files) {
|
||||
if (!filename.isEmpty() && filename.baseName().at(0).isLower()) {
|
||||
const MimeType type = mimeTypeForFile(filename);
|
||||
if (type.matchesName(ProjectExplorer::Constants::QML_MIMETYPE)
|
||||
|| type.matchesName(ProjectExplorer::Constants::QMLUI_MIMETYPE)) {
|
||||
m_currentFileFilename = filename.toString();
|
||||
m_currentFileFilename = filename;
|
||||
qmlFileFound = true;
|
||||
break;
|
||||
}
|
||||
@@ -251,4 +247,5 @@ QmlBuildSystem *QmlMainFileAspect::qmlBuildSystem() const
|
||||
{
|
||||
return static_cast<QmlBuildSystem *>(m_target->buildSystem());
|
||||
}
|
||||
} // namespace QmlProjectManager
|
||||
|
||||
} // QmlProjectManager
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -38,11 +38,11 @@ public:
|
||||
|
||||
struct Data : BaseAspect::Data
|
||||
{
|
||||
QString mainScript;
|
||||
QString currentFile;
|
||||
Utils::FilePath mainScript;
|
||||
Utils::FilePath currentFile;
|
||||
};
|
||||
|
||||
void addToLayout(Utils::LayoutBuilder &builder) final;
|
||||
void addToLayout(Utils::Layouting::LayoutBuilder &builder) final;
|
||||
void toMap(QVariantMap &map) const final;
|
||||
void fromMap(const QVariantMap &map) final;
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
|
||||
void setScriptSource(MainScriptSource source, const QString &settingsPath = QString());
|
||||
|
||||
QString mainScript() const;
|
||||
QString currentFile() const;
|
||||
Utils::FilePath mainScript() const;
|
||||
Utils::FilePath currentFile() const;
|
||||
void changeCurrentFile(Core::IEditor *editor = nullptr);
|
||||
bool isQmlFilePresent();
|
||||
QmlBuildSystem *qmlBuildSystem() const;
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
QStandardItemModel m_fileListModel;
|
||||
QString m_scriptFile;
|
||||
// absolute path to current file (if being used)
|
||||
QString m_currentFileFilename;
|
||||
Utils::FilePath m_currentFileFilename;
|
||||
// absolute path to selected main script (if being used)
|
||||
QString m_mainScriptFilename;
|
||||
Utils::FilePath m_mainScriptFilename;
|
||||
};
|
||||
|
||||
} // namespace QmlProjectManager
|
||||
} // QmlProjectManager
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlmultilanguageaspect.h"
|
||||
|
||||
#include "qmlprojectmanagertr.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <extensionsystem/pluginspec.h>
|
||||
|
||||
@@ -54,8 +56,8 @@ QmlMultiLanguageAspect::QmlMultiLanguageAspect(ProjectExplorer::Target *target)
|
||||
{
|
||||
setVisible(isMultilanguagePresent());
|
||||
setSettingsKey(Constants::USE_MULTILANGUAGE_KEY);
|
||||
setLabel(tr("Use MultiLanguage in 2D view"), BoolAspect::LabelPlacement::AtCheckBox);
|
||||
setToolTip(tr("Reads translations from MultiLanguage plugin."));
|
||||
setLabel(Tr::tr("Use MultiLanguage in 2D view"), BoolAspect::LabelPlacement::AtCheckBox);
|
||||
setToolTip(Tr::tr("Reads translations from MultiLanguage plugin."));
|
||||
|
||||
setDefaultValue(!databaseFilePath().isEmpty());
|
||||
QVariantMap getDefaultValues;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlproject.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "fileformat/qmlprojectitem.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlprojectmanagerconstants.h"
|
||||
#include "qmlprojectmanagertr.h"
|
||||
#include "qmlprojectnodes.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -132,7 +133,7 @@ QmlProject::QmlProject(const Utils::FilePath &fileName)
|
||||
});
|
||||
} else {
|
||||
Utils::FilePaths uiFiles = collectUiQmlFilesForFolder(
|
||||
projectDirectory() + "/content");
|
||||
projectDirectory().pathAppended("content"));
|
||||
if (uiFiles.isEmpty())
|
||||
uiFiles = collectUiQmlFilesForFolder(projectDirectory());
|
||||
|
||||
@@ -173,7 +174,8 @@ QmlBuildSystem::QmlBuildSystem(Target *target)
|
||||
// FIXME: Check. Probably bogus after the BuildSystem move.
|
||||
// // addedTarget calls updateEnabled on the runconfigurations
|
||||
// // which needs to happen after refresh
|
||||
// foreach (Target *t, targets())
|
||||
// const QLis<Target> targetList = targets();
|
||||
// for (Target *t : targetList)
|
||||
// addedTarget(t);
|
||||
|
||||
connect(target->project(), &Project::activeTargetChanged,
|
||||
@@ -221,14 +223,14 @@ void QmlBuildSystem::parseProject(RefreshOptions options)
|
||||
|
||||
} else {
|
||||
MessageManager::writeFlashing(
|
||||
tr("Error while loading project file %1.").arg(projectFilePath().toUserOutput()));
|
||||
Tr::tr("Error while loading project file %1.").arg(projectFilePath().toUserOutput()));
|
||||
MessageManager::writeSilently(errorMessage);
|
||||
}
|
||||
}
|
||||
if (m_projectItem) {
|
||||
m_projectItem->setSourceDirectory(canonicalProjectDir().toString());
|
||||
m_projectItem->setSourceDirectory(canonicalProjectDir());
|
||||
if (m_projectItem->targetDirectory().isEmpty())
|
||||
m_projectItem->setTargetDirectory(canonicalProjectDir().toString());
|
||||
m_projectItem->setTargetDirectory(canonicalProjectDir());
|
||||
|
||||
if (auto modelManager = QmlJS::ModelManagerInterface::instance()) {
|
||||
QStringList files = m_projectItem->files();
|
||||
@@ -246,7 +248,7 @@ void QmlBuildSystem::parseProject(RefreshOptions options)
|
||||
Utils::FileReader reader;
|
||||
QString errorMessage;
|
||||
if (!reader.fetch(Utils::FilePath::fromString(mainFilePath), &errorMessage)) {
|
||||
MessageManager::writeFlashing(tr("Warning while loading project file %1.")
|
||||
MessageManager::writeFlashing(Tr::tr("Warning while loading project file %1.")
|
||||
.arg(projectFilePath().toUserOutput()));
|
||||
MessageManager::writeSilently(errorMessage);
|
||||
}
|
||||
@@ -260,7 +262,9 @@ void QmlBuildSystem::parseProject(RefreshOptions options)
|
||||
}
|
||||
}
|
||||
|
||||
bool QmlBuildSystem::setFileSettingInProjectFile(const QString &setting, const Utils::FilePath &mainFilePath, const QString &oldFile)
|
||||
bool QmlBuildSystem::setFileSettingInProjectFile(const QString &setting,
|
||||
const FilePath &mainFilePath,
|
||||
const FilePath &oldFile)
|
||||
{
|
||||
// make sure to change it also in the qmlproject file
|
||||
const Utils::FilePath qmlProjectFilePath = project()->projectFilePath();
|
||||
@@ -293,7 +297,7 @@ bool QmlBuildSystem::setFileSettingInProjectFile(const QString &setting, const U
|
||||
auto index = fileContent.lastIndexOf("}");
|
||||
fileContent.insert(index, addedText);
|
||||
} else {
|
||||
QString originalFileName = oldFile;
|
||||
QString originalFileName = oldFile.path();
|
||||
originalFileName.replace(".", "\\.");
|
||||
const QRegularExpression expression(QString("%1\\s*\"(%2)\"").arg(settingQmlCode).arg(originalFileName));
|
||||
|
||||
@@ -338,53 +342,52 @@ void QmlBuildSystem::refresh(RefreshOptions options)
|
||||
emit projectChanged();
|
||||
}
|
||||
|
||||
QString QmlBuildSystem::mainFile() const
|
||||
FilePath QmlBuildSystem::mainFile() const
|
||||
{
|
||||
if (m_projectItem)
|
||||
return m_projectItem->mainFile();
|
||||
return QString();
|
||||
return FilePath::fromString(m_projectItem->mainFile());
|
||||
return {};
|
||||
}
|
||||
|
||||
QString QmlBuildSystem::mainUiFile() const
|
||||
FilePath QmlBuildSystem::mainUiFile() const
|
||||
{
|
||||
if (m_projectItem)
|
||||
return m_projectItem->mainUiFile();
|
||||
return QString();
|
||||
return FilePath::fromString(m_projectItem->mainUiFile());
|
||||
return {};
|
||||
}
|
||||
|
||||
Utils::FilePath QmlBuildSystem::mainFilePath() const
|
||||
FilePath QmlBuildSystem::mainFilePath() const
|
||||
{
|
||||
const auto mainFileString = mainFile();
|
||||
|
||||
if (mainFileString.isEmpty())
|
||||
return {};
|
||||
|
||||
return projectDirectory().pathAppended(mainFileString);
|
||||
return projectDirectory().resolvePath(mainFileString);
|
||||
}
|
||||
|
||||
Utils::FilePath QmlBuildSystem::mainUiFilePath() const
|
||||
FilePath QmlBuildSystem::mainUiFilePath() const
|
||||
{
|
||||
const auto mainUiFileString = mainUiFile();
|
||||
|
||||
if (mainUiFileString.isEmpty())
|
||||
return {};
|
||||
|
||||
return projectDirectory().pathAppended(mainUiFileString);
|
||||
return projectDirectory().resolvePath(mainUiFileString);
|
||||
}
|
||||
|
||||
bool QmlBuildSystem::setMainFileInProjectFile(const Utils::FilePath &newMainFilePath)
|
||||
bool QmlBuildSystem::setMainFileInProjectFile(const FilePath &newMainFilePath)
|
||||
{
|
||||
|
||||
return setFileSettingInProjectFile("mainFile", newMainFilePath, mainFile());
|
||||
}
|
||||
|
||||
bool QmlBuildSystem::setMainUiFileInProjectFile(const Utils::FilePath &newMainUiFilePath)
|
||||
bool QmlBuildSystem::setMainUiFileInProjectFile(const FilePath &newMainUiFilePath)
|
||||
{
|
||||
return setMainUiFileInMainFile(newMainUiFilePath)
|
||||
&& setFileSettingInProjectFile("mainUiFile", newMainUiFilePath, mainUiFile());
|
||||
}
|
||||
|
||||
bool QmlBuildSystem::setMainUiFileInMainFile(const Utils::FilePath &newMainUiFilePath)
|
||||
bool QmlBuildSystem::setMainUiFileInMainFile(const FilePath &newMainUiFilePath)
|
||||
{
|
||||
Core::FileChangeBlocker fileChangeBlocker(mainFilePath());
|
||||
const QList<Core::IEditor *> editors = Core::DocumentModel::editorsForFilePath(mainFilePath());
|
||||
@@ -437,23 +440,22 @@ void QmlBuildSystem::setMainFile(const QString &mainFilePath)
|
||||
m_projectItem->setMainFile(mainFilePath);
|
||||
}
|
||||
|
||||
Utils::FilePath QmlBuildSystem::targetDirectory() const
|
||||
FilePath QmlBuildSystem::targetDirectory() const
|
||||
{
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return canonicalProjectDir();
|
||||
|
||||
return m_projectItem ? Utils::FilePath::fromString(m_projectItem->targetDirectory())
|
||||
: Utils::FilePath();
|
||||
return m_projectItem ? m_projectItem->targetDirectory() : FilePath();
|
||||
}
|
||||
|
||||
Utils::FilePath QmlBuildSystem::targetFile(const Utils::FilePath &sourceFile) const
|
||||
FilePath QmlBuildSystem::targetFile(const FilePath &sourceFile) const
|
||||
{
|
||||
const QDir sourceDir(m_projectItem ? m_projectItem->sourceDirectory()
|
||||
: canonicalProjectDir().toString());
|
||||
const QDir targetDir(targetDirectory().toString());
|
||||
const QString relative = sourceDir.relativeFilePath(sourceFile.toString());
|
||||
return Utils::FilePath::fromString(QDir::cleanPath(targetDir.absoluteFilePath(relative)));
|
||||
const FilePath sourceDir = m_projectItem ? m_projectItem->sourceDirectory()
|
||||
: canonicalProjectDir();
|
||||
const FilePath targetDir = targetDirectory();
|
||||
const FilePath relative = sourceFile.relativePathFrom(sourceDir);
|
||||
return targetDir.resolvePath(relative);
|
||||
}
|
||||
|
||||
Utils::EnvironmentItems QmlBuildSystem::environment() const
|
||||
@@ -555,14 +557,14 @@ Tasks QmlProject::projectIssues(const Kit *k) const
|
||||
|
||||
const QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
|
||||
if (!version)
|
||||
result.append(createProjectTask(Task::TaskType::Warning, tr("No Qt version set in kit.")));
|
||||
result.append(createProjectTask(Task::TaskType::Warning, Tr::tr("No Qt version set in kit.")));
|
||||
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
|
||||
if (dev.isNull())
|
||||
result.append(createProjectTask(Task::TaskType::Error, tr("Kit has no device.")));
|
||||
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("Kit has no device.")));
|
||||
|
||||
if (version && version->qtVersion() < QVersionNumber(5, 0, 0))
|
||||
result.append(createProjectTask(Task::TaskType::Error, tr("Qt version is too old.")));
|
||||
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("Qt version is too old.")));
|
||||
|
||||
if (dev.isNull() || !version)
|
||||
return result; // No need to check deeper than this
|
||||
@@ -571,12 +573,12 @@ Tasks QmlProject::projectIssues(const Kit *k) const
|
||||
if (version->type() == QtSupport::Constants::DESKTOPQT) {
|
||||
if (version->qmlRuntimeFilePath().isEmpty()) {
|
||||
result.append(createProjectTask(Task::TaskType::Error,
|
||||
tr("Qt version has no QML utility.")));
|
||||
Tr::tr("Qt version has no QML utility.")));
|
||||
}
|
||||
} else {
|
||||
// Non-desktop Qt on a desktop device? We don't support that.
|
||||
result.append(createProjectTask(Task::TaskType::Error,
|
||||
tr("Non-desktop Qt is used with a desktop device.")));
|
||||
Tr::tr("Non-desktop Qt is used with a desktop device.")));
|
||||
}
|
||||
} else {
|
||||
// If not a desktop device, don't check the Qt version for qml runtime binary.
|
||||
@@ -814,9 +816,9 @@ bool QmlBuildSystem::deleteFiles(Node *context, const FilePaths &filePaths)
|
||||
bool QmlBuildSystem::renameFile(Node * context, const FilePath &oldFilePath, const FilePath &newFilePath)
|
||||
{
|
||||
if (dynamic_cast<QmlProjectNode *>(context)) {
|
||||
if (oldFilePath.endsWith(mainFile()))
|
||||
if (oldFilePath.endsWith(mainFile().path()))
|
||||
return setMainFileInProjectFile(newFilePath);
|
||||
if (oldFilePath.endsWith(mainUiFile()))
|
||||
if (oldFilePath.endsWith(mainUiFile().path()))
|
||||
return setMainUiFileInProjectFile(newFilePath);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -53,8 +53,8 @@ public:
|
||||
void refresh(RefreshOptions options);
|
||||
|
||||
Utils::FilePath canonicalProjectDir() const;
|
||||
QString mainFile() const;
|
||||
QString mainUiFile() const;
|
||||
Utils::FilePath mainFile() const;
|
||||
Utils::FilePath mainUiFile() const;
|
||||
Utils::FilePath mainFilePath() const;
|
||||
Utils::FilePath mainUiFilePath() const;
|
||||
|
||||
@@ -106,7 +106,7 @@ signals:
|
||||
private:
|
||||
bool setFileSettingInProjectFile(const QString &setting,
|
||||
const Utils::FilePath &mainFilePath,
|
||||
const QString &oldFile);
|
||||
const Utils::FilePath &oldFile);
|
||||
|
||||
std::unique_ptr<QmlProjectItem> m_projectItem;
|
||||
Utils::FilePath m_canonicalProjectDir;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprojectgenerator.h"
|
||||
#include "../cmakegen/generatecmakelists.h"
|
||||
#include "../qmlprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -73,8 +74,8 @@ bool QmlProjectFileGenerator::execute()
|
||||
file.close();
|
||||
|
||||
QMessageBox::information(Core::ICore::dialogParent(),
|
||||
QObject::tr("Project File Generated"),
|
||||
QObject::tr("File created:\n\n%1").arg(m_targetFile.toString()),
|
||||
Tr::tr("Project File Generated"),
|
||||
Tr::tr("File created:\n\n%1").arg(m_targetFile.toString()),
|
||||
QMessageBox::Ok);
|
||||
|
||||
return true;
|
||||
@@ -151,9 +152,9 @@ const FilePath QmlProjectFileGenerator::selectTargetFile(const FilePath &uiFileP
|
||||
bool selectionCompleted = false;
|
||||
do {
|
||||
targetFile = Core::DocumentManager::getSaveFileNameWithExtension(
|
||||
QObject::tr("Select File Location"),
|
||||
Tr::tr("Select File Location"),
|
||||
suggestedDir,
|
||||
QObject::tr("Qt Design Studio Project Files (*.qmlproject)"));
|
||||
Tr::tr("Qt Design Studio Project Files (*.qmlproject)"));
|
||||
selectionCompleted = isDirAcceptable(targetFile.parentDir(), uiFilePath);
|
||||
} while (!selectionCompleted);
|
||||
|
||||
@@ -166,8 +167,8 @@ bool QmlProjectFileGenerator::isDirAcceptable(const FilePath &dir, const FilePat
|
||||
|
||||
if (dir.isChildOf(uiFileParentDir)) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
QObject::tr("Invalid Directory"),
|
||||
QObject::tr("Project file must be placed in a parent directory of the QML files."),
|
||||
Tr::tr("Invalid Directory"),
|
||||
Tr::tr("Project file must be placed in a parent directory of the QML files."),
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
@@ -177,8 +178,8 @@ bool QmlProjectFileGenerator::isDirAcceptable(const FilePath &dir, const FilePat
|
||||
QStringList components = relativePath.toString().split("/");
|
||||
if (components.size() > 2) {
|
||||
QMessageBox::StandardButton sel = QMessageBox::question(Core::ICore::dialogParent(),
|
||||
QObject::tr("Problem"),
|
||||
QObject::tr("Selected directory is far away from the QML file. This can cause unexpected results.\n\nAre you sure?"),
|
||||
Tr::tr("Problem"),
|
||||
Tr::tr("Selected directory is far away from the QML file. This can cause unexpected results.\n\nAre you sure?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (sel == QMessageBox::No)
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace QmlProjectManager {
|
||||
|
||||
struct Tr
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlProjectManager)
|
||||
Q_DECLARE_TR_FUNCTIONS(QtC::QmlProjectManager)
|
||||
};
|
||||
|
||||
} // namespace QmlProjectManager
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprojectnodes.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qdslandingpage.h"
|
||||
#include "qmlprojectplugin.h"
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlprojectmanagertr.h"
|
||||
#include "qmlprojectrunconfiguration.h"
|
||||
#include "projectfilecontenttools.h"
|
||||
#include "cmakegen/cmakeprojectconverter.h"
|
||||
@@ -51,8 +52,7 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
namespace QmlProjectManager::Internal {
|
||||
|
||||
static bool isQmlDesigner(const ExtensionSystem::PluginSpec *spec)
|
||||
{
|
||||
@@ -90,9 +90,7 @@ class QmlProjectPluginPrivate
|
||||
{
|
||||
public:
|
||||
QmlProjectRunConfigurationFactory runConfigFactory;
|
||||
RunWorkerFactory runWorkerFactory{RunWorkerFactory::make<SimpleTargetRunner>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||
{runConfigFactory.runConfigurationId()}};
|
||||
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
|
||||
QPointer<QMessageBox> lastMessageBox;
|
||||
QdsLandingPage *landingPage = nullptr;
|
||||
QdsLandingPageWidget *landingPageWidget = nullptr;
|
||||
@@ -126,7 +124,7 @@ void QmlProjectPlugin::openQDS(const Utils::FilePath &fileName)
|
||||
if (!qdsStarted) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
fileName.fileName(),
|
||||
QObject::tr("Failed to start Qt Design Studio."));
|
||||
Tr::tr("Failed to start Qt Design Studio."));
|
||||
if (alwaysOpenWithMode() == Core::Constants::MODE_DESIGN)
|
||||
clearAlwaysOpenWithMode();
|
||||
}
|
||||
@@ -215,8 +213,8 @@ void QmlProjectPlugin::openInQDSWithProject(const Utils::FilePath &filePath)
|
||||
QTimer::singleShot(4000, [filePath] { openQDS(filePath); });
|
||||
} else {
|
||||
Core::AsynchronousMessageBox::warning(
|
||||
tr("Qt Design Studio"),
|
||||
tr("No project file (*.qmlproject) found for Qt Design "
|
||||
Tr::tr("Qt Design Studio"),
|
||||
Tr::tr("No project file (*.qmlproject) found for Qt Design "
|
||||
"Studio.\nQt Design Studio requires a .qmlproject "
|
||||
"based project to open the .ui.qml file."));
|
||||
}
|
||||
@@ -239,10 +237,8 @@ static QmlBuildSystem *qmlBuildSystemforFileNode(const FileNode *fileNode)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||
void QmlProjectPlugin::initialize()
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
d = new QmlProjectPluginPrivate;
|
||||
|
||||
if (!qmlDesignerEnabled()) {
|
||||
@@ -272,7 +268,7 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||
if (QmlProject::isQtDesignStudio()) {
|
||||
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
|
||||
ProjectExplorer::Constants::M_FILECONTEXT);
|
||||
QAction *mainfileAction = new QAction(tr("Set as Main .qml File"), this);
|
||||
QAction *mainfileAction = new QAction(Tr::tr("Set as Main .qml File"), this);
|
||||
mainfileAction->setEnabled(false);
|
||||
|
||||
connect(mainfileAction, &QAction::triggered, this, []() {
|
||||
@@ -315,7 +311,7 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||
!= fileNode->filePath());
|
||||
});
|
||||
|
||||
QAction *mainUifileAction = new QAction(tr("Set as Main .ui.qml File"), this);
|
||||
QAction *mainUifileAction = new QAction(Tr::tr("Set as Main .ui.qml File"), this);
|
||||
mainUifileAction->setEnabled(false);
|
||||
|
||||
connect(mainUifileAction, &QAction::triggered, this, []() {
|
||||
@@ -360,8 +356,6 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||
GenerateCmake::generateMenuEntry(this);
|
||||
if (QmlProject::isQtDesignStudio())
|
||||
GenerateCmake::CmakeProjectConverter::generateMenuEntry(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlProjectPlugin::displayQmlLandingPage()
|
||||
@@ -457,5 +451,4 @@ Utils::FilePath QmlProjectPlugin::projectFilePath()
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
||||
} // QmlProjectManager::Internal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -36,7 +36,7 @@ public slots:
|
||||
void openQds(bool permanent = false);
|
||||
|
||||
private:
|
||||
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||
void initialize() final;
|
||||
void displayQmlLandingPage();
|
||||
void hideQmlLandingPage();
|
||||
void updateQmlLandingPageProjectInfo(const Utils::FilePath &projectFile);
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprojectrunconfiguration.h"
|
||||
#include "qmlmainfileaspect.h"
|
||||
#include "qmlmultilanguageaspect.h"
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectmanagerconstants.h"
|
||||
|
||||
#include <qmlpuppetpaths.h>
|
||||
|
||||
// getting the qmlpuppet path from setings
|
||||
#include <app/app_version.h>
|
||||
#include "qmlprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
@@ -29,6 +25,7 @@
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmldesignerbase/qmldesignerbaseplugin.h>
|
||||
#include <qmldesignerbase/utils/qmlpuppetpaths.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
@@ -47,16 +44,12 @@ using namespace ProjectExplorer;
|
||||
using namespace QtSupport;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmlProjectManager {
|
||||
class QmlMultiLanguageAspect;
|
||||
namespace Internal {
|
||||
namespace QmlProjectManager::Internal {
|
||||
|
||||
// QmlProjectRunConfiguration
|
||||
|
||||
class QmlProjectRunConfiguration final : public RunConfiguration
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectRunConfiguration)
|
||||
|
||||
public:
|
||||
QmlProjectRunConfiguration(Target *target, Id id);
|
||||
|
||||
@@ -64,9 +57,8 @@ private:
|
||||
QString disabledReason() const final;
|
||||
bool isEnabled() const final;
|
||||
|
||||
QString mainScript() const;
|
||||
FilePath mainScript() const;
|
||||
FilePath qmlRuntimeFilePath() const;
|
||||
QString commandLineArguments() const;
|
||||
void createQtVersionAspect();
|
||||
|
||||
StringAspect *m_qmlViewerAspect = nullptr;
|
||||
@@ -80,7 +72,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
m_qmlViewerAspect = addAspect<StringAspect>();
|
||||
m_qmlViewerAspect->setLabelText(tr("QML Viewer:"));
|
||||
m_qmlViewerAspect->setLabelText(Tr::tr("Override device QML viewer:"));
|
||||
m_qmlViewerAspect->setPlaceHolderText(qmlRuntimeFilePath().toUserOutput());
|
||||
m_qmlViewerAspect->setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
m_qmlViewerAspect->setHistoryCompleter("QmlProjectManager.viewer.history");
|
||||
@@ -89,8 +81,44 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||
auto argumentAspect = addAspect<ArgumentsAspect>(macroExpander());
|
||||
argumentAspect->setSettingsKey(Constants::QML_VIEWER_ARGUMENTS_KEY);
|
||||
|
||||
setCommandLineGetter([this] {
|
||||
return CommandLine(qmlRuntimeFilePath(), commandLineArguments(), CommandLine::Raw);
|
||||
setCommandLineGetter([this, target] {
|
||||
const FilePath qmlRuntime = qmlRuntimeFilePath();
|
||||
CommandLine cmd(qmlRuntime);
|
||||
if (usePuppetAsQmlRuntime)
|
||||
cmd.addArg("--qml-runtime");
|
||||
|
||||
// arguments in .user file
|
||||
cmd.addArgs(aspect<ArgumentsAspect>()->arguments(), CommandLine::Raw);
|
||||
|
||||
// arguments from .qmlproject file
|
||||
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target->buildSystem());
|
||||
const QStringList importPaths = QmlBuildSystem::makeAbsolute(bs->targetDirectory(),
|
||||
bs->customImportPaths());
|
||||
for (const QString &importPath : importPaths) {
|
||||
cmd.addArg("-I");
|
||||
cmd.addArg(importPath);
|
||||
}
|
||||
|
||||
for (const QString &fileSelector : bs->customFileSelectors()) {
|
||||
cmd.addArg("-S");
|
||||
cmd.addArg(fileSelector);
|
||||
}
|
||||
|
||||
if (qmlRuntime.osType() == OsTypeWindows && bs->forceFreeType()) {
|
||||
cmd.addArg("-platform");
|
||||
cmd.addArg("windows:fontengine=freetype");
|
||||
}
|
||||
|
||||
if (bs->qt6Project() && bs->widgetApp()) {
|
||||
cmd.addArg("--apptype");
|
||||
cmd.addArg("widget");
|
||||
}
|
||||
|
||||
const FilePath main = bs->targetFile(mainScript());
|
||||
if (!main.isEmpty())
|
||||
cmd.addArg(main.nativePath());
|
||||
|
||||
return cmd;
|
||||
});
|
||||
|
||||
m_qmlMainFileAspect = addAspect<QmlMainFileAspect>(target);
|
||||
@@ -129,67 +157,68 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||
|
||||
const Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(target->kit());
|
||||
if (deviceTypeId == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
envAspect->addPreferredBaseEnvironment(tr("System Environment"), [envModifier] {
|
||||
envAspect->addPreferredBaseEnvironment(Tr::tr("System Environment"), [envModifier] {
|
||||
return envModifier(Environment::systemEnvironment());
|
||||
});
|
||||
}
|
||||
|
||||
envAspect->addSupportedBaseEnvironment(tr("Clean Environment"), [envModifier] {
|
||||
envAspect->addSupportedBaseEnvironment(Tr::tr("Clean Environment"), [envModifier] {
|
||||
Environment environment;
|
||||
return envModifier(environment);
|
||||
});
|
||||
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<X11ForwardingAspect>(macroExpander());
|
||||
|
||||
setRunnableModifier([this](Runnable &r) {
|
||||
const QmlBuildSystem *bs = static_cast<QmlBuildSystem *>(activeBuildSystem());
|
||||
r.workingDirectory = bs->targetDirectory();
|
||||
if (const auto * const forwardingAspect = aspect<X11ForwardingAspect>())
|
||||
r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display());
|
||||
});
|
||||
|
||||
setDisplayName(tr("QML Utility", "QMLRunConfiguration display name."));
|
||||
setDisplayName(Tr::tr("QML Utility", "QMLRunConfiguration display name."));
|
||||
update();
|
||||
}
|
||||
|
||||
QString QmlProjectRunConfiguration::disabledReason() const
|
||||
{
|
||||
if (mainScript().isEmpty())
|
||||
return tr("No script file to execute.");
|
||||
return Tr::tr("No script file to execute.");
|
||||
|
||||
const FilePath viewer = qmlRuntimeFilePath();
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|
||||
&& !viewer.exists()) {
|
||||
return tr("No QML utility found.");
|
||||
return Tr::tr("No QML utility found.");
|
||||
}
|
||||
if (viewer.isEmpty())
|
||||
return tr("No QML utility specified for target device.");
|
||||
return Tr::tr("No QML utility specified for target device.");
|
||||
return RunConfiguration::disabledReason();
|
||||
}
|
||||
|
||||
FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
|
||||
{
|
||||
usePuppetAsQmlRuntime = false;
|
||||
// Give precedence to the manual override.
|
||||
// Give precedence to the manual override in the run configuration.
|
||||
const FilePath qmlViewer = m_qmlViewerAspect->filePath();
|
||||
if (!qmlViewer.isEmpty())
|
||||
return qmlViewer;
|
||||
|
||||
Kit *kit = target()->kit();
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(kit);
|
||||
if (!dev.isNull()) {
|
||||
|
||||
// We might not have a full Qt version for building, but the device
|
||||
// might know what is good for running.
|
||||
if (IDevice::ConstPtr dev = DeviceKitAspect::device(kit)) {
|
||||
const FilePath qmlRuntime = dev->qmlRunCommand();
|
||||
if (!qmlRuntime.isEmpty())
|
||||
return qmlRuntime;
|
||||
}
|
||||
|
||||
// If not given explicitly by device, try to pick it from $PATH.
|
||||
QtVersion *version = QtKitAspect::qtVersion(kit);
|
||||
if (!version) // No Qt version in Kit. Don't try to run QML runtime.
|
||||
return {};
|
||||
|
||||
const Id deviceType = DeviceTypeKitAspect::deviceTypeId(kit);
|
||||
if (deviceType == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
// If not given explicitly by Qt Version, try to pick it from $PATH.
|
||||
const bool isDesktop = version->type() == QtSupport::Constants::DESKTOPQT;
|
||||
|
||||
// The Qt version might know. That's the "build" Qt version,
|
||||
// i.e. not necessarily something the device can use, but the
|
||||
// device had its chance above.
|
||||
if (QtVersion *version = QtKitAspect::qtVersion(kit)) {
|
||||
if (version->qtVersion().majorVersion() > 5) {
|
||||
auto [workingDirectoryPath, puppetPath] = QmlDesigner::QmlPuppetPaths::qmlPuppetPaths(
|
||||
target(), QmlDesigner::QmlDesignerBasePlugin::settings());
|
||||
@@ -198,60 +227,14 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
|
||||
return puppetPath;
|
||||
}
|
||||
}
|
||||
|
||||
return isDesktop ? version->qmlRuntimeFilePath() : "qmlscene";
|
||||
const FilePath qmlRuntime = version->qmlRuntimeFilePath();
|
||||
if (!qmlRuntime.isEmpty())
|
||||
return qmlRuntime;
|
||||
}
|
||||
|
||||
if (dev.isNull()) // No device set. We don't know where a QML utility is.
|
||||
return {};
|
||||
|
||||
const FilePath qmlRuntime = dev->qmlRunCommand();
|
||||
// If not given explicitly by device, try to pick it from $PATH.
|
||||
return qmlRuntime.isEmpty() ? "qml" : qmlRuntime;
|
||||
}
|
||||
|
||||
QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
QString args;
|
||||
if (usePuppetAsQmlRuntime)
|
||||
ProcessArgs::addArg(&args, "--qml-runtime");
|
||||
|
||||
// arguments in .user file
|
||||
if (!aspect<ArgumentsAspect>()->arguments().isEmpty())
|
||||
ProcessArgs::addArg(&args, aspect<ArgumentsAspect>()->arguments());
|
||||
const IDevice::ConstPtr device = DeviceKitAspect::device(kit());
|
||||
const OsType osType = device ? device->osType() : HostOsInfo::hostOs();
|
||||
|
||||
// arguments from .qmlproject file
|
||||
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target()->buildSystem());
|
||||
const QStringList importPaths = QmlBuildSystem::makeAbsolute(bs->targetDirectory(),
|
||||
bs->customImportPaths());
|
||||
for (const QString &importPath : importPaths) {
|
||||
ProcessArgs::addArg(&args, "-I", osType);
|
||||
ProcessArgs::addArg(&args, importPath, osType);
|
||||
}
|
||||
|
||||
for (const QString &fileSelector : bs->customFileSelectors()) {
|
||||
ProcessArgs::addArg(&args, "-S", osType);
|
||||
ProcessArgs::addArg(&args, fileSelector, osType);
|
||||
}
|
||||
|
||||
if (HostOsInfo::isWindowsHost() && bs->forceFreeType()) {
|
||||
ProcessArgs::addArg(&args, "-platform", osType);
|
||||
ProcessArgs::addArg(&args, "windows:fontengine=freetype", osType);
|
||||
}
|
||||
|
||||
if (bs->qt6Project() && bs->widgetApp()) {
|
||||
ProcessArgs::addArg(&args, "--apptype", osType);
|
||||
ProcessArgs::addArg(&args, "widget", osType);
|
||||
}
|
||||
|
||||
const QString main = bs->targetFile(FilePath::fromString(mainScript())).toString();
|
||||
if (!main.isEmpty())
|
||||
ProcessArgs::addArg(&args, main, osType);
|
||||
|
||||
|
||||
return args;
|
||||
// If not given explicitly by run device, nor Qt, try to pick
|
||||
// it from $PATH on the run device.
|
||||
return "qml";
|
||||
}
|
||||
|
||||
void QmlProjectRunConfiguration::createQtVersionAspect()
|
||||
@@ -261,7 +244,7 @@ void QmlProjectRunConfiguration::createQtVersionAspect()
|
||||
|
||||
m_qtversionAspect = addAspect<SelectionAspect>();
|
||||
m_qtversionAspect->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
||||
m_qtversionAspect->setLabelText(tr("Qt Version:"));
|
||||
m_qtversionAspect->setLabelText(Tr::tr("Qt Version:"));
|
||||
m_qtversionAspect->setSettingsKey("QmlProjectManager.kit");
|
||||
|
||||
Kit *kit = target()->kit();
|
||||
@@ -272,11 +255,11 @@ void QmlProjectRunConfiguration::createQtVersionAspect()
|
||||
const bool isQt6Project = buildSystem && buildSystem->qt6Project();
|
||||
|
||||
if (isQt6Project) {
|
||||
m_qtversionAspect->addOption(tr("Qt 6"));
|
||||
m_qtversionAspect->addOption(Tr::tr("Qt 6"));
|
||||
m_qtversionAspect->setReadOnly(true);
|
||||
} else { /* Only if this is not a Qt 6 project changing kits makes sense */
|
||||
m_qtversionAspect->addOption(tr("Qt 5"));
|
||||
m_qtversionAspect->addOption(tr("Qt 6"));
|
||||
m_qtversionAspect->addOption(Tr::tr("Qt 5"));
|
||||
m_qtversionAspect->addOption(Tr::tr("Qt 6"));
|
||||
|
||||
const int valueForVersion = version->qtVersion().majorVersion() == 6 ? 1 : 0;
|
||||
|
||||
@@ -324,7 +307,7 @@ bool QmlProjectRunConfiguration::isEnabled() const
|
||||
&& activeBuildSystem()->hasParsingData();
|
||||
}
|
||||
|
||||
QString QmlProjectRunConfiguration::mainScript() const
|
||||
FilePath QmlProjectRunConfiguration::mainScript() const
|
||||
{
|
||||
return m_qmlMainFileAspect->mainScript();
|
||||
}
|
||||
@@ -332,12 +315,11 @@ QString QmlProjectRunConfiguration::mainScript() const
|
||||
// QmlProjectRunConfigurationFactory
|
||||
|
||||
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
|
||||
: FixedRunConfigurationFactory(QmlProjectRunConfiguration::tr("QML Runtime"), false)
|
||||
: FixedRunConfigurationFactory(Tr::tr("QML Runtime"), false)
|
||||
{
|
||||
registerRunConfiguration<QmlProjectRunConfiguration>
|
||||
("QmlProjectManager.QmlRunConfiguration.Qml");
|
||||
addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
||||
} // QmlProjectManager::Internal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
Reference in New Issue
Block a user