~ubuntu-branches/ubuntu/saucy/unity8/saucy-proposed

« back to all changes in this revision

Viewing changes to Bottombar/Bottombar.qml

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Michał Sawicz, Nick Dedekind, Albert Astals, Christopher Lee, Ubuntu daily release
  • Date: 2013-10-05 11:45:14 UTC
  • mfrom: (1.1.42)
  • Revision ID: package-import@ubuntu.com-20131005114514-fhwzgl2362zv4fmd
Tags: 7.82+13.10.20131005-0ubuntu1
[ Michał Sawicz ]
* Revert r376 that caused constant CPU usage due to the
  ActivityIndicator.

[ Nick Dedekind ]
* Removed indicators-client autopilot tests. (LP: #1234736)

[ Albert Astals ]
* Revert r388. (LP: #1235268)

[ Christopher Lee ]
* Removes passing -fullscreen to unity8 when on the device (as per bug
  #1235065). (LP: #1235065)

[ Ubuntu daily release ]
* Automatic snapshot from revision 396

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
    state: "hidden"
36
36
 
 
37
    function hide() {
 
38
        dismissTimer.stop()
 
39
        bottombar.state = "hidden"
 
40
    }
 
41
 
 
42
    onApplicationIsOnForegroundChanged: {
 
43
        if (!applicationIsOnForeground) {
 
44
            hide()
 
45
        }
 
46
    }
 
47
 
37
48
    onStateChanged: {
38
49
        if (state == "hidden") {
39
50
            dismissTimer.stop()
 
51
            bottomBarVisibilityCommunicatorShell.forceHidden = false
40
52
        } else {
41
53
            dismissTimer.restart()
42
54
        }
43
55
    }
44
56
 
45
57
    onPreventHidingChanged: {
 
58
        if (!preventHiding) {
 
59
            if (state == "hint" || state == "reveal")
 
60
                hide()
 
61
        }
 
62
 
46
63
        if (dismissTimer.running) {
47
64
            dismissTimer.restart();
48
65
        }
50
67
 
51
68
    Timer {
52
69
        id: dismissTimer
53
 
        interval: 5000
 
70
        interval: 1000
54
71
        onTriggered: {
55
72
            if (!bottombar.preventHiding) {
56
73
                bottombar.state = "hidden"
103
120
 
104
121
    EdgeDragArea {
105
122
        id: dragArea
 
123
        objectName: "hudDragArea"
106
124
        width: parent.width
107
125
        height: distanceThreshold
108
126
        anchors.bottom: parent.bottom
109
127
 
110
 
        distanceThreshold: units.gu(1)
 
128
        distanceThreshold: units.gu(8)
111
129
        enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground
112
130
        direction: Direction.Upwards
 
131
        maxSilenceTime: 2000
113
132
 
114
133
        property int previousStatus: -1
115
134
        property real touchStartX: -1
116
135
 
 
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: MathLocal.clamp(distanceFromThreshold / commitDistance, 0, 1)
 
140
 
117
141
        onStatusChanged: {
118
142
            if (status === DirectionalDragArea.WaitingForTouch) {
119
143
                if (previousStatus == DirectionalDragArea.Recognized) {
120
144
                    if (hudButton.mouseOver) {
121
145
                        hudButton.clicked()
122
 
                    } else {
123
 
                        bottombar.state = "hidden"
124
146
                    }
125
147
                }
126
148
            } else if (status === DirectionalDragArea.Undecided) {
128
150
                    touchStartX = touchX
129
151
                }
130
152
            } else if (status === DirectionalDragArea.Recognized) {
131
 
                bottombar.state = "shown"
 
153
                bottombar.state = "hint"
132
154
            }
133
155
            previousStatus = status
134
156
        }
 
157
 
 
158
        onDistanceChanged: {
 
159
            if (status === DirectionalDragArea.Recognized) {
 
160
                if (distanceFromThreshold > commitDistance)
 
161
                    bottombar.state = "shown"
 
162
                else if (distanceFromThreshold > revealDistance)
 
163
                    bottombar.state = "reveal"
 
164
            }
 
165
        }
 
166
    }
 
167
 
 
168
    Item {
 
169
        id: dismissArea
 
170
        anchors {
 
171
            top: parent.top
 
172
            left: parent.left
 
173
            right: parent.right
 
174
        }
 
175
        height: parent.height - bottomBarVisibilityCommunicatorShell.position
 
176
 
 
177
        MouseArea {
 
178
            anchors.fill: parent
 
179
            enabled: bottombar.state == "shown"
 
180
            onPressed: {
 
181
                bottomBarVisibilityCommunicatorShell.forceHidden = true
 
182
                bottombar.state = "hidden"
 
183
            }
 
184
        }
 
185
 
 
186
        InputFilterArea {
 
187
            anchors.fill: parent
 
188
            blockInput: (hudButton.opacity == 1)
 
189
        }
135
190
    }
136
191
 
137
192
    MouseArea {
138
 
        anchors.fill: parent
139
 
        enabled: bottombar.state == "shown"
 
193
        anchors {
 
194
            top: dismissArea.bottom
 
195
            left: parent.left
 
196
            right: parent.right
 
197
            bottom: parent.bottom
 
198
        }
 
199
        enabled: bottombar.state == "shown" && bottomBarVisibilityCommunicatorShell.position > 0
140
200
        onPressed: {
141
201
            bottombar.state = "hidden"
142
202
        }
143
203
    }
144
204
 
145
 
    InputFilterArea {
146
 
        anchors.fill: parent
147
 
        blockInput: (hudButton.opacity == 1)
148
 
    }
149
 
 
150
205
    states: [
151
206
        State {
152
207
            name: "hidden"
153
 
            PropertyChanges { target: hudButton; opacity: 0}
154
 
            PropertyChanges { target: hudButton; bottomMargin: units.gu(-1)}
 
208
            PropertyChanges { target: hudButton; opacity: 0 }
 
209
            PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) }
 
210
        },
 
211
        State {
 
212
            name: "hint"
 
213
            extend: "hidden"
 
214
            PropertyChanges { target: hudButton; opacity: 0.5 }
 
215
        },
 
216
        State {
 
217
            name: "reveal"
 
218
            extend: "hint"
 
219
            PropertyChanges { target: hudButton; bottomMargin: units.gu(-2) + units.gu(2) * dragArea.commitProgress }
155
220
        },
156
221
        State {
157
222
            name: "shown"
158
 
            PropertyChanges { target: hudButton; opacity: 1}
159
 
            PropertyChanges { target: hudButton; bottomMargin: units.gu(0)}
 
223
            PropertyChanges { target: hudButton; opacity: 1 }
 
224
            PropertyChanges { target: hudButton; bottomMargin: units.gu(0) }
160
225
        }
161
226
    ]
162
227
}