on 551c708 help sign in
123 lines 3.1 kB history raw
1/*
2 * Copyright 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 Lesser 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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 * Olivier Tilloy <olivier.tilloy@canonical.com>
19 */
21import QtQuick 2.0
22import Ubuntu.Components 0.1
23import Unity.Indicators 0.1 as Indicators
25Indicators.BaseMenuItem {
26 id: heroMessage
28 property alias heroMessageHeader: __heroMessageHeader
29 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
30 property real expandedHeight: collapsedHeight
32 property alias avatar: __heroMessageHeader.avatar
33 property alias appIcon: __heroMessageHeader.icon
35 signal activateApp
36 signal dismiss
38 removable: state !== "expanded"
39 implicitHeight: collapsedHeight
41 Rectangle {
42 id: background
43 property real alpha: 0.0
44 anchors.fill: parent
45 color: Qt.rgba(1.0, 1.0, 1.0, alpha)
46 z: -1
47 }
49 HeroMessageHeader {
50 id: __heroMessageHeader
52 anchors.top: parent.top
53 anchors.left: parent.left
54 anchors.right: parent.right
56 avatar: "qrc:/indicators/artwork/messaging/default_contact.png"
57 appIcon: icon
59 state: heroMessage.state
61 onAppIconClicked: {
62 deselectMenu();
63 heroMessage.activateApp();
64 }
65 }
67 onClicked: {
68 if (menuSelected) {
69 deselectMenu();
70 } else {
71 selectMenu();
72 }
73 }
75 Indicators.HLine {
76 id: __topHLine
77 anchors.top: parent.top
78 color: "#403b37"
79 }
81 Indicators.HLine {
82 id: __bottomHLine
83 anchors.bottom: parent.bottom
84 color: "#060606"
85 }
87 states: State {
88 name: "expanded"
89 when: menuSelected
91 PropertyChanges {
92 target: heroMessage
93 implicitHeight: heroMessage.expandedHeight
94 }
95 PropertyChanges {
96 target: background
97 alpha: 0.05
98 }
99 PropertyChanges {
100 target: __topHLine
101 opacity: 0.0
102 }
103 PropertyChanges {
104 target: __bottomHLine
105 opacity: 0.0
106 }
107 }
109 transitions: Transition {
110 ParallelAnimation {
111 NumberAnimation {
112 properties: "opacity,implicitHeight"
113 duration: 200
114 easing.type: Easing.OutQuad
115 }
116 ColorAnimation {}
117 }
118 }
120 onItemRemoved: {
121 heroMessage.dismiss();
122 }