~tiagosh/unity-2d/fix-dash-cursor

« back to all changes in this revision

Viewing changes to shell/launcher/LauncherLoader.qml

  • Committer: Tarmac
  • Author(s): Albert Astals, Ugo Riboni, Michał Sawicz, Florian Boucault, LDS
  • Date: 2012-02-10 17:32:14 UTC
  • mfrom: (771.3.235 unity-2d-shell_trunk)
  • Revision ID: tarmac-20120210173214-eekg5uiqdb7gjza6
Merge launcher and dash into a common new QML scene: the shell.
 - Created a shell folder that holds both launcher and dash QML code, the C++ code for the single binary and a common folder with shared QML files
 - The shell occupies the whole screen but is shaped for input where it is transparent in order not to interfere with the rest of the windows
 - The shell binary, unity-2d-shell, has a -rootqml option that lets the user specify the QML file to load
 - Implement visibility behaviours in QML instead of C++
 - Do not use D-Bus anymore to communicate between the launcher and the dash
 - Remove the homebutton panel plugin
 - Make the strut setting reusable outside of Unity2dPanel
 - Make LauncherDropItem a FocusScope
 - Implement gesture handling in QML instead of C++

Known issues:
 - In non composited mode there is a 1px wide rectangle on the edge of the screen where the launcher is hidden. This is acceptable for the moment since XFixes barriers to show the launcher are in the plan and will get rid of this problem
 - HomeShortcuts.qml has a transparent Rectangle to fix alignment in RTL mode that causes QML warnings. This is acceptable since the Home lens is going away. Fixes: . Approved by .

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of unity-2d
 
3
 *
 
4
 * Copyright 2012 Canonical Ltd.
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
import QtQuick 1.0
 
20
import Unity2d 1.0
 
21
import "../common"
 
22
import "../common/utils.js" as Utils
 
23
 
 
24
Loader {
 
25
    id: launcherLoader
 
26
    source: "Launcher.qml"
 
27
    property variant visibilityController: visibilityController
 
28
    onLoaded: item.focus = true
 
29
    property alias outerEdgeMouseArea: outerEdge
 
30
 
 
31
    VisibilityController {
 
32
        id: visibilityController
 
33
        behavior: launcherBehavior.status == Loader.Ready ? launcherBehavior.item : null
 
34
    }
 
35
 
 
36
    Loader {
 
37
        id: launcherBehavior
 
38
 
 
39
        property variant modesMap: { 0: '../common/visibilityBehaviors/AlwaysVisibleBehavior.qml',
 
40
                                     1: '../common/visibilityBehaviors/AutoHideBehavior.qml',
 
41
                                     2: '../common/visibilityBehaviors/IntelliHideBehavior.qml' }
 
42
 
 
43
        source: modesMap[Utils.clamp(launcher2dConfiguration.hideMode, 0, 2)]
 
44
    }
 
45
 
 
46
    Binding {
 
47
        target: launcherBehavior
 
48
        property: "item.target"
 
49
        value: launcherLoader.item
 
50
        when: launcherBehavior.status == Loader.Ready
 
51
    }
 
52
 
 
53
    Binding {
 
54
        target: declarativeView
 
55
        property: "monitoredArea"
 
56
        value: Qt.rect(launcherLoader.x, launcherLoader.item.y, launcherLoader.item.width, launcherLoader.item.height)
 
57
        when: launcherBehavior.status == Loader.Ready && !launcherLoaderXAnimation.running
 
58
    }
 
59
 
 
60
    Binding {
 
61
        target: launcherBehavior.item
 
62
        property: "forcedVisible"
 
63
        value: visibilityController.forceVisible
 
64
    }
 
65
 
 
66
    Binding {
 
67
        target: launcherBehavior.item
 
68
        property: "forcedVisibleChangeId"
 
69
        value: visibilityController.forceVisibleChangeId
 
70
    }
 
71
 
 
72
    Connections {
 
73
        target: declarativeView
 
74
        onSuperKeyHeldChanged: {
 
75
            if (superKeyHeld) visibilityController.beginForceVisible()
 
76
            else visibilityController.endForceVisible()
 
77
        }
 
78
    }
 
79
 
 
80
    Binding {
 
81
        target: launcherLoader.item
 
82
        property: "outerEdgeContainsMouse"
 
83
        value: outerEdge.containsMouse && outerEdge.enabled
 
84
    }
 
85
 
 
86
    MouseArea {
 
87
        id: outerEdge
 
88
        anchors.fill: parent
 
89
        anchors.margins: -1
 
90
        hoverEnabled: !visibilityController.shown
 
91
        enabled: !visibilityController.shown
 
92
    }
 
93
 
 
94
}