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 : #include "languagesmodule.h"
23 :
24 : #include "modularity/ioc.h"
25 :
26 : #include "internal/languagesconfiguration.h"
27 : #include "internal/languagesservice.h"
28 :
29 : #include "muse_framework_config.h"
30 :
31 : #ifdef MUSE_MODULE_DIAGNOSTICS
32 : #include "diagnostics/idiagnosticspathsregister.h"
33 : #endif
34 :
35 : using namespace muse::languages;
36 : using namespace muse::modularity;
37 :
38 0 : std::string LanguagesModule::moduleName() const
39 : {
40 0 : return "languages";
41 : }
42 :
43 0 : void LanguagesModule::registerExports()
44 : {
45 0 : m_languagesConfiguration = std::make_shared<LanguagesConfiguration>(globalCtx());
46 0 : m_languagesService = std::make_shared<LanguagesService>(globalCtx());
47 :
48 0 : globalIoc()->registerExport<ILanguagesConfiguration>(moduleName(), m_languagesConfiguration);
49 0 : globalIoc()->registerExport<ILanguagesService>(moduleName(), m_languagesService);
50 0 : }
51 :
52 0 : void LanguagesModule::onPreInit(const IApplication::RunMode&)
53 : {
54 : //! NOTE: configurator must be initialized before any service that uses it
55 0 : m_languagesConfiguration->init();
56 0 : m_languagesService->init();
57 0 : }
58 :
59 0 : void LanguagesModule::onInit(const IApplication::RunMode&)
60 : {
61 : #ifdef MUSE_MODULE_DIAGNOSTICS
62 0 : auto pr = globalIoc()->resolve<muse::diagnostics::IDiagnosticsPathsRegister>(moduleName());
63 0 : if (pr) {
64 0 : pr->reg("languagesAppDataPath", m_languagesConfiguration->languagesAppDataPath());
65 0 : pr->reg("languagesUserAppDataPath", m_languagesConfiguration->languagesUserAppDataPath());
66 : }
67 : #endif
68 0 : }
|