~sil2100/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to places/HomeButton.qml

  • Committer: Aurelien Gateau
  • Date: 2010-11-10 08:57:29 UTC
  • mto: This revision was merged to the branch mainline in revision 284.
  • Revision ID: aurelien.gateau@canonical.com-20101110085729-fl1ye7impkqhm0w6
Added a section about const correct-ness

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of unity-2d
3
 
 *
4
 
 * Copyright 2010-2011 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 "../common"
21
 
 
22
 
AbstractButton {
23
 
    id: button
24
 
 
 
1
import Qt 4.7
 
2
 
 
3
Button {
25
4
    property alias icon: icon.source
26
5
    property alias label: label.text
27
 
    property alias iconSourceSize: icon.sourceSize
28
 
 
29
 
    Accessible.name: label.text
30
 
 
31
 
    width: 160
32
 
    height: 172
33
 
 
34
 
    ButtonBackground {
35
 
        anchors.fill: icon
36
 
        anchors.margins: -5
37
 
        state: button.state
38
 
    }
 
6
 
 
7
    width: 126
 
8
    height: 148
39
9
 
40
10
    Image {
41
11
        id: icon
42
12
 
43
 
        width: sourceSize.width
44
 
        height: sourceSize.height
45
 
 
46
 
        anchors.horizontalCenter: parent.horizontalCenter
47
13
        anchors.top: parent.top
48
 
        anchors.topMargin: 5
 
14
        anchors.left: parent.left
 
15
        anchors.leftMargin: -1
 
16
        anchors.topMargin: -1
 
17
        width: 128
 
18
        height: 128
49
19
        fillMode: Image.PreserveAspectFit
 
20
        sourceSize.width: width
 
21
        sourceSize.height: height
50
22
 
51
23
        asynchronous: true
52
24
        opacity: status == Image.Ready ? 1 : 0
53
25
        Behavior on opacity {NumberAnimation {duration: 200; easing.type: Easing.InOutQuad}}
54
26
    }
55
27
 
56
 
    TextMultiLine {
 
28
    TextCustom {
57
29
        id: label
58
30
 
59
 
        color: "#ffffff"
60
 
        state: ( parent.state == "selected" || parent.state == "hovered" ) ? "expanded" : ""
 
31
        color: parent.state == "pressed" ? "#444444" : "#ffffff"
 
32
        elide: Text.ElideMiddle
61
33
        horizontalAlignment: Text.AlignHCenter
62
 
        anchors.top: icon.bottom
 
34
        anchors.bottom: parent.bottom
63
35
        anchors.right: parent.right
64
36
        anchors.left: parent.left
65
 
        anchors.topMargin: 8
 
37
        anchors.bottomMargin: 3
66
38
        anchors.rightMargin: 5
67
39
        anchors.leftMargin: 7
68
 
        height: 40
69
 
        font.bold: true
70
 
        fontSize: "large"
 
40
        font.underline: parent.activeFocus
71
41
    }
72
42
}