/*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authors:
* Nick Dedekind
*/
import QtQuick 2.0
import Ubuntu.Components 0.1
import Unity.IndicatorsLegacy 0.1 as Indicators
Indicators.IndicatorWidget {
id: indicatorWidget
enabled:true
width: itemRow.width + units.gu(0.5)
property alias label: itemLabel.text
property alias iconSource: itemImage.source
Row {
id: itemRow
objectName: "itemRow"
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
spacing: units.gu(0.5)
// FIXME : Should us Ubuntu.Icon . results in low res images
Image {
id: itemImage
objectName: "itemImage"
visible: source != ""
height: indicatorWidget.iconSize
width: indicatorWidget.iconSize
anchors.verticalCenter: parent.verticalCenter
}
Label {
id: itemLabel
objectName: "itemLabel"
color: Theme.palette.selected.backgroundText
opacity: 0.8
font.family: "Ubuntu"
fontSize: "medium"
anchors.verticalCenter: parent.verticalCenter
visible: text != ""
}
}
onActionStateChanged: {
if (action == undefined || !action.valid) {
return;
}
if (action.state == undefined) {
return;
}
label = action.state[Indicators.ActionState.Label];
iconSource = "image://theme/" + action.state[Indicators.ActionState.IconSource];
}
}