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
22 property alias mascot: mascotImage.source
23 property alias title: titleLabel.text
24 property alias subtitle: subtitleLabel.text
25 property alias price: priceLabel.text
26 property alias oldPrice: oldPriceLabel.text
27 property alias altPrice: altPriceLabel.text
29 property alias titleWeight: titleLabel.font.weight
30 property alias titleSize: titleLabel.fontSize
32 // FIXME: Saviq, used to scale fonts down in Carousel
33 property real fontScale: 1.0
35 property alias headerAlignment: titleLabel.horizontalAlignment
37 property bool inOverlay: false
38 property bool useMascotShape: true
39 property color fontColor: "grey"
41 visible: mascotImage.status === Image.Ready || title || price
42 height: row.height > 0 ? row.height + row.margins * 2 : 0
46 objectName: "outerRow"
48 property real margins: units.gu(1)
50 spacing: mascotShape.visible || mascotImage.visible || inOverlay ? margins : 0
52 top: parent.top; left: parent.left; right: parent.right
60 objectName: "mascotShape"
62 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
64 height: units.gu(5.625)
65 anchors.verticalCenter: parent.verticalCenter
66 visible: useMascotShape && image && image.status === Image.Ready
67 readonly property int maxSize: Math.max(width, height) * 4
69 image: useMascotShape ? mascotImage : null
75 width: source ? mascotShape.width : 0
76 height: mascotShape.height
77 anchors.verticalCenter: parent.verticalCenter
78 visible: !useMascotShape && status === Image.Ready
80 sourceSize { width: mascotShape.maxSize; height: mascotShape.maxSize }
81 fillMode: Image.PreserveAspectCrop
82 horizontalAlignment: Image.AlignHCenter
83 verticalAlignment: Image.AlignVCenter
88 width: parent.width - x
89 spacing: units.gu(0.25)
90 anchors.verticalCenter: parent.verticalCenter
94 objectName: "titleLabel"
95 anchors { left: parent.left; right: parent.right }
96 elide: Text.ElideRight
97 font.weight: Font.Normal
101 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
107 objectName: "subtitleLabel"
108 anchors { left: parent.left; right: parent.right }
109 elide: Text.ElideRight
111 font.weight: Font.Light
112 visible: titleLabel.text && text
113 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
120 anchors { left: parent.left; right: parent.right }
122 property int labels: {
123 var labels = 1; // price always visible
124 if (oldPriceLabel.text !== "") labels += 1;
125 if (altPriceLabel.text !== "") labels += 1;
128 property real labelWidth: width / labels
132 width: parent.labelWidth
133 elide: Text.ElideRight
134 font.weight: Font.DemiBold
141 objectName: "oldPriceLabel"
142 width: parent.labelWidth
143 elide: Text.ElideRight
144 horizontalAlignment: parent.labels === 3 ? Text.AlignHCenter : Text.AlignRight
152 width: parent.labelWidth
153 elide: Text.ElideRight
154 horizontalAlignment: Text.AlignRight
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