Lomiri
TutorialRight.qml
1 /*
2  * Copyright (C) 2015-2016 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.12
18 import Lomiri.Components 1.3
19 
20 TutorialPage {
21  id: root
22 
23  property var stage
24  property string usageScenario
25 
26  // When on phone or tablet, fade out as the drag progresses
27  opacityOverride: stage.spreadShown ? 0 : usageScenario === "desktop" ? 1 : 1 - stage.rightEdgeDragProgress * 2
28 
29  Connections {
30  target: stage
31  ignoreUnknownSignals: true
32  onSpreadShownChanged: if (stage.spreadShown && root.shown) root.hide()
33  }
34 
35  mouseArea {
36  anchors.rightMargin: stage.dragAreaWidth
37  }
38 
39  background {
40  sourceSize.height: 1916
41  sourceSize.width: 1080
42  source: Qt.resolvedUrl("graphics/background1.png")
43  }
44 
45  arrow {
46  anchors.right: root.right
47  anchors.rightMargin: units.gu(2)
48  anchors.verticalCenter: root.verticalCenter
49  rotation: usageScenario === "desktop" ? 180 : 0
50  }
51 
52  label {
53  text: root.usageScenario === "desktop" ?
54  i18n.tr("Push your mouse against the right edge to view your open apps") :
55  i18n.tr("Swipe from the right edge to view your open apps")
56  anchors.right: arrow.left
57  anchors.rightMargin: units.gu(2) - (label.width - label.contentWidth)
58  anchors.verticalCenter: arrow.verticalCenter
59  width: Math.min(units.gu(40), arrow.x - units.gu(4))
60  }
61 }