~unity-team/+junk/dashboard-playground

« back to all changes in this revision

Viewing changes to Bottombar/HudButton.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
 
 
20
Item {
 
21
    id: item
 
22
 
 
23
    property int bottomMargin: units.gu(2)
 
24
    property bool mouseOver: contains(mouse)
 
25
 
 
26
    property point mouse: Qt.point(-1,-1)
 
27
 
 
28
    readonly property real scaleOnMouseOver: 1.2
 
29
 
 
30
    width: hudButton.width * scaleOnMouseOver
 
31
    height: hudButton.height * scaleOnMouseOver
 
32
 
 
33
    Item {
 
34
        id: hudButton
 
35
        property alias actionButton: actionButton
 
36
 
 
37
        anchors.centerIn: parent
 
38
        height: units.gu(12)
 
39
        width: height
 
40
        opacity: item.mouseOver ? 1 : 0.7
 
41
        scale: item.mouseOver ? scaleOnMouseOver : 1
 
42
        Behavior on opacity {NumberAnimation{duration: 200; easing.type: Easing.OutQuart}}
 
43
        Behavior on scale {NumberAnimation{duration: 200; easing.type: Easing.OutQuart}}
 
44
 
 
45
        UbuntuShape {
 
46
            id: actionButton
 
47
            anchors.fill: parent
 
48
 
 
49
            borderSource: ""
 
50
            image: Image {
 
51
                source: "graphics/hud_invoke_button_active.png"
 
52
            }
 
53
        }
 
54
 
 
55
        Image {
 
56
            width: units.gu(4)
 
57
            height: width
 
58
            source: "graphics/hud.png"
 
59
            anchors.centerIn: parent
 
60
            fillMode: Image.PreserveAspectFit
 
61
        }
 
62
    }
 
63
}