~unity-2d-team/unity-2d/window-focus-fixes

« back to all changes in this revision

Viewing changes to shell/hud/ResultItem.qml

  • Committer: Tarmac
  • Author(s): Gerry Boland, Michał Sawicz
  • Date: 2012-02-28 11:30:52 UTC
  • mfrom: (915.1.61 hud-qml)
  • Revision ID: tarmac-20120228113052-ko3v4z076cq2aanr
Add HUD to Unity 2D

Known issue:
- on switching between Dash & Hud (tap Alt, then Super, then Alt...) blurred background image will contain Hud/Dash.. Fixes: https://bugs.launchpad.net/bugs/942045. Approved by Albert Astals Cid.

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.1
 
20
import "../common"
 
21
 
 
22
AbstractButton {
 
23
    id: delegate
 
24
    property string icon: ""
 
25
 
 
26
    Accessible.name: completionText
 
27
    Accessible.role: Accessible.Button
 
28
 
 
29
    Rectangle {
 
30
        id: line
 
31
 
 
32
        anchors.top: parent.top
 
33
        anchors.left: parent.left
 
34
        anchors.right: parent.right
 
35
        height: 1
 
36
 
 
37
        color: "#21ffffff" // 80% opaque
 
38
    }
 
39
 
 
40
    Rectangle {
 
41
        id: container
 
42
        objectName: "container"
 
43
 
 
44
        anchors.top: line.bottom
 
45
        anchors.left: parent.left
 
46
        anchors.right: parent.right
 
47
        anchors.bottom: parent.bottom
 
48
 
 
49
        border.color: "white"
 
50
        border.width: (parent.state == "selected" || parent.state == "hovered"
 
51
                       || parent.state == "pressed") ? 2 : 0
 
52
        color: {
 
53
            if (parent.state == "selected" || parent.state == "hovered") return "#21ffffff"
 
54
            else if ( parent.state == "pressed" ) return "white"
 
55
            else return "transparent"
 
56
        }
 
57
        radius: 7
 
58
        smooth: true
 
59
 
 
60
        TextCustom {
 
61
            id: resultText
 
62
            objectName: "result"
 
63
 
 
64
            anchors.left: parent.left
 
65
            anchors.right: shortcutText.left
 
66
            anchors.leftMargin: 38
 
67
            anchors.rightMargin: 4
 
68
            anchors.verticalCenter: container.verticalCenter
 
69
 
 
70
            color: (delegate.state == "pressed") ? "black" : "white"
 
71
            fontSize: "large"
 
72
            font.weight: Font.Light
 
73
            maximumLineCount: 1
 
74
            clip: true
 
75
 
 
76
            textFormat: Text.RichText
 
77
            text: formattedText
 
78
        }
 
79
 
 
80
        TextCustom {
 
81
            id: shortcutText
 
82
            objectName: "shortcut"
 
83
 
 
84
            width: paintedWidth
 
85
            anchors.right: parent.right
 
86
            anchors.rightMargin: 16
 
87
            anchors.verticalCenter: container.verticalCenter
 
88
 
 
89
            color: (delegate.state == "pressed") ? "black" : "white"
 
90
            fontSize: "small"
 
91
            font.weight: Font.Light
 
92
 
 
93
            text: shortcut
 
94
        }
 
95
    }
 
96
}