-
-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathmain.qml
More file actions
1080 lines (998 loc) · 38.8 KB
/
Copy pathmain.qml
File metadata and controls
1080 lines (998 loc) · 38.8 KB
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.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtQuick.Dialogs 1.0
import QtGraphicalEffects 1.12
import Qt.labs.settings 1.0
import QtMultimedia 5.15
import org.cagnulein.qdomyoszwift 1.0
import QtQuick.Window 2.12
import Qt.labs.platform 1.1
import AndroidStatusBar 1.0
ApplicationWindow {
id: window
width: 640
height: 480
visibility: Qt.WindowFullScreen
visible: true
objectName: "stack"
title: Qt.platform.os === "ios" ? "" : qsTr("qDomyos-Zwift")
// Force update on orientation change
property int currentOrientation: Screen.orientation
onCurrentOrientationChanged: {
if (Qt.platform.os === "android") {
console.log("Orientation changed to:", currentOrientation)
// Force property binding updates by accessing the properties
var temp = AndroidStatusBar.height + AndroidStatusBar.navigationBarHeight + AndroidStatusBar.leftInset + AndroidStatusBar.rightInset
}
}
// Helper functions for cleaner padding calculations
function getTopPadding() {
// Add padding for iPadOS multi-window mode (Stage Manager, Split View, Slide Over)
// to avoid overlap with window control buttons (red/yellow/green)
// Check both the native detection and window size comparison for reactivity
if (Qt.platform.os === "ios") {
var isMultiWindow = (typeof rootItem !== "undefined" && rootItem && rootItem.iPadMultiWindowMode) ||
(window.width < Screen.width - 10); // Window smaller than screen = multi-window
if (isMultiWindow) {
return 15; // Space for window control buttons
}
}
if (Qt.platform.os !== "android" || AndroidStatusBar.apiLevel < 31) return 0;
return (Screen.orientation === Qt.PortraitOrientation || Screen.orientation === Qt.InvertedPortraitOrientation) ?
AndroidStatusBar.height : AndroidStatusBar.leftInset;
}
function getBottomPadding() {
if (Qt.platform.os !== "android" || AndroidStatusBar.apiLevel < 31) return 0;
return (Screen.orientation === Qt.PortraitOrientation || Screen.orientation === Qt.InvertedPortraitOrientation) ?
AndroidStatusBar.navigationBarHeight : AndroidStatusBar.rightInset;
}
function getLeftPadding() {
if (Qt.platform.os !== "android" || AndroidStatusBar.apiLevel < 31) return 0;
return (Screen.orientation === Qt.LandscapeOrientation || Screen.orientation === Qt.InvertedLandscapeOrientation) ?
AndroidStatusBar.leftInset : 0;
}
function getRightPadding() {
if (Qt.platform.os !== "android" || AndroidStatusBar.apiLevel < 31) return 0;
return (Screen.orientation === Qt.LandscapeOrientation || Screen.orientation === Qt.InvertedLandscapeOrientation) ?
AndroidStatusBar.rightInset : 0;
}
signal gpx_open_clicked(url name)
signal gpxpreview_open_clicked(url name)
signal profile_open_clicked(url name)
signal trainprogram_open_clicked(url name)
signal fitfile_preview_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal gpx_open_other_folder(url name)
signal trainprogram_preview(url name)
signal trainprogram_zwo_loaded(string s)
signal trainprogram_autostart_requested()
signal fitfile_preview(string s)
signal gpx_save_clicked()
signal fit_save_clicked()
signal refresh_bluetooth_devices_clicked()
signal strava_connect_clicked()
signal peloton_connect_clicked()
signal intervalsicu_connect_clicked()
signal intervalsicu_download_todays_workout_clicked()
signal loadSettings(url name)
signal saveSettings(url name)
signal deleteSettings(url name)
signal restoreSettings()
signal saveProfile(string profilename)
signal restart()
signal volumeUp()
signal volumeDown()
signal keyMediaPrevious()
signal keyMediaNext()
signal floatingOpen()
signal openFloatingWindowBrowser();
signal strava_upload_file_prepare();
property bool lockTiles: false
property bool settings_restart_to_apply: false
Settings {
id: settings
property string profile_name: "default"
property string theme_status_bar_background_color: "#800080"
property bool volume_change_gears: false
property string peloton_username: "username"
property string peloton_password: "password"
}
Store {
id: iapStore
}
Loader {
id: googleMapUI
source:"GoogleMap.qml";
active: false
onLoaded: { console.log("googleMapUI loaded"); stackView.push(googleMapUI.item); }
}
// here in order to cache everything for the SwagBagView
Product {
id: productUnlockVowels
type: Product.Unlockable
store: iapStore
identifier: "org.cagnulein.qdomyoszwift.swagbag"
onPurchaseSucceeded: {
console.log(identifier + " purchase successful");
applicationData.vowelsUnlocked = true;
transaction.finalize();
pageStack.pop();
}
onPurchaseFailed: {
console.log(identifier + " purchase failed");
console.log("reason: "
+ transaction.failureReason === Transaction.CanceledByUser ? "Canceled" : transaction.errorString);
transaction.finalize();
}
onPurchaseRestored: {
console.log(identifier + " purchase restored");
applicationData.vowelsUnlocked = true;
console.log("timestamp: " + transaction.timestamp);
transaction.finalize();
pageStack.pop();
}
}
ToastManager {
id: toast
}
Timer {
interval: 1
repeat: false
running: (rootItem.toastRequested !== "")
onTriggered: {
toast.show(rootItem.toastRequested);
rootItem.toastRequested = "";
}
}
/*
Timer {
interval: 1000
repeat: true
running: true
property int i: 0
onTriggered: {
toast.show("This timer has triggered " + (++i) + " times!");
}
}
Timer {
interval: 3000
repeat: true
running: true
property int i: 0
onTriggered: {
toast.show("This important message has been shown " + (++i) + " times.", 5000);
}
}*/
Keys.onBackPressed: {
if(OS_VERSION === "Android") {
toast.show("Pressed it quickly to close the app!")
timer.pressBack();
}
}
Timer{
id: timer
property bool backPressed: false
repeat: false
interval: 200//ms
onTriggered: backPressed = false
function pressBack(){
if(backPressed){
timer.stop()
backPressed = false
Qt.callLater(Qt.quit)
}
else{
backPressed = true
timer.start()
}
}
}
Popup {
id: popup
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 60
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Program has been loaded correctly. Press start to begin!")
}
}
}
MessageDialog {
id: popupPelotonAuth
text: "Peloton Authentication Change"
informativeText: "Peloton has moved to a new authentication system. Username and password are no longer required.\n\nWould you like to switch to the new authentication method now?"
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {
settings.peloton_username = "username"
settings.peloton_password = "password"
stackView.push("WebPelotonAuth.qml")
peloton_connect_clicked()
}
onNoClicked: this.visible = false
visible: false
}
Timer {
id: pelotonAuthCheck
interval: 1000 // 1 second delay after startup
running: true
repeat: false
onTriggered: {
if (settings.peloton_password !== "password") {
popupPelotonAuth.visible = true
}
}
}
Popup {
id: popupClassificaHelper
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 130
modal: true
focus: true
palette.text: "white"
onClosed: stackView.push("Classifica.qml");
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("QZ Classifica is a realtime viewer about the actual\neffort of every QZ users! If you want to join in,\nchoose a nickname in the general settings\nand enable the QZ Classifica setting in the\nexperimental settings section and\nrestart the app.")
}
}
}
Popup {
id: popupWhatsOnZwiftHelper
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 130
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
onClosed: {
stackView.push("WebEngineTest.qml")
drawer.close()
stackView.currentItem.trainprogram_zwo_loaded.connect(trainprogram_zwo_loaded)
stackView.currentItem.trainprogram_zwo_loaded.connect(function(s) {
stackView.pop();
});
}
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Browse the What's on Zwift workout library<br>and choose your workout. It will<br> be automatically loaded on QZ when you will<br>press the load button on the top!<br><br>QZ is not affiliated with Zwift<br>or https://whatsonzwift.com/ website.")
}
}
}
Popup {
id: popupLoadSettings
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 60
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Settings has been loaded correctly. Restart the app!")
}
}
}
Popup {
id: popupSaveFile
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 60
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Saved! Check your private folder (Android)<br>or Files App (iOS)")
}
}
}
Popup {
id: popupStravaConnected
parent: Overlay.overlay
enabled: rootItem.generalPopupVisible
onEnabledChanged: { if(rootItem.generalPopupVisible) popupStravaConnected.open() }
onClosed: { rootItem.generalPopupVisible = false; }
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 120
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
width: 370
height: 120
text: qsTr("Your Strava account is now connected!<br><br>When you will save a FIT file it will<br>automatically uploaded to Strava!")
}
}
}
Popup {
id: popupPelotonConnected
parent: Overlay.overlay
enabled: rootItem.pelotonPopupVisible
onEnabledChanged: { if(rootItem.pelotonPopupVisible) popupPelotonConnected.open() }
onClosed: { rootItem.pelotonPopupVisible = false; }
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 120
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
width: 370
height: 120
text: qsTr("Your Peloton account is now connected!<br><br>Restart the app to apply this change!")
}
}
}
Timer {
id: popupLicenseAutoClose
interval: 120000; running: rootItem.licensePopupVisible; repeat: false
onTriggered: popupLicense.close();
}
Popup {
id: popupLicense
parent: Overlay.overlay
enabled: rootItem.licensePopupVisible
onEnabledChanged: { if(rootItem.licensePopupVisible) popupLicense.open() }
onClosed: { Qt.openUrlExternally("https://www.patreon.com/bePatron?u=45290147"); Qt.callLater(Qt.quit); }
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 580
height: 230
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
width: 570
height: 220
text: qsTr("Trial time expired!<br><br>Please join the QZ Patreon Membership to unlock the full license!<br>https://www.patreon.com/bePatron?u=45290147<br><br>Then add your patreon email in the email field in the general settings.<br>The App will now close.")
}
}
}
MessageDialog {
id: popupRestartApp
text: "Settings changed"
informativeText: "In order to apply the changes you need to restart the app.\nDo you want to do it now?"
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: Qt.callLater(Qt.quit)
onNoClicked: this.visible = false;
visible: false
}
MessageDialog {
text: "Strava"
informativeText: "Do you want to upload the workout to Strava?"
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {strava_upload_file_prepare(); rootItem.stravaUploadRequested = false;}
onNoClicked: {rootItem.stravaUploadRequested = false;}
visible: rootItem.stravaUploadRequested
}
header: ToolBar {
contentHeight: toolButton.implicitHeight
Material.primary: settings.theme_status_bar_background_color
id: headerToolbar
topPadding: getTopPadding()
leftPadding: getLeftPadding()
rightPadding: getRightPadding()
ToolButton {
id: toolButton
icon.source: "icons/icons/icon.png"
text: stackView.depth > 1 ? "◄" : "◄"
font.pixelSize: Qt.application.font.pixelSize * 1.6
onClicked: {
if (stackView.depth > 1) {
if(window.settings_restart_to_apply === true) {
window.settings_restart_to_apply = false;
popupRestartApp.visible = true;
}
stackView.pop()
toolButtonLoadSettings.visible = false;
toolButtonSaveSettings.visible = false;
rootItem.sortTiles()
} else {
drawer.open()
}
}
}
ToolButton {
id: toolButtonFloating
icon.source: "icons/icons/mini-display.png"
onClicked: { console.log("floating!"); floatingOpen(); }
anchors.left: toolButton.right
visible: OS_VERSION === "Android" ? true : false
}
Popup {
id: popupAutoResistance
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 60
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Auto Resistance " + (rootItem.autoResistance?"enabled":"disabled"))
}
}
}
Timer {
id: popupAutoResistanceAutoClose
interval: 2000; running: false; repeat: false
onTriggered: popupAutoResistance.close();
}
Popup {
id: popuplockTiles
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 60
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: window.lockTiles ? qsTr("You can move the tiles!") : qsTr("The tiles are locked now")
}
}
}
Timer {
id: popuplockTilesAutoClose
interval: 2000; running: false; repeat: false
onTriggered: popuplockTiles.close();
}
ToolButton {
id: toolButtonLoadSettings
icon.source: "icons/icons/tray-arrow-up.png"
onClicked: {
stackView.push("SettingsList.qml")
stackView.currentItem.loadSettings.connect(loadSettings)
stackView.currentItem.loadSettings.connect(function(url) {
stackView.pop();
if (stackView.depth > 1) {
stackView.pop()
}
popupLoadSettings.open();
});
drawer.close()
}
anchors.right: toolButtonSaveSettings.left
visible: false
}
ToolButton {
id: toolButtonSaveSettings
icon.source: "icons/icons/tray-arrow-down.png"
onClicked: {
saveSettings("settings");
popupSaveFile.open()
}
anchors.right: toolButtonAutoResistance.left/*toolClassifica.left*/
visible: false
}
/*ToolButton {
id: toolClassifica
icon.source: "icons/icons/chart.png"
onClicked: { if(settings.classifica_enable) stackView.push("Classifica.qml"); else popupClassificaHelper.open(); }
anchors.right: toolButtonAutoResistance.left
}*/
ToolButton {
function loadMaps() {
if(rootItem.currentCoordinateValid) {
console.log("coordinate is valid for map");
if(googleMapUI.status === Loader.Ready)
stackView.push(googleMapUI.item);
else
googleMapUI.active = true;
} else {
console.log("coordinate is NOT valid for map");
}
}
id: toolButtonMaps
icon.source: ( "icons/icons/maps-icon-16.png" )
onClicked: { loadMaps(); }
anchors.right: toolButtonChart.left
visible: rootItem.mapsVisible
}
ToolButton {
function loadVideo() {
if(rootItem.currentCoordinateValid || rootItem.trainProgramLoadedWithVideo) {
console.log("coordinate is valid for map");
//stackView.push("videoPlayback.qml");
rootItem.videoVisible = !rootItem.videoVisible
} else {
console.log("coordinate is NOT valid for map");
}
}
id: toolButtonVideo
icon.source: ( "icons/icons/video.png" )
onClicked: { loadVideo(); }
anchors.right: toolButtonMaps.left
visible: rootItem.videoIconVisible
}
ToolButton {
id: toolButtonChart
icon.source: ( "icons/icons/chart.png" )
onClicked: { rootItem.chartFooterVisible = !rootItem.chartFooterVisible }
anchors.right: toolButtonLockTiles.left
visible: rootItem.chartIconVisible
}
ToolButton {
id: toolButtonLockTiles
icon.source: ( window.lockTiles ? "icons/icons/unlock.png" : "icons/icons/lock.png")
onClicked: { window.lockTiles = !window.lockTiles; console.log("lock tiles toggled " + window.lockTiles); popuplockTiles.open(); popuplockTilesAutoClose.running = true; }
anchors.right: toolButtonAutoResistance.left
visible: !toolButtonSaveSettings.visible
}
ToolButton {
id: toolButtonAutoResistance
icon.source: ( rootItem.autoResistance ? "icons/icons/resistance.png" : "icons/icons/pause.png")
onClicked: { rootItem.autoResistance = !rootItem.autoResistance; console.log("auto resistance toggled " + rootItem.autoResistance); popupAutoResistance.open(); popupAutoResistanceAutoClose.running = true; }
anchors.right: parent.right
}
Label {
text: stackView.currentItem.title
anchors.centerIn: parent
}
}
Drawer {
id: drawer
width: window.width * 0.66
height: window.height
topPadding: getTopPadding()
bottomPadding: getBottomPadding()
leftPadding: getLeftPadding()
rightPadding: getRightPadding()
Accessible.ignored: !drawer.opened
ScrollView {
contentWidth: -1
focus: true
anchors.horizontalCenter: parent.horizontalCenter
anchors.fill: parent
Column {
anchors.fill: parent
spacing: 3
ItemDelegate {
text: qsTr("Profile: ") + settings.profile_name
width: parent.width
onClicked: {
toolButtonLoadSettings.visible = true;
toolButtonSaveSettings.visible = true;
stackView.push("profiles.qml")
stackView.currentItem.profile_open_clicked.connect(profile_open_clicked)
drawer.close()
}
}
ItemDelegate {
text: qsTr("Settings")
width: parent.width
onClicked: {
toolButtonLoadSettings.visible = true;
toolButtonSaveSettings.visible = true;
stackView.push("settings.qml")
stackView.currentItem.peloton_connect_clicked.connect(function() {
peloton_connect_clicked()
});
drawer.close()
}
}
ItemDelegate {
text: qsTr("Workouts History")
width: parent.width
onClicked: {
stackView.push("WorkoutsHistory.qml")
stackView.currentItem.fitfile_preview_clicked.connect(fitfile_preview_clicked)
drawer.close()
}
}
ItemDelegate {
text: qsTr("Swag Bag")
width: parent.width
onClicked: {
stackView.push("SwagBagView.qml")
drawer.close()
}
}
ItemDelegate {
text: qsTr("Charts")
width: parent.width
onClicked: {
console.log(CHARTJS)
if(CHARTJS)
stackView.push("ChartJsTest.qml")
else
stackView.push("ChartsEndWorkout.qml")
drawer.close()
}
}
ItemDelegate {
id: gpx_open
text: qsTr("Open GPX")
width: parent.width
onClicked: {
stackView.push("GPXList.qml")
stackView.currentItem.trainprogram_open_clicked.connect(gpx_open_clicked)
stackView.currentItem.trainprogram_open_other_folder.connect(gpx_open_other_folder)
stackView.currentItem.trainprogram_preview.connect(gpxpreview_open_clicked)
stackView.currentItem.trainprogram_open_clicked.connect(function(url) {
stackView.pop();
popup.open();
});
drawer.close()
}
}
ItemDelegate {
id: trainprogram_open
text: qsTr("Open Train Program")
width: parent.width
onClicked: {
if(CHARTJS)
stackView.push("TrainingProgramsListJS.qml")
else
stackView.push("TrainingProgramsList.qml")
stackView.currentItem.trainprogram_open_clicked.connect(trainprogram_open_clicked)
stackView.currentItem.trainprogram_open_other_folder.connect(trainprogram_open_other_folder)
stackView.currentItem.trainprogram_preview.connect(trainprogram_preview)
stackView.currentItem.trainprogram_autostart_requested.connect(trainprogram_autostart_requested)
stackView.currentItem.trainprogram_open_clicked.connect(function(url) {
stackView.pop();
});
drawer.close()
}
}
ItemDelegate {
text: qsTr("Workout Editor")
width: parent.width
onClicked: {
var editorPage = stackView.push("WorkoutEditor.qml")
if (editorPage) {
editorPage.closeRequested.connect(function() {
stackView.pop()
})
// Close editor when workout is started from Save & Start
trainprogram_autostart_requested.connect(function() {
console.log("[main.qml] trainprogram_autostart_requested received, closing editor")
editorPage.closeRequested()
})
}
drawer.close()
}
}
/*
ItemDelegate {
text: qsTr("What's On Zwift™")
width: parent.width
onClicked: {
popupWhatsOnZwiftHelper.open()
}
}*/
ItemDelegate {
id: gpx_save
text: qsTr("Save GPX")
width: parent.width
onClicked: {
gpx_save_clicked()
drawer.close()
popupSaveFile.open()
}
}
ItemDelegate {
id: fit_save
text: qsTr("Save FIT")
width: parent.width
onClicked: {
fit_save_clicked()
drawer.close()
popupSaveFile.open()
}
}
ItemDelegate {
id: wizardItem
text: qsTr("Wizard")
width: parent.width
onClicked: {
stackView.push("Wizard.qml")
drawer.close()
}
}
ItemDelegate {
id: help
text: qsTr("Help")
width: parent.width
onClicked: {
Qt.openUrlExternally("https://robertoviola.cloud/qdomyos-zwift-guide/");
drawer.close()
}
}
ItemDelegate {
id: community
text: qsTr("Community")
width: parent.width
onClicked: {
Qt.openUrlExternally("https://www.facebook.com/groups/149984563348738");
drawer.close()
}
}
ItemDelegate {
text: qsTr("Credits")
width: parent.width
onClicked: {
stackView.push("Credits.qml")
drawer.close()
}
}
ItemDelegate {
text: qsTr("Quit")
width: parent.width
visible: OS_VERSION === "Other" ? true : false
onClicked: {
console.log("closing...")
Qt.callLater(Qt.quit)
}
}
ItemDelegate {
text: "version 2.20.26"
width: parent.width
}
ItemDelegate {
id: strava_connect
Image {
anchors.left: parent.left;
anchors.verticalCenter: parent.verticalCenter
source: "icons/icons/btn_strava_connectwith_orange.png"
fillMode: Image.PreserveAspectFit
visible: true
width: parent.width
}
width: parent.width
onClicked: {
stackView.push("WebStravaAuth.qml")
strava_connect_clicked()
drawer.close()
}
}
ItemDelegate {
Image {
anchors.left: parent.left;
anchors.verticalCenter: parent.verticalCenter
source: "icons/icons/Button_Connect_Rect_DarkMode.png"
fillMode: Image.PreserveAspectFit
visible: true
width: parent.width
}
width: parent.width
onClicked: {
stackView.push("WebPelotonAuth.qml")
stackView.currentItem.goBack.connect(function() {
stackView.pop();
})
peloton_connect_clicked()
drawer.close()
}
}
ItemDelegate {
Image {
anchors.left: parent.left;
anchors.verticalCenter: parent.verticalCenter
source: "icons/icons/garmin-connect-badge.png"
fillMode: Image.PreserveAspectFit
visible: true
width: parent.width
height: 48
}
width: parent.width
onClicked: {
toolButtonLoadSettings.visible = true;
toolButtonSaveSettings.visible = true;
stackView.push("settings.qml")
if (stackView.currentItem) {
if (stackView.currentItem.openGarminSection) {
stackView.currentItem.openGarminSection()
}
if (stackView.currentItem.peloton_connect_clicked) {
stackView.currentItem.peloton_connect_clicked.connect(function() {