Lomiri
Loading...
Searching...
No Matches
11-changelog.qml
1/*
2 * Copyright (C) 2018 The UBports project
3 *
4 * Written by: Dalton Durst <dalton@ubports.com>
5 * Marius Gripsgard <marius@ubports.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20import QtQuick 2.12
21import Lomiri.Components 1.3
22import AccountsService 0.1
23import Wizard 0.1
24import ".." as LocalComponents
25
26LocalComponents.Page {
27 objectName: "changelogPage"
28 title: i18n.tr("What's new")
29 id: changelogPage
30
31 // See skipTimer below for information about this hack
32 property bool loading: false
33
34 forwardButtonSourceComponent: forwardButton
35 onlyOnUpdate: true
36
37 ScrollView {
38 id: scroll
39
40 anchors {
41 fill: content
42 leftMargin: wideMode ? parent.leftMargin : staticMargin
43 rightMargin: wideMode ? parent.rightMargin : staticMargin
44 }
45
46 Column {
47 id: column
48
49 width: scroll.width
50
51 // Make it appear that the text is hiding behind the header
52 Item {
53 height: staticMargin
54 width: units.gu(1)
55 }
56
57 Label {
58 anchors {
59 // Keep the scroll bar from interfering with text
60 rightMargin: units.gu(1)
61 }
62 id: changelogText
63 width: parent.width
64 wrapMode: Text.WordWrap
65 textSize: Label.Medium
66 text: Changelog.text
67 }
68 }
69 }
70
71 Component {
72 id: forwardButton
73 LocalComponents.StackButton {
74 text: loading ? i18n.tr("Loading...") : i18n.tr("Next")
75 onClicked: {
76 changelogPage.loading = true;
77 skipTimer.restart();
78 }
79 }
80 }
81
82 // A horrible hack to make sure the UI refreshes before actually skipping
83 // Without this, people press the Next button multiple times and skip
84 // multiple pages at once.
85 Timer {
86 id: skipTimer
87 interval: 100
88 repeat: false
89 running: false
90 onTriggered: {
91 changelogPage.loading = false;
92 pageStack.next();
93 }
94 }
95}