18 import Ubuntu.Components 0.1
19 import Unity.Indicators 0.1 as Indicators
20 import "../Components"
25 readonly
property alias currentItem : itemView.currentItem
26 readonly
property alias currentItemIndex: itemView.currentIndex
27 readonly
property alias row: itemView
28 property QtObject indicatorsModel: null
29 property int overFlowWidth: width
30 property bool showAll:
false
31 property real currentItemOffset: 0.0
32 property real unitProgress: 0.0
37 function setDefaultItem() {
42 function setCurrentItemIndex(index) {
43 itemView.currentIndex = index;
46 function setCurrentItem(item) {
47 if (item && item.hasOwnProperty(
"ownIndex")) {
48 itemView.currentIndex = item.ownIndex;
50 itemView.currentIndex = -1;
65 objectName:
"indicatorRowItems"
67 model: indicatorsModel ? indicatorsModel : null
69 width: childrenRect.width
70 height: indicatorRow.height
71 anchors.right: parent.right
72 orientation: ListView.Horizontal
74 property int lastCount: 0
76 if (lastCount < count) {
85 objectName:
"item" + index
86 height: indicatorRow.height
87 width: indicatorItem.width
88 opacity: 1 - indicatorRow.unitProgress
92 property int ownIndex: index
93 property bool highlighted: indicatorRow.unitProgress > 0 ? ListView.isCurrentItem :
false
94 property bool dimmed: indicatorRow.unitProgress > 0 ? !ListView.isCurrentItem :
false
96 property bool hidden: !showAll && !highlighted && (indicatorRow.state ==
"locked" || indicatorRow.state ==
"commit")
97 property
bool overflow: row.width - itemWrapper.x > overFlowWidth
101 identifier: model.identifier
102 height: parent.height
104 dimmed: itemWrapper.dimmed
106 widgetSource: model.widgetSource
107 indicatorProperties : model.indicatorProperties
113 when: !hidden && !overflow && !highlighted
118 PropertyChanges { target: itemWrapper; opacity: 1.0 }
122 when: hidden || overflow
123 PropertyChanges { target: itemWrapper; opacity: 0.0 }
127 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
134 color: Theme.palette.selected.foreground
135 objectName:
"highlight"
137 anchors.top: row.bottom
138 visible: indicatorRow.currentItem != null
140 property real intendedX: row.x + (indicatorRow.currentItem != null ? (indicatorRow.currentItem.x - row.originX) + centerOffset : 0)
141 x: intendedX >= row.x ? (intendedX + width <= row.x + row.width ? intendedX : row.x + row.width - width) : row.x
142 width: indicatorRow.currentItem != null ? indicatorRow.currentItem.width : 0
144 property real centerOffset: {
145 if (indicatorRow.currentItemOffset > 0.1) {
146 return (indicatorRow.currentItemOffset - 0.1) * units.gu(0.4);
147 }
else if (indicatorRow.currentItemOffset < -0.1) {
148 return (indicatorRow.currentItemOffset + 0.1) * units.gu(0.4);
154 enabled: unitProgress > 0;
155 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
158 enabled: unitProgress > 0;
159 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }