Unity 8
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.4
18 import Ubuntu.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: usageScenario === "desktop" ? 1 : 1 - stage.dragProgress * 2
28 
29  // Else on desktop, fade out when the spread is shown
30  Connections {
31  target: usageScenario === "desktop" ? stage : null
32  ignoreUnknownSignals: true
33  onSpreadShownChanged: if (stage.spreadShown && root.shown) root.hide()
34  }
35 
36  mouseArea {
37  anchors.rightMargin: stage.dragAreaWidth
38  }
39 
40  background {
41  sourceSize.height: 1916
42  sourceSize.width: 1080
43  source: Qt.resolvedUrl("graphics/background1.png")
44  }
45 
46  arrow {
47  anchors.right: root.right
48  anchors.rightMargin: units.gu(2)
49  anchors.verticalCenter: root.verticalCenter
50  rotation: usageScenario === "desktop" ? 180 : 0
51  }
52 
53  label {
54  text: root.usageScenario === "desktop" ?
55  i18n.tr("Push your mouse against the right edge to view your open apps") :
56  i18n.tr("Swipe from the right edge to view your open apps")
57  anchors.right: arrow.left
58  anchors.rightMargin: units.gu(2) - (label.width - label.contentWidth)
59  anchors.verticalCenter: arrow.verticalCenter
60  width: Math.min(units.gu(40), arrow.x - units.gu(4))
61  }
62 }