forked from IgorYbema/tscSettings
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSoftwareUpdateInProgressPopup.qml
More file actions
57 lines (46 loc) · 1.44 KB
/
SoftwareUpdateInProgressPopup.qml
File metadata and controls
57 lines (46 loc) · 1.44 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
import QtQuick 2.1
import qb.base 1.0
import qb.components 1.0
Popup {
id: softwareUpdateInProgressPopup
QtObject {
id: p
property variant actionStrings : {'Downloading': qsTr('Downloading'), 'Installing': qsTr('Installing') }
property variant upgradeStatus : {'action': actionStrings['Downloading'], 'item': 0}
function translateAction(action) {
return actionStrings[action];
}
function actionFailed() {
timer.stop();
softwareUpdateProgressPopup.stopAnimation();
hide();
stage.openFullscreen(app.settingsScreenUrl);
qdialog.showDialog(qdialog.SizeLarge, "Update failed", "Toon firmware update failed. Please check the logs /var/log/tsc.toonupdate.log");
}
}
onShown: {
//app.startSoftwareUpdate(p.handleDoUpgradeCallback);
timer.restart();
softwareUpdateProgressPopup.startAnimation();
}
UpdateProgressPopupElements{
id: softwareUpdateProgressPopup
headerText: qsTr("Updating Toon")
footerText: qsTr("Do NOT power off your Toon!")
progressText: p.upgradeStatus.action + ": " + p.upgradeStatus.item + "%"
}
Timer {
id: timer
interval: 100
repeat: true
triggeredOnStart: true
onTriggered: {
var uStatus = app.getSoftwareUpdateStatus();
// avoid undefined state before download is started
if (uStatus.action === "") uStatus.action = 'Downloading';
if (uStatus.action === "Failed") p.actionFailed();
uStatus.action = p.translateAction(uStatus.action);
p.upgradeStatus = uStatus;
}
}
}