|
19 | 19 | * You should have received a copy of the GNU General Public License
|
20 | 20 | * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
21 | 21 | */
|
22 |
| -import QtQuick 2.15 |
23 |
| -import QtQuick.Layouts 1.15 |
| 22 | +import QtQuick |
| 23 | +import QtQuick.Layouts |
24 | 24 |
|
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 |
27 | 29 |
|
28 | 30 | RowLayout {
|
29 | 31 | id: root
|
30 | 32 |
|
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 |
35 | 34 |
|
36 |
| - signal moved(real newValue) |
| 35 | + property NavigationPanel navigationPanel: null |
| 36 | + property int navigationOrderStart: 0 |
37 | 37 |
|
38 |
| - height: 30 |
39 |
| - spacing: 0 |
| 38 | + spacing: 12 |
40 | 39 |
|
41 | 40 | StyledTextLabel {
|
| 41 | + Layout.fillWidth: true |
42 | 42 | Layout.fillHeight: true
|
43 |
| - Layout.alignment: Qt.AlignVCenter |
44 | 43 |
|
45 |
| - text: qsTrc("playback", "Tempo") |
| 44 | + text: qsTrc("playback", "Speed") |
46 | 45 | font: ui.theme.largeBodyFont
|
| 46 | + horizontalAlignment: Text.AlignLeft |
47 | 47 | }
|
48 | 48 |
|
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) |
53 | 52 |
|
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 |
58 | 58 |
|
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") |
63 | 62 |
|
64 | 63 | onValueEdited: function(newValue) {
|
65 |
| - root.moved(newValue / 100) |
| 64 | + root.playbackModel.tempoMultiplier = newValue / 100 |
66 | 65 | }
|
67 | 66 | }
|
68 | 67 |
|
69 |
| - StyledTextLabel { |
70 |
| - text: "%" |
71 |
| - font: ui.theme.largeBodyFont |
72 |
| - } |
73 |
| - |
74 | 68 | StyledSlider {
|
75 | 69 | id: slider
|
76 | 70 |
|
77 | 71 | Layout.preferredWidth: root.width / 2
|
78 |
| - Layout.leftMargin: 12 |
79 | 72 |
|
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 |
84 | 77 |
|
85 | 78 | fillBackground: false
|
86 | 79 |
|
87 | 80 | onMoved: {
|
88 |
| - root.moved(slider.value) |
| 81 | + root.playbackModel.tempoMultiplier = value |
89 | 82 | }
|
90 | 83 | }
|
91 | 84 | }
|
0 commit comments