/*
* 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.Indicators 0.1 as Indicators
Indicators.IndicatorWidget {
id: indicatorWidget
width: itemRow.width + units.gu(0.5)
property alias leftLabel: itemLeftLabel.text
property alias rightLabel: itemRightLabel.text
property var icons: undefined
Row {
id: itemRow
objectName: "itemRow"
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
spacing: units.gu(0.5)
Label {
id: itemLeftLabel
objectName: "leftLabel"
color: Theme.palette.selected.backgroundText
opacity: 0.8
font.family: "Ubuntu"
fontSize: "medium"
anchors.verticalCenter: parent.verticalCenter
visible: text != ""
}
Row {
width: childrenRect.width
anchors {
top: parent.top
bottom: parent.bottom
}
spacing: units.gu(0.5)
Repeater {
model: indicatorWidget.icons
Image {
id: itemImage
objectName: "itemImage"
visible: source != ""
source: modelData
height: indicatorWidget.iconSize
width: indicatorWidget.iconSize
anchors.verticalCenter: parent.verticalCenter
}
}
}
Label {
id: itemRightLabel
objectName: "rightLabel"
color: Theme.palette.selected.backgroundText
opacity: 0.8
font.family: "Ubuntu"
fontSize: "medium"
anchors.verticalCenter: parent.verticalCenter
visible: text != ""
}
}
onRootActionStateChanged: {
if (rootActionState == undefined) {
leftLabel = "";
rightLabel = "";
icons = undefined;
enabled = false;
return;
}
leftLabel = rootActionState.leftLabel ? rootActionState.leftLabel : "";
rightLabel = rootActionState.rightLabel ? rootActionState.rightLabel : "";
icons = rootActionState.icons;
enabled = rootActionState.visible;
}
}