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
23 property int minimumHorizontalSpacing: units.gu(0.5)
24 // property int minimumNumberOfColumns: 2 // FIXME: not implemented
25 property int maximumNumberOfColumns: 6
26 readonly property int columns: flow.columns
27 property alias verticalSpacing: flow.verticalSpacing
28 property alias horizontalSpacing: flow.horizontalSpacing
29 property int referenceDelegateWidth
30 property alias firstModel: repeater1.model
31 property alias secondModel: repeater2.model
32 property alias delegate: repeater1.delegate
33 readonly property int cellWidth: referenceDelegateWidth + horizontalSpacing
34 readonly property int cellHeight: referenceDelegateWidth + verticalSpacing
35 property alias move: flow.move
37 height: flow.height + flow.anchors.topMargin
47 topMargin: verticalSpacing
50 function pixelToGU(value) {
51 return Math.floor(value / units.gu(1));
54 function spacingForColumns(columns) {
55 // spacing between columns as an integer number of GU, the remainder goes in the margins
56 var spacingGU = pixelToGU(allocatableVerticalSpace / columns);
57 return units.gu(spacingGU);
60 function columnsForSpacing(space) {
61 // minimum margin is half of the spacing
62 return Math.floor((parent.width - space/2) / (referenceDelegateWidth + space));
65 property real allocatableVerticalSpace: parent.width - columns * referenceDelegateWidth
66 property int columns: Math.min(columnsForSpacing(minimumHorizontalSpacing), maximumNumberOfColumns)
67 property real horizontalSpacing: spacingForColumns(columns)
68 property real verticalSpacing: horizontalSpacing
69 property int margin: allocatableVerticalSpace - columns * horizontalSpacing
73 model: (root.model) ? root.model[0] : null
77 model: (root.model) ? root.model[1] : null
78 delegate: repeater1.delegate
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