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) 2026 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 : #pragma once
24 :
25 : #include <string>
26 : #include <vector>
27 :
28 : #include "modularity/imoduleinterface.h"
29 : #include "shortcutstypes.h"
30 : #include "async/channel.h"
31 : #include "async/notification.h"
32 : #include "types/ret.h"
33 : #include "io/path.h"
34 :
35 : namespace muse::shortcuts {
36 : class ICommandShortcutsRegister : MODULE_GLOBAL_INTERFACE
37 : {
38 15 : INTERFACE_ID(ICommandShortcutsRegister)
39 : public:
40 18 : virtual ~ICommandShortcutsRegister() = default;
41 :
42 : virtual const ShortcutList& shortcuts() const = 0;
43 : virtual Ret updateShortcuts(const ShortcutList& shortcuts) = 0;
44 : virtual void resetShortcuts() = 0;
45 : virtual async::Notification shortcutsChanged() const = 0;
46 :
47 : virtual Ret setAdditionalShortcuts(const std::string& context, const ShortcutList& shortcuts) = 0;
48 :
49 : virtual ShortcutList shortcutsForSequence(const std::string& sequence) const = 0;
50 : virtual const Shortcut& shortcut(const rcommand::Command& command) const = 0;
51 : virtual const Shortcut& defaultShortcut(const rcommand::Command& command) const = 0;
52 :
53 : virtual Ret importFromFile(const io::path_t& filePath) = 0;
54 : virtual Ret exportToFile(const io::path_t& filePath) const = 0;
55 :
56 : virtual std::vector<std::string> availablePresets() const = 0;
57 :
58 : virtual std::string currentPresetName() const = 0;
59 : virtual void setCurrentPresetName(const std::string& presetName) = 0;
60 : virtual async::Channel<std::string> currentPresetNameChanged() const = 0;
61 :
62 : virtual bool isPresetEdited(const std::string& presetName) const = 0;
63 : virtual bool canDeletePreset(const std::string& presetName) const = 0;
64 : virtual void deletePreset(const std::string& presetName) = 0;
65 :
66 : // for testflow tests
67 : virtual void reload(bool onlyDef = false) = 0;
68 : };
69 : }
|