This repository has been archived by the owner on May 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ui.qml
487 lines (364 loc) · 8.14 KB
/
ui.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
#ifdef KDEPLASMA
import org.kde.plasma.core 2.0
#endif
Item {
id: "root"
objectName: "root"
/* BACKGROUND IMAGE */
Image {
id: "backgroundimg"
objectName: "backgroundimg"
source: Python.get_background()
anchors.fill: parent
visible: false
MouseArea {
anchors.fill: parent
onClicked: {
searchfield.focus = false; windowsgrid.visible = true
}
}
}
ColorOverlay {
id: "background"
objectName: "background"
anchors.fill: backgroundimg
source: backgroundimg
property var overlaycolor: Python.get_background_overlay_color()
MouseArea {
anchors.fill: parent
onClicked: {
Python.background_clicked()
}
}
color: Qt.rgba(overlaycolor[0], overlaycolor[1], overlaycolor[2], overlaycolor[3])
}
/* SEARCH BAR */
TextField {
id: "searchfield"
objectName: "searchfield"
placeholderText: "Search applications…"
focus: true
width: 500
height: 30
anchors {
top: root.top
topMargin: 50
horizontalCenter: parent.horizontalCenter
}
style: TextFieldStyle {
background: Rectangle {
color: "#3A4055"
radius: 50
}
textColor: "white"
placeholderTextColor: "white"
}
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
onClicked: {
windowsgrid.visible = false
searchfield.focus = true
}
}
Keys.onReleased: {
if (searchfield.length == 0) {
windowsgrid.visible = true
appsgrid.visible = false
}
else {
appsloop.model = Python.search(searchfield.text)
windowsgrid.visible = false
appsgrid.visible = true
}
}
}
/* DOCK */
Rectangle {
id: "dockrect"
objectName: "dockrect"
color: "#3A4055"
property int dockHeight: dock.height + 20
width: 80
height: dockHeight
anchors {
left: root.left
verticalCenter: parent.verticalCenter
}
Component.onCompleted: {
if (! Python.is_dock_enabled()) {
visible = false
}
}
Column {
id: "dock"
objectName: "dock"
spacing: 10
leftPadding: 10
anchors {
leftMargin: 10
verticalCenter: parent.verticalCenter
}
Repeater {
id: "dockloop"
objectName: "dockloop"
model: Python.get_dock_items()
#ifdef KDEPLASMA
IconItem {
source: modelData[2]
width: units.iconSizes.huge
height: units.iconSizes.huge
#else
Image {
source: modelData[2]
#endif
MouseArea {
anchors.fill: parent
onClicked: {
Python.app_clicked(modelData[1])
}
}
}
}
}
}
/* WORKSPACES */
Rectangle {
id: "workspacerect"
objectName: "workspacerect"
color: "#3A4055"
property int workspaceHeight: workspaces.height + 20
width: 80
height: workspaceHeight
anchors {
right: root.right
verticalCenter: parent.verticalCenter
}
Column {
id: "workspaces"
objectName: "workspaces"
spacing: 10
leftPadding: 10
anchors {
leftMargin: 10
verticalCenter: parent.verticalCenter
//horizontalCenter: parent.horizontalCenter
}
Repeater {
id: "workspaceloop"
objectName: "workspaceloop"
model: Python.get_workspaces()
DropArea {
width: 64
height: 64
onDropped: {
Python.dropped_on_workspace(modelData, drag.source.dragdata[1]);
windowsloop.model = Python.get_windows(Python.get_current_workspace());
}
onEntered: console.log("entered")
Rectangle {
anchors {
fill: parent
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
Text {
text: modelData
anchors {
fill: parent
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
Component.onCompleted: {
if (Python.get_current_workspace() == modelData) {
parent.color = "lightblue";
}
if (! Python.is_workspaces_enabled()) {
workspacerect.visible = false;
}
}
}
MouseArea {
anchors.fill: parent
onClicked: {
Python.workspace_clicked(modelData)
}
}
}
}
}
}
}
/* WINDOWS */
Flickable {
id: "windowsscrollview"
objectName: "windowsscrollview"
anchors {
fill: parent
leftMargin: 270
rightMargin: 250
topMargin: 280
bottomMargin: 100
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
Flow {
id: "windowsgrid"
objectName: "windowsgrid"
spacing: 20
anchors {
fill: parent
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
Repeater {
id: "windowsloop"
model: Python.get_windows(Python.get_current_workspace())
#ifdef KDEPLASMA
WindowThumbnail {
winId: modelData[2]
width: 288
height: 140
#else
Image {
source: modelData[2]
width: (sourceSize.width / 10) * 2
height: (sourceSize.height / 10) * 2
#endif
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
onPressed: {
if (pressedButtons & Qt.LeftButton) {
Python.window_clicked(modelData[1])
}
else {
if (pressedButtons & Qt.MiddleButton) {
if (Python.is_midbutton_enabled()) {
Python.window_clicked_midbutton(modelData[1])
parent.visible = false
}
}
}
}
}
Rectangle {
id: "windowoverlay"
color: "#3A4055"
property var dragdata: modelData
height: windowoverlaytext.paintedHeight + 2
width: 288 + 2
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
Drag.active: windowMouseArea.drag.active
Drag.dragType: Drag.Automatic
states: State {
when: windowMouseArea.drag.active
ParentChange { target: windowoverlay;
parent: root }
AnchorChanges { target: windowoverlay;
anchors.verticalCenter: undefined;
anchors.horizontalCenter: undefined;
anchors.bottom: undefined; }
}
onXChanged: {
if (windowMouseArea.drag.active) {
windowoverlay.x = x
}
}
onYChanged: {
if (windowMouseArea.drag.active) {
windowoverlay.y = y
}
}
MouseArea {
id: windowMouseArea
anchors.fill: parent
onReleased: parent.Drag.drop()
drag.target: parent
drag.axis: Drag.XandYAxis
}
Text {
id: "windowoverlaytext"
text: modelData[0]
color: "#fff"
width: 288
elide: Text.ElideMiddle
horizontalAlignment: Text.AlignHCenter
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
}
}
}
}
}
/* APPS */
Flow {
visible: false
id: "appsgrid"
objectName: "appsgrid"
spacing: 50
anchors {
fill: parent
leftMargin: 270
rightMargin: 250
topMargin: 280
bottomMargin: 100
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
Repeater {
id: "appsloop"
objectName: "appsloop"
model: [['Name', 'EntryName', 'IconPath']]
#ifdef KDEPLASMA
IconItem {
source: modelData[2]
height: units.iconSizes.huge
width: units.iconSizes.huge
#else
Image {
source: modelData[2]
#endif
MouseArea {
anchors.fill: parent
onClicked: {
Python.app_clicked(modelData[1])
}
}
Rectangle {
id: "applabel"
color: "transparent"
height: applabeltext.paintedHeight + 2
width: parent.paintedWidth + 20
anchors {
top: parent.bottom
horizontalCenter: parent.horizontalCenter
}
Text {
id: "applabeltext"
text: modelData[0]
color: "#fff"
width: parent.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
}
}
}
}
}