@@ -22,18 +22,20 @@ Item {
22 property alias mascot: mascotImage.source
22 property alias mascot: mascotImage.source
23 property alias title: titleLabel.text
23 property alias title: titleLabel.text
24 property alias subtitle: subtitleLabel.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
26 property alias titleWeight: titleLabel.font.weight
27+ property alias titleSize: titleLabel.fontSize
31 // FIXME: Saviq, used to scale fonts down in Carousel
29 // FIXME: Saviq, used to scale fonts down in Carousel
32 property real fontScale: 1.0
30 property real fontScale: 1.0
34 property alias headerAlignment: titleLabel.horizontalAlignment
32 property alias headerAlignment: titleLabel.horizontalAlignment
34+ property bool inOverlay: false
35+ property bool useMascotShape: true
36+ property color fontColor: Theme.palette.selected.backgroundText
36− visible: mascotImage.status === Image.Ready || title || price
38+ visible: mascotImage.status === Image.Ready || title
37 height: row.height > 0 ? row.height + row.margins * 2 : 0
39 height: row.height > 0 ? row.height + row.margins * 2 : 0
@@ -42,13 +44,13 @@ Item {
43 property real margins: units.gu(1)
45 property real margins: units.gu(1)
47+ spacing: mascotShape.visible || mascotImage.visible || inOverlay ? margins : 0
46 top: parent.top; left: parent.left; right: parent.right
49 top: parent.top; left: parent.left; right: parent.right
47 margins: margins
50 margins: margins
48 leftMargin: spacing
51 leftMargin: spacing
49 rightMargin: spacing
52 rightMargin: spacing
51− spacing: mascotShape.visible || (template && template["overlay"]) ? margins : 0
53 UbuntuShape {
55 UbuntuShape {
54 id: mascotShape
56 id: mascotShape
@@ -57,35 +59,45 @@ Item {
57 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
59 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
58 width: units.gu(6)
60 width: units.gu(6)
59 height: units.gu(5.625)
61 height: units.gu(5.625)
62+ anchors.verticalCenter: parent.verticalCenter
60− visible: image.status === Image.Ready
63+ visible: useMascotShape && image && image.status === Image.Ready
61 readonly property int maxSize: Math.max(width, height)
64 readonly property int maxSize: Math.max(width, height)
64− id: mascotImage
66+ image: useMascotShape ? mascotImage : null
71+ objectName: "mascotImage"
73+ width: source ? mascotShape.width : 0
74+ height: mascotShape.height
75+ anchors.verticalCenter: parent.verticalCenter
76+ visible: !useMascotShape && status === Image.Ready
66− sourceSize { width: mascotShape.maxSize; height: mascotShape.maxSize }
78+ sourceSize { width: mascotShape.maxSize; height: mascotShape.maxSize }
67− fillMode: Image.PreserveAspectCrop
79+ fillMode: Image.PreserveAspectCrop
68− horizontalAlignment: Image.AlignHCenter
80+ horizontalAlignment: Image.AlignHCenter
69− verticalAlignment: Image.AlignVCenter
81+ verticalAlignment: Image.AlignVCenter
74 objectName: "column"
85 objectName: "column"
75 width: parent.width - x
86 width: parent.width - x
76− spacing: units.gu(0.5)
87+ spacing: units.gu(0.25)
88+ anchors.verticalCenter: parent.verticalCenter
79 id: titleLabel
91 id: titleLabel
80 objectName: "titleLabel"
92 objectName: "titleLabel"
81 anchors { left: parent.left; right: parent.right }
93 anchors { left: parent.left; right: parent.right }
82 elide: Text.ElideRight
94 elide: Text.ElideRight
83− font.weight: Font.DemiBold
95+ font.weight: Font.Normal
84 wrapMode: Text.Wrap
97 wrapMode: Text.Wrap
85 maximumLineCount: 2
98 maximumLineCount: 2
87 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
99 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
88− color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
100+ color: fontColor
@@ -93,51 +105,11 @@ Item {
93 objectName: "subtitleLabel"
105 objectName: "subtitleLabel"
94 anchors { left: parent.left; right: parent.right }
106 anchors { left: parent.left; right: parent.right }
95 elide: Text.ElideRight
107 elide: Text.ElideRight
96 font.weight: Font.Light
109 font.weight: Font.Light
97 visible: titleLabel.text && text
110 visible: titleLabel.text && text
99 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
111 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
100− color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
112+ color: fontColor
105− objectName: "prices"
106− anchors { left: parent.left; right: parent.right }
108− property int labels: {
109− var labels = 1; // price always visible
110− if (oldPriceLabel.text !== "") labels += 1;
111− if (altPriceLabel.text !== "") labels += 1;
114− property real labelWidth: width / labels
118− width: parent.labelWidth
119− elide: Text.ElideRight
120− font.weight: Font.DemiBold
121− color: Theme.palette.selected.foreground
127− objectName: "oldPriceLabel"
128− width: parent.labelWidth
129− elide: Text.ElideRight
130− horizontalAlignment: parent.labels === 3 ? Text.AlignHCenter : Text.AlignRight
136− width: parent.labelWidth
137− elide: Text.ElideRight
138− horizontalAlignment: Text.AlignRight