-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
InputsOverlay.qml
159 lines (150 loc) · 5.04 KB
/
InputsOverlay.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/****************************************************************************
**
** QPrompt
** Copyright (C) 2021-2022 Javier O. Cordero Pérez
**
** This file is part of QPrompt.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, version 3 of the License.
**
** 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 <http://www.gnu.org/licenses/>.
**
****************************************************************************/
import QtQuick 2.12
import org.kde.kirigami 2.11 as Kirigami
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
Kirigami.OverlaySheet {
id: key_configuration_overlay
background: Rectangle {
color: appTheme.__backgroundColor
anchors.fill: parent
}
header: Kirigami.Heading {
text: i18n("Key Bindings")
level: 1
}
onSheetOpenChanged: prompterPage.actions.main.checked = sheetOpen
GridLayout {
id: buttonGrid
width: parent.width
columns: 2
// Toggle all buttons off
function toggleButtonsOff() {
for (let i=1; i<children.length; i+=2)
children[i].item.checked = false;
}
Component.onCompleted: {
keyInputTogglePrompter.setSource("KeyInputButton.qml", { "text": "F9" });
keyInputDecreaseVelocity.setSource("KeyInputButton.qml", { "text": "Up Arrow" });
keyInputIncreaseVelocity.setSource("KeyInputButton.qml", { "text": "Down Arrow" });
keyInputPlayPause.setSource("KeyInputButton.qml", { "text": "Spacebar" });
keyInputMoveBackwards.setSource("KeyInputButton.qml", { "text": "Page Up" });
keyInputMoveForward.setSource("KeyInputButton.qml", { "text": "Page Down" });
}
Connections {
target: keyInputTogglePrompter.item
function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); }
function onSetKey(key) { prompter.keys.toggle=key; }
}
Connections {
target: keyInputDecreaseVelocity.item
function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); }
function onSetKey(key) { prompter.keys.decreaseVelocity = key; }
}
Connections {
target: keyInputIncreaseVelocity.item
function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); }
function onSetKey(key) { prompter.keys.increaseVelocity = key; }
}
Connections {
target: keyInputPlayPause.item
function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); }
function onSetKey(key) { prompter.keys.pause = key; }
}
Connections {
target: keyInputMoveBackwards.item
function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); }
function onSetKey(key) { prompter.keys.skipBackwards = key; }
}
Connections {
target: keyInputMoveForward.item
function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); }
function onSetKey(key) { prompter.keys.skipForward = key; }
}
Label {
text: i18n("Toggle Prompter State")
}
Loader {
id: keyInputTogglePrompter
asynchronous: true
Layout.fillWidth: true
}
Label {
text: i18n("Decrease Velocity")
}
Loader {
id: keyInputDecreaseVelocity
asynchronous: true
Layout.fillWidth: true
}
Label {
text: i18n("Increase Velocity")
}
Loader {
id: keyInputIncreaseVelocity
asynchronous: true
Layout.fillWidth: true
}
Label {
text: i18n("Play/Pause")
}
Loader {
id: keyInputPlayPause
asynchronous: true
Layout.fillWidth: true
}
Label {
text: i18n("Move Backwards")
}
Loader {
id: keyInputMoveBackwards
asynchronous: true
Layout.fillWidth: true
}
Label {
text: i18n("Move Forward")
}
Loader {
id: keyInputMoveForward
asynchronous: true
Layout.fillWidth: true
}
/*
Label {
text: i18n("Go to Previous Marker")
}
Loader {
id: keyInputHome
asynchronous: true
Layout.fillWidth: true
}
Label {
text: i18n("Go to Next Marker")
}
Loader {
id: keyInputEnd
asynchronous: true
Layout.fillWidth: true
}
*/
}
}