-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
613 lines (566 loc) · 20.1 KB
/
main.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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.LocalStorage 2.0
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Extras 1.4
import "adbCommands.js" as ADB
import "mainLogic.js" as JS
import "sqlDatabase.js" as SQL
ApplicationWindow {
id: root
width: windowWidth
height: windowHeight
x: SQL.windowHandler("window_x")
y: SQL.windowHandler("window_y")
minimumHeight: 369
minimumWidth: 375
visible: true
title: applicationTitle + version
// VERSION
property string version: " v1.2.6.5"
property string github: "https://github.com/ghcosta87/ADB-Manager.git"
// DATABASE
property string dbId: 'MyData'
property string dbVersion: '2.0'
property string dbDescription: 'Database application'
property int dbsize: 1000000
// COLORS
property string myBackground: "#3c3c3c"
property string myMenuBar: "#606060"
property string consoleColor: "#181818"
property string consoleBorderColor: "#6c6c6c"
property string consoleTitleColor: "#0c0c0c"
property string noColor: "#00000000"
property string buttonPressed: "#d7d7d7"
property string buttonRealeased: "#545454"
property string textColor: "white"
// SIZES SETTINGS
property int windowWidth: SQL.windowHandler("window_width")
property int windowHeight: SQL.windowHandler("window_height")
property int menuWidth: 100
property int buttonWidth: appWindow.width * (45 / 100)
property int buttonHeight: appWindow.height * (10 / 100)
property int marginWidth: appWindow.width * (2 / 100)
property int marginHeight: appWindow.height * (2 / 100)
property int cellWidthProp: appWindow.width * (50 / 100)
property int cellHeightProp: appWindow.height * (25 / 100)
property int celula_marca_width: appWindow.width * 0.008
property int celula_marca_height: appWindow.height * 0.008
property int inputTextHeight: appWindow.height * 0.08
property int consoleLogLineNumbers
// STRINGS
property string connectDevice: "CONNECT"
property string removeDevice: "DISCONNECT"
property string arrow: "▶"
property string selectionText: "SELECT"
property string searchButtonText: "SEARCH"
property string backButtonText: "BACK"
property string searchHint: "Wich device are you looking for?"
property string addDevice: "ADD DEVICE"
property string loadDevice: "LOAD FROM CONNECTED DEVICE"
property string setWifi: "ACTIVATE WI-FI"
property string toSettingsPage: "SETTINGS"
property string previousPage: "BACK"
property string applicationTitle: "Android Debug Bridge - Manager"
// CONTROL VARIABLES
property bool click
property bool lockPosition
property bool mainPageFirstTime
property bool settingsPAgeFirstTime
property bool debugStarted
property bool remoteImageSelected
property int currentPage
property var imageSelection
property int maximumImageResults: 10
property int gridSelectedItem
//JAVA PROPERTIES
property int id_device_quantity: 0
property int id_select_all: 1
property int id_delete_item: 2
property string select_all: 'SELEC * FROM dispositivos'
property string delete_item: 'DELETE FROM dispositivos WHERE rowid=?'
// ACTIONS
function mainActions(actionSelected) {
switch (actionSelected) {
case 0:
appWindow.close()
break
}
}
property int close_window: 0
Component.onCompleted: {
consoleLogLineNumbers = 0
runScript.console_fill()
ADB.load_content()
}
Component.onDestruction: {
SQL.setSavedData()
}
// DEBUGS
Page {
visible: false
property alias consoleLog: consoleLog
Text {
id: consoleLog
}
property alias debug_field_1: debug_field_1
Text {
id: debug_field_1
}
property alias debug_field_2: debug_field_2
Text {
id: debug_field_2
}
property alias debug_field_3: debug_field_3
Text {
id: debug_field_3
}
property alias debug_field_4: debug_field_4
Text {
id: debug_field_4
}
property alias debug_field_5: debug_field_5
Text {
id: debug_field_5
}
property alias debug_field_6: debug_field_6
Text {
id: debug_field_6
}
property alias debug_field_7: debug_field_7
Text {
id: debug_field_7
}
property alias debug_field_8: debug_field_8
Text {
id: debug_field_8
}
}
// GLOBAL CONTROL VARIABLES
Page {
visible: false
property alias loading_gif_visibility: loading_gif_visibility
Text {
id: loading_gif_visibility
}
property alias loading_text_visibility: loading_text_visibility
Text {
id: loading_text_visibility
}
property alias loading_text_context: loading_text_context
Text {
id: loading_text_context
}
property alias console_title_text: console_title_text
Text {
id: console_title_text
}
property alias console_area_text: console_area_text
Text {
id: console_area_text
}
property alias loading_timer_control: loading_timer_control
Text {
id: loading_timer_control
}
property alias loading_iamge_gif_visibility: loading_iamge_gif_visibility
Text {
id: loading_iamge_gif_visibility
}
property alias grid_updater_timer: grid_updater_timer
Text {
id: grid_updater_timer
}
}
Timer {
id: killDelay
interval: 1000
repeat: false
onTriggered: {
runScript.console_fill()
}
}
Rectangle {
id: appWindow
anchors.fill: parent
StackView {
id: stackView
anchors {
top: globalMenu.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
initialItem: mainPage
pushEnter: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to: 1
duration: 500
}
}
pushExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to: 0
duration: 500
}
}
Component {
id: mainPage
MainPage {}
}
Component {
id: settingsPage
SettingsPage {}
}
}
Item {
id: globalMenu
height: parent.height * 0.05
anchors {
top: parent.top
left: parent.left
right: parent.right
}
Rectangle {
id: globalMenuContainer
color: myMenuBar
anchors.fill: parent
border.width: 1
}
Rectangle {
id: subMenuFile
color: noColor
border.width: 1
width: menuWidth
height: globalMenuContainer.height
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
Text {
anchors.fill: parent
anchors.leftMargin: 5
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
text: "<u>A</u>rquivos"
textFormat: Text.RichText
}
MouseArea {
anchors.fill: parent
onClicked: {
contextFile.open()
}
Menu {
id: contextFile
y: (parent.height)
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "height"
from: 0
to: contextFile.implicitHeight
duration: 100
}
NumberAnimation {
property: "width"
from: 0
to: contextFile.implicitWidth
duration: 100
}
}
}
exit: Transition {
ParallelAnimation {
NumberAnimation {
property: "height"
from: contextFile.implicitHeight
to: 0
duration: 100
}
NumberAnimation {
property: "width"
from: contextFile.implicitWidth
to: 0
duration: 100
}
}
}
MenuItem {
text: "Import Database"
onClicked: {
}
}
MenuItem {
text: "Export Database"
onClicked: {
}
}
MenuSeparator {
padding: 0
topPadding: 12
bottomPadding: 12
contentItem: Rectangle {
implicitWidth: 200
implicitHeight: 1
color: "#1E000000"
}
}
MenuItem {
text: "Add new device"
onClicked: {
stackView.push(settingsPage)
}
}
MenuItem {
text: "Remove device"
onClicked: {
if (SQL.removeSelectedDevice(gridSelectedItem))
grid_updater_timer.text = "true"
}
}
MenuSeparator {
padding: 0
topPadding: 12
bottomPadding: 12
contentItem: Rectangle {
implicitWidth: 200
implicitHeight: 1
color: "#1E000000"
}
}
MenuItem {
text: "Exit"
onClicked: {
close()
}
}
}
}
}
Rectangle {
id: subMenuDevice
color: "#00000000"
border.width: 1
width: menuWidth
height: globalMenuContainer.height
anchors {
top: parent.top
bottom: parent.bottom
left: subMenuFile.right
}
Text {
anchors.fill: parent
anchors.leftMargin: 5
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
text: "<u>D</u>ispositivos"
textFormat: Text.RichText
}
MouseArea {
anchors.fill: parent
onClicked: {
contextDevice.open()
}
Menu {
id: contextDevice
y: (parent.height)
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "height"
from: 0
to: contextDevice.implicitHeight + 20
duration: 100
}
NumberAnimation {
property: "width"
from: 0
to: contextDevice.implicitWidth
duration: 100
}
}
}
exit: Transition {
ParallelAnimation {
NumberAnimation {
property: "height"
from: contextDevice.implicitHeight
to: 0
duration: 100
}
NumberAnimation {
property: "width"
from: contextDevice.implicitWidth
to: 0
duration: 100
}
}
}
MenuItem {
text: "Search for connection"
onClicked: {
runScript.console_fill()
loading_gif_visibility.text = "true"
loading_text_visibility.text = "true"
loading_text_context.text = "Loading ..."
loading_timer_control.text = "true"
}
}
MenuItem {
text: "Add new device"
onClicked: {
stackView.push(settingsPage)
}
}
MenuItem {
text: "Remove device"
onClicked: {
}
}
MenuSeparator {
padding: 0
topPadding: 12
bottomPadding: 12
contentItem: Rectangle {
implicitWidth: 200
implicitHeight: 1
color: "#1E000000"
}
}
MenuItem {
text: "Set Wi-fi connection"
onClicked: {
runScript.setWifiConnection()
}
}
MenuItem {
text: "Disconnect Wi-fi connection"
onClicked: {
runScript.desconectar_dispositivos()
}
}
MenuItem {
text: "Kill server"
onClicked: {
runScript.desconectar_dispositivos()
killDelay.start()
}
}
}
}
}
Rectangle {
id: subMenuHelp
color: "#00000000"
border.width: 1
width: menuWidth
height: globalMenuContainer.height
anchors {
top: parent.top
bottom: parent.bottom
left: subMenuDevice.right
}
Text {
anchors.fill: parent
anchors.leftMargin: 5
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
text: "<u>A</u>juda"
textFormat: Text.RichText
}
MouseArea {
anchors.fill: parent
onClicked: {
contextHelp.open()
}
Menu {
id: contextHelp
y: (parent.height)
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "height"
from: 0
to: contextHelp.implicitHeight
duration: 100
}
NumberAnimation {
property: "width"
from: 0
to: contextHelp.implicitWidth
duration: 100
}
}
}
exit: Transition {
ParallelAnimation {
NumberAnimation {
property: "height"
from: contextHelp.implicitHeight
to: 0
duration: 100
}
NumberAnimation {
property: "width"
from: contextHelp.implicitWidth
to: 0
duration: 100
}
}
}
MenuItem {
text: "Manual"
onClicked: {
}
}
MenuItem {
text: "About"
onClicked: {
aboutStackView.push(aboutPage)
}
}
}
}
}
}
StackView {
id: aboutStackView
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
right: parent.right
topMargin: parent.height * 0.3
bottomMargin: parent.height * 0.3
leftMargin: parent.width * 0.2
rightMargin: parent.width * 0.2
}
pushEnter: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to: 1
duration: 500
}
}
pushExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to: 0
duration: 500
}
}
Component {
id: aboutPage
About {}
}
}
}
}