2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
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 General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Ubuntu.Components 0.1
19import Unity.Indicators 0.1 as Indicators
25 property QtObject currentItem : null
26 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
27 property alias row: row
28 property QtObject indicatorsModel: null
29 property var visibleIndicators: undefined
30 property int overFlowWidth: width
31 property bool showAll: false
32 property real currentItemOffset: 0.0
33 property real unitProgress: 0.0
38 function setDefaultItem() {
39 // The leftmost indicator
43 function setCurrentItem(index) {
44 if (currentItemIndex !== index) {
45 currentItem = rowRepeater.itemAt(index);
63 anchors.right: parent.right
67 objectName: "rowRepeater"
68 model: indicatorsModel ? indicatorsModel : undefined
70 property int lastCount: 0
72 if (lastCount < count) {
81 height: indicatorRow.height
82 width: indicatorItem.width
83 visible: indicatorItem.indicatorVisible
84 opacity: 1.0 * opacityMultiplier
88 property int ownIndex: index
89 property bool highlighted: indicatorRow.state != "initial" ? ownIndex == indicatorRow.currentItemIndex : false
90 property bool dimmed: indicatorRow.state != "initial" ? ownIndex != indicatorRow.currentItemIndex : false
92 property bool hidden: !showAll && !highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")
93 property bool overflow: row.width - itemWrapper.x > overFlowWidth
94 property real opacityMultiplier: highlighted ? 1 : (1 - indicatorRow.unitProgress)
98 identifier: model.identifier
101 dimmed: itemWrapper.dimmed
103 widgetSource: model.widgetSource
104 indicatorProperties : model.indicatorProperties
106 Component.onCompleted: {
109 onIndicatorVisibleChanged: {
112 if (indicatorVisible) {
118 function updateVisiblility() {
119 if (visibleIndicators == undefined) {
120 visibleIndicators = {}
122 indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
124 // removed current index?
125 if (indicatorRow.currentItemIndex === index && !indicatorVisible) {
126 // find the next closest visible indicator (after current, else before)
128 for (var i = index+1; i < rowRepeater.count; i++) {
129 if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
134 if (newIndex === -1) {
135 for (i = index - 1; i >= 0; i--) {
136 if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
142 indicatorRow.setCurrentItem(newIndex);
145 indicatorRow.visibleIndicatorsChanged();
152 when: !hidden && !overflow
156 when: hidden || overflow
157 PropertyChanges { target: itemWrapper; opacity: 0.0 }
163 UbuntuNumberAnimation {
166 duration: UbuntuAnimation.BriskDuration
176 color: Theme.palette.selected.foreground
177 objectName: "highlight"
179 anchors.top: row.bottom
180 visible: indicatorRow.currentItem != null
181 x: row.x + (indicatorRow.currentItem != null ? indicatorRow.currentItem.x + centerOffset : 0)
182 width: indicatorRow.currentItem != null ? indicatorRow.currentItem.width : 0
184 property real centerOffset: {
185 if (indicatorRow.currentItemOffset > 0.1) {
186 return (indicatorRow.currentItemOffset - 0.1) * units.gu(0.4);
187 } else if (indicatorRow.currentItemOffset < -0.1) {
188 return (indicatorRow.currentItemOffset + 0.1) * units.gu(0.4);
194 enabled: unitProgress > 0;
195 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
198 enabled: unitProgress > 0;
199 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list