Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2024 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 "musesoundsmodule.h"
23 :
24 : #include "modularity/ioc.h"
25 : #include "framework/interactive/iinteractiveuriregister.h"
26 :
27 : #include "internal/musesoundsconfiguration.h"
28 : #include "internal/musesoundsrepository.h"
29 :
30 : #include "internal/musesoundscheckupdatescenario.h"
31 : #include "internal/musesoundscheckupdateservice.h"
32 : #include "internal/musesamplercheckstatusservice.h"
33 : #include "internal/musesamplercheckstatusscenario.h"
34 :
35 : using namespace mu::musesounds;
36 : using namespace muse;
37 : using namespace muse::modularity;
38 :
39 : static const std::string mname("musesounds");
40 :
41 0 : std::string MuseSoundsModule::moduleName() const
42 : {
43 0 : return mname;
44 : }
45 :
46 0 : void MuseSoundsModule::registerExports()
47 : {
48 0 : m_configuration = std::make_shared<MuseSoundsConfiguration>();
49 0 : m_repository = std::make_shared<MuseSoundsRepository>();
50 :
51 0 : globalIoc()->registerExport<IMuseSoundsConfiguration>(mname, m_configuration);
52 0 : globalIoc()->registerExport<IMuseSoundsRepository>(mname, m_repository);
53 0 : globalIoc()->registerExport<IMuseSamplerCheckStatusService>(mname, new MuseSamplerCheckStatusService());
54 0 : globalIoc()->registerExport<IMuseSoundsCheckUpdateService>(mname, new MuseSoundsCheckUpdateService());
55 0 : }
56 :
57 0 : void MuseSoundsModule::resolveImports()
58 : {
59 0 : auto ir = globalIoc()->resolve<interactive::IInteractiveUriRegister>(mname);
60 0 : if (ir) {
61 0 : ir->registerQmlUri(Uri("musescore://musesounds/musesoundsreleaseinfo"), "MuseScore.MuseSounds", "MuseSoundsReleaseInfoDialog");
62 : }
63 0 : }
64 :
65 0 : void MuseSoundsModule::onInit(const IApplication::RunMode&)
66 : {
67 0 : m_configuration->init();
68 0 : m_repository->init();
69 0 : }
70 :
71 0 : IContextSetup* MuseSoundsModule::newContext(const muse::modularity::ContextPtr& ctx) const
72 : {
73 0 : return new MuseSoundsModuleContext(ctx);
74 : }
75 :
76 0 : void MuseSoundsModuleContext::registerExports()
77 : {
78 0 : ioc()->registerExport<IMuseSoundsCheckUpdateScenario>(mname, new MuseSoundsCheckUpdateScenario(iocContext()));
79 0 : ioc()->registerExport<IMuseSamplerCheckStatusScenario>(mname, new MuseSamplerCheckStatusScenario(iocContext()));
80 0 : }
|