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) 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 "dockcommandsregister.h"
24 :
25 : #include "../dockcommands.h"
26 : #include "rcommand/commandtypes.h"
27 :
28 : using namespace muse;
29 : using namespace muse::rcommand;
30 : using namespace muse::dock;
31 :
32 : static const std::vector<CommandInfo> s_commandInfos = {
33 : CommandInfo {
34 : DOCK_SET_OPEN_COMMAND,
35 : TranslatableString("dock", "Set Open"),
36 : TranslatableString("dock", "Dock: Set Open"),
37 : InputSchema({
38 : { "dock_name", Arg(DataType::String, u"Dock name") },
39 : { "open", Arg(DataType::Bool, u"Open") }
40 : }),
41 : Decoration(),
42 : Availability::Dispatch
43 : },
44 : CommandInfo {
45 : DOCK_TOGGLE_COMMAND,
46 : TranslatableString("dock", "Toggle dock"),
47 : TranslatableString("dock", "Dock: Toggle dock"),
48 : InputSchema({ { "dock_name", Arg(DataType::String, u"Dock name") } }),
49 : Decoration(),
50 : Availability::Dispatch
51 : },
52 : CommandInfo {
53 : DOCK_TOGGLE_FLOATING_COMMAND,
54 : TranslatableString("dock", "Toggle dock floating"),
55 : TranslatableString("dock", "Dock: Toggle dock floating"),
56 : InputSchema({ { "dock_name", Arg(DataType::String, u"Dock name") } }),
57 : Decoration(),
58 : Availability::Dispatch
59 : },
60 : CommandInfo {
61 : DOCK_RESTORE_DEFAULT_LAYOUT_COMMAND,
62 : TranslatableString("dock", "Restore default layout"),
63 : TranslatableString("dock", "Dock: Restore default layout"),
64 : InputSchema(),
65 : Decoration(),
66 : Availability::All
67 : }
68 : };
69 :
70 3 : std::string DockCommandsRegister::moduleName() const
71 : {
72 6 : return "dock";
73 : }
74 :
75 3 : const std::vector<muse::rcommand::Command>& DockCommandsRegister::commandList() const
76 : {
77 3 : static std::vector<muse::rcommand::Command> commands;
78 3 : if (commands.empty()) {
79 1 : commands.reserve(s_commandInfos.size());
80 5 : for (const auto& info : s_commandInfos) {
81 4 : commands.push_back(info.command);
82 : }
83 : }
84 3 : return commands;
85 : }
86 :
87 9 : const std::vector<CommandInfo>& DockCommandsRegister::commandInfoList() const
88 : {
89 9 : return s_commandInfos;
90 : }
|