on bf461a2 help sign in
unity8/Panel/Indicators/DefaultIndicatorWidget.qml
77 lines 2.3 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 * Nick Dedekind <nick.dedekind@canonical.com>
18 */
20import QtQuick 2.0
21import Ubuntu.Components 0.1
22import Unity.IndicatorsLegacy 0.1 as Indicators
24Indicators.IndicatorWidget {
25 id: indicatorWidget
27 enabled:true
28 width: itemRow.width + units.gu(0.5)
30 property alias label: itemLabel.text
31 property alias iconSource: itemImage.source
33 Row {
34 id: itemRow
35 objectName: "itemRow"
36 anchors {
37 top: parent.top
38 bottom: parent.bottom
39 horizontalCenter: parent.horizontalCenter
40 }
41 spacing: units.gu(0.5)
43 // FIXME : Should us Ubuntu.Icon . results in low res images
44 Image {
45 id: itemImage
46 objectName: "itemImage"
47 visible: source != ""
48 height: indicatorWidget.iconSize
49 width: indicatorWidget.iconSize
50 anchors.verticalCenter: parent.verticalCenter
51 }
53 Label {
54 id: itemLabel
55 objectName: "itemLabel"
56 color: Theme.palette.selected.backgroundText
57 opacity: 0.8
58 font.family: "Ubuntu"
59 fontSize: "medium"
60 anchors.verticalCenter: parent.verticalCenter
61 visible: text != ""
62 }
63 }
65 onActionStateChanged: {
66 if (action == undefined || !action.valid) {
67 return;
68 }
70 if (action.state == undefined) {
71 return;
72 }
74 label = action.state[Indicators.ActionState.Label];
75 iconSource = "image://theme/" + action.state[Indicators.ActionState.IconSource];
76 }