2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2020-06-18 08:49:29 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "qmlprojectmanager_global.h"
|
|
|
|
|
|
|
|
|
|
#include <qmlprojectmanager/qmlprojectmanagerconstants.h>
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
|
|
|
|
|
|
|
|
|
namespace QmlProjectManager {
|
|
|
|
|
|
2020-09-18 12:11:40 +02:00
|
|
|
class QMLPROJECTMANAGER_EXPORT QmlMultiLanguageAspect : public Utils::BoolAspect
|
2020-06-18 08:49:29 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit QmlMultiLanguageAspect(ProjectExplorer::Target *target);
|
|
|
|
|
~QmlMultiLanguageAspect() override;
|
|
|
|
|
|
2020-07-20 20:45:08 +02:00
|
|
|
QString currentLocale() const;
|
|
|
|
|
void setCurrentLocale(const QString &locale);
|
2020-06-18 08:49:29 +02:00
|
|
|
Utils::FilePath databaseFilePath() const;
|
|
|
|
|
void toMap(QVariantMap &map) const final;
|
|
|
|
|
void fromMap(const QVariantMap &map) final;
|
|
|
|
|
|
2020-07-21 13:47:14 +02:00
|
|
|
static QmlMultiLanguageAspect *current();
|
|
|
|
|
static QmlMultiLanguageAspect *current(ProjectExplorer::Project *project);
|
|
|
|
|
static QmlMultiLanguageAspect *current(ProjectExplorer::Target *target);
|
|
|
|
|
|
2022-04-11 09:53:55 +02:00
|
|
|
struct Data : BaseAspect::Data
|
|
|
|
|
{
|
|
|
|
|
const void *origin = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-20 20:45:08 +02:00
|
|
|
signals:
|
|
|
|
|
void currentLocaleChanged(const QString &locale);
|
2020-06-18 08:49:29 +02:00
|
|
|
|
|
|
|
|
private:
|
2022-04-11 09:53:55 +02:00
|
|
|
const void *origin() const { return this; }
|
|
|
|
|
|
2020-06-18 08:49:29 +02:00
|
|
|
ProjectExplorer::Target *m_target = nullptr;
|
|
|
|
|
mutable Utils::FilePath m_databaseFilePath;
|
2020-07-20 20:45:08 +02:00
|
|
|
QString m_currentLocale;
|
2020-06-18 08:49:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QmlProjectManager
|