Lomiri
Wizard.qml
1 /*
2  * Copyright (C) 2018 The UBports project
3  * Copyright (C) 2013, 2015 Canonical Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 import QtQuick 2.12
19 import Lomiri.Components 1.3
20 import Wizard 0.1
21 import "../Components"
22 
23 Showable {
24  id: wizard
25 
26  // This is a bool instead of an alias because Loader classes like to emit
27  // changed signals for 'active' during startup even if they aren't actually
28  // changing values. Having it cached as a proper Qml bool property prevents
29  // unnecessary 'changed' emissions and provides consuming classes the
30  // expected behavior of no emission on startup.
31  readonly property bool active: loader.active
32 
33  property bool isUpdate: System.isUpdate
34 
35  // The wizard should be run at a later time if, for example, lomiri is
36  // in greeter mode
37  property bool deferred: false
38 
39  hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
40 
41  onRequiredChanged: {
42  if (!required) {
43  System.wizardEnabled = false;
44  }
45  }
46 
47  Loader {
48  id: loader
49  anchors.fill: parent
50  active: System.wizardEnabled && !deferred
51  source: "Pages.qml"
52 
53  Connections {
54  target: loader.item
55  onQuit: wizard.hide()
56  }
57  }
58 }