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 : #include "workspaceuiactions.h"
23 :
24 : #include "ui/uiaction.h"
25 : #include "shortcuts/shortcutcontext.h"
26 : #include "types/translatablestring.h"
27 :
28 : using namespace muse;
29 : using namespace muse::workspace;
30 : using namespace muse::ui;
31 : using namespace muse::actions;
32 :
33 : const UiActionList WorkspaceUiActions::m_actions = {
34 : UiAction("select-workspace",
35 : muse::ui::UiCtxAny,
36 : muse::shortcuts::CTX_ANY,
37 : TranslatableString("action", "Select workspace")
38 : ),
39 : UiAction("configure-workspaces",
40 : muse::ui::UiCtxAny,
41 : muse::shortcuts::CTX_ANY,
42 : TranslatableString("action", "Edit workspaces…"),
43 : TranslatableString("action", "Edit workspaces"),
44 : IconCode::Code::EDIT
45 : ),
46 : UiAction("create-workspace",
47 : muse::ui::UiCtxAny,
48 : muse::shortcuts::CTX_ANY,
49 : TranslatableString("action", "Create new workspace"),
50 : IconCode::Code::PLUS
51 : ),
52 : };
53 :
54 0 : WorkspaceUiActions::WorkspaceUiActions(std::shared_ptr<WorkspaceActionController> controller, const modularity::ContextPtr& iocCtx)
55 0 : : Contextable(iocCtx), m_controller(controller)
56 : {
57 0 : }
58 :
59 0 : const UiActionList& WorkspaceUiActions::actionsList() const
60 : {
61 0 : return m_actions;
62 : }
63 :
64 0 : bool WorkspaceUiActions::actionEnabled(const UiAction& act) const
65 : {
66 0 : if (!m_controller->canReceiveAction(act.code)) {
67 0 : return false;
68 : }
69 :
70 0 : return true;
71 : }
72 :
73 0 : bool WorkspaceUiActions::actionChecked(const UiAction&) const
74 : {
75 0 : return false;
76 : }
77 :
78 0 : async::Channel<ActionCodeList> WorkspaceUiActions::actionEnabledChanged() const
79 : {
80 0 : return m_actionEnabledChanged;
81 : }
82 :
83 0 : async::Channel<ActionCodeList> WorkspaceUiActions::actionCheckedChanged() const
84 : {
85 0 : return m_actionCheckedChanged;
86 : }
|