@@ -1,227 +0,0 @@
2− * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
18−import "../Components"
20−import Unity.Application 0.1
21−import Ubuntu.Gestures 0.1
22−import Ubuntu.Components 0.1
27− // Whether there's an application on foreground (as opposed to have shell's Dash on foreground)
28− property bool applicationIsOnForeground
30− property variant theHud
31− property bool enabled: false
32− property bool preventHiding: dragArea.dragging
33− readonly property real bottomEdgeButtonCenterDistance: units.gu(34)
39− bottombar.state = "hidden"
42− onApplicationIsOnForegroundChanged: {
43− if (!applicationIsOnForeground) {
49− if (state == "hidden") {
51− bottomBarVisibilityCommunicatorShell.forceHidden = false
53− dismissTimer.restart()
57− onPreventHidingChanged: {
58− if (!preventHiding) {
59− if (state == "hint" || state == "reveal")
63− if (dismissTimer.running) {
64− dismissTimer.restart();
72− if (!bottombar.preventHiding) {
73− bottombar.state = "hidden"
75− dismissTimer.restart()
83− readonly property bool centeredHud: parent.width < units.gu(68) // Nexus 7 has 67 gu width
85− x: centeredHud ? parent.width / 2 - width / 2 : MathUtils.clamp(dragArea.touchStartX - (width / 2), 0, bottombar.width - width)
86− y: bottombar.height - bottomEdgeButtonCenterDistance - (height / 2) - bottomMargin
88− visible: opacity != 0
91− if (dragArea.status === DirectionalDragArea.Recognized) {
92− var touchLocal = mapFromItem(dragArea, dragArea.touchX, dragArea.touchY)
93− return touchLocal.x > 0 && touchLocal.x < width
94− && touchLocal.y > 0 && touchLocal.y < height
100− onClicked: theHud.show()
102− Behavior on bottomMargin {
103− NumberAnimation{duration: hudButton.opacity < 0.01 ? 200 : 70; easing.type: Easing.OutQuart}
106− Behavior on opacity {
107− NumberAnimation{duration: 200; easing.type: Easing.OutCubic}
114− bottomBarVisibilityCommunicatorShell.forceHidden = theHud.shown
116− bottombar.state = "hidden"
123− objectName: "hudDragArea"
125− height: shell.edgeSize
126− anchors.bottom: parent.bottom
128− distanceThreshold: units.gu(8)
129− enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground
130− direction: Direction.Upwards
131− maxSilenceTime: 2000
133− property int previousStatus: -1
134− property real touchStartX: -1
136− readonly property real distanceFromThreshold: (-distance) - distanceThreshold // distance is negative
137− readonly property real revealDistance: units.gu(2)
138− readonly property real commitDistance: units.gu(6)
139− readonly property real commitProgress: MathUtils.clamp(distanceFromThreshold / commitDistance, 0, 1)
142− if (status === DirectionalDragArea.WaitingForTouch) {
143− if (previousStatus == DirectionalDragArea.Recognized) {
144− if (hudButton.mouseOver) {
148− } else if (status === DirectionalDragArea.Undecided) {
149− if (!hudButton.centeredHud) {
150− touchStartX = touchX
152− } else if (status === DirectionalDragArea.Recognized) {
153− bottombar.state = "hint"
155− previousStatus = status
158− onDistanceChanged: {
159− if (status === DirectionalDragArea.Recognized) {
160− if (distanceFromThreshold > commitDistance)
161− bottombar.state = "shown"
162− else if (distanceFromThreshold > revealDistance)
163− bottombar.state = "reveal"
175− height: parent.height - bottomBarVisibilityCommunicatorShell.position
178− anchors.fill: parent
179− enabled: bottombar.state == "shown"
181− bottomBarVisibilityCommunicatorShell.forceHidden = true
182− bottombar.state = "hidden"
187− anchors.fill: parent
188− blockInput: (hudButton.opacity == 1)
194− top: dismissArea.bottom
197− bottom: parent.bottom
199− enabled: bottombar.state == "shown" && bottomBarVisibilityCommunicatorShell.position > 0
201− bottombar.state = "hidden"
208− PropertyChanges { target: hudButton; opacity: 0 }
209− PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) }
214− PropertyChanges { target: hudButton; opacity: 0.5 }
219− PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) + units.gu(2) * dragArea.commitProgress }
223− PropertyChanges { target: hudButton; opacity: 1 }
224− PropertyChanges { target: hudButton; bottomMargin: units.gu(0) }