Merge remote-tracking branch 'origin/11.0' into qds/dev

Change-Id: I79a272471b3400eec0a0fa9fca175d1d4a8c0a13
This commit is contained in:
Tim Jenssen
2023-06-07 12:06:26 +02:00
184 changed files with 1975 additions and 992 deletions

View File

@@ -107,9 +107,8 @@ void QmlBuildSystem::updateDeploymentData()
}
ProjectExplorer::DeploymentData deploymentData;
for (const auto &file : m_projectItem->files()) {
deploymentData.addFile(file, targetFile(file).parentDir().toString());
}
for (const auto &file : m_projectItem->files())
deploymentData.addFile(file, m_projectItem->targetDirectory());
setDeploymentData(deploymentData);
}
@@ -160,9 +159,7 @@ void QmlBuildSystem::triggerParsing()
Utils::FilePath QmlBuildSystem::canonicalProjectDir() const
{
return BuildSystem::target()
->project()
->projectFilePath()
return projectFilePath()
.canonicalPath()
.normalizedPathName()
.parentDir();
@@ -188,10 +185,11 @@ void QmlBuildSystem::refresh(RefreshOptions options)
QmlJS::ModelManagerInterface::ProjectInfo projectInfo
= modelManager->defaultProjectInfoForProject(project(),
project()->files(Project::HiddenRccFolders));
const QStringList searchPaths = makeAbsolute(canonicalProjectDir(), customImportPaths());
for (const QString &searchPath : searchPaths)
projectInfo.importPaths.maybeInsert(Utils::FilePath::fromString(searchPath),
for (const QString &searchPath : customImportPaths()) {
projectInfo.importPaths.maybeInsert(projectFilePath().pathAppended(searchPath),
QmlJS::Dialect::Qml);
}
modelManager->updateProjectInfo(projectInfo, project());
@@ -370,22 +368,23 @@ bool QmlBuildSystem::setMainUiFileInMainFile(const Utils::FilePath &newMainUiFil
Utils::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();
Utils::FilePath result;
if (DeviceTypeKitAspect::deviceTypeId(kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
result = canonicalProjectDir();
} else if (IDevice::ConstPtr device = DeviceKitAspect::device(kit())) {
if (m_projectItem)
result = device->filePath(m_projectItem->targetDirectory());
}
return result;
}
Utils::FilePath QmlBuildSystem::targetFile(const Utils::FilePath &sourceFile) const
{
const QDir sourceDir(m_projectItem ? m_projectItem->sourceDirectory().path()
: canonicalProjectDir().toString());
const QDir targetDir(targetDirectory().toString());
const QString relative = sourceDir.relativeFilePath(sourceFile.toString());
return Utils::FilePath::fromString(QDir::cleanPath(targetDir.absoluteFilePath(relative)));
const Utils::FilePath sourceDir = m_projectItem ? m_projectItem->sourceDirectory()
: canonicalProjectDir();
const Utils::FilePath relative = sourceFile.relativePathFrom(sourceDir);
return targetDirectory().resolvePath(relative);
}
void QmlBuildSystem::setSupportedLanguages(QStringList languages)
{
m_projectItem->setSupportedLanguages(languages);
@@ -396,18 +395,6 @@ void QmlBuildSystem::setPrimaryLanguage(QString language)
m_projectItem->setPrimaryLanguage(language);
}
QStringList QmlBuildSystem::makeAbsolute(const Utils::FilePath &path,
const QStringList &relativePaths)
{
if (path.isEmpty())
return relativePaths;
const QDir baseDir(path.toString());
return Utils::transform(relativePaths, [&baseDir](const QString &path) {
return QDir::cleanPath(baseDir.absoluteFilePath(path));
});
}
void QmlBuildSystem::refreshFiles(const QSet<QString> & /*added*/, const QSet<QString> &removed)
{
if (m_blockFilesUpdate) {

View File

@@ -89,9 +89,6 @@ public:
bool addFiles(const QStringList &filePaths);
void refreshProjectFile();
static Utils::FilePath activeMainFilePath();
static QStringList makeAbsolute(const Utils::FilePath &path, const QStringList &relativePaths);
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
bool blockFilesUpdate() const;

View File

@@ -210,7 +210,7 @@ void QmlMainFileAspect::changeCurrentFile(Core::IEditor *editor)
bool QmlMainFileAspect::isQmlFilePresent()
{
bool qmlFileFound = false;
if (mainScriptSource() == FileInEditor) {
if (mainScriptSource() == FileInEditor && !mainScript().isEmpty()) {
IDocument *document = EditorManager::currentDocument();
const MimeType mainScriptMimeType = mimeTypeForFile(mainScript());
if (document) {

View File

@@ -61,7 +61,7 @@ private:
FilePath qmlRuntimeFilePath() const;
void createQtVersionAspect();
StringAspect *m_qmlViewerAspect = nullptr;
FilePathAspect *m_qmlViewerAspect = nullptr;
QmlMainFileAspect *m_qmlMainFileAspect = nullptr;
QmlMultiLanguageAspect *m_multiLanguageAspect = nullptr;
SelectionAspect *m_qtversionAspect = nullptr;
@@ -71,10 +71,9 @@ private:
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
: RunConfiguration(target, id)
{
m_qmlViewerAspect = addAspect<StringAspect>();
m_qmlViewerAspect = addAspect<FilePathAspect>();
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");
m_qmlViewerAspect->setSettingsKey(Constants::QML_VIEWER_KEY);
@@ -92,11 +91,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
// 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) {
for (const QString &importPath : bs->customImportPaths()) {
cmd.addArg("-I");
cmd.addArg(importPath);
cmd.addArg(bs->targetDirectory().pathAppended(importPath).path());
}
for (const QString &fileSelector : bs->customFileSelectors()) {
@@ -115,8 +112,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
}
const FilePath main = bs->targetFile(mainScript());
if (!main.isEmpty())
cmd.addArg(main.nativePath());
cmd.addArg(main.path());
return cmd;
});