~saviq/unity/phablet.release-172

278.1.1 by Michał Sawicz
add copyright headers
1
/*
2
 * Copyright (C) 2013 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
68.2.1 by Kaleo
Migrated to QtQuick 2.0
17
import QtQuick 2.0
603.1.1 by Daniel d'Andrada
Purge fakes from QML code.
18
import Ubuntu.Application 0.1
71.2.1 by Kaleo
Removed hacked up resolution independence and deleted implementation from Widgets/*.qml
19
import Ubuntu.Components 0.1
4 by Florian Boucault
Capitalize folder names.
20
import "Dash"
21
import "Greeter"
22
import "Launcher"
277.3.2 by Gerry Boland
Create Panel to encapsulate both itself and the Indicators. Reorder code to suit involves renaming Indicators directory to Panel
23
import "Panel"
22 by Vesa Rautiainen
Hud placeholder, new version of Indicators and Indicatormenu added. Also QuitDialog added. Some smallish changes were needed in Revealer and DragArea components.
24
import "Hud"
71.1.1 by Vesa Rautiainen
Reorganizing Revealer and related components from main level in to a new Components folder. Also QuitDialog moved from Widgets to Components.
25
import "Components"
26
import "Components/Math.js" as MathLocal
154.1.90 by Albert Astals
BottomBar + controller for sdk apps
27
import "Bottombar"
301.2.1 by Kaleo
Current sidestage work.
28
import "SideStage"
603.1.6 by Daniel d'Andrada
fix ApplicationManager's side stage implementation
29
import "Applications/applications.js" as ApplicationsModel
1 by Florian Boucault
Initial import
30
270.1.1 by Michał Sawicz
make Shell a FocusScope so that focus is not lost
31
FocusScope {
2 by Florian Boucault
First shot at shell navigation.
32
    id: shell
33
277.1.5 by Michał Sawicz
drop the use of shell.tablet boolean
34
    // this is only here to select the width / height of the window if not running fullscreen
372.1.2 by Michał Sawicz
revert accidental change
35
    property bool tablet: false
79.1.1 by Kaleo
Use grid units everywhere possible.
36
    width: tablet ? units.gu(160) : units.gu(40)
37
    height: tablet ? units.gu(100) : units.gu(71)
2 by Florian Boucault
First shot at shell navigation.
38
394.2.1 by Michał Sawicz
reduce the edge size to 2 GUs
39
    property real edgeSize: units.gu(2)
419.1.2 by Michael Zanetti
instead of changin the code, change the image filenames
40
    property url background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
301.6.3 by Gerry Boland
Make panelHeight a property in shell so other components can use it. Requires a small amount of moving around numbers in Panel
41
    readonly property real panelHeight: panel.panelHeight
301.1.5 by Kaleo
Shell: added FIXMEs.
42
433.1.4 by Kaleo
Dash apps lens: use screenshot of applications from cache when going back to dash.
43
    property bool dashShown: dash.shown
44
    property bool stageScreenshotsReady: {
45
        if (sideStage.shown) {
433.1.5 by Kaleo
Also take screenshots for dash apps lens when only side stage apps.
46
            if (mainStage.applications.count > 0) {
47
                return mainStage.usingScreenshots && sideStage.usingScreenshots;
48
            } else {
49
                return sideStage.usingScreenshots;
50
            }
433.1.4 by Kaleo
Dash apps lens: use screenshot of applications from cache when going back to dash.
51
        } else {
52
            return mainStage.usingScreenshots;
53
        }
54
    }
55
482.2.1 by Michael Zanetti
move access to "shell" out of the PageHeader
56
    property ListModel searchHistory: SearchHistoryModel {}
285.1.17 by Michał Sawicz
add search history
57
603.1.1 by Daniel d'Andrada
Purge fakes from QML code.
58
    property var applicationManager: ApplicationManagerWrapper {}
281.1.5 by Kaleo
More generic way to detect availability of Ubuntu.Application.
59
186.1.1 by Gerry Boland
merge trunk
60
    Component.onCompleted: {
301.2.9 by Kaleo
Disable sidestage if shell less than 60gu.
61
        applicationManager.sideStageEnabled = Qt.binding(function() { return sideStage.enabled })
277.4.22 by Gerry Boland
Fix bug where is a fullscreen app is running before shell starts, shell would see focused app was fullscreen and hide the panel. Fix by ensuring app unfocused by shell at startup
62
277.4.27 by Gerry Boland
Add better fixme about ashell issue when it starts with existing applications running already
63
        // FIXME: if application focused before shell starts, shell draws on top of it only.
64
        // We should detect already running applications on shell start and bring them to the front.
277.4.22 by Gerry Boland
Fix bug where is a fullscreen app is running before shell starts, shell would see focused app was fullscreen and hide the panel. Fix by ensuring app unfocused by shell at startup
65
        applicationManager.unfocusCurrentApplication();
186.1.1 by Gerry Boland
merge trunk
66
    }
48 by Vesa Rautiainen
Old launcher merged into the project. This is a temporary solution until revealer based launcher is ready.
67
301.8.2 by Gerry Boland
Restore fullscreen behaviour
68
    readonly property bool fullscreenMode: {
421.1.1 by Gerry Boland
Fix panel being hidden when greeter showing
69
        if (greeter.shown) {
70
            return false;
71
        } else if (mainStage.usingScreenshots) { // Window Manager animating so want to re-evaluate fullscreen mode
301.8.4 by Gerry Boland
Line forgotton restored. Give property better name
72
            return mainStage.switchingFromFullscreenToFullscreen;
301.8.2 by Gerry Boland
Restore fullscreen behaviour
73
        } else if (applicationManager.mainStageFocusedApplication) {
74
            return applicationManager.mainStageFocusedApplication.fullscreen;
75
        } else {
76
            return false;
77
        }
78
    }
277.4.22 by Gerry Boland
Fix bug where is a fullscreen app is running before shell starts, shell would see focused app was fullscreen and hide the panel. Fix by ensuring app unfocused by shell at startup
79
233.1.1 by Kaleo
Handle ApplicationManager.focusRequested
80
    Connections {
277.2.4 by Gerry Boland
ApplicationManager depends on Ubuntu.Application which is not available on all platforms. Create fallback with ApplicationManagerFake which will display images instead of execuing real applications and emulate the focus/unfocus behaviour (not complete).
81
        target: applicationManager
277.2.20 by Gerry Boland
Fix initialization errors when the applicationManager is not ready
82
        ignoreUnknownSignals: true
233.1.1 by Kaleo
Handle ApplicationManager.focusRequested
83
        onFocusRequested: {
284.4.1 by Kaleo
Cleaned up application management by aligning Application classes APIs.
84
            shell.activateApplication(desktopFile);
85
        }
86
    }
87
88
    function activateApplication(desktopFile, argument) {
277.2.4 by Gerry Boland
ApplicationManager depends on Ubuntu.Application which is not available on all platforms. Create fallback with ApplicationManagerFake which will display images instead of execuing real applications and emulate the focus/unfocus behaviour (not complete).
89
        if (applicationManager) {
301.2.1 by Kaleo
Current sidestage work.
90
            var application;
91
            application = applicationManager.activateApplication(desktopFile, argument);
92
            if (application == null) {
93
                return;
94
            }
603.1.6 by Daniel d'Andrada
fix ApplicationManager's side stage implementation
95
            if (application.stage == ApplicationsModel.MainStage || !sideStage.enabled) {
284.4.1 by Kaleo
Cleaned up application management by aligning Application classes APIs.
96
                mainStage.activateApplication(desktopFile);
301.2.1 by Kaleo
Current sidestage work.
97
            } else {
98
                sideStage.activateApplication(desktopFile);
218.1.1 by Kaleo
Window management
99
            }
301.2.2 by Kaleo
Show stages when activating an app.
100
            stages.show();
186.1.3 by Gerry Boland
Running apps works on both desktop and phone
101
        }
2 by Florian Boucault
First shot at shell navigation.
102
    }
103
396.1.1 by Renato Araujo Oliveira Filho
Implemented support for volume control using hardware keys.
104
    VolumeControl {
581.1.3 by Michael Zanetti
Make volume slider in Overview work
105
        id: volumeControl
396.1.1 by Renato Araujo Oliveira Filho
Implemented support for volume control using hardware keys.
106
    }
107
581.1.7 by Michael Zanetti
fix button volume control
108
    Keys.onVolumeUpPressed: volumeControl.volumeUp()
109
    Keys.onVolumeDownPressed: volumeControl.volumeDown()
396.1.1 by Renato Araujo Oliveira Filho
Implemented support for volume control using hardware keys.
110
238.1.1 by Kaleo
Lock screen only when releasing the power button, not upon pressing it.
111
    Keys.onReleased: {
233.2.1 by Kaleo
Lock screen by showing greeter upon pressing the power button.
112
        if (event.key == Qt.Key_PowerOff) {
113
            greeter.show()
114
        }
115
    }
116
301.1.12 by Kaleo
Cleaned up dash disappearing animation.
117
    Item {
118
        id: underlay
119
120
        anchors.fill: parent
301.2.15 by Kaleo
Renamed Stage.fullyShown into more generic Stage.shouldUseScreenshots.
121
        visible: !(panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth)
301.2.66 by Kaleo
Show the underlay at the right times.
122
                 && (stages.fullyHidden
123
                     || (stages.fullyShown && mainStage.usingScreenshots)
124
                     || !stages.fullyShown && (mainStage.usingScreenshots || (sideStage.shown && sideStage.usingScreenshots)))
301.1.12 by Kaleo
Cleaned up dash disappearing animation.
125
126
        Image {
127
            id: backgroundImage
128
            source: shell.background
419.1.3 by Michael Zanetti
sourceSize = size
129
            sourceSize.width: parent.width
130
            sourceSize.height: parent.height
301.1.12 by Kaleo
Cleaned up dash disappearing animation.
131
            anchors.fill: parent
132
        }
133
134
        Rectangle {
135
            anchors.fill: parent
136
            color: "black"
137
            opacity: dash.disappearingAnimationProgress
138
        }
139
140
        Dash {
141
            id: dash
142
143
            available: !greeter.shown
301.2.14 by Kaleo
Merged stage_cleanup.
144
            hides: [stages, launcher, panel.indicators]
433.1.4 by Kaleo
Dash apps lens: use screenshot of applications from cache when going back to dash.
145
            shown: disappearingAnimationProgress !== 1.0
301.1.14 by Kaleo
Disable dash when swiping from launcher.
146
            enabled: disappearingAnimationProgress === 0.0
301.2.56 by Kaleo
Omitted code in previous commit.
147
            // FIXME: unfocus all applications when going back to the dash
148
            onEnabledChanged: {
149
                if (enabled) {
150
                    shell.applicationManager.unfocusCurrentApplication()
151
                }
152
            }
301.1.12 by Kaleo
Cleaned up dash disappearing animation.
153
154
            anchors {
301.1.26 by Kaleo
Merged from trunk.
155
                fill: parent
156
                topMargin: panel.panelHeight
301.1.12 by Kaleo
Cleaned up dash disappearing animation.
157
            }
158
159
            contentScale: 1.0 - 0.2 * disappearingAnimationProgress
160
            opacity: 1.0 - disappearingAnimationProgress
301.2.1 by Kaleo
Current sidestage work.
161
            property real disappearingAnimationProgress: ((greeter.shown) ? greeterRevealer.animatedProgress : stagesRevealer.animatedProgress)
162
            // FIXME: only necessary because stagesRevealer.animatedProgress and
301.1.12 by Kaleo
Cleaned up dash disappearing animation.
163
            // greeterRevealer.animatedProgress are not animated
164
            Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
165
        }
166
    }
167
277.2.12 by Gerry Boland
Remove a little duplication, fix some focus ordering bugs
168
49 by Vesa Rautiainen
Changes for launcher spread demo. To dash app animation is not finalized yet though.
169
    Item {
170
171
        width: parent.width
172
        height: parent.height
173
        x: launcher.progress
174
        Behavior on x {SmoothedAnimation{velocity: 600}}
175
277.2.18 by Gerry Boland
Reduce delta
176
301.2.1 by Kaleo
Current sidestage work.
177
        Showable {
178
            id: stages
49 by Vesa Rautiainen
Changes for launcher spread demo. To dash app animation is not finalized yet though.
179
301.2.1 by Kaleo
Current sidestage work.
180
            property bool fullyShown: shown && stages[stagesRevealer.boundProperty] == stagesRevealer.openedValue
181
                                      && parent.x == 0
301.2.66 by Kaleo
Show the underlay at the right times.
182
            property bool fullyHidden: !shown && stages[stagesRevealer.boundProperty] == stagesRevealer.closedValue
49 by Vesa Rautiainen
Changes for launcher spread demo. To dash app animation is not finalized yet though.
183
            available: !greeter.shown
277.3.1 by Gerry Boland
Create Panel to encapsulate both itself and the Indicators, reorder code to suit.
184
            hides: [launcher, panel.indicators]
49 by Vesa Rautiainen
Changes for launcher spread demo. To dash app animation is not finalized yet though.
185
            shown: false
186
            opacity: 1.0
301.2.1 by Kaleo
Current sidestage work.
187
            showAnimation: StandardAnimation { property: "x"; duration: 350; to: stagesRevealer.openedValue; easing.type: Easing.OutCubic }
188
            hideAnimation: StandardAnimation { property: "x"; duration: 350; to: stagesRevealer.closedValue; easing.type: Easing.OutCubic }
49 by Vesa Rautiainen
Changes for launcher spread demo. To dash app animation is not finalized yet though.
189
190
            width: parent.width
277.4.10 by Gerry Boland
Add fullscreen support to shell. Stages now overlap panel. Applications are contained by their wrappers from drawing over panel when they are non-fullscreen. All applications models get an extra role 'fullscreen'.
191
            height: parent.height
301.2.1 by Kaleo
Current sidestage work.
192
423.1.1 by Kaleo
Do not rely on number of applications remaining to return to dash because application list is updated _before_ focused applications.
193
            // close the stages when no focused application remains
194
            Connections {
195
                target: shell.applicationManager
196
                onMainStageFocusedApplicationChanged: stages.closeIfNoApplications()
197
                onSideStageFocusedApplicationChanged: stages.closeIfNoApplications()
410.1.1 by Kaleo
Close the stages when no application remains in either the main or the side stage.
198
                ignoreUnknownSignals: true
199
            }
200
201
            function closeIfNoApplications() {
423.1.1 by Kaleo
Do not rely on number of applications remaining to return to dash because application list is updated _before_ focused applications.
202
                if (!shell.applicationManager.mainStageFocusedApplication
427.1.1 by Kaleo
When checking if no applications are remaining opened, also verify that the list
203
                 && !shell.applicationManager.sideStageFocusedApplication
204
                 && shell.applicationManager.mainStageApplications.count == 0
205
                 && shell.applicationManager.sideStageApplications.count == 0) {
410.1.1 by Kaleo
Close the stages when no application remains in either the main or the side stage.
206
                    stages.hide();
207
                }
208
            }
209
432.2.1 by Kaleo
[Window Management] Show stages when a new application gets the focus.
210
            // show the stages when an application gets the focus
211
            Connections {
212
                target: shell.applicationManager
213
                onMainStageFocusedApplicationChanged: {
214
                    if (shell.applicationManager.mainStageFocusedApplication) {
215
                        mainStage.show();
216
                        stages.show();
217
                    }
218
                }
219
                onSideStageFocusedApplicationChanged: {
220
                    if (shell.applicationManager.sideStageFocusedApplication) {
221
                        sideStage.show();
222
                        stages.show();
223
                    }
224
                }
225
                ignoreUnknownSignals: true
226
            }
227
228
301.2.1 by Kaleo
Current sidestage work.
229
            Stage {
230
                id: mainStage
231
232
                anchors.fill: parent
233
                fullyShown: stages.fullyShown
301.2.52 by Kaleo
Do not refocus the main stage app when the side stage app loses the focus but instead do it when side stage is not fully shown.
234
                shouldUseScreenshots: !fullyShown
404.3.1 by Kaleo
Disable main stage's right edge swipe to switch applications when side stage is enabled.
235
                rightEdgeEnabled: !sideStage.enabled
301.2.1 by Kaleo
Current sidestage work.
236
507.6.1 by Daniel d'Andrada
Refactoring Stage.qml
237
                applicationManager: shell.applicationManager
238
                rightEdgeDraggingAreaWidth: shell.edgeSize
239
                normalApplicationY: shell.panelHeight
240
301.2.1 by Kaleo
Current sidestage work.
241
                shown: true
242
                function show() {
243
                    stages.show();
244
                }
245
                function showWithoutAnimation() {
246
                    stages.showWithoutAnimation();
247
                }
248
                function hide() {
249
                }
301.2.57 by Kaleo
Only reraise a sidestage app if the sidestage is shown.
250
251
                // FIXME: workaround the fact that focusing a main stage application
252
                // raises its surface on top of all other surfaces including the ones
253
                // that belong to side stage applications.
254
                onFocusedApplicationChanged: {
255
                    if (focusedApplication && sideStage.focusedApplication && sideStage.fullyShown) {
301.2.59 by Kaleo
Fixes syntax error. Show screenshots as soon as the sidestage handle is pressed.
256
                        shell.applicationManager.focusApplication(sideStage.focusedApplication);
301.2.57 by Kaleo
Only reraise a sidestage app if the sidestage is shown.
257
                    }
258
                }
301.2.1 by Kaleo
Current sidestage work.
259
            }
260
261
            SideStage {
262
                id: sideStage
263
507.6.1 by Daniel d'Andrada
Refactoring Stage.qml
264
                applicationManager: shell.applicationManager
265
                rightEdgeDraggingAreaWidth: shell.edgeSize
266
                normalApplicationY: shell.panelHeight
267
301.2.1 by Kaleo
Current sidestage work.
268
                onShownChanged: {
301.2.2 by Kaleo
Show stages when activating an app.
269
                    if (!shown && mainStage.applications.count == 0) {
270
                        stages.hide();
301.2.1 by Kaleo
Current sidestage work.
271
                    }
272
                }
301.2.52 by Kaleo
Do not refocus the main stage app when the side stage app loses the focus but instead do it when side stage is not fully shown.
273
                // FIXME: when hiding the side stage, refocus the main stage
274
                // application so that it goes in front of the side stage
275
                // application and hides it
276
                onFullyShownChanged: {
301.2.53 by Kaleo
Do not refocus main stage app if stages are hiding.
277
                    if (!fullyShown && stages.fullyShown && sideStage.focusedApplication != null) {
301.2.52 by Kaleo
Do not refocus the main stage app when the side stage app loses the focus but instead do it when side stage is not fully shown.
278
                        shell.applicationManager.focusApplication(mainStage.focusedApplication);
279
                    }
280
                }
301.2.1 by Kaleo
Current sidestage work.
281
301.2.9 by Kaleo
Disable sidestage if shell less than 60gu.
282
                enabled: shell.width >= units.gu(60)
283
                visible: enabled
301.2.3 by Kaleo
Sidestage: switch to snapshots when launching a mainstage app.
284
                fullyShown: stages.fullyShown && shown
285
                            && sideStage[sideStageRevealer.boundProperty] == sideStageRevealer.openedValue
301.2.59 by Kaleo
Fixes syntax error. Show screenshots as soon as the sidestage handle is pressed.
286
                shouldUseScreenshots: !fullyShown || mainStage.usingScreenshots || sideStageRevealer.pressed
301.2.15 by Kaleo
Renamed Stage.fullyShown into more generic Stage.shouldUseScreenshots.
287
301.2.9 by Kaleo
Disable sidestage if shell less than 60gu.
288
                available: !greeter.shown && enabled
301.2.18 by Kaleo
Fixed invalid reference that caused a crash at startup;
289
                hides: [launcher, panel.indicators]
301.2.1 by Kaleo
Current sidestage work.
290
                shown: false
291
                showAnimation: StandardAnimation { property: "x"; duration: 350; to: sideStageRevealer.openedValue; easing.type: Easing.OutQuint }
292
                hideAnimation: StandardAnimation { property: "x"; duration: 350; to: sideStageRevealer.closedValue; easing.type: Easing.OutQuint }
293
294
                width: units.gu(40)
295
                height: stages.height
301.2.6 by Kaleo
Better handle visuals
296
                handleExpanded: sideStageRevealer.pressed
301.2.1 by Kaleo
Current sidestage work.
297
            }
298
299
            Revealer {
300
                id: sideStageRevealer
301
301.2.24 by Kaleo
Sidestage not dismissable if there is no main stage app running.
302
                enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
303
                         && sideStage.available
301.2.1 by Kaleo
Current sidestage work.
304
                direction: Qt.RightToLeft
305
                openedValue: parent.width - sideStage.width
306
                hintDisplacement: units.gu(3)
432.1.1 by Kaleo
Sidestage: make the handle bigger to make it easier to grab.
307
                /* The size of the sidestage handle needs to be bigger than the
308
                   typical size used for edge detection otherwise it is really
309
                   hard to grab.
310
                */
311
                handleSize: sideStage.shown ? units.gu(4) : shell.edgeSize
301.2.6 by Kaleo
Better handle visuals
312
                closedValue: parent.width + sideStage.handleSizeCollapsed
301.2.1 by Kaleo
Current sidestage work.
313
                target: sideStage
314
                x: parent.width - width
432.1.1 by Kaleo
Sidestage: make the handle bigger to make it easier to grab.
315
                width: sideStage.width + handleSize * 0.7
301.2.1 by Kaleo
Current sidestage work.
316
                height: sideStage.height
317
                orientation: Qt.Horizontal
318
            }
28.1.9 by Vesa Rautiainen
Sidestage added with sidestage applications.
319
        }
30 by Vesa Rautiainen
Applications architecture merged. Not fully implemented yet.
320
    }
321
48 by Vesa Rautiainen
Old launcher merged into the project. This is a temporary solution until revealer based launcher is ready.
322
30 by Vesa Rautiainen
Applications architecture merged. Not fully implemented yet.
323
    Revealer {
301.2.1 by Kaleo
Current sidestage work.
324
        id: stagesRevealer
30 by Vesa Rautiainen
Applications architecture merged. Not fully implemented yet.
325
51 by Vesa Rautiainen
Revealer dragPosition bug fix.
326
        property real animatedProgress: MathLocal.clamp((-dragPosition - launcher.progress) / closedValue, 0, 1)
301.2.1 by Kaleo
Current sidestage work.
327
        enabled: mainStage.applications.count > 0 || sideStage.applications.count > 0
30 by Vesa Rautiainen
Applications architecture merged. Not fully implemented yet.
328
        direction: Qt.RightToLeft
329
        openedValue: 0
79.1.1 by Kaleo
Use grid units everywhere possible.
330
        hintDisplacement: units.gu(3)
301.1.35 by Kaleo
Made edge swipes area 4gu wide instead of 2gu and added InputFilterArea protection.
331
        handleSize: shell.edgeSize
30 by Vesa Rautiainen
Applications architecture merged. Not fully implemented yet.
332
        closedValue: width
301.2.1 by Kaleo
Current sidestage work.
333
        target: stages
334
        width: stages.width
335
        height: stages.height
30 by Vesa Rautiainen
Applications architecture merged. Not fully implemented yet.
336
        orientation: Qt.Horizontal
2 by Florian Boucault
First shot at shell navigation.
337
    }
338
339
    Greeter {
340
        id: greeter
341
13 by Florian Boucault
Shell: replaced use of EdgeSwipeArea with Revealer.
342
        available: true
311.5.3 by Albert Astals
* latest designs for greeter and video preview
343
        hides: [launcher, panel.indicators, hud]
319.3.3 by Michael Zanetti
cleanup
344
        shown: true
16 by Florian Boucault
Shell: more generic show/hide animation when a Revealer is used.
345
        showAnimation: StandardAnimation { property: "x"; to: greeterRevealer.openedValue }
346
        hideAnimation: StandardAnimation { property: "x"; to: greeterRevealer.closedValue }
2 by Florian Boucault
First shot at shell navigation.
347
277.3.1 by Gerry Boland
Create Panel to encapsulate both itself and the Indicators, reorder code to suit.
348
        y: panel.panelHeight
2 by Florian Boucault
First shot at shell navigation.
349
        width: parent.width
277.3.1 by Gerry Boland
Create Panel to encapsulate both itself and the Indicators, reorder code to suit.
350
        height: parent.height - panel.panelHeight
285.1.14 by Michał Sawicz
force focus on greeter when locking
351
352
        onShownChanged: if (shown) greeter.forceActiveFocus()
533.7.1 by Michi Henning
Added test to look for trailing whitespace.
353
483.2.1 by Michael Zanetti
Greeter tests
354
        onUnlocked: greeter.hide()
355
        onSelected: shell.background = greeter.model.get(uid).background;
356
2 by Florian Boucault
First shot at shell navigation.
357
    }
358
13 by Florian Boucault
Shell: replaced use of EdgeSwipeArea with Revealer.
359
    Revealer {
16 by Florian Boucault
Shell: more generic show/hide animation when a Revealer is used.
360
        id: greeterRevealer
361
258.3.1 by Ugo Riboni
Use the correct transition when sliding off the Greeter
362
        property real animatedProgress: MathLocal.clamp(-dragPosition / closedValue, 0, 1)
13 by Florian Boucault
Shell: replaced use of EdgeSwipeArea with Revealer.
363
        target: greeter
364
        width: greeter.width
365
        height: greeter.height
301.1.35 by Kaleo
Made edge swipes area 4gu wide instead of 2gu and added InputFilterArea protection.
366
        handleSize: shell.edgeSize
13 by Florian Boucault
Shell: replaced use of EdgeSwipeArea with Revealer.
367
        orientation: Qt.Horizontal
33 by Vesa Rautiainen
dash scaling connected to applications progress state.
368
        visible: greeter.shown
300.3.2 by Michael Zanetti
disable swiping the greeter and opening the launcher when tablet is locked
369
        enabled: !greeter.locked
2 by Florian Boucault
First shot at shell navigation.
370
    }
371
372
    Item {
373
        id: overlay
374
375
        anchors.fill: parent
376
277.3.1 by Gerry Boland
Create Panel to encapsulate both itself and the Indicators, reorder code to suit.
377
        Panel {
378
            id: panel
379
            anchors.fill: parent //because this draws indicator menus
340.1.1 by Gerry Boland
Indicator menu width should be more intelligently decided
380
            indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
277.3.18 by Gerry Boland
Use fact we alias indicatorMenu as public, can simplify Panel API
381
            indicators {
382
                hides: [launcher]
383
                available: !greeter.shown
22 by Vesa Rautiainen
Hud placeholder, new version of Indicators and Indicatormenu added. Also QuitDialog added. Some smallish changes were needed in Revealer and DragArea components.
384
            }
277.4.19 by Gerry Boland
Standardize on fullscreen (from fullScreen)
385
            fullscreenMode: shell.fullscreenMode
277.3.27 by Gerry Boland
Merge trunk and resolve conflicts
386
            searchEnabled: !greeter.shown
301.1.34 by Kaleo
Use InputFilterArea for Hud, Indicators and Launcher.
387
388
            InputFilterArea {
389
                anchors.fill: parent
390
                blockInput: panel.indicators.shown
391
            }
285.1.11 by Michał Sawicz
bring back the search indicator
392
        }
393
24 by Vesa Rautiainen
Indicators rewritten. Earlier Indicators and IndicatorsMenu combined to one. DragArea modified so that 0 velocity events are not taken into account. This improves revealer component logic.
394
        Hud {
395
            id: hud
396
291.3.6 by Albert Astals
Don't depend on the tablet bool
397
            width: parent.width > units.gu(60) ? units.gu(40) : parent.width
154.1.1 by Albert Astals
First attempt at a merged Hud in the shell
398
            height: parent.height
399
277.3.20 by Gerry Boland
Merge trunk & fix conflicts
400
            available: !greeter.shown && !panel.indicators.shown
291.4.17 by Gerry Boland
Oopsie again
401
            shown: false
362.1.3 by Albert Astals
fix++
402
            showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
403
            hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
311.5.4 by Albert Astals
Hide hud on showing launcher or in initiating right border gesture
404
405
            Connections {
406
                target: shell.applicationManager
301.2.62 by Kaleo
Hide the hud whenever an app from any stage gets or loses focus.
407
                onMainStageFocusedApplicationChanged: hud.hide()
408
                onSideStageFocusedApplicationChanged: hud.hide()
311.5.4 by Albert Astals
Hide hud on showing launcher or in initiating right border gesture
409
            }
301.1.34 by Kaleo
Use InputFilterArea for Hud, Indicators and Launcher.
410
411
            InputFilterArea {
412
                anchors.fill: parent
413
                blockInput: hud.shown
414
            }
154.1.1 by Albert Astals
First attempt at a merged Hud in the shell
415
        }
416
417
        Revealer {
418
            id: hudRevealer
419
154.1.96 by Albert Astals
Only enable the hud revealer if it is shown
420
            enabled: hud.shown
154.1.48 by Albert Astals
Make it tablet friendly-er
421
            width: hud.width
422
            anchors.left: hud.left
154.1.1 by Albert Astals
First attempt at a merged Hud in the shell
423
            height: parent.height
154.1.8 by Albert Astals
Store this afternoon's work
424
            target: hud.revealerTarget
154.1.97 by Albert Astals
1 pixel offset
425
            closedValue: height
154.1.1 by Albert Astals
First attempt at a merged Hud in the shell
426
            openedValue: 0
427
            direction: Qt.RightToLeft
428
            orientation: Qt.Vertical
451.1.6 by Albert Astals
Fix test and code to make the handleSize be correct
429
            handleSize: hud.handleHeight
291.3.20 by Albert Astals
Close hud on handle/close click
430
            onCloseClicked: target.hide()
24 by Vesa Rautiainen
Indicators rewritten. Earlier Indicators and IndicatorsMenu combined to one. DragArea modified so that 0 velocity events are not taken into account. This improves revealer component logic.
431
        }
432
154.1.90 by Albert Astals
BottomBar + controller for sdk apps
433
        Bottombar {
434
            theHud: hud
386.4.3 by Albert Astals
sidestage support
435
            sideStageWidth: sideStage.width
154.1.90 by Albert Astals
BottomBar + controller for sdk apps
436
            anchors.fill: parent
349.4.1 by Gerry Boland
Disable BottomBar revealer if indicators menu open
437
            enabled: !panel.indicators.shown
154.1.90 by Albert Astals
BottomBar + controller for sdk apps
438
        }
439
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
440
        Launcher {
441
            id: launcher
442
443
            anchors.top: parent.top
444
            anchors.bottom: parent.bottom
445
            width: parent.width
301.2.1 by Kaleo
Current sidestage work.
446
            applicationFocused: stages.shown
236.1.1 by Vesa Rautiainen
[Launcher] Visual fixes. Proper Ubuntu shape used now with border image overlay. Dash icon text changed to Home. Launcher width changed from 8gu to 9gu. Icon folding removed for now. Home icon updated not to be transparent.
447
            shortcutsWidth: units.gu(9)
301.1.35 by Kaleo
Made edge swipes area 4gu wide instead of 2gu and added InputFilterArea protection.
448
            shortcutsThreshold: shell.edgeSize
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
449
            iconPath: "graphics/applicationIcons"
311.5.4 by Albert Astals
Hide hud on showing launcher or in initiating right border gesture
450
            available: !greeter.locked
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
451
            onDashItemSelected: {
226.1.1 by Kaleo
Made launcher available from greeter.
452
                greeter.hide()
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
453
                // Animate if moving between application and dash
301.2.1 by Kaleo
Current sidestage work.
454
                if (!stages.shown) {
437.6.1 by vesa.rautiainen at canonical
Resetting Apps lense content position when swiping from left.
455
                    dash.setCurrentLens("home.lens", true, false)
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
456
                } else {
437.6.1 by vesa.rautiainen at canonical
Resetting Apps lense content position when swiping from left.
457
                    dash.setCurrentLens("home.lens", false, false)
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
458
                }
301.2.1 by Kaleo
Current sidestage work.
459
                stages.hide();
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
460
            }
461
            onDash: {
226.1.1 by Kaleo
Made launcher available from greeter.
462
                greeter.hide()
301.2.1 by Kaleo
Current sidestage work.
463
                stages.hide();
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
464
            }
465
            onLauncherApplicationSelected:{
226.1.1 by Kaleo
Made launcher available from greeter.
466
                greeter.hide()
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
467
                shell.activateApplication(name)
468
            }
469
            onStateChanged: {
470
                if (state == "spreadMoving") {
437.6.1 by vesa.rautiainen at canonical
Resetting Apps lense content position when swiping from left.
471
                    dash.setCurrentLens("applications.lens", false, true)
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
472
                }
473
            }
311.5.4 by Albert Astals
Hide hud on showing launcher or in initiating right border gesture
474
            onShownChanged: {
475
                if (shown) {
476
                    panel.indicators.hide()
477
                    hud.hide()
478
                }
479
            }
142.2.1 by Kaleo
Launcher: moved to be on top of the indicators.
480
        }
301.1.34 by Kaleo
Use InputFilterArea for Hud, Indicators and Launcher.
481
482
        InputFilterArea {
483
            blockInput: launcher.shown
484
            anchors {
485
                top: parent.top
486
                bottom: parent.bottom
487
                left: parent.left
488
            }
489
            width: launcher.shortcutsWidth
490
        }
2 by Florian Boucault
First shot at shell navigation.
491
    }
492
493
    focus: true
253.4.2 by Ricardo Mendoza
Move input eater to Shell.qml for later use. Also simplify property setting and conditional
494
301.1.35 by Kaleo
Made edge swipes area 4gu wide instead of 2gu and added InputFilterArea protection.
495
    InputFilterArea {
496
        anchors {
497
            top: parent.top
498
            bottom: parent.bottom
499
            left: parent.left
500
        }
501
        width: shell.edgeSize
502
        blockInput: true
503
    }
504
505
    InputFilterArea {
506
        anchors {
507
            top: parent.top
508
            bottom: parent.bottom
509
            right: parent.right
510
        }
511
        width: shell.edgeSize
512
        blockInput: true
513
    }
514
253.4.2 by Ricardo Mendoza
Move input eater to Shell.qml for later use. Also simplify property setting and conditional
515
    //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
516
    MouseArea {
517
        anchors.bottom: parent.bottom
518
        anchors.left: parent.left
519
        anchors.right: parent.right
426.1.1 by Kaleo
Deprecate use of Qt.inputMethod that is not working anymore.
520
        height: shell.applicationManager ? shell.applicationManager.keyboardHeight : 0
253.4.2 by Ricardo Mendoza
Move input eater to Shell.qml for later use. Also simplify property setting and conditional
521
426.1.1 by Kaleo
Deprecate use of Qt.inputMethod that is not working anymore.
522
        enabled: shell.applicationManager && shell.applicationManager.keyboardVisible
253.4.2 by Ricardo Mendoza
Move input eater to Shell.qml for later use. Also simplify property setting and conditional
523
    }
1 by Florian Boucault
Initial import
524
}