Unity 8
10-welcome-update.qml
1 /*
2  * Copyright (C) 2018 The UBports project
3  *
4  * Written by: Marius Gripsgard <marius@ubports.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 3.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 import QtQuick 2.4
20 import Ubuntu.Components 1.3
21 import Wizard 0.1
22 import ".." as LocalComponents
23 
24 LocalComponents.Page {
25  objectName: "welcomeUpdate"
26 
27  hasBackButton: false
28  customTitle: true
29  buttonBarVisible: false
30  onlyOnUpdate: true
31 
32  Component.onCompleted: {
33  state = "reanchored";
34  }
35 
36  states: State {
37  name: "reanchored"
38  AnchorChanges { target: bgImage; anchors.top: parent.top; anchors.bottom: parent.bottom }
39  AnchorChanges { target: column;
40  anchors.verticalCenter: parent.verticalCenter;
41  anchors.top: undefined
42  }
43  }
44 
45  SequentialAnimation {
46  id: splashAnimation
47  PauseAnimation { duration: UbuntuAnimation.BriskDuration }
48  SmoothedAnimation {
49  target: bgImage
50  property: "height"
51  to: units.gu(16)
52  duration: UbuntuAnimation.BriskDuration
53  }
54  NumberAnimation {
55  target: bgImage
56  property: 'opacity'
57  from: 1
58  to: 0
59  }
60  }
61 
62  Image {
63  id: bgImage
64  source: wideMode ? "data/Desktop_splash_screen_bkg.png" : "data/Phone_splash_screen_bkg.png"
65  scale: Image.PreserveAspectFit
66  anchors.left: parent.left
67  anchors.right: parent.right
68  anchors.bottom: parent.top // outside to let it slide down
69  visible: opacity > 0
70  }
71 
72  Item {
73  id: column
74  anchors.leftMargin: leftMargin
75  anchors.rightMargin: rightMargin
76  anchors.left: parent.left
77  anchors.right: parent.right
78  anchors.top: parent.bottom // outside to let it slide in
79  height: childrenRect.height
80  visible: opacity > 0
81 
82  Label {
83  id: welcomeLabel
84  anchors.left: parent.left
85  anchors.right: parent.right
86  horizontalAlignment: Text.AlignHCenter
87  wrapMode: Text.Wrap
88  fontSize: "x-large"
89  font.weight: Font.Light
90  lineHeight: 1.2
91  text: i18n.tr("Welcome to ") + System.version.split("Base-Version: ")[1]
92  color: whiteColor
93  }
94 
95  Label {
96  id: welcomeText
97  anchors.left: parent.left
98  anchors.right: parent.right
99  anchors.top: welcomeLabel.bottom
100  anchors.topMargin: units.gu(2)
101  horizontalAlignment: Text.AlignHCenter
102  wrapMode: Text.Wrap
103  fontSize: "large"
104  font.weight: Font.Light
105  lineHeight: 1.2
106  text: i18n.tr("We will make sure your device is ready to use ") + System.version.split("Base-Version: ")[1]
107  color: whiteColor
108  }
109 
110  Rectangle {
111  anchors {
112  top: welcomeText.bottom
113  horizontalCenter: parent.horizontalCenter
114  topMargin: units.gu(4)
115  }
116  color: "transparent"
117  border.width: units.dp(1)
118  border.color: whiteColor
119  radius: units.dp(4)
120  width: buttonLabel.paintedWidth + units.gu(6)
121  height: buttonLabel.paintedHeight + units.gu(1.8)
122 
123  Label {
124  id: buttonLabel
125  color: whiteColor
126  text: i18n.tr("Next")
127  fontSize: "medium"
128  anchors.centerIn: parent
129  }
130  AbstractButton {
131  objectName: "nextButton"
132  anchors.fill: parent
133  onClicked: pageStack.next();
134  }
135  }
136  }
137 }