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) 2025 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 : #pragma once
23 :
24 : #include "musesounds/imusesamplercheckstatusscenario.h"
25 :
26 : #include "async/asyncable.h"
27 :
28 : #include "modularity/ioc.h"
29 : #include "rcommand/icommanddispatcher.h"
30 : #include "musesounds/imusesamplercheckstatusservice.h"
31 : #include "musesounds/imusesoundsconfiguration.h"
32 : #include "global/iprocess.h"
33 : #include "global/iglobalconfiguration.h"
34 : #include "interactive/iinteractive.h"
35 : #include "interactive/iplatforminteractive.h"
36 : #include "multiwindows/imultiwindowsprovider.h"
37 : #include "update/iupdateconfiguration.h"
38 :
39 : namespace mu::musesounds {
40 : class MuseSamplerCheckStatusScenario : public IMuseSamplerCheckStatusScenario, public muse::Contextable, public muse::async::Asyncable
41 : {
42 : public:
43 : muse::GlobalInject<muse::mi::IMultiWindowsProvider> multiwindowsProvider;
44 : muse::GlobalInject<muse::IGlobalConfiguration> globalConfiguration;
45 : muse::GlobalInject<muse::update::IUpdateConfiguration> updateConfiguration;
46 : muse::GlobalInject<muse::IProcess> process;
47 : muse::GlobalInject<IMuseSoundsConfiguration> configuration;
48 : muse::GlobalInject<IMuseSamplerCheckStatusService> service;
49 : muse::GlobalInject<muse::IPlatformInteractive> platformInteractive;
50 : muse::ContextInject<muse::IInteractive> interactive = { this };
51 : muse::ContextInject<muse::rcommand::ICommandDispatcher> commandDispatcher = { this };
52 :
53 : public:
54 14 : MuseSamplerCheckStatusScenario(const muse::modularity::ContextPtr& iocCtx)
55 14 : : muse::Contextable(iocCtx) {}
56 :
57 : bool alreadyChecked() const override;
58 : void checkAndShowStatusIfNeed() override;
59 :
60 : private:
61 : void showLoadingFailedNotification();
62 : void showCriticalUpdateNotification();
63 : void showNewVersionNotification();
64 :
65 : void openMuseHub(bool quit);
66 : void openMuseHubWebsite(bool quit);
67 :
68 : bool m_alreadyChecked = false;
69 : };
70 : }
|