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 :
23 : #include "cloudmodule.h"
24 :
25 : #include "modularity/ioc.h"
26 : #include "interactive/iinteractiveuriregister.h"
27 :
28 : #ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
29 : #include "musescorecom/musescorecomservice.h"
30 : #endif
31 : #include "audiocom/audiocomservice.h"
32 : #include "internal/cloudconfiguration.h"
33 :
34 : using namespace muse;
35 : using namespace muse::cloud;
36 : using namespace muse::modularity;
37 :
38 0 : std::string CloudModule::moduleName() const
39 : {
40 0 : return "cloud";
41 : }
42 :
43 0 : void CloudModule::registerExports()
44 : {
45 0 : m_cloudConfiguration = std::make_shared<CloudConfiguration>(globalCtx());
46 0 : globalIoc()->registerExport<ICloudConfiguration>(moduleName(), m_cloudConfiguration);
47 : #ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
48 0 : m_museScoreComService = std::make_shared<MuseScoreComService>(globalCtx());
49 0 : globalIoc()->registerExport<IMuseScoreComService>(moduleName(), m_museScoreComService);
50 : #endif
51 0 : m_audioComService = std::make_shared<AudioComService>(globalCtx());
52 0 : globalIoc()->registerExport<IAudioComService>(moduleName(), m_audioComService);
53 0 : }
54 :
55 0 : void CloudModule::resolveImports()
56 : {
57 0 : auto ir = globalIoc()->resolve<interactive::IInteractiveUriRegister>(moduleName());
58 0 : if (ir) {
59 0 : ir->registerQmlUri(Uri("muse://cloud/requireauthorization"), "Muse.Cloud", "RequireAuthorizationDialog");
60 : }
61 0 : }
62 :
63 0 : void CloudModule::onInit(const IApplication::RunMode&)
64 : {
65 0 : m_cloudConfiguration->init();
66 : #ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
67 0 : m_museScoreComService->init();
68 : #endif
69 0 : m_audioComService->init();
70 0 : }
|