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 "updateuiactions.h"
23 :
24 : #include "ui/uiaction.h"
25 : #include "shortcuts/shortcutcontext.h"
26 : #include "types/translatablestring.h"
27 :
28 : using namespace muse::update;
29 : using namespace muse::ui;
30 : using namespace muse::actions;
31 :
32 : const UiActionList UpdateUiActions::m_actions = {
33 : UiAction("check-update",
34 : UiCtxAny,
35 : muse::shortcuts::CTX_ANY,
36 : TranslatableString("action", "Check for &update")
37 : )
38 : };
39 :
40 0 : UpdateUiActions::UpdateUiActions(std::shared_ptr<UpdateActionController> controller, const modularity::ContextPtr& iocCtx)
41 0 : : Contextable(iocCtx), m_controller(controller)
42 : {
43 0 : }
44 :
45 0 : const UiActionList& UpdateUiActions::actionsList() const
46 : {
47 0 : return m_actions;
48 : }
49 :
50 0 : bool UpdateUiActions::actionEnabled(const UiAction& act) const
51 : {
52 0 : if (!m_controller->canReceiveAction(act.code)) {
53 0 : return false;
54 : }
55 :
56 0 : return true;
57 : }
58 :
59 0 : bool UpdateUiActions::actionChecked(const UiAction&) const
60 : {
61 0 : return false;
62 : }
63 :
64 0 : muse::async::Channel<ActionCodeList> UpdateUiActions::actionEnabledChanged() const
65 : {
66 0 : return m_actionEnabledChanged;
67 : }
68 :
69 0 : muse::async::Channel<ActionCodeList> UpdateUiActions::actionCheckedChanged() const
70 : {
71 0 : return m_actionCheckedChanged;
72 : }
|