Files
qt-creator/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
Kai Köhne 56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00

119 lines
2.8 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmlprojectitem.h"
#include "filefilteritems.h"
#include <utils/algorithm.h>
#include <QDir>
using namespace Utils;
namespace QmlProjectManager {
// kind of initialization
void QmlProjectItem::setSourceDirectory(const FilePath &directoryPath)
{
if (m_sourceDirectory == directoryPath)
return;
m_sourceDirectory = directoryPath;
for (auto &fileFilter : m_content) {
fileFilter->setDefaultDirectory(directoryPath.toFSPathString());
connect(fileFilter.get(),
&FileFilterBaseItem::filesChanged,
this,
&QmlProjectItem::qmlFilesChanged);
}
}
void QmlProjectItem::setTargetDirectory(const FilePath &directoryPath)
{
m_targetDirectory = directoryPath;
}
void QmlProjectItem::setQtForMCUs(bool b)
{
m_qtForMCUs = b;
}
void QmlProjectItem::setQt6Project(bool qt6Project)
{
m_qt6Project = qt6Project;
}
void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{
if (m_importPaths != importPaths)
m_importPaths = importPaths;
}
void QmlProjectItem::setFileSelectors(const QStringList &selectors)
{
if (m_fileSelectors != selectors)
m_fileSelectors = selectors;
}
void QmlProjectItem::setMultilanguageSupport(const bool isEnabled)
{
m_multilanguageSupport = isEnabled;
}
void QmlProjectItem::setSupportedLanguages(const QStringList &languages)
{
if (m_supportedLanguages != languages)
m_supportedLanguages = languages;
}
void QmlProjectItem::setPrimaryLanguage(const QString &language)
{
if (m_primaryLanguage != language)
m_primaryLanguage = language;
}
/* Returns list of absolute paths */
QStringList QmlProjectItem::files() const
{
QSet<QString> files;
for (const auto &fileFilter : m_content) {
const QStringList fileList = fileFilter->files();
for (const QString &file : fileList) {
files.insert(file);
}
}
return Utils::toList(files);
}
/**
Check whether the project would include a file path
- regardless whether the file already exists or not.
@param filePath: absolute file path to check
*/
bool QmlProjectItem::matchesFile(const QString &filePath) const
{
return Utils::contains(m_content, [&filePath](const auto &fileFilter) {
return fileFilter->matchesFile(filePath);
});
}
void QmlProjectItem::setForceFreeType(bool b)
{
m_forceFreeType = b;
}
Utils::EnvironmentItems QmlProjectItem::environment() const
{
return m_environment;
}
void QmlProjectItem::addToEnviroment(const QString &key, const QString &value)
{
m_environment.append(Utils::EnvironmentItem(key, value));
}
} // namespace QmlProjectManager