Lomiri
Loading...
Searching...
No Matches
79-system-update.qml
1/*
2 * Copyright (C) 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.15
18import QtQuick.Layouts 1.1
19import Lomiri.Components 1.3
20import Lomiri.SystemSettings.Update 1.0
21import Wizard 0.1
22import GSettings 1.0
23import ".." as LocalComponents
24import "../../Components"
25
26LocalComponents.Page {
27 id: systemUpdatePage
28 objectName: "systemUpdatePage"
29
30 title: i18n.tr("Update Device")
31 forwardButtonSourceComponent: forwardButton
32
33 skip: !root.updateDownloaded // skip the page when the system update is not ready to install
34
35 Column {
36 id: column
37 anchors {
38 fill: content
39 leftMargin: systemUpdatePage.leftMargin
40 rightMargin: systemUpdatePage.rightMargin
41 topMargin: systemUpdatePage.customMargin
42 }
43 spacing: units.gu(3)
44 opacity: spinner.running ? 0.5 : 1
45 Behavior on opacity {
46 LomiriNumberAnimation {}
47 }
48
49 Label {
50 anchors.left: parent.left
51 anchors.right: parent.right
52 anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
53 font.weight: Font.Light
54 color: textColor
55 wrapMode: Text.Wrap
56 fontSize: "small"
57 text: i18n.tr("There is a system update available and ready to install. Afterwards, the device will automatically restart.")
58 }
59
60 GridLayout {
61 rows: 3
62 columns: 2
63 rowSpacing: units.gu(1)
64 columnSpacing: units.gu(2)
65
66 Image {
67 Layout.rowSpan: 3
68 Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
69 sourceSize: Qt.size(units.gu(3), units.gu(3))
70 fillMode: Image.PreserveAspectFit
71 source: logoResolver.resolvedImage
72 }
73
74 ImageResolver {
75 id: logoResolver
76 objectName: "logoResolver"
77
78 readonly property url defaultLogo: "file://" + Constants.defaultLogo
79
80 GSettings {
81 id: logoSettings
82 schema.id: "com.lomiri.Shell.Launcher"
83 }
84
85 candidates: [
86 logoSettings.logoPictureUri,
87 "image://theme/start-here",
88 defaultLogo
89 ]
90 }
91
92 Label {
93 color: textColor
94 font.weight: Font.Normal
95 fontSize: "small"
96 text: i18n.ctr("string identifying name of the update", "Ubuntu Touch system")
97 }
98
99 Label {
100 font.weight: Font.Light
101 fontSize: "small"
102 color: textColor
103 text: i18n.ctr("version of the system update", "Version %1").arg(SystemImage.targetBuildNumber)
104 }
105 }
106
107 Label {
108 anchors.left: parent.left
109 anchors.right: parent.right
110 anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
111 font.weight: Font.Light
112 color: textColor
113 wrapMode: Text.Wrap
114 fontSize: "small"
115 text: i18n.tr("This could take a few minutes...")
116 }
117
118 Rectangle {
119 anchors.left: parent.left
120 anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
121 color: theme.palette.normal.foreground
122 radius: units.dp(4)
123 width: buttonLabel.paintedWidth + units.gu(3)
124 height: buttonLabel.paintedHeight + units.gu(1.8)
125
126 Label {
127 id: buttonLabel
128 color: textColor
129 text: i18n.tr("Install and restart now")
130 font.weight: Font.Light
131 anchors.centerIn: parent
132 }
133
134 AbstractButton {
135 id: button
136 objectName: "installButton"
137 anchors.fill: parent
138 onClicked: {
139 System.skipUntilFinishedPage();
140 SystemImage.applyUpdate();
141 }
142 }
143
144 transformOrigin: Item.Top
145 scale: button.pressed ? 0.98 : 1.0
146 Behavior on scale {
147 ScaleAnimator {
148 duration: LomiriAnimation.SnapDuration
149 easing.type: Easing.Linear
150 }
151 }
152 }
153 }
154
155 ActivityIndicator {
156 id: spinner
157 anchors.centerIn: systemUpdatePage
158 visible: running
159 }
160
161 Component {
162 id: forwardButton
163 LocalComponents.StackButton {
164 text: i18n.tr("Skip")
165 onClicked: pageStack.next()
166 }
167 }
168}