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) 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 : #include "projectcommandsregister.h"
24 :
25 : using namespace mu::project;
26 :
27 : #include "../projectcommands.h"
28 :
29 : using namespace muse;
30 : using namespace muse::rcommand;
31 : using namespace muse::ui;
32 : using namespace mu::project;
33 :
34 : static const std::vector<CommandInfo> s_commandInfos = {
35 : CommandInfo{
36 : PROJECT_NEW_COMMAND,
37 : TranslatableString("project", "&New…"),
38 : TranslatableString("project", "Create a new project"),
39 : InputSchema(),
40 : Decoration(IconCode::Code::NEW_FILE)
41 : },
42 : CommandInfo{
43 : PROJECT_OPEN_COMMAND,
44 : TranslatableString("project", "&Open…"),
45 : TranslatableString("project", "Open a project"),
46 : InputSchema({
47 : { "url", Arg(DataType::String, u"URL of the project to open (optional)") },
48 : { "display_name", Arg(DataType::String, u"Display name of the project (optional)") },
49 : }),
50 : Decoration(IconCode::Code::OPEN_FILE)
51 : },
52 : CommandInfo{
53 : PROJECT_CLOSE_COMMAND,
54 : TranslatableString("project", "&Close"),
55 : TranslatableString("project", "Close the project"),
56 : InputSchema(),
57 : Decoration()
58 : },
59 :
60 : CommandInfo{
61 : PROJECT_SAVE_COMMAND,
62 : TranslatableString("project", "&Save"),
63 : TranslatableString("project", "Save the project"),
64 : InputSchema(),
65 : Decoration(IconCode::Code::SAVE)
66 : },
67 : CommandInfo{
68 : PROJECT_SAVE_AS_COMMAND,
69 : TranslatableString("project", "Save &as…"),
70 : TranslatableString("project", "Save the project as"),
71 : InputSchema(),
72 : Decoration()
73 : },
74 : CommandInfo{
75 : PROJECT_SAVE_A_COPY_COMMAND,
76 : TranslatableString("project", "Save a ©…"),
77 : TranslatableString("project", "Save a copy of the project"),
78 : InputSchema(),
79 : Decoration()
80 : },
81 : CommandInfo{
82 : PROJECT_SAVE_SELECTION_COMMAND,
83 : TranslatableString("project", "Save &selection…"),
84 : TranslatableString("project", "Save the selection of the project"),
85 : InputSchema(),
86 : Decoration()
87 : },
88 : CommandInfo{
89 : PROJECT_SAVE_TO_CLOUD_COMMAND,
90 : TranslatableString("project", "Save to clo&ud…"),
91 : TranslatableString("project", "Save the project to cloud"),
92 : InputSchema(),
93 : Decoration(IconCode::Code::CLOUD_FILE)
94 : },
95 : CommandInfo{
96 : PROJECT_SAVE_AT_COMMAND,
97 : TranslatableString("project", "Save at…"),
98 : TranslatableString("project", "Save the project at"),
99 : InputSchema({
100 : { "path", Arg(DataType::String, u"Path of the project to save") }
101 : }),
102 : Decoration()
103 : },
104 :
105 : CommandInfo{
106 : PROJECT_PUBLISH_COMMAND,
107 : TranslatableString("project", "Publish to &MuseScore.com…"),
108 : TranslatableString("project", "Publish the project to MuseScore.com"),
109 : InputSchema(),
110 : Decoration(IconCode::Code::CLOUD_FILE)
111 : },
112 : CommandInfo{
113 : PROJECT_SHARE_AUDIO_COMMAND,
114 : TranslatableString("project", "Share on &Audio.com…"),
115 : TranslatableString("project", "Share the project on Audio.com"),
116 : InputSchema(),
117 : Decoration(IconCode::Code::SHARE_AUDIO)
118 : },
119 :
120 : CommandInfo{
121 : PROJECT_EXPORT_COMMAND,
122 : TranslatableString("project", "&Export…"),
123 : TranslatableString("project", "Export the project"),
124 : InputSchema(),
125 : Decoration(IconCode::Code::SHARE_FILE)
126 : },
127 : CommandInfo{
128 : PROJECT_CONVERT_TO_SCORE_COMMAND,
129 : TranslatableString("project", "Convert &file…"),
130 : TranslatableString("project", "Convert a file to a score"),
131 : InputSchema(),
132 : Decoration(IconCode::Code::IMPORT)
133 : },
134 :
135 : CommandInfo{
136 : PROJECT_PROPERTIES_COMMAND,
137 : TranslatableString("project", "Project propert&ies…"),
138 : TranslatableString("project", "Project properties"),
139 : InputSchema(),
140 : Decoration()
141 : },
142 : CommandInfo{
143 : PROJECT_PRINT_COMMAND,
144 : TranslatableString("project", "&Print…"),
145 : TranslatableString("project", "Print the project"),
146 : InputSchema(),
147 : Decoration(IconCode::Code::PRINT)
148 : },
149 : CommandInfo{
150 : PROJECT_CLEAR_RECENT_COMMAND,
151 : TranslatableString("project", "&Clear list of recent files"),
152 : TranslatableString("project", "Clear list of recent files"),
153 : InputSchema(),
154 : Decoration()
155 : },
156 : CommandInfo{
157 : PROJECT_CONTINUE_LAST_SESSION_COMMAND,
158 : TranslatableString("project", "Continue last session"),
159 : TranslatableString("project", "Continue the last session"),
160 : InputSchema(),
161 : Decoration()
162 : },
163 : };
164 :
165 0 : std::string ProjectCommandsRegister::moduleName() const
166 : {
167 0 : return "project";
168 : }
169 :
170 0 : const std::vector<muse::rcommand::Command>& ProjectCommandsRegister::commandList() const
171 : {
172 0 : static std::vector<muse::rcommand::Command> commands;
173 0 : if (commands.empty()) {
174 0 : commands.reserve(s_commandInfos.size());
175 0 : for (const auto& info : s_commandInfos) {
176 0 : commands.push_back(info.command);
177 : }
178 : }
179 0 : return commands;
180 : }
181 :
182 0 : const std::vector<muse::rcommand::CommandInfo>& ProjectCommandsRegister::commandInfoList() const
183 : {
184 0 : return s_commandInfos;
185 : }
|