Skip to content

Commit 7875e61

Browse files
authored
Merge pull request #25621 from cbjeukendrup/playback_toolbar_tempo_slider
Add playback speed popup to docked Playback Toolbar
2 parents c21c72e + 8e0b0b2 commit 7875e61

File tree

8 files changed

+270
-77
lines changed

8 files changed

+270
-77
lines changed

src/framework/uicomponents/qml/Muse/UiComponents/IncrementalPropertyControl.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Item {
230230
scrolled = 0
231231
}
232232

233-
onTextChanged: function(newTextValue) {
233+
onTextEdited: function(newTextValue) {
234234
if (prv.isCustom) {
235235
root.valueEdited(newTextValue)
236236
return

src/framework/uicomponents/qml/Muse/UiComponents/TimeInputField.qml

+24
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Row {
3232

3333
property font font: ui.theme.largeBodyFont
3434

35+
property NavigationPanel navigationPanel: null
36+
property int navigationOrderStart: 0
37+
readonly property int navigationOrderEnd: millisecondsField.navigation.order
38+
3539
signal timeEdited(var newTime)
3640

3741
spacing: 0
@@ -46,6 +50,11 @@ Row {
4650

4751
font: root.font
4852

53+
navigation.panel: root.navigationPanel
54+
navigation.order: root.navigationOrderStart
55+
navigation.name: "hours"
56+
accessible.name: qsTrc("global", "Hours")
57+
4958
onValueEdited: function(newValue) {
5059
var newTime = root.time
5160
newTime.setHours(newValue)
@@ -68,6 +77,11 @@ Row {
6877
displayedNumberLength: 2
6978
font: root.font
7079

80+
navigation.panel: root.navigationPanel
81+
navigation.order: root.navigationOrderStart + 1
82+
navigation.name: "minutes"
83+
accessible.name: qsTrc("global", "Minutes")
84+
7185
onValueEdited: function(newValue) {
7286
var newTime = root.time
7387
newTime.setMinutes(newValue)
@@ -90,6 +104,11 @@ Row {
90104
displayedNumberLength: 2
91105
font: root.font
92106

107+
navigation.panel: root.navigationPanel
108+
navigation.order: root.navigationOrderStart + 2
109+
navigation.name: "seconds"
110+
accessible.name: qsTrc("global", "Seconds")
111+
93112
onValueEdited: function(newValue) {
94113
var newTime = root.time
95114
newTime.setSeconds(newValue)
@@ -114,6 +133,11 @@ Row {
114133

115134
font: root.font
116135

136+
navigation.panel: root.navigationPanel
137+
navigation.order: root.navigationOrderStart + 3
138+
navigation.name: "milliseconds"
139+
accessible.name: qsTrc("global", "Milliseconds")
140+
117141
onValueEdited: function(newValue) {
118142
var newTime = root.time
119143
newTime.setMilliseconds(newValue * precision)

src/playback/playback.qrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<file>qml/MuseScore/Playback/qmldir</file>
44
<file>qml/MuseScore/Playback/PlaybackToolBar.qml</file>
55
<file>qml/MuseScore/Playback/internal/MeasureAndBeatFields.qml</file>
6-
<file>qml/MuseScore/Playback/internal/TempoSlider.qml</file>
6+
<file>qml/MuseScore/Playback/internal/PlaybackSpeedSlider.qml</file>
7+
<file>qml/MuseScore/Playback/internal/PlaybackSpeedPopup.qml</file>
78
<file>qml/MuseScore/Playback/MixerPanel.qml</file>
89
<file>qml/MuseScore/Playback/internal/MixerPanelToolbar.qml</file>
910
<file>qml/MuseScore/Playback/internal/MixerPanelSection.qml</file>

src/playback/qml/MuseScore/Playback/PlaybackToolBar.qml

+14-14
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Item {
3434

3535
property bool floating: false
3636

37-
width: content.width
37+
width: content.width + (floating ? 12 : 0)
3838
height: content.height
3939

4040
property NavigationPanel navigationPanel: NavigationPanel {
@@ -48,12 +48,12 @@ Item {
4848
property alias navigationPanelOrder: navPanel.order
4949

5050
PlaybackToolBarModel {
51-
id: playbackModel
51+
id: thePlaybackModel
5252
isToolbarFloating: root.floating
5353
}
5454

5555
Component.onCompleted: {
56-
playbackModel.load()
56+
thePlaybackModel.load()
5757
}
5858

5959
Column {
@@ -63,35 +63,35 @@ Item {
6363

6464
width: childrenRect.width
6565

66-
enabled: playbackModel.isPlayAllowed
66+
enabled: thePlaybackModel.isPlayAllowed
6767

6868
PlaybackToolBarActions {
6969
id: playbackActions
7070

71-
playbackModel: playbackModel
71+
playbackModel: thePlaybackModel
7272
floating: root.floating
7373

7474
navPanel: root.navigationPanel
7575
}
7676

7777
StyledSlider {
78-
width: playbackActions.width - 12
78+
width: playbackActions.width
7979
visible: root.floating
80-
value: playbackModel.playPosition
80+
value: thePlaybackModel.playPosition
8181

8282
onMoved: {
83-
playbackModel.playPosition = value
83+
thePlaybackModel.playPosition = value
8484
}
8585
}
8686

87-
TempoSlider {
88-
width: playbackActions.width - 12
87+
PlaybackSpeedSlider {
88+
width: playbackActions.width
8989
visible: root.floating
90-
value: playbackModel.tempoMultiplier
9190

92-
onMoved: function(newValue) {
93-
playbackModel.tempoMultiplier = newValue
94-
}
91+
playbackModel: thePlaybackModel
92+
93+
navigationPanel: navPanel
94+
navigationOrderStart: playbackActions.navigationOrderEnd + 1
9595
}
9696
}
9797
}

src/playback/qml/MuseScore/Playback/internal/MeasureAndBeatFields.qml

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Item {
3636

3737
property font font: ui.theme.largeBodyFont
3838

39+
property NavigationPanel navigationPanel: null
40+
property int navigationOrderStart: 0
41+
readonly property int navigationOrderEnd: beatNumberField.navigation.order
42+
3943
signal measureNumberEdited(var newValue)
4044
signal beatNumberEdited(var newValue)
4145

@@ -66,6 +70,11 @@ Item {
6670

6771
font: root.font
6872

73+
navigation.panel: root.navigationPanel
74+
navigation.order: root.navigationOrderStart
75+
navigation.name: "measure"
76+
accessible.name: qsTrc("playback", "Measure", "Measure number")
77+
6978
onValueEdited: function(newValue) {
7079
root.measureNumberEdited(newValue)
7180
}
@@ -94,6 +103,11 @@ Item {
94103

95104
font: root.font
96105

106+
navigation.panel: root.navigationPanel
107+
navigation.order: root.navigationOrderStart + 1
108+
navigation.name: "beat"
109+
accessible.name: qsTrc("playback", "Beat", "Beat number")
110+
97111
onValueEdited: function(newValue) {
98112
root.beatNumberEdited(newValue)
99113
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0-only
3+
* MuseScore-CLA-applies
4+
*
5+
* MuseScore
6+
* Music Composition & Notation
7+
*
8+
* Copyright (C) 2023 MuseScore BVBA 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+
import QtQuick
24+
import QtQuick.Layouts
25+
26+
import Muse.Ui
27+
import Muse.UiComponents
28+
29+
import MuseScore.Playback
30+
31+
StyledPopupView {
32+
id: root
33+
34+
property PlaybackToolBarModel playbackModel: null
35+
36+
contentWidth: contentColumn.implicitWidth
37+
contentHeight: contentColumn.implicitHeight
38+
39+
NavigationPanel {
40+
id: navPanel
41+
name: "PlaybackSpeedPopup"
42+
section: root.navigationSection
43+
accessible.name: qsTrc("playback", "Playback speed popup")
44+
}
45+
46+
ColumnLayout {
47+
id: contentColumn
48+
spacing: 8
49+
50+
StyledTextLabel {
51+
Layout.fillWidth: true
52+
text: qsTrc("playback", "Speed")
53+
horizontalAlignment: Text.AlignLeft
54+
}
55+
56+
RowLayout {
57+
spacing: 12
58+
59+
IncrementalPropertyControl {
60+
Layout.preferredWidth: 76
61+
currentValue: (root.playbackModel.tempoMultiplier * 100).toFixed(decimals)
62+
63+
maxValue: 300
64+
minValue: 10
65+
step: 5
66+
measureUnitsSymbol: "%"
67+
decimals: 0
68+
69+
navigation.panel: navPanel
70+
navigation.accessible.name: qsTrc("playback", "Speed")
71+
72+
onValueEdited: function(newValue) {
73+
root.playbackModel.tempoMultiplier = newValue / 100
74+
}
75+
}
76+
77+
StyledSlider {
78+
Layout.preferredWidth: 200
79+
Layout.preferredHeight: 30
80+
81+
value: root.playbackModel.tempoMultiplier
82+
from: 0.1
83+
to: 3.0
84+
stepSize: 0.05
85+
86+
fillBackground: false
87+
88+
onMoved: {
89+
root.playbackModel.tempoMultiplier = value
90+
}
91+
}
92+
}
93+
}
94+
}

src/playback/qml/MuseScore/Playback/internal/TempoSlider.qml src/playback/qml/MuseScore/Playback/internal/PlaybackSpeedSlider.qml

+30-37
Original file line numberDiff line numberDiff line change
@@ -19,73 +19,66 @@
1919
* You should have received a copy of the GNU General Public License
2020
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2121
*/
22-
import QtQuick 2.15
23-
import QtQuick.Layouts 1.15
22+
import QtQuick
23+
import QtQuick.Layouts
2424

25-
import Muse.UiComponents 1.0
26-
import Muse.Ui 1.0
25+
import Muse.UiComponents
26+
import Muse.Ui
27+
28+
import MuseScore.Playback
2729

2830
RowLayout {
2931
id: root
3032

31-
property real value: 0
32-
property real from: 0.1
33-
property real to: 3
34-
property real stepSize: 0.05
33+
property PlaybackToolBarModel playbackModel: null
3534

36-
signal moved(real newValue)
35+
property NavigationPanel navigationPanel: null
36+
property int navigationOrderStart: 0
3737

38-
height: 30
39-
spacing: 0
38+
spacing: 12
4039

4140
StyledTextLabel {
41+
Layout.fillWidth: true
4242
Layout.fillHeight: true
43-
Layout.alignment: Qt.AlignVCenter
4443

45-
text: qsTrc("playback", "Tempo")
44+
text: qsTrc("playback", "Speed")
4645
font: ui.theme.largeBodyFont
46+
horizontalAlignment: Text.AlignLeft
4747
}
4848

49-
Item {
50-
Layout.fillWidth: true
51-
Layout.fillHeight: true
52-
}
49+
IncrementalPropertyControl {
50+
Layout.preferredWidth: 76
51+
currentValue: (root.playbackModel.tempoMultiplier * 100).toFixed(decimals)
5352

54-
NumberInputField {
55-
value: Math.round(root.value * 100)
56-
minValue: root.from * 100
57-
maxValue: root.to * 100
53+
maxValue: 300
54+
minValue: 10
55+
step: 5
56+
measureUnitsSymbol: "%"
57+
decimals: 0
5858

59-
live: false
60-
61-
addLeadingZeros: false
62-
font: ui.theme.largeBodyFont
59+
navigation.panel: root.navigationPanel
60+
navigation.order: root.navigationOrderStart
61+
navigation.accessible.name: qsTrc("playback", "Speed")
6362

6463
onValueEdited: function(newValue) {
65-
root.moved(newValue / 100)
64+
root.playbackModel.tempoMultiplier = newValue / 100
6665
}
6766
}
6867

69-
StyledTextLabel {
70-
text: "%"
71-
font: ui.theme.largeBodyFont
72-
}
73-
7468
StyledSlider {
7569
id: slider
7670

7771
Layout.preferredWidth: root.width / 2
78-
Layout.leftMargin: 12
7972

80-
value: root.value
81-
from: root.from
82-
to: root.to
83-
stepSize: root.stepSize
73+
value: root.playbackModel.tempoMultiplier
74+
from: 0.1
75+
to: 3.0
76+
stepSize: 0.05
8477

8578
fillBackground: false
8679

8780
onMoved: {
88-
root.moved(slider.value)
81+
root.playbackModel.tempoMultiplier = value
8982
}
9083
}
9184
}

0 commit comments

Comments
 (0)