Lomiri
Loading...
Searching...
No Matches
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
19import QtQuick 2.15
20import Lomiri.Components 1.3
21import Lomiri.SystemSettings.Update 1.0
22import Wizard 0.1
23import ".." as LocalComponents
24
25LocalComponents.Page {
26 objectName: "welcomeUpdate"
27
28 hasBackButton: false
29 customTitle: true
30 buttonBarVisible: false
31 onlyOnUpdate: true
32
33 // XXX: make this distro-agnostic in the future
34 property string distroName: System.distroName
35 property string distroVersion:
36 SystemImage.versionTag || System.version.split("Base-Version: ")[1]
37
38 Component.onCompleted: {
39 state = "reanchored";
40 }
41
42 states: State {
43 name: "reanchored"
44 AnchorChanges { target: bgImage; anchors.top: parent.top; anchors.bottom: parent.bottom }
45 AnchorChanges { target: column;
46 anchors.verticalCenter: parent.verticalCenter;
47 anchors.top: undefined
48 }
49 }
50
51 SequentialAnimation {
52 id: splashAnimation
53 PauseAnimation { duration: LomiriAnimation.BriskDuration }
54 SmoothedAnimation {
55 target: bgImage
56 property: "height"
57 to: units.gu(16)
58 duration: LomiriAnimation.BriskDuration
59 }
60 NumberAnimation {
61 target: bgImage
62 property: 'opacity'
63 from: 1
64 to: 0
65 }
66 }
67
68 Image {
69 id: bgImage
70 source: wideMode ? "data/Desktop_splash_screen_bkg.png" : "data/Phone_splash_screen_bkg.png"
71 scale: Image.PreserveAspectFit
72 anchors.left: parent.left
73 anchors.right: parent.right
74 anchors.bottom: parent.top // outside to let it slide down
75 visible: opacity > 0
76 }
77
78 Item {
79 id: column
80 anchors.leftMargin: leftMargin
81 anchors.rightMargin: rightMargin
82 anchors.left: parent.left
83 anchors.right: parent.right
84 anchors.top: parent.bottom // outside to let it slide in
85 height: childrenRect.height
86 visible: opacity > 0
87
88 Label {
89 id: welcomeLabel
90 anchors.left: parent.left
91 anchors.right: parent.right
92 horizontalAlignment: Text.AlignHCenter
93 wrapMode: Text.Wrap
94 fontSize: "x-large"
95 font.weight: Font.Light
96 lineHeight: 1.2
97 // TRANSLATORS: %1 contains the distro name, %2 the version
98 text: i18n.tr("Welcome to %1 %2")
99 .arg(distroName).arg(distroVersion)
100 color: whiteColor
101 }
102
103 Label {
104 id: welcomeText
105 anchors.left: parent.left
106 anchors.right: parent.right
107 anchors.top: welcomeLabel.bottom
108 anchors.topMargin: units.gu(2)
109 horizontalAlignment: Text.AlignHCenter
110 wrapMode: Text.Wrap
111 fontSize: "large"
112 font.weight: Font.Light
113 lineHeight: 1.2
114 // TRANSLATORS: %1 contains the distro name, %2 the version
115 text: i18n.tr("We will make sure your device is ready to use %1 %2")
116 .arg(distroName).arg(distroVersion)
117 color: whiteColor
118 }
119
120 Rectangle {
121 anchors {
122 top: welcomeText.bottom
123 horizontalCenter: parent.horizontalCenter
124 topMargin: units.gu(4)
125 }
126 color: "transparent"
127 border.width: units.dp(1)
128 border.color: whiteColor
129 radius: units.dp(4)
130 width: buttonLabel.paintedWidth + units.gu(6)
131 height: buttonLabel.paintedHeight + units.gu(1.8)
132
133 Label {
134 id: buttonLabel
135 color: whiteColor
136 text: i18n.tr("Next")
137 fontSize: "medium"
138 anchors.centerIn: parent
139 }
140 AbstractButton {
141 objectName: "nextButton"
142 anchors.fill: parent
143 onClicked: pageStack.next();
144 }
145 }
146 }
147}