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 : #pragma once
23 :
24 : #include <string>
25 :
26 : #include "modularity/imoduleinterface.h"
27 : #include "modularity/ioc.h"
28 : #include "io/path.h"
29 : #include "async/channel.h"
30 : #include "async/promise.h"
31 : #include "types/ret.h"
32 : #include "types/val.h"
33 :
34 : namespace muse::mi {
35 : class IMultiWindowsProvider : MODULE_GLOBAL_INTERFACE
36 : {
37 2335 : INTERFACE_ID(IMultiWindowsProvider)
38 : public:
39 308 : virtual ~IMultiWindowsProvider() = default;
40 :
41 : // Windows info
42 : virtual size_t windowCount() const = 0;
43 : virtual bool isFirstWindow() const = 0;
44 :
45 : // Project opening
46 : virtual bool isProjectAlreadyOpened(const io::path_t& projectPath) const = 0;
47 : virtual void activateWindowWithProject(const io::path_t& projectPath) = 0;
48 : virtual bool isHasWindowWithoutProject() const = 0;
49 : virtual void activateWindowWithoutProject(const QStringList& args = { }) = 0;
50 : virtual bool openNewWindow(const QStringList& args) = 0;
51 :
52 : // Settings
53 : virtual bool isPreferencesAlreadyOpened() const = 0;
54 : virtual void activateWindowWithOpenedPreferences() const = 0;
55 : virtual void settingsBeginTransaction() = 0;
56 : virtual void settingsCommitTransaction() = 0;
57 : virtual void settingsRollbackTransaction() = 0;
58 : virtual void settingsReset() = 0;
59 : virtual void settingsSetValue(const std::string& key, const Val& value) = 0;
60 :
61 : // Resources (files)
62 : virtual bool lockResource(const std::string& name) = 0;
63 : virtual bool unlockResource(const std::string& name) = 0;
64 : virtual void notifyAboutResourceChanged(const std::string& name) = 0;
65 : virtual async::Channel<std::string> resourceChanged() = 0;
66 :
67 : // Quit
68 : virtual void notifyAboutWindowWasQuited() = 0;
69 : virtual async::Promise<Ret> quitForAll(const modularity::ContextPtr& ctx) = 0;
70 : virtual void quitWindow(const modularity::ContextPtr& ctx) = 0;
71 : virtual void quitAllAndRestartLast() = 0;
72 : virtual void quitAllAndRunInstallation(const io::path_t& installerPath) = 0;
73 : };
74 : }
|