Lomiri
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.12
20 import Lomiri.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: LomiriAnimation.BriskDuration }
48  SmoothedAnimation {
49  target: bgImage
50  property: "height"
51  to: units.gu(16)
52  duration: LomiriAnimation.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  // TRANSLATORS: %1 contains the distro name, %2 the version
92  text: i18n.tr("Welcome to %1 %2").arg(System.distroName).arg(System.version.split("Base-Version: ")[1])
93  color: whiteColor
94  }
95 
96  Label {
97  id: welcomeText
98  anchors.left: parent.left
99  anchors.right: parent.right
100  anchors.top: welcomeLabel.bottom
101  anchors.topMargin: units.gu(2)
102  horizontalAlignment: Text.AlignHCenter
103  wrapMode: Text.Wrap
104  fontSize: "large"
105  font.weight: Font.Light
106  lineHeight: 1.2
107  // TRANSLATORS: %1 contains the distro name, %2 the version
108  text: i18n.tr("We will make sure your device is ready to use %1 %2").arg(System.distroName).arg(System.version.split("Base-Version: ")[1])
109  color: whiteColor
110  }
111 
112  Rectangle {
113  anchors {
114  top: welcomeText.bottom
115  horizontalCenter: parent.horizontalCenter
116  topMargin: units.gu(4)
117  }
118  color: "transparent"
119  border.width: units.dp(1)
120  border.color: whiteColor
121  radius: units.dp(4)
122  width: buttonLabel.paintedWidth + units.gu(6)
123  height: buttonLabel.paintedHeight + units.gu(1.8)
124 
125  Label {
126  id: buttonLabel
127  color: whiteColor
128  text: i18n.tr("Next")
129  fontSize: "medium"
130  anchors.centerIn: parent
131  }
132  AbstractButton {
133  objectName: "nextButton"
134  anchors.fill: parent
135  onClicked: pageStack.next();
136  }
137  }
138  }
139 }