Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #ifndef MUSE_LANGUAGES_LANGUAGESCONFIGURATION_H
23 : #define MUSE_LANGUAGES_LANGUAGESCONFIGURATION_H
24 :
25 : #include "modularity/ioc.h"
26 : #include "ilanguagesconfiguration.h"
27 : #include "iglobalconfiguration.h"
28 :
29 : #include "global/types/config.h"
30 :
31 : namespace muse::languages {
32 : class LanguagesConfiguration : public ILanguagesConfiguration, public Contextable
33 : {
34 : GlobalInject<IGlobalConfiguration> globalConfiguration;
35 :
36 : public:
37 0 : LanguagesConfiguration(const modularity::ContextPtr& iocCtx)
38 0 : : Contextable(iocCtx) {}
39 :
40 : void init();
41 :
42 : ValCh<QString> currentLanguageCode() const override;
43 : void setCurrentLanguageCode(const QString& languageCode) const override;
44 :
45 : QUrl languagesUpdateUrl() const override;
46 : QUrl languageFileServerUrl(const QString& languageCode) const override;
47 :
48 : io::path_t languagesAppDataPath() const override;
49 : io::path_t languagesUserAppDataPath() const override;
50 :
51 : io::path_t appLanguagesJsonPath() const override;
52 : io::path_t builtinLanguagesJsonPath() const override;
53 : io::path_t builtinLanguageFilePath(const QString& resourceName, const QString& languageCode) const override;
54 : io::path_t userLanguageFilePath(const QString& resourceName, const QString& languageCode) const override;
55 :
56 : QStringList languageResourceNames() const override;
57 :
58 : private:
59 : Config m_config;
60 : async::Channel<QString> m_currentLanguageCodeChanged;
61 : };
62 : }
63 :
64 : #endif // MUSE_LANGUAGES_LANGUAGESCONFIGURATION_H
|