on xenial help sign in
Give page unique ID, lint Javascript
commit9d73ee31f90635413fc7aa9fe23c38c6c868d011 authorDalton Durst <me@daltondurst.com> dateWed 22 Aug 2018, 13:24 (8 years ago) parent9b055e7
1 file changed+67−61
qml/Wizard/Pages/78-firmware-update.qml+67−61
qml/Wizard/Pages/78-firmware-update.qml+67−61
@@ -25,7 +25,7 @@ import Wizard 0.1
2525import ".." as LocalComponents
2626
2727LocalComponents.Page {
28− id: systemUpdatePage
28+ id: firmwareUpdatePage
2929 objectName: "firmwareUpdatePage"
3030
3131 title: i18n.tr("Firmware Update")
@@ -40,17 +40,19 @@ LocalComponents.Page {
4040 property var partitions: ""
4141
4242 function check() {
43− if (!SystemImage.supportsFirmwareUpdate())
44− return;
45− systemUpdatePage.isChecking = true
46− SystemImage.checkForFirmwareUpdate()
43+ if (!SystemImage.supportsFirmwareUpdate()) {
44+ return;
45+ }
46+ firmwareUpdatePage.isChecking = true;
47+ SystemImage.checkForFirmwareUpdate();
4748 }
4849
4950 function flash() {
50− if (!SystemImage.supportsFirmwareUpdate())
51− return pageStack.next();
52− systemUpdatePage.isUpdating = true
53− SystemImage.updateFirmware()
51+ if (!SystemImage.supportsFirmwareUpdate()) {
52+ return pageStack.next();
53+ }
54+ firmwareUpdatePage.isUpdating = true;
55+ SystemImage.updateFirmware();
5456 }
5557
5658 Connections {
@@ -59,29 +61,30 @@ LocalComponents.Page {
5961 var updateobj = JSON.parse(updateObj);
6062 if (Array.isArray(updateobj) && updateobj.length > 0) {
6163 for (var u in updateobj) {
62− console.log(u)
63− if (systemUpdatePage.partitions === "")
64− systemUpdatePage.partitions += updateobj[u].file
65− else
66− systemUpdatePage.partitions += ", " + updateobj[u].file
64+ console.log(u);
65+ if (firmwareUpdatePage.partitions === "") {
66+ firmwareUpdatePage.partitions += updateobj[u].file;
67+ } else {
68+ firmwareUpdatePage.partitions += ", " + updateobj[u].file;
69+ }
6770 }
68− systemUpdatePage.hasUpdate = true;
71+ firmwareUpdatePage.hasUpdate = true;
6972 }
7073 console.log(updateobj);
71− systemUpdatePage.isChecking = false;
74+ firmwareUpdatePage.isChecking = false;
7275 }
7376 onUpdateFirmwareDone: {
7477 var updateobj = JSON.parse(updateObj);
7578 if (Array.isArray(updateobj) && updateobj.length === 0) {
7679 // This means success!
77− systemUpdatePage.hasUpdate = false;
78− systemUpdatePage.partitions = "";
80+ firmwareUpdatePage.hasUpdate = false;
81+ firmwareUpdatePage.partitions = "";
7982 System.skipUntilFinishedPage();
8083 SystemImage.reboot();
8184 return;
8285 }
8386 console.log(updateobj);
84− systemUpdatePage.isUpdating = false;
87+ firmwareUpdatePage.isUpdating = false;
8588 }
8689 }
8790
@@ -89,9 +92,9 @@ LocalComponents.Page {
8992 id: column
9093 anchors {
9194 fill: content
92− leftMargin: systemUpdatePage.leftMargin
93− rightMargin: systemUpdatePage.rightMargin
94− topMargin: systemUpdatePage.customMargin
95+ leftMargin: firmwareUpdatePage.leftMargin
96+ rightMargin: firmwareUpdatePage.rightMargin
97+ topMargin: firmwareUpdatePage.customMargin
9598 }
9699 spacing: units.gu(3)
97100 opacity: spinner.visible ? 0.5 : 1
@@ -100,12 +103,12 @@ LocalComponents.Page {
100103 }
101104
102105 Label {
103− visible: !systemUpdatePage.isChecking
106+ visible: !firmwareUpdatePage.isChecking
104107 anchors.horizontalCenter: parent.horizontalCenter
105108 font.weight: Font.Light
106109 wrapMode: Text.Wrap
107110 textSize: Label.Medium
108− text: systemUpdatePage.hasUpdate ? i18n.tr("There is a firmware update available!")
111+ text: firmwareUpdatePage.hasUpdate ? i18n.tr("There is a firmware update available!")
109112 : online ? i18n.tr("Firmware is up to date!")
110113 : i18n.tr("Please connect to the Internet to check for updates.")
111114
@@ -137,7 +140,7 @@ LocalComponents.Page {
137140 font.weight: Font.Light
138141 wrapMode: Text.WordWrap
139142 fontSize: "small"
140− text: systemUpdatePage.partitions
143+ text: firmwareUpdatePage.partitions
141144 }
142145
143146 Label {
@@ -171,7 +174,7 @@ LocalComponents.Page {
171174 anchors.fill: parent
172175 anchors.horizontalCenter: parent.horizontalCenter
173176 onClicked: {
174− systemUpdatePage.flash()
177+ firmwareUpdatePage.flash()
175178 }
176179 }
177180
@@ -188,54 +191,57 @@ LocalComponents.Page {
188191
189192 Column {
190193 id: spinner
191− anchors.centerIn: systemUpdatePage
192− visible: systemUpdatePage.isChecking || systemUpdatePage.isUpdating
194+ anchors.centerIn: firmwareUpdatePage
195+ visible: firmwareUpdatePage.isChecking || firmwareUpdatePage.isUpdating
193196 spacing: units.gu(1)
194197
195− ActivityIndicator {
196− anchors.horizontalCenter: parent.horizontalCenter
197− running: parent.visible
198− }
199−
200− Label {
201− wrapMode: Text.Wrap
202− width: systemUpdatePage.width - units.gu(3)
203− fontSize: "small"
204− text: i18n.tr("Downloading and Flashing firmware updates, this could take a few minutes...")
205− visible: systemUpdatePage.isUpdating
206− }
207−
208− Label {
209− wrapMode: Text.Wrap
210− fontSize: "small"
211− text: i18n.tr("Checking for firmware update")
212− visible: systemUpdatePage.isChecking
213− }
214−
215− Component.onCompleted: {
216− if (online)
217− systemUpdatePage.check();
218− else
219− systemUpdatePage.isChecking = false;
220− }
198+ ActivityIndicator {
199+ anchors.horizontalCenter: parent.horizontalCenter
200+ running: parent.visible
201+ }
202+
203+ Label {
204+ wrapMode: Text.Wrap
205+ width: firmwareUpdatePage.width - units.gu(3)
206+ fontSize: "small"
207+ text: i18n.tr("Downloading and Flashing firmware updates, this could take a few minutes...")
208+ visible: firmwareUpdatePage.isUpdating
209+ }
210+
211+ Label {
212+ wrapMode: Text.Wrap
213+ fontSize: "small"
214+ text: i18n.tr("Checking for firmware update")
215+ visible: firmwareUpdatePage.isChecking
216+ }
217+
218+ Component.onCompleted: {
219+ if (online) {
220+ firmwareUpdatePage.check();
221+ }
222+ else {
223+ firmwareUpdatePage.isChecking = false;
224+ }
225+ }
221226 }
222227
223228 Connections {
224229 target: NetworkingStatus
225230 onOnlineChanged: {
226− if (online)
227− systemUpdatePage.check();
228− else
229− systemUpdatePage.isChecking = false;
231+ if (online) {
232+ firmwareUpdatePage.check();
233+ } else {
234+ firmwareUpdatePage.isChecking = false;
235+ }
230236 }
231237 }
232238
233239 Component {
234240 id: forwardButton
235241 LocalComponents.StackButton {
236− text: !systemUpdatePage.hasUpdate && !systemUpdatePage.spinner.visible
237− ? i18n.tr("Next") : i18n.tr("Skip")
238− onClicked: pageStack.next()
242+ text: !firmwareUpdatePage.hasUpdate && !firmwareUpdatePage.spinner.visible
243+ ? i18n.tr("Next") : i18n.tr("Skip");
244+ onClicked: pageStack.next();
239245 }
240246 }
241247}