forked from opelpanfan/PowerTune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSerialSettings.qml
2064 lines (1901 loc) · 99 KB
/
SerialSettings.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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import QtQuick 2.8
import QtQuick.Controls 1.4 as Quick1
import QtQuick.Controls 2.1
import Qt.labs.settings 1.0
import QtSensors 5.0
import QtQuick.Controls.Styles 1.4
import QtMultimedia 5.8
import "qrc:/Gauges/"
import DLM 1.0
import QtQuick.VirtualKeyboard 2.1
Quick1.TabView {
id: tabView
anchors.fill: parent
property int lastdashamount
DLM
{
id:downloadManager
}
Rectangle{
id: keyboardcontainer
color: "darkgrey"
visible: false
width :500
height:180
z:220
MouseArea {
id: touchAkeyboardcontainer
anchors.fill:parent
drag.target: keyboardcontainer
}
InputPanel {
id: keyboard
anchors.fill: parent
visible: false
states: State {
name: "visible";
when: keyboard.active;
PropertyChanges {
target: keyboard;
visible: true
}
PropertyChanges {
target: keyboardcontainer;
visible: true;
x:300
y:200
}
}
}
}
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {
id:tabrect
color: styleData.selected ? "grey" :"lightgrey"
border.color: "steelblue"
implicitWidth: Math.max(text.width + 4, 80)
implicitHeight: 50
radius: 2
Text {
id: text
anchors.centerIn: parent
font.pixelSize: tabView.width / 55
text: styleData.title
color: styleData.selected ? "white" : "black"
}
}
frame: Rectangle { color: "steelblue" }
}
Quick1.Tab {
title: "Main"
anchors.fill: parent
Rectangle {
id: windowbackround
anchors.fill: parent
color: "grey"
property int test1: 0
property int connected: 0
property var gpscom
property int hexstring;
property int hexstring2;
Item {
id: powerTuneSettings
Settings {
//property alias brightnessselect: brightness.value
// property alias connectAtStartUp: connectAtStart.checked
property alias connectECUAtStartup: connectButton.enabled
property alias connectGPSAtStartup: connectButtonGPS.enabled
//property alias gpsswitch: gpsswitch.checked
property alias serialPortName: serialName.currentText
property alias gpsPortName: serialNameGPS.currentText
property alias gpsPortNameindex: serialNameGPS.currentIndex
//property alias gpsBaud: serialGPSBaud.currentText
//property alias gpsBaudindex: serialGPSBaud.currentIndex
property alias ecuType: ecuSelect.currentText
property alias auxunit1: unitaux1.text
property alias aux1: an1V0.text
property alias aux2: an2V5.text
property alias auxunit2: unitaux2.text
property alias aux3: an3V0.text
property alias aux4: an4V5.text
property alias goProVariant: goProSelect.currentIndex
property alias password: goPropass.text
property alias vehicleweight: weight.text
property alias unitSelector1: unitSelect1.currentIndex
property alias unitSelector: unitSelect.currentIndex
property alias unitSelector2: unitSelect2.currentIndex
property alias odometervalue: odometer.text
property alias tripmetervalue: tripmeter.text
//property alias protocol : protocol.currentIndex
property alias smoothingrpm : smoothrpm.currentIndex
property alias smoothingspeed : smoothspeed.currentIndex
property alias extendercanbase: baseadresstext.text
property alias shiftlightcanbase: shiftlightbaseadresstext.text
}
SoundEffect {
id: warnsound
source: "qrc:/Sounds/alarm.wav"
}
Connections{
target: Dashboard
onOdoChanged:{odometer.text = (Dashboard.Odo).toFixed(0) }
onTripChanged:{tripmeter.text = (Dashboard.Trip).toFixed(1) }
onWatertempChanged: { if (Dashboard.Watertemp > Dashboard.waterwarn) {playwarning.start()};}
onRpmChanged: { if (Dashboard.rpm > Dashboard.rpmwarn) {playwarning.start()};}
onKnockChanged: { if (Dashboard.Knock > Dashboard.knockwarn) {playwarning.start()};}
onBoostPresChanged: { if (Dashboard.BoostPres > Dashboard.boostwarn) {playwarning.start()};}
}
Row {
x: windowbackround.width /150
y: windowbackround.width /150
spacing: windowbackround.width /150
Grid {
anchors.top :parent.top
anchors.topMargin: parent.height / 20
rows: 13
columns: 2
spacing: windowbackround.width /150
// [0]
Text {
text: "ECU Serial Port: "
font.pixelSize: windowbackround.width / 55
color: "white"
visible: { (ecuSelect.currentIndex != "1") ? false: true; }
}
ComboBox {
id: serialName
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: Connect.portsNames
visible: { (ecuSelect.currentIndex != "1") ? false: true; }
property bool initialized: false
onCurrentIndexChanged: if (initialized) AppSettings.setBaudRate( currentIndex )
Component.onCompleted: { currentIndex = AppSettings.getBaudRate(); initialized = true; autoconnect.auto(); }
delegate: ItemDelegate {
width: serialName.width
text: serialName.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: serialName.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: serialName.font.family
font.pixelSize: serialName.font.pixelSize
highlighted: serialName.highlightedIndex == index
hoverEnabled: serialName.hoverEnabled
}
}
Text {
text: "GPS Port: "
font.pixelSize: windowbackround.width / 55
color: "white"
//visible: { (gpsswitch.checked == true ) ? true:false; }
}
ComboBox {
id: serialNameGPS
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: Connect.portsNames
// visible: { (gpsswitch.checked == true ) ? true:false; }
delegate: ItemDelegate {
width: serialNameGPS.width
text: serialNameGPS.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: serialNameGPS.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: serialNameGPS.font.family
font.pixelSize: serialNameGPS.font.pixelSize
highlighted: serialNameGPS.highlightedIndex == index
hoverEnabled: serialNameGPS.hoverEnabled
}
}
Text {
text: "Speed units:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
ComboBox {
id: unitSelect1
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: [ "Metric","Imperial"]
property bool initialized: false
Component.onCompleted: { Connect.setSpeedUnits(currentIndex);changeweighttext.changetext()}
onCurrentIndexChanged: { Connect.setSpeedUnits(currentIndex);changeweighttext.changetext()}
delegate: ItemDelegate {
width: unitSelect1.width
text: unitSelect1.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: unitSelect1.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: unitSelect1.font.family
font.pixelSize: unitSelect1.font.pixelSize
highlighted: unitSelect1.highlightedIndex == index
hoverEnabled: unitSelect1.hoverEnabled
}
}
Text {
text: "Temp units:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
ComboBox {
id: unitSelect
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: [ "Metric","Imperial"]
property bool initialized: false
Component.onCompleted: { Connect.setUnits(currentIndex);changeweighttext.changetext()}
onCurrentIndexChanged: { Connect.setUnits(currentIndex);changeweighttext.changetext()}
delegate: ItemDelegate {
width: unitSelect.width
text: unitSelect.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: unitSelect.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: unitSelect.font.family
font.pixelSize: unitSelect.font.pixelSize
highlighted: unitSelect.highlightedIndex == index
hoverEnabled: unitSelect.hoverEnabled
}
}
Text {
text: "Pressure units:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
ComboBox {
id: unitSelect2
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: [ "kPa","PSI"]
property bool initialized: false
Component.onCompleted: { Connect.setPressUnits(currentIndex);}
onCurrentIndexChanged: { Connect.setPressUnits(currentIndex);}
delegate: ItemDelegate {
width: unitSelect.width
text: unitSelect.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: unitSelect.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: unitSelect.font.family
font.pixelSize: unitSelect.font.pixelSize
highlighted: unitSelect.highlightedIndex == index
hoverEnabled: unitSelect.hoverEnabled
}
}
Text {
text: "ECU Selection:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
ComboBox {
id: ecuSelect
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
//model: [ "PowerFC","UDP","None","CAN Adaptronic Modular","Consult","HaltechV1","HaltechV2","OBD2"]
model: [ "CAN","PowerFC","Consult","OBD2"]
property bool initialized: false
onCurrentIndexChanged: {if (initialized) AppSettings.setECU( currentIndex ),Dashboard.setecu(ecuSelect.currentIndex);}
Component.onCompleted: { currentIndex = AppSettings.getECU(),Dashboard.setecu(ecuSelect.currentIndex),initialized = true; }
delegate: ItemDelegate {
width: ecuSelect.width
text: ecuSelect.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: ecuSelect.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: ecuSelect.font.family
font.pixelSize: ecuSelect.font.pixelSize
highlighted: ecuSelect.highlightedIndex == index
hoverEnabled: ecuSelect.hoverEnabled
}
}
Text {
text: "GoPro Variant :"
font.pixelSize: windowbackround.width / 55
color: "white"
}
ComboBox {
id: goProSelect
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: [ "Hero", "Hero2","Hero3"]
delegate: ItemDelegate {
width: goProSelect.width
text: goProSelect.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: goProSelect.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: goProSelect.font.family
font.pixelSize: goProSelect.font.pixelSize
highlighted: goProSelect.highlightedIndex == index
hoverEnabled: goProSelect.hoverEnabled
}
}
Text {
text: "GoPro Password :"
font.pixelSize: windowbackround.width / 55
color: "white"
}
TextField {
id: goPropass
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
placeholderText: qsTr("GoPro Password")
//InputMethod:Qt.
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase | Qt.ImhSensitiveData | Qt.ImhNoPredictiveText
Component.onCompleted: {transferSettings.sendSettings() }
}
Text
{
text: "Logfile name:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
TextField {
id: logfilenameSelect
text: qsTr("DataLog")
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase | Qt.ImhSensitiveData | Qt.ImhNoPredictiveText
//enterKeyAction: EnterKeyAction.Next
}
Text
{
text: "Odo:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
TextField {
id: odometer
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
text: qsTr("0")
inputMethodHints: Qt.ImhFormattedNumbersOnly
//enterKeyAction: EnterKeyAction.Next
}
Text
{
text: "Trip:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
TextField{
id: tripmeter
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
readOnly: true
text: "0"
Component.onCompleted: Dashboard.setTrip(tripmeter.text)
}
Text
{
id: weighttext
font.pixelSize: windowbackround.width / 55
color: "white"
text: "Weight:"
}
TextField {
id: weight
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
inputMethodHints: Qt.ImhFormattedNumbersOnly
}
Text
{
text: "Serial Status:"
font.pixelSize: windowbackround.width / 55
color: "white"
}
TextField {
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
text: qsTr(Dashboard.SerialStat)
}
}
Grid {
rows: 13
columns: 2
spacing: windowbackround.width / 150
anchors.top :parent.top
anchors.topMargin: parent.height / 20
id:middlegrid
Button {
id: connectButton
text: "Connect"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
onClicked: {
functconnect.connectfunc();
connectButton.enabled =false;
ecuSelect.enabled = false;
disconnectButton.enabled = true;
//consultset.enabled = false;
}
}
Button {
id: disconnectButton
text: "Disconnect"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
enabled: false
onClicked: {
connectButton.enabled = true;
disconnectButton.enabled = false;
ecuSelect.enabled = true;
// consultset.enabled = true;
functdisconnect.disconnectfunc();
}
}
Button {
id: connectButtonGPS
text: "GPS Connect"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
Component.onCompleted: autoconnectGPS.auto()
onClicked: {
//console.log("clicked GPS")
connectButtonGPS.enabled=false
disconnectButtonGPS.enabled=true
autoconnectGPS.auto()
//console.log("gps disconnect enabled")
}
}
Button {
id: disconnectButtonGPS
text: "GPS Disconnect"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
enabled: false
onClicked: {
connectButtonGPS.enabled = true
disconnectButtonGPS.enabled = false
Gps.closeConnection()
}
}
Button {
id: resettrip
text: "Trip Reset"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
onClicked: {Calculations.resettrip()}
}
//for official raspberry Pi image only !!!!
/*
Button {
id: updateButton
text: "Pi Update "
onClicked: { updateButton.enabled =false,Connect.update();
}
}
*/
Button {
text: "Quit"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
onClicked: { Qt.quit();}
}
Button {
text: "Shutdown"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
onClicked: {Connect.shutdown();}
}
Button {
text: "Reboot"
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
onClicked: {
//GPS.closeConnection();
Connect.reboot();
}
}
Text { text: "RPM Smoothing :";color: "white";font.pixelSize: windowbackround.width / 55}
ComboBox {
id: smoothrpm
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: ["OFF","2","3","4","5","6","7","8","9","10"]
//property bool initialized: true
onCurrentIndexChanged:{Dashboard.setsmoothrpm(smoothrpm.currentIndex);}
Component.onCompleted: {Dashboard.setsmoothrpm(smoothrpm.currentIndex);}
delegate: ItemDelegate {
width: smoothrpm.width
text: smoothrpm.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: smoothrpm.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: smoothrpm.font.family
font.pixelSize: smoothrpm.font.pixelSize
highlighted: smoothrpm.highlightedIndex == index
hoverEnabled: smoothrpm.hoverEnabled
}
}
Text { text: "Speed Smoothing :";color: "white";font.pixelSize: windowbackround.width / 55}
ComboBox {
id: smoothspeed
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
model: ["OFF","2","3","4","5","6","7","8","9","10"]
property bool initialized: true
onCurrentIndexChanged:{Dashboard.setsmoothspeed(smoothspeed.currentIndex)}
Component.onCompleted: {Dashboard.setsmoothspeed(smoothspeed.currentIndex)}
delegate: ItemDelegate {
width: smoothspeed.width
text: smoothspeed.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: smoothspeed.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: smoothspeed.font.family
font.pixelSize: smoothspeed.font.pixelSize
highlighted: smoothspeed.highlightedIndex == index
hoverEnabled: smoothspeed.hoverEnabled
}
}
Switch {
id: loggerswitch
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
text: qsTr("Data Logger")
Component.onCompleted: {logger.datalogger()}
onCheckedChanged: logger.datalogger()
}
Switch {
id: record
width: windowbackround.width / 5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
text: qsTr("GoPro rec")
onCheckedChanged: {transferSettings.sendSettings(),goproRec.rec()}
Component.onCompleted: tabView.currentIndex = 1; // opens the 2nd tab
}
Text { text: " V 1.96o " + Dashboard.Platform ;color: "white";font.pixelSize: windowbackround.width / 55} //spacer
}
Grid {
rows: 10
columns:1
spacing: windowbackround.width / 150
anchors.top :parent.top
anchors.topMargin: parent.height / 20
Text { text: " CAN Extender";color: "white";font.pixelSize: windowbackround.width / 55}
Text { text: " base adress ";color: "white";font.pixelSize: windowbackround.width / 55}
Text { text: " (decimal) :";color: "white";font.pixelSize: windowbackround.width / 55}
TextField {
id: baseadresstext
enabled: connectButton.enabled == false ? false : true
width: windowbackround.width /5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
validator: IntValidator {bottom: 0; top: 4000;}
inputMethodHints: Qt.ImhFormattedNumbersOnly
placeholderText: qsTr("1024")
onTextChanged: hexstring = baseadresstext.text;
}
Text { text: " HEX: 0x"+(hexstring+0x1000).toString(16).substr(-3).toUpperCase();color: "white";font.pixelSize: windowbackround.width / 55}
Text { text: " Shiftlight CAN";color: "white";font.pixelSize: windowbackround.width / 55}
Text { text: " base adress ";color: "white";font.pixelSize: windowbackround.width / 55}
Text { text: " (decimal) :";color: "white";font.pixelSize: windowbackround.width / 55}
TextField {
id: shiftlightbaseadresstext
enabled: connectButton.enabled == false ? false : true
width: windowbackround.width /5
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
validator: IntValidator {bottom: 0; top: 4000;}
inputMethodHints: Qt.ImhFormattedNumbersOnly
placeholderText: qsTr("1024")
onTextChanged: hexstring2 = shiftlightbaseadresstext.text;
}
Text { text: " HEX: 0x"+(hexstring2+0x1000).toString(16).substr(-3).toUpperCase();color: "white";font.pixelSize: windowbackround.width / 55}
}
}
Grid {
visible: { (ecuSelect.currentIndex != "1") ? false: true; }
rows: 3
columns: 4
spacing: windowbackround.width / 150
x:350
y:290
// anchors.right: windowbackround.right
// anchors.bottom: windowbackround.bottom
/* //Just a spacer for now still need to do it properly
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "";font.pixelSize: windowbackround.width / 55}
//Spacer end
*/
Text { text: "";font.pixelSize: windowbackround.width / 55}
Text { text: "0V";font.pixelSize: windowbackround.width / 55}
Text { text: "5V";font.pixelSize: windowbackround.width / 55}
Text { text: "Name";font.pixelSize: windowbackround.width / 55}
Text { text: " ";font.pixelSize: windowbackround.width / 55}
TextField {
id: an1V0
width: windowbackround.width / 10
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
//validator: DoubleValidator {bottom: -1000.0; top: 1000.0;notation : DoubleValidator.StandardNotation ; decimals : 1}
inputMethodHints: Qt.ImhFormattedNumbersOnly
placeholderText: qsTr("9")
}
TextField {
id: an2V5
width: windowbackround.width / 10
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
// validator: DoubleValidator {bottom: -1000.0; top: 1000.0;notation : DoubleValidator.StandardNotation ; decimals : 1}
inputMethodHints: Qt.ImhFormattedNumbersOnly
placeholderText: qsTr("16")
}
TextField {
id: unitaux1
width: windowbackround.width / 10
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
placeholderText: qsTr("AFR")
}
Text { text: "AN1-2";font.pixelSize: windowbackround.width / 55}
TextField {
id: an3V0
width: windowbackround.width / 10
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
//validator: DoubleValidator {bottom: -1000.0; top: 1000.0;notation : DoubleValidator.StandardNotation ; decimals : 1}
inputMethodHints: Qt.ImhFormattedNumbersOnly
placeholderText: qsTr("0")
}
TextField {
id: an4V5
width: windowbackround.width / 10
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
//validator: DoubleValidator {bottom: -1000.0; top: 1000.0;notation : DoubleValidator.StandardNotation ; decimals : 1}
inputMethodHints: Qt.ImhFormattedNumbersOnly
placeholderText: qsTr("5")
}
TextField {
id: unitaux2
width: windowbackround.width / 10
height: windowbackround.height /15
font.pixelSize: windowbackround.width / 55
placeholderText: qsTr("AFR")
}
Text { text: "AN3-4";font.pixelSize: windowbackround.width / 55}
}
}
//Functions
Item {
//Function to automatically connect at Startup , function is called from COmbobox Serialname component.oncompleted
id: autoconnect
function auto()
{
// if (connectAtStart.checked == true) Connect.openConnection(serialName.currentText, ecuSelect.currentIndex, interfaceSelect.currentIndex, loggerSelect.currentIndex);
if (connectButton.enabled == false) functconnect.connectfunc(),ecuSelect.enabled = false,disconnectButton.enabled = true;//Connect.openConnection(serialName.currentText, ecuSelect.currentIndex, loggerSelect.currentIndex,logger.datalogger()),
}
}
Item {
//Function to connect and disconnect GPS
id: autoconnectGPS
function auto()
{
// if (gpsswitch.checked == true)GPS.startGPScom(serialNameGPS.currentText,serialGPSBaud.currentText);
if (connectButtonGPS.enabled == false)
{
Gps.openConnection(serialNameGPS.currentText,"9600")
disconnectButtonGPS.enabled=true
}
//if (connectButtonGPS.enabled == true)GPS.openConnection(serialNameGPS.currentText,"9600"),disconnectButtonGPS.enabled=false;
//if (gpsswitch.checked == false)GPS.closeConnection(),console.log("GPS CLOSED BY QML");
}
}
Item {
id: changeweighttext
function changetext()
{
if (unitSelect.currentIndex == 0) weighttext.text = "Weight kg";
if (unitSelect.currentIndex == 1) weighttext.text = "Weight lbs";
}
}
Item {
//Function to transmit GoPro rec status on off
id: goproRec
property var recording: 0
function rec()
{
if (record.checked == true) goproRec.recording = 1, GoPro.goprorec(recording.valueOf());
if (record.checked == false) goproRec.recording = 0,GoPro.goprorec(recording.valueOf());
}
}
Item {
//Logger on off function
id: logger
property var loggeron: 0
function datalogger()
{
if (loggerswitch.checked == true) logger.loggeron = 1, Logger.startLog(logfilenameSelect.text);
if (loggerswitch.checked == false) logger.loggeron = 0,Logger.stopLog();
}
}
Item {
//Function to transmit GoPro variant and GoPro Password
id: transferSettings
function sendSettings()
{
GoPro.goProSettings(goProSelect.currentIndex,goPropass.text);
}
}
Item {
//function to Connect
id: functconnect
function connectfunc()
{
Connect.openConnection(serialName.currentText, ecuSelect.currentIndex ,baseadresstext.text,shiftlightbaseadresstext.text);
Connect.setOdometer(odometer.text);
Connect.setWeight(weight.text);
Apexi.calculatorAux(an1V0.text,an2V5.text,an3V0.text,an4V5.text,unitaux1.text,unitaux2.text);
connected = 1;
}
}
//function to Disconnect
Item {
id: functdisconnect
function disconnectfunc()
{
Connect.closeConnection()
connected = 0;
}
}
Item {
//Function to play warning sound
id: playwarning
function start()
{
if (warnsound.playing == false) warnsound.play();
}
}
}
}
Quick1.Tab {
id :dash
title: "Dash Sel."
Rectangle{
id: dashselector
anchors.fill : parent
color: "grey"
Item {
id: dashSettings
Settings {
property alias dashselect1 : dash1.currentIndex
property alias dashselect2 : dash2.currentIndex
property alias dashselect3 : dash3.currentIndex
property alias dashselect4 : dash4.currentIndex
property alias numberofdash : numberofdashes.currentIndex
}
}
/*
Rectangle{
id: firstgrid
width: 800
height: 100
color:"grey"
}*/
Grid {
id: dashselectorgrid
rows: 2
columns: 1
anchors.centerIn: parent
// x: 100
// y: 100
Text { text: "Active Dashboards"
font.pixelSize: dashselector.width / 55 }
ComboBox {
id: numberofdashes
width: dashselector.width / 5
height: dashselector.height /15
font.pixelSize: dashselector.width / 55
model: ["1","2","3","4"]
currentIndex: -1
onCurrentIndexChanged:{addremovedashpage.adremove()}
delegate: ItemDelegate {
width: numberofdashes.width
text: numberofdashes.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: numberofdashes.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: numberofdashes.font.family
font.pixelSize: numberofdashes.font.pixelSize
highlighted: numberofdashes.highlightedIndex == index
hoverEnabled: numberofdashes.hoverEnabled
}
}
}
Grid {
id: dash1grid
anchors.top: parent.top
anchors.left: parent.left
anchors.margins:dashselector.width / 60
rows: 2
columns: 1
Text { text: "Dash1"
font.pixelSize: dashselector.width / 55 }
ComboBox {
id: dash1
width: dashselector.width / 5
height: dashselector.height /15
font.pixelSize: dashselector.width / 55
model: ["Main Dash","GPS", "Laptimer", "PowerFC Sensors","User Dash 1","User Dash 2","User Dash 3","G-Force","Mediaplayer","Screen Toggle","Drag Timer"]
//currentIndex: 1
onCurrentIndexChanged:{select1.selDash1() }
//Component.onCompleted: {select1.selDash1() }
delegate: ItemDelegate {
width: dash1.width
text: dash1.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: dash1.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: dash1.font.family
font.pixelSize: dash1.font.pixelSize
highlighted: dash1.highlightedIndex == index
hoverEnabled: dash1.hoverEnabled
}
}
}
Grid {
id: dash2grid
anchors.top: parent.top
anchors.left: dash1grid.right
anchors.margins:dashselector.width / 60
rows: 2
columns: 1
Text { text: "Dash2"
visible: Dashboard.Visibledashes >1
font.pixelSize: dashselector.width / 55}
ComboBox {
id: dash2
width: dashselector.width / 5
height: dashselector.height /15
font.pixelSize: dashselector.width / 55
model: ["Main Dash","GPS", "Laptimer", "PowerFC Sensors","User Dash 1","User Dash 2","User Dash 3","G-Force","Mediaplayer","Screen Toggle","Drag Timer"]
//currentIndex: 1
//onCurrentIndexChanged:{select2.selDash2() }
visible: Dashboard.Visibledashes >1
onCurrentIndexChanged:{if (dash2.visible == true){select2.selDash2()} }
onVisibleChanged:{if (dash2.visible == true){select2.selDash2()} }
delegate: ItemDelegate {
width: dash2.width
text: dash2.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: dash2.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: dash2.font.family
font.pixelSize: dash2.font.pixelSize
highlighted: dash2.highlightedIndex == index
hoverEnabled: dash2.hoverEnabled
}
}
}
Grid {
id: dash3grid
anchors.top: parent.top
anchors.left: dash2grid.right
anchors.margins:dashselector.width / 60
rows: 2
columns: 1
Text { text: "Dash3"
visible: Dashboard.Visibledashes >2
font.pixelSize: dashselector.width / 55}
ComboBox {
id: dash3
width: dashselector.width / 5
height: dashselector.height /15
font.pixelSize: dashselector.width / 55
model: ["Main Dash","GPS", "Laptimer", "PowerFC Sensors","User Dash 1","User Dash 2","User Dash 3","G-Force","Mediaplayer","Screen Toggle","Drag Timer"]
visible: Dashboard.Visibledashes >2
onCurrentIndexChanged:{if (dash3.visible == true){select3.selDash3()} }
onVisibleChanged: {if (dash3.visible == true){select3.selDash3()} }
delegate: ItemDelegate {
width: dash3.width
text: dash3.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: dash3.currentIndex == index ? Font.DemiBold : Font.Normal
font.family: dash3.font.family
font.pixelSize: dash3.font.pixelSize
highlighted: dash3.highlightedIndex == index
hoverEnabled: dash3.hoverEnabled
}
}
}
Grid {
id: dash4grid
anchors.top: parent.top
anchors.left: dash3grid.right
anchors.margins:dashselector.width / 60
rows: 2
columns: 1
Text { text: "Dash4"
visible: Dashboard.Visibledashes >3
font.pixelSize: dashselector.width / 55}