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 "navigationevent.h"
23 :
24 : #include "log.h"
25 :
26 : using namespace muse::ui;
27 :
28 42 : NavigationEvent::NavigationEvent(INavigation::EventPtr event)
29 42 : : m_event(event)
30 : {
31 42 : }
32 :
33 0 : void NavigationEvent::setEvent(INavigation::EventPtr event)
34 : {
35 0 : m_event = event;
36 0 : }
37 :
38 0 : NavigationEvent::Type NavigationEvent::type() const
39 : {
40 0 : IF_ASSERT_FAILED(m_event) {
41 0 : return Undefined;
42 : }
43 0 : return static_cast<Type>(m_event->type);
44 : }
45 :
46 0 : void NavigationEvent::setAccepted(bool accepted)
47 : {
48 0 : IF_ASSERT_FAILED(m_event) {
49 0 : return;
50 : }
51 0 : m_event->accepted = accepted;
52 : }
53 :
54 0 : bool NavigationEvent::accepted() const
55 : {
56 0 : IF_ASSERT_FAILED(m_event) {
57 0 : return false;
58 : }
59 0 : return m_event->accepted;
60 : }
61 :
62 0 : QVariant NavigationEvent::data(const QString& key) const
63 : {
64 0 : IF_ASSERT_FAILED(m_event) {
65 0 : return false;
66 : }
67 0 : return m_event->data.value(key);
68 : }
69 :
70 0 : void NavigationEvent::setData(const QString& key, const QVariant& val)
71 : {
72 0 : IF_ASSERT_FAILED(m_event) {
73 0 : return;
74 : }
75 0 : m_event->data[key] = val;
76 : }
|