Skip to content

Latest commit

 

History

History
440 lines (404 loc) · 19.6 KB

MenuFingerterm.qml

File metadata and controls

440 lines (404 loc) · 19.6 KB
 
Feb 20, 2013
Feb 20, 2013
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm 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, either version 2 of the License, or
(at your option) any later version.
FingerTerm 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 FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
Jul 22, 2013
Jul 22, 2013
20
21
import QtQuick 2.0
import QtQuick.XmlListModel 2.0
Jun 27, 2016
Jun 27, 2016
22
import FingerTerm 1.0
Feb 20, 2013
Feb 20, 2013
23
Jun 8, 2016
Jun 8, 2016
24
Item {
Feb 20, 2013
Feb 20, 2013
25
id: menuWin
May 4, 2016
May 4, 2016
26
27
28
property bool showing
Jun 8, 2016
Jun 8, 2016
29
visible: rect.x < menuWin.width
Feb 20, 2013
Feb 20, 2013
30
31
32
Rectangle {
id: fader
May 4, 2016
May 4, 2016
33
Sep 20, 2013
Sep 20, 2013
34
color: "#000000"
Jun 8, 2016
Jun 8, 2016
35
opacity: menuWin.showing ? 0.5 : 0.0
Jun 8, 2016
Jun 8, 2016
36
anchors.fill: parent
May 4, 2016
May 4, 2016
37
Jun 8, 2016
Jun 8, 2016
38
39
Behavior on opacity { NumberAnimation { duration: 100; } }
Feb 20, 2013
Feb 20, 2013
40
41
MouseArea {
anchors.fill: parent
Jun 8, 2016
Jun 8, 2016
42
onClicked: menuWin.showing = false
Feb 20, 2013
Feb 20, 2013
43
44
45
46
}
}
Rectangle {
id: rect
May 4, 2016
May 4, 2016
47
Feb 20, 2013
Feb 20, 2013
48
color: "#e0e0e0"
Jun 8, 2016
Jun 8, 2016
49
50
anchors.left: parent.right
anchors.leftMargin: menuWin.showing ? -width : 1
Dec 18, 2014
Dec 18, 2014
51
width: flickableContent.width + 22*window.pixelRatio;
Feb 20, 2013
Feb 20, 2013
52
53
54
55
56
57
58
height: menuWin.height
MouseArea {
// event eater
anchors.fill: parent
}
Jun 8, 2016
Jun 8, 2016
59
Behavior on anchors.leftMargin {
Feb 20, 2013
Feb 20, 2013
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
NumberAnimation { duration: 100; easing.type: Easing.InOutQuad; }
}
XmlListModel {
id: xmlModel
xml: term.getUserMenuXml()
query: "/userMenu/item"
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "command"; query: "command/string()" }
XmlRole { name: "disableOn"; query: "disableOn/string()" }
}
Component {
id: xmlDelegate
Button {
text: title
isShellCommand: true
Jun 8, 2016
Jun 8, 2016
78
enabled: disableOn.length === 0 || util.windowTitle.search(disableOn) === -1
Feb 20, 2013
Feb 20, 2013
79
onClicked: {
Jun 8, 2016
Jun 8, 2016
80
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
81
82
83
84
85
86
term.putString(command, true);
}
}
}
Rectangle {
Dec 18, 2014
Dec 18, 2014
87
88
89
y: menuFlickArea.visibleArea.yPosition*menuFlickArea.height + window.scrollBarWidth
x: parent.width-window.paddingMedium
width: window.scrollBarWidth
Feb 20, 2013
Feb 20, 2013
90
height: menuFlickArea.visibleArea.heightRatio*menuFlickArea.height
Dec 18, 2014
Dec 18, 2014
91
radius: 3*window.pixelRatio
Feb 20, 2013
Feb 20, 2013
92
93
94
95
96
color: "#202020"
}
Flickable {
id: menuFlickArea
Jun 8, 2016
Jun 8, 2016
97
Feb 20, 2013
Feb 20, 2013
98
anchors.fill: parent
Dec 18, 2014
Dec 18, 2014
99
100
101
102
anchors.topMargin: window.scrollBarWidth
anchors.bottomMargin: window.scrollBarWidth
anchors.leftMargin: window.scrollBarWidth
anchors.rightMargin: 16*window.pixelRatio
Feb 20, 2013
Feb 20, 2013
103
104
105
106
contentHeight: flickableContent.height
Column {
id: flickableContent
Jun 8, 2016
Jun 8, 2016
107
Dec 18, 2014
Dec 18, 2014
108
spacing: 12*window.pixelRatio
Feb 20, 2013
Feb 20, 2013
109
110
111
Row {
id: menuBlocksRow
Dec 18, 2014
Dec 18, 2014
112
spacing: 8*window.pixelRatio
Feb 20, 2013
Feb 20, 2013
113
114
Column {
Dec 18, 2014
Dec 18, 2014
115
spacing: 12*window.pixelRatio
Feb 20, 2013
Feb 20, 2013
116
117
118
119
120
121
122
Repeater {
model: xmlModel
delegate: xmlDelegate
}
}
Column {
Dec 18, 2014
Dec 18, 2014
123
spacing: 12*window.pixelRatio
Feb 20, 2013
Feb 20, 2013
124
125
126
127
128
Row {
Button {
text: "Copy"
onClicked: {
Jun 8, 2016
Jun 8, 2016
129
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
130
131
term.copySelectionToClipboard();
}
Dec 18, 2014
Dec 18, 2014
132
133
width: window.buttonWidthHalf
height: window.buttonHeightLarge
Jun 8, 2016
Jun 8, 2016
134
enabled: util.terminalHasSelection
Feb 20, 2013
Feb 20, 2013
135
136
137
138
}
Button {
text: "Paste"
onClicked: {
Jun 8, 2016
Jun 8, 2016
139
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
140
141
term.pasteFromClipboard();
}
Dec 18, 2014
Dec 18, 2014
142
143
width: window.buttonWidthHalf
height: window.buttonHeightLarge
Jun 8, 2016
Jun 8, 2016
144
enabled: util.canPaste
Feb 20, 2013
Feb 20, 2013
145
146
147
148
}
}
Button {
text: "URL grabber"
Dec 18, 2014
Dec 18, 2014
149
150
width: window.buttonWidthLarge
height: window.buttonHeightLarge
Feb 20, 2013
Feb 20, 2013
151
onClicked: {
Jun 8, 2016
Jun 8, 2016
152
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
153
urlWindow.urls = term.grabURLsFromBuffer();
Jun 27, 2016
Jun 27, 2016
154
urlWindow.show = true
Feb 20, 2013
Feb 20, 2013
155
156
157
}
}
Rectangle {
Dec 18, 2014
Dec 18, 2014
158
159
160
width: window.buttonWidthLarge
height: window.buttonHeightLarge
radius: window.radiusSmall
Feb 20, 2013
Feb 20, 2013
161
162
163
color: "#606060"
border.color: "#000000"
border.width: 1
May 4, 2016
May 4, 2016
164
Feb 20, 2013
Feb 20, 2013
165
166
Column {
Text {
Dec 18, 2014
Dec 18, 2014
167
168
width: window.buttonWidthLarge
height: window.headerHeight
Feb 20, 2013
Feb 20, 2013
169
color: "#ffffff"
Dec 18, 2014
Dec 18, 2014
170
font.pointSize: window.uiFontSize-1
Feb 20, 2013
Feb 20, 2013
171
172
173
174
175
176
177
text: "Font size"
horizontalAlignment: Text.AlignHCenter
}
Row {
Button {
text: "<font size=\"+3\">+</font>"
onClicked: {
Jun 27, 2016
Jun 27, 2016
178
util.fontSize = util.fontSize + window.pixelRatio
Jun 27, 2016
Jun 27, 2016
179
util.notifyText(term.columns + "×" + term.rows);
Feb 20, 2013
Feb 20, 2013
180
}
Dec 18, 2014
Dec 18, 2014
181
182
width: window.buttonWidthHalf
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
183
184
185
186
}
Button {
text: "<font size=\"+3\">-</font>"
onClicked: {
Jun 27, 2016
Jun 27, 2016
187
util.fontSize = util.fontSize - window.pixelRatio
Jun 27, 2016
Jun 27, 2016
188
util.notifyText(term.columns + "×" + term.rows);
Feb 20, 2013
Feb 20, 2013
189
}
Dec 18, 2014
Dec 18, 2014
190
191
width: window.buttonWidthHalf
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
192
193
194
195
}
}
}
}
Aug 14, 2013
Aug 14, 2013
196
Rectangle {
Dec 18, 2014
Dec 18, 2014
197
198
199
width: window.buttonWidthLarge
height: window.buttonHeightLarge
radius: window.radiusSmall
Aug 14, 2013
Aug 14, 2013
200
201
202
color: "#606060"
border.color: "#000000"
border.width: 1
May 4, 2016
May 4, 2016
203
Aug 14, 2013
Aug 14, 2013
204
205
Column {
Text {
Dec 18, 2014
Dec 18, 2014
206
207
width: window.buttonWidthLarge
height: window.headerHeight
Aug 14, 2013
Aug 14, 2013
208
color: "#ffffff"
Dec 18, 2014
Dec 18, 2014
209
font.pointSize: window.uiFontSize-1
Aug 14, 2013
Aug 14, 2013
210
211
212
213
214
215
text: "UI Orientation"
horizontalAlignment: Text.AlignHCenter
}
Row {
Button {
text: "<font size=\"-1\">Auto</font>"
Jun 27, 2016
Jun 27, 2016
216
217
highlighted: util.orientationMode == Util.OrientationAuto
onClicked: util.orientationMode = Util.OrientationAuto
Dec 18, 2014
Dec 18, 2014
218
219
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Aug 14, 2013
Aug 14, 2013
220
221
222
}
Button {
text: "<font size=\"-1\">L<font>"
Jun 27, 2016
Jun 27, 2016
223
224
highlighted: util.orientationMode == Util.OrientationLandscape
onClicked: util.orientationMode = Util.OrientationLandscape
Dec 18, 2014
Dec 18, 2014
225
226
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Aug 14, 2013
Aug 14, 2013
227
228
229
}
Button {
text: "<font size=\"-1\">P</font>"
Jun 27, 2016
Jun 27, 2016
230
231
highlighted: util.orientationMode == Util.OrientationPortrait
onClicked: util.orientationMode = Util.OrientationPortrait
Dec 18, 2014
Dec 18, 2014
232
233
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Aug 14, 2013
Aug 14, 2013
234
235
236
237
}
}
}
}
Feb 20, 2013
Feb 20, 2013
238
Rectangle {
Dec 18, 2014
Dec 18, 2014
239
240
241
width: window.buttonWidthLarge
height: window.buttonHeightLarge
radius: window.radiusSmall
Feb 20, 2013
Feb 20, 2013
242
243
244
color: "#606060"
border.color: "#000000"
border.width: 1
May 4, 2016
May 4, 2016
245
Feb 20, 2013
Feb 20, 2013
246
247
Column {
Text {
Dec 18, 2014
Dec 18, 2014
248
249
width: window.buttonWidthLarge
height: window.headerHeight
Feb 20, 2013
Feb 20, 2013
250
color: "#ffffff"
Dec 18, 2014
Dec 18, 2014
251
font.pointSize: window.uiFontSize-1
Feb 20, 2013
Feb 20, 2013
252
253
254
255
256
257
text: "Drag mode"
horizontalAlignment: Text.AlignHCenter
}
Row {
Button {
text: "<font size=\"-1\">Gesture</font>"
Jun 27, 2016
Jun 27, 2016
258
highlighted: util.dragMode == Util.DragGestures
Feb 20, 2013
Feb 20, 2013
259
onClicked: {
Jun 27, 2016
Jun 27, 2016
260
util.dragMode = Util.DragGestures
Feb 20, 2013
Feb 20, 2013
261
term.clearSelection();
Jun 8, 2016
Jun 8, 2016
262
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
263
}
Dec 18, 2014
Dec 18, 2014
264
265
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
266
267
268
}
Button {
text: "<font size=\"-1\">Scroll</font>"
Jun 27, 2016
Jun 27, 2016
269
highlighted: util.dragMode == Util.DragScroll
Feb 20, 2013
Feb 20, 2013
270
onClicked: {
Jun 27, 2016
Jun 27, 2016
271
util.dragMode = Util.DragScroll
Feb 20, 2013
Feb 20, 2013
272
term.clearSelection();
Jun 8, 2016
Jun 8, 2016
273
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
274
}
Dec 18, 2014
Dec 18, 2014
275
276
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
277
278
279
}
Button {
text: "<font size=\"-1\">Select</font>"
Jun 27, 2016
Jun 27, 2016
280
highlighted: util.dragMode == Util.DragSelect
Feb 20, 2013
Feb 20, 2013
281
onClicked: {
Jun 27, 2016
Jun 27, 2016
282
util.dragMode = Util.DragSelect
Jun 8, 2016
Jun 8, 2016
283
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
284
}
Dec 18, 2014
Dec 18, 2014
285
286
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
287
288
289
290
291
}
}
}
}
Rectangle {
Dec 18, 2014
Dec 18, 2014
292
293
294
width: window.buttonWidthLarge
height: window.buttonHeightLarge
radius: window.radiusSmall
Feb 20, 2013
Feb 20, 2013
295
296
297
color: "#606060"
border.color: "#000000"
border.width: 1
May 4, 2016
May 4, 2016
298
Feb 20, 2013
Feb 20, 2013
299
300
Column {
Text {
Dec 18, 2014
Dec 18, 2014
301
302
width: window.buttonWidthLarge
height: window.headerHeight
Feb 20, 2013
Feb 20, 2013
303
color: "#ffffff"
Dec 18, 2014
Dec 18, 2014
304
font.pointSize: window.uiFontSize-1
Feb 20, 2013
Feb 20, 2013
305
306
307
308
309
310
text: "VKB behavior"
horizontalAlignment: Text.AlignHCenter
}
Row {
Button {
text: "Off"
Jun 27, 2016
Jun 27, 2016
311
highlighted: util.keyboardMode == Util.KeyboardOff
Feb 20, 2013
Feb 20, 2013
312
onClicked: {
Jun 27, 2016
Jun 27, 2016
313
util.keyboardMode = Util.KeyboardOff
Aug 14, 2013
Aug 14, 2013
314
window.setTextRenderAttributes();
Jun 8, 2016
Jun 8, 2016
315
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
316
}
Dec 18, 2014
Dec 18, 2014
317
318
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
319
320
321
}
Button {
text: "Fade"
Jun 27, 2016
Jun 27, 2016
322
highlighted: util.keyboardMode == Util.KeyboardFade
Feb 20, 2013
Feb 20, 2013
323
onClicked: {
Jun 27, 2016
Jun 27, 2016
324
util.keyboardMode = Util.KeyboardFade
Aug 14, 2013
Aug 14, 2013
325
window.setTextRenderAttributes();
Jun 8, 2016
Jun 8, 2016
326
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
327
}
Dec 18, 2014
Dec 18, 2014
328
329
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
330
331
332
}
Button {
text: "Move"
Jun 27, 2016
Jun 27, 2016
333
highlighted: util.keyboardMode == Util.KeyboardMove
Feb 20, 2013
Feb 20, 2013
334
onClicked: {
Jun 27, 2016
Jun 27, 2016
335
util.keyboardMode = Util.KeyboardMove
Aug 14, 2013
Aug 14, 2013
336
window.setTextRenderAttributes();
Jun 8, 2016
Jun 8, 2016
337
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
338
}
Dec 18, 2014
Dec 18, 2014
339
340
width: window.buttonWidthSmall
height: window.buttonHeightSmall
Feb 20, 2013
Feb 20, 2013
341
342
343
344
345
346
347
}
}
}
}
Button {
text: "New window"
onClicked: {
Jun 8, 2016
Jun 8, 2016
348
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
349
350
351
352
353
354
util.openNewWindow();
}
}
Button {
text: "VKB layout..."
onClicked: {
Jun 8, 2016
Jun 8, 2016
355
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
356
layoutWindow.layouts = keyLoader.availableLayouts();
Jun 27, 2016
Jun 27, 2016
357
layoutWindow.show = true
Feb 20, 2013
Feb 20, 2013
358
359
360
361
362
}
}
Button {
text: "About"
onClicked: {
Jun 8, 2016
Jun 8, 2016
363
menuWin.showing = false;
Jun 27, 2016
Jun 27, 2016
364
aboutDialog.show = true
Feb 20, 2013
Feb 20, 2013
365
366
367
368
369
}
}
Button {
text: "Quit"
onClicked: {
Jun 8, 2016
Jun 8, 2016
370
menuWin.showing = false;
Feb 20, 2013
Feb 20, 2013
371
372
373
374
375
376
377
378
Qt.quit();
}
}
}
}
// VKB delay slider
Rectangle {
id: vkbDelaySliderArea
May 4, 2016
May 4, 2016
379
Feb 20, 2013
Feb 20, 2013
380
width: menuBlocksRow.width
Dec 18, 2014
Dec 18, 2014
381
382
height: window.buttonHeightLarge
radius: window.radiusSmall
Feb 20, 2013
Feb 20, 2013
383
384
385
color: "#606060"
border.color: "#000000"
border.width: 1
May 4, 2016
May 4, 2016
386
Feb 20, 2013
Feb 20, 2013
387
388
Text {
width: parent.width
Dec 18, 2014
Dec 18, 2014
389
height: window.headerHeight
Feb 20, 2013
Feb 20, 2013
390
color: "#ffffff"
Dec 18, 2014
Dec 18, 2014
391
font.pointSize: window.uiFontSize-1
Jun 27, 2016
Jun 27, 2016
392
text: "VKB delay: " + vkbDelaySlider.keyboardFadeOutDelay + " ms"
Feb 20, 2013
Feb 20, 2013
393
394
395
horizontalAlignment: Text.AlignHCenter
}
Rectangle {
Dec 18, 2014
Dec 18, 2014
396
x: window.paddingSmall
Feb 20, 2013
Feb 20, 2013
397
y: vkbDelaySlider.y + vkbDelaySlider.height/2 - height/2
Dec 18, 2014
Dec 18, 2014
398
399
400
width: menuBlocksRow.width - window.paddingMedium
height: window.paddingMedium
radius: window.radiusSmall
Feb 20, 2013
Feb 20, 2013
401
402
403
404
color: "#909090"
}
Rectangle {
id: vkbDelaySlider
May 4, 2016
May 4, 2016
405
Jun 27, 2016
Jun 27, 2016
406
property int keyboardFadeOutDelay: util.keyboardFadeOutDelay
May 4, 2016
May 4, 2016
407
Dec 18, 2014
Dec 18, 2014
408
409
410
411
y: window.headerHeight
width: window.buttonWidthSmall
radius: window.radiusLarge
height: parent.height-window.headerHeight
Feb 20, 2013
Feb 20, 2013
412
413
414
color: "#202020"
onXChanged: {
if (vkbDelaySliderMA.drag.active)
Jun 27, 2016
Jun 27, 2016
415
vkbDelaySlider.keyboardFadeOutDelay =
Feb 20, 2013
Feb 20, 2013
416
417
Math.floor((1000+vkbDelaySlider.x/vkbDelaySliderMA.drag.maximumX*9000)/250)*250;
}
Jun 27, 2016
Jun 27, 2016
418
419
420
421
Component.onCompleted: {
x = (keyboardFadeOutDelay-1000)/9000 * (vkbDelaySliderArea.width - vkbDelaySlider.width)
}
Feb 20, 2013
Feb 20, 2013
422
423
424
425
426
427
428
429
430
MouseArea {
id: vkbDelaySliderMA
anchors.fill: parent
drag.target: vkbDelaySlider
drag.axis: Drag.XAxis
drag.minimumX: 0
drag.maximumX: vkbDelaySliderArea.width - vkbDelaySlider.width
drag.onActiveChanged: {
if (!drag.active) {
Jun 27, 2016
Jun 27, 2016
431
util.keyboardFadeOutDelay = vkbDelaySlider.keyboardFadeOutDelay
Feb 20, 2013
Feb 20, 2013
432
433
434
435
436
437
438
439
440
}
}
}
}
}
}
}
}
}