Mercurial > ~darius > hgwebdir.cgi > OverviewJD
annotate main.qml.orig @ 0:57ffb39f29d4
First commit of new carousel page to allow battery charging current to
be adjusted.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 13 Dec 2021 23:05:38 +1030 |
parents | |
children |
rev | line source |
---|---|
0
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
1 import QtQuick 1.1 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
2 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
3 import Qt.labs.components.native 1.0 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
4 import com.victron.velib 1.0 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
5 import "utils.js" as Utils |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
6 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
7 PageStackWindow { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
8 id: rootWindow |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
9 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
10 gpsConnected: gpsFix.value === 1 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
11 onCompletedChanged: checkAlarm() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
12 initialPage: PageMain {} |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
13 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
14 property VeQuickItem gpsService: VeQuickItem { uid: "dbus/com.victronenergy.system/GpsService" } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
15 property VeQuickItem gpsFix: VeQuickItem { uid: Utils.path("dbus/", gpsService.value, "/Fix") } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
16 property bool completed: false |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
17 property bool showAlert: NotificationCenter.alert |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
18 property bool alarm: NotificationCenter.alarm |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
19 property bool overviewsLoaded: defaultOverview.valid && generatorOverview.valid && mobileOverview.valid && tanksOverview.valid && startWithMenu.valid |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
20 property string bindPrefix: "com.victronenergy.settings" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
21 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
22 property bool isNotificationPage: pageStack.currentPage && pageStack.currentPage.title === qsTr("Notifications") |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
23 property bool isOverviewPage: pageStack.currentPage && pageStack.currentPage.model === overviewModel; |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
24 property bool isOfflineFwUpdatePage: pageStack.currentPage && pageStack.currentPage.objectName === "offlineFwUpdatePage"; |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
25 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
26 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
27 property string hubOverviewType: theSystem.systemType.valid ? |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
28 withoutGridMeter.value === 1 ? "Hub" : theSystem.systemType.value : "" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
29 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
30 // Keep track of the current view (menu/overview) to show as default next time the |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
31 // CCGX is restarted |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
32 onIsOverviewPageChanged: startWithMenu.setValue(isOverviewPage ? 0 : 1) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
33 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
34 // Add the correct OverviewHub page |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
35 onHubOverviewTypeChanged: { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
36 switch(hubOverviewType){ |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
37 case "Hub": |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
38 case "Hub-1": |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
39 case "Hub-2": |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
40 case "Hub-3": |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
41 replaceOverview("OverviewGridParallel.qml", "OverviewHub.qml"); |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
42 break; |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
43 case "Hub-4": |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
44 case "ESS": |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
45 replaceOverview("OverviewHub.qml", "OverviewGridParallel.qml"); |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
46 break; |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
47 default: |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
48 break; |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
49 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
50 // Workaround the QTBUG-17012 (only the first sentence in each case of Switch Statement can be executed) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
51 // by adding a return statement |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
52 return |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
53 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
54 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
55 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
56 id: generatorOverview |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
57 bind: "com.victronenergy.settings/Settings/Relay/Function" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
58 onValueChanged: extraOverview("OverviewGeneratorRelay.qml", value === 1) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
59 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
60 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
61 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
62 id: fischerPandaGenOverview |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
63 bind: "com.victronenergy.settings/Settings/Services/FischerPandaAutoStartStop" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
64 onValueChanged: extraOverview("OverviewGeneratorFp.qml", value === 1) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
65 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
66 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
67 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
68 id: mobileOverview |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
69 bind: "com.victronenergy.settings/Settings/Gui/MobileOverview" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
70 onValueChanged:{ |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
71 extraOverview("OverviewMobile.qml", value === 1) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
72 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
73 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
74 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
75 id: tanksOverview |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
76 bind: "com.victronenergy.settings/Settings/Gui/TanksOverview" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
77 onValueChanged:{ |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
78 extraOverview("OverviewTanks.qml", value === 1) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
79 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
80 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
81 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
82 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
83 id: startWithMenu |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
84 bind: "com.victronenergy.settings/Settings/Gui/StartWithMenuView" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
85 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
86 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
87 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
88 id: withoutGridMeter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
89 bind: "com.victronenergy.settings/Settings/CGwacs/RunWithoutGridMeter" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
90 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
91 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
92 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
93 VBusItem { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
94 id: defaultOverview |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
95 bind: "com.victronenergy.settings/Settings/Gui/DefaultOverview" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
96 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
97 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
98 // Note: finding a firmware image on the storage device is error 4 for vrm storage |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
99 // since it should not be used for logging. That fact is used here to determine if |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
100 // there is a firmware image. |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
101 Connections { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
102 target: storageEvents |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
103 onVrmStorageError: { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
104 if (error === 4) { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
105 setTopPage(offlineFwUpdates) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
106 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
107 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
108 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
109 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
110 onAlarmChanged: { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
111 if (completed) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
112 checkAlarm() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
113 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
114 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
115 // always keep track of system information |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
116 HubData { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
117 id: theSystem |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
118 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
119 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
120 // note: used for leaving the overviews as well |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
121 function backToMainMenu() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
122 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
123 pageStack.pop(initialPage); |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
124 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
125 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
126 Toast { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
127 id: toast |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
128 transform: Scale { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
129 xScale: screen.scaleX |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
130 yScale: screen.scaleY |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
131 origin.x: toast.width / 2 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
132 origin.y: toast.height / 2 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
133 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
134 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
135 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
136 SignalToaster {} |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
137 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
138 ToolbarHandlerPages { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
139 id: mainToolbarHandler |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
140 isDefault: true |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
141 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
142 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
143 ToolBarLayout { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
144 id: mbTools |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
145 height: parent.height |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
146 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
147 Item { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
148 anchors.verticalCenter: parent.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
149 anchors.left: mbTools.left |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
150 height: mbTools.height |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
151 width: 200 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
152 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
153 MouseArea { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
154 anchors.fill: parent |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
155 onClicked: { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
156 if (pageStack.currentPage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
157 pageStack.currentPage.toolbarHandler.leftAction(true) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
158 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
159 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
160 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
161 Row { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
162 anchors.centerIn: parent |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
163 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
164 MbIcon { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
165 anchors.verticalCenter: parent.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
166 iconId: pageStack.currentPage ? pageStack.currentPage.leftIcon : "" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
167 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
168 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
169 Text { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
170 anchors.verticalCenter: parent.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
171 text: pageStack.currentPage ? pageStack.currentPage.leftText : "" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
172 color: "white" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
173 font.bold: true |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
174 font.pixelSize: 16 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
175 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
176 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
177 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
178 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
179 MbIcon { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
180 id: centerScrollIndicator |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
181 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
182 anchors { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
183 horizontalCenter: parent.horizontalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
184 verticalCenter: mbTools.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
185 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
186 iconId: pageStack.currentPage ? pageStack.currentPage.scrollIndicator : "" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
187 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
188 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
189 Item { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
190 anchors.verticalCenter: parent.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
191 height: mbTools.height |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
192 anchors.right: mbTools.right |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
193 width: 200 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
194 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
195 MouseArea { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
196 anchors.fill: parent |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
197 onClicked: { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
198 if (pageStack.currentPage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
199 pageStack.currentPage.toolbarHandler.rightAction(true) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
200 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
201 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
202 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
203 Row { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
204 anchors.centerIn: parent |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
205 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
206 MbIcon { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
207 iconId: pageStack.currentPage ? pageStack.currentPage.rightIcon : "" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
208 anchors.verticalCenter: parent.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
209 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
210 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
211 Text { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
212 text: pageStack.currentPage ? pageStack.currentPage.rightText : "" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
213 anchors.verticalCenter: parent.verticalCenter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
214 color: "white" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
215 font.bold: true |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
216 font.pixelSize: 16 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
217 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
218 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
219 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
220 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
221 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
222 Component.onCompleted: { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
223 completed = true |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
224 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
225 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
226 ListModel { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
227 id: overviewModel |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
228 ListElement { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
229 pageSource: "OverviewHub.qml" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
230 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
231 ListElement { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
232 pageSource: "OverviewTiles.qml" |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
233 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
234 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
235 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
236 Component { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
237 id: overviewComponent |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
238 PageFlow { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
239 // Display default overview when loaded |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
240 defaultIndex: getDefaultOverviewIndex() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
241 // Store the current overview page as default |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
242 onCurrentIndexChanged: if (active) defaultOverview.setValue(overviewModel.get(currentIndex).pageSource.replace(".qml", "")) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
243 model: overviewModel |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
244 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
245 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
246 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
247 // When all the related settings items are valid, show the overview page if was the last oppened page |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
248 // before restarting |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
249 Timer { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
250 interval: 2000 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
251 running: completed && overviewsLoaded && startWithMenu.valid |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
252 onTriggered: if (startWithMenu.value === 0) showOverview() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
253 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
254 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
255 function getDefaultOverviewIndex() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
256 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
257 if(!defaultOverview.valid) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
258 return 0 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
259 for (var i = 0; i < overviewModel.count; i++){ |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
260 if (overviewModel.get(i).pageSource.replace(".qml", "") === defaultOverview.value) { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
261 return i |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
262 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
263 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
264 return 0 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
265 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
266 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
267 Component { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
268 id: noticationsComponent |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
269 PageNotifications {} |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
270 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
271 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
272 Component { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
273 id: offlineFwUpdates |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
274 PageSettingsFirmwareOffline { checkOnCompleted: true} |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
275 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
276 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
277 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
278 // Add or remove extra overviews. for example, generator overview |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
279 // shouldn't be shown if the start/stop functionality is not enabled. |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
280 // Index parameter is optional, usefull to keep an order. |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
281 function extraOverview(name, show, index) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
282 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
283 var i = 0 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
284 if (show) { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
285 if (index !== undefined) { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
286 if (overviewModel.get(index).pageSource === name) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
287 return |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
288 // First append the page |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
289 overviewModel.append({"pageSource": name}) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
290 // Then move all the pages behind index |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
291 overviewModel.move(index, overviewModel.count - 2, overviewModel.count - 2) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
292 } else { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
293 for (i = 0; i < overviewModel.count; i++) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
294 if (overviewModel.get(i).pageSource === name) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
295 // Don't append if already exists |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
296 return |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
297 overviewModel.append({"pageSource": name}) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
298 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
299 } else { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
300 for (i = 0; i < overviewModel.count; i++) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
301 if (overviewModel.get(i).pageSource === name) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
302 overviewModel.remove(i) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
303 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
304 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
305 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
306 function replaceOverview(oldPage, newPage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
307 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
308 for (var i = 0; i < overviewModel.count; i++) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
309 if (overviewModel.get(i).pageSource === oldPage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
310 overviewModel.get(i).pageSource = newPage |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
311 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
312 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
313 // Central mover for the ball animation on the overviews |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
314 // Instead of using a timer per line, using a central one |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
315 // reduces the CPU usage a little bit and makes the animations |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
316 // smoother. |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
317 Timer { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
318 id: mover |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
319 property double pos: _counter / _loops |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
320 property int _counter |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
321 property int _loops: 13 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
322 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
323 interval: 100 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
324 running: true |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
325 repeat: true |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
326 onTriggered: if (_counter >= (_loops - 1)) _counter = 0; else _counter++ |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
327 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
328 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
329 // If an overview or notifications is active, the new page will replace it |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
330 // instead to be pushed. This way we prevent an unwanted stackpage depth |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
331 // increment everytime another page wants to be on top. |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
332 function setTopPage(page) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
333 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
334 if (isNotificationPage || isOverviewPage || isOfflineFwUpdatePage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
335 rootWindow.pageStack.replace(page); |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
336 else |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
337 rootWindow.pageStack.push(page); |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
338 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
339 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
340 function spuriousKeyPress() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
341 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
342 return !pageStack.currentPage || !pageStack.currentPage.active |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
343 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
344 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
345 function showOverview() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
346 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
347 if (spuriousKeyPress() || isOverviewPage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
348 return |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
349 setTopPage(overviewComponent) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
350 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
351 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
352 function showPageNotifications() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
353 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
354 if (spuriousKeyPress() || isNotificationPage) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
355 return |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
356 setTopPage(noticationsComponent) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
357 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
358 |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
359 function checkAlarm() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
360 { |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
361 if (alarm) |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
362 showPageNotifications() |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
363 } |
57ffb39f29d4
First commit of new carousel page to allow battery charging current to
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
364 } |