~unity-team/unity8/dash-only

« back to all changes in this revision

Viewing changes to qml/Wizard/Pages/77-system-update.qml

  • Committer: Kevin Gunn
  • Date: 2016-10-24 19:51:33 UTC
  • Revision ID: kevin.gunn@canonical.com-20161024195133-61lwdzzdwsnue1mn
shave some more

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
17
 
import QtQuick 2.4
18
 
import QtQuick.Layouts 1.1
19
 
import Ubuntu.Components 1.3
20
 
import Ubuntu.SystemImage 0.1
21
 
import Wizard 0.1
22
 
import ".." as LocalComponents
23
 
 
24
 
LocalComponents.Page {
25
 
    id: systemUpdatePage
26
 
    objectName: "systemUpdatePage"
27
 
 
28
 
    title: i18n.tr("Update Device")
29
 
    forwardButtonSourceComponent: forwardButton
30
 
 
31
 
    skip: !SystemImage.updateDownloaded // skip the page when the system update is not ready to install
32
 
 
33
 
    Column {
34
 
        id: column
35
 
        anchors {
36
 
            fill: content
37
 
            leftMargin: systemUpdatePage.leftMargin
38
 
            rightMargin: systemUpdatePage.rightMargin
39
 
            topMargin: systemUpdatePage.customMargin
40
 
        }
41
 
        spacing: units.gu(3)
42
 
        opacity: spinner.running ? 0.5 : 1
43
 
        Behavior on opacity {
44
 
            UbuntuNumberAnimation {}
45
 
        }
46
 
 
47
 
        Label {
48
 
            anchors.left: parent.left
49
 
            anchors.right: parent.right
50
 
            anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
51
 
            font.weight: Font.Light
52
 
            color: textColor
53
 
            wrapMode: Text.Wrap
54
 
            fontSize: "small"
55
 
            text: i18n.tr("There is a system update available and ready to install. Afterwards, the device will automatically restart.")
56
 
        }
57
 
 
58
 
        GridLayout {
59
 
            rows: 3
60
 
            columns: 2
61
 
            rowSpacing: units.gu(1)
62
 
            columnSpacing: units.gu(2)
63
 
 
64
 
            Image {
65
 
                Layout.rowSpan: 3
66
 
                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
67
 
                sourceSize: Qt.size(units.gu(3), units.gu(3))
68
 
                fillMode: Image.PreserveAspectFit
69
 
                source: "image://theme/distributor-logo"
70
 
            }
71
 
 
72
 
            Label {
73
 
                color: textColor
74
 
                font.weight: Font.Normal
75
 
                fontSize: "small"
76
 
                text: i18n.ctr("string identifying name of the update", "Ubuntu system")
77
 
            }
78
 
 
79
 
            Label {
80
 
                font.weight: Font.Light
81
 
                fontSize: "small"
82
 
                color: textColor
83
 
                text: i18n.ctr("version of the system update", "Version %1").arg(SystemImage.availableVersion)
84
 
            }
85
 
 
86
 
            Label {
87
 
                font.weight: Font.Light
88
 
                fontSize: "small"
89
 
                color: textColor
90
 
                text: SystemImage.updateSize
91
 
            }
92
 
        }
93
 
 
94
 
        Label {
95
 
            anchors.left: parent.left
96
 
            anchors.right: parent.right
97
 
            anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
98
 
            font.weight: Font.Light
99
 
            color: textColor
100
 
            wrapMode: Text.Wrap
101
 
            fontSize: "small"
102
 
            text: i18n.tr("This could take a few minutes...")
103
 
        }
104
 
 
105
 
        Rectangle {
106
 
            anchors.left: parent.left
107
 
            anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
108
 
            color: theme.palette.normal.foreground
109
 
            radius: units.dp(4)
110
 
            width: buttonLabel.paintedWidth + units.gu(3)
111
 
            height: buttonLabel.paintedHeight + units.gu(1.8)
112
 
 
113
 
            Label {
114
 
                id: buttonLabel
115
 
                color: textColor
116
 
                text: i18n.tr("Install and restart now")
117
 
                font.weight: Font.Light
118
 
                anchors.centerIn: parent
119
 
            }
120
 
 
121
 
            AbstractButton {
122
 
                id: button
123
 
                objectName: "installButton"
124
 
                anchors.fill: parent
125
 
                onClicked: {
126
 
                    System.skipUntilFinishedPage();
127
 
                    SystemImage.applyUpdate();
128
 
                }
129
 
            }
130
 
 
131
 
            transformOrigin: Item.Top
132
 
            scale: button.pressed ? 0.98 : 1.0
133
 
            Behavior on scale {
134
 
                ScaleAnimator {
135
 
                    duration: UbuntuAnimation.SnapDuration
136
 
                    easing.type: Easing.Linear
137
 
                }
138
 
            }
139
 
        }
140
 
    }
141
 
 
142
 
    ActivityIndicator {
143
 
        id: spinner
144
 
        anchors.centerIn: systemUpdatePage
145
 
        running: SystemImage.updateApplying
146
 
        visible: running
147
 
    }
148
 
 
149
 
    Component {
150
 
        id: forwardButton
151
 
        LocalComponents.StackButton {
152
 
            text: i18n.tr("Skip")
153
 
            onClicked: pageStack.next()
154
 
        }
155
 
    }
156
 
}