-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
SoundFlagPopup.qml
145 lines (110 loc) · 3.87 KB
/
SoundFlagPopup.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2024 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0
import MuseScore.Playback 1.0
import "internal/SoundFlag"
StyledPopupView {
id: root
property NavigationSection notationViewNavigationSection: null
property int navigationOrderStart: 0
property int navigationOrderEnd: museSoundsParams.navigationPanelOrderEnd
contentWidth: content.childrenRect.width
contentHeight: content.childrenRect.height
onContentHeightChanged: {
root.updatePosition()
}
signal elementRectChanged(var elementRect)
function updatePosition() {
var popupHeight = root.contentHeight + root.margins * 2 + root.padding * 2
root.y = -popupHeight
root.setOpensUpward(true)
}
Column {
id: content
width: 294
spacing: 12
SoundFlagSettingsModel {
id: soundFlagModel
onIconRectChanged: function(rect) {
root.elementRectChanged(rect)
}
}
Component.onCompleted: {
soundFlagModel.init()
}
RowLayout {
width: parent.width
spacing: 6
NavigationPanel {
id: navPanel
name: "SoundFlagSettings"
direction: NavigationPanel.Vertical
section: root.notationViewNavigationSection
order: root.navigationOrderStart
accessible.name: qsTrc("playback", "Sound flag settings")
}
StyledIconLabel {
Layout.preferredWidth: 24
Layout.preferredHeight: width
iconCode: IconCode.AUDIO
}
StyledTextLabel {
id: titleLabel
Layout.fillWidth: true
text: soundFlagModel.title
font: ui.theme.largeBodyBoldFont
horizontalAlignment: Text.AlignLeft
NavigationControl {
name: "SoundFlagTitle"
enabled: titleLabel.enabled && titleLabel.visible
panel: navPanel
order: 1
accessible.role: MUAccessible.StaticText
accessible.visualItem: titleLabel
accessible.name: titleLabel.text
}
}
MenuButton {
Layout.preferredWidth: 24
Layout.preferredHeight: width
menuModel: soundFlagModel.contextMenuModel
navigation.panel: navPanel
navigation.order: 2
navigation.accessible.name: qsTrc("playback", "Sound flag menu")
onHandleMenuItem: function(itemId) {
soundFlagModel.handleContextMenuItem(itemId)
}
}
}
MuseSoundsParams {
id: museSoundsParams
width: parent.width
model: soundFlagModel
visible: soundFlagModel.inited
navigationPanelSection: root.notationViewNavigationSection
navigationPanelOrderStart: navPanel.order + 1
}
}
}