forked from qt-creator/qt-creator
QmlProject: Add support for primaryLanguage
Task-number: QDS-5187 Change-Id: I05aafa726fd6c2b586d57b64239cf08c1f2342ab Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -103,6 +103,10 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
|
||||
if (languagesProperty.isValid())
|
||||
projectItem->setSupportedLanguages(languagesProperty.value.toStringList());
|
||||
|
||||
const auto primaryLanguageProperty = rootNode->property(QLatin1String("primaryLanguage"));
|
||||
if (primaryLanguageProperty.isValid())
|
||||
projectItem->setPrimaryLanguage(primaryLanguageProperty.value.toString());
|
||||
|
||||
const auto forceFreeTypeProperty = rootNode->property("forceFreeType");
|
||||
if (forceFreeTypeProperty.isValid())
|
||||
projectItem->setForceFreeType(forceFreeTypeProperty.value.toBool());
|
||||
|
@@ -83,6 +83,12 @@ void QmlProjectItem::setSupportedLanguages(const QStringList &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
|
||||
{
|
||||
|
@@ -66,6 +66,9 @@ public:
|
||||
QStringList supportedLanguages() const { return m_supportedLanguages; }
|
||||
void setSupportedLanguages(const QStringList &languages);
|
||||
|
||||
QString primaryLanguage() const { return m_primaryLanguage; }
|
||||
void setPrimaryLanguage(const QString &language);
|
||||
|
||||
QStringList files() const;
|
||||
bool matchesFile(const QString &filePath) const;
|
||||
|
||||
@@ -89,6 +92,7 @@ protected:
|
||||
QStringList m_importPaths;
|
||||
QStringList m_fileSelectors;
|
||||
QStringList m_supportedLanguages;
|
||||
QString m_primaryLanguage;
|
||||
QString m_mainFile;
|
||||
Utils::EnvironmentItems m_environment;
|
||||
QVector<QmlProjectContentItem *> m_content; // content property
|
||||
|
@@ -46,8 +46,7 @@ static bool isMultilanguagePresent()
|
||||
static Utils::FilePath getMultilanguageDatabaseFilePath(ProjectExplorer::Target *target)
|
||||
{
|
||||
if (target) {
|
||||
auto filePath = target->project()->projectDirectory().pathAppended(
|
||||
"multilanguage-experimental-v6.db");
|
||||
auto filePath = target->project()->projectDirectory().pathAppended("translations.db");
|
||||
if (filePath.exists())
|
||||
return filePath;
|
||||
}
|
||||
|
@@ -347,6 +347,13 @@ QStringList QmlBuildSystem::supportedLanguages() const
|
||||
return {};
|
||||
}
|
||||
|
||||
QString QmlBuildSystem::primaryLanguage() const
|
||||
{
|
||||
if (m_projectItem)
|
||||
return m_projectItem.data()->primaryLanguage();
|
||||
return {};
|
||||
}
|
||||
|
||||
void QmlBuildSystem::refreshProjectFile()
|
||||
{
|
||||
refresh(QmlBuildSystem::ProjectFile | Files);
|
||||
@@ -518,6 +525,8 @@ QVariant QmlBuildSystem::additionalData(Id id) const
|
||||
return customFileSelectors();
|
||||
if (id == Constants::supportedLanguagesData)
|
||||
return supportedLanguages();
|
||||
if (id == Constants::primaryLanguageData)
|
||||
return primaryLanguage();
|
||||
if (id == Constants::customForceFreeTypeData)
|
||||
return forceFreeType();
|
||||
if (id == Constants::customQtForMCUs)
|
||||
|
@@ -89,6 +89,7 @@ public:
|
||||
QStringList customImportPaths() const;
|
||||
QStringList customFileSelectors() const;
|
||||
QStringList supportedLanguages() const;
|
||||
QString primaryLanguage() const;
|
||||
bool forceFreeType() const;
|
||||
|
||||
bool addFiles(const QStringList &filePaths);
|
||||
|
@@ -33,6 +33,7 @@ namespace Constants {
|
||||
const char * const QMLPROJECT_MIMETYPE = QmlJSTools::Constants::QMLPROJECT_MIMETYPE;
|
||||
const char customFileSelectorsData[] = "CustomFileSelectorsData";
|
||||
const char supportedLanguagesData[] = "SupportedLanguagesData";
|
||||
const char primaryLanguageData[] = "PrimaryLanguageData";
|
||||
const char customForceFreeTypeData[] = "CustomForceFreeType";
|
||||
const char customQtForMCUs[] = "CustomQtForMCUs";
|
||||
const char customQt6Project[] = "CustomQt6Project";
|
||||
|
Reference in New Issue
Block a user