on xenial help sign in
Drop prices from CardHeader, they need to be reworked.
commitdf03adcf731dbe94f4658750885e2e8af81c20c1 authorMichał Sawicz <michal.sawicz@canonical.com> dateWed 12 Mar 2014, 11:46 (13 years ago) parent9a27624
2 files changed+1−74
qml/Dash/CardHeader.qml+1−47 tests/qmltests/Dash/tst_CardHeader.qml−27
qml/Dash/CardHeader.qml+1−47
@@ -22,9 +22,6 @@ Item {
2222 property alias mascot: mascotImage.source
2323 property alias title: titleLabel.text
2424 property alias subtitle: subtitleLabel.text
25− property alias price: priceLabel.text
26− property alias oldPrice: oldPriceLabel.text
27− property alias altPrice: altPriceLabel.text
2825
2926 property alias titleWeight: titleLabel.font.weight
3027
@@ -37,7 +34,7 @@ Item {
3734 property bool useMascotShape: true
3835 property color fontColor: "grey"
3936
40− visible: mascotImage.status === Image.Ready || title || price
37+ visible: mascotImage.status === Image.Ready || title
4138 height: row.height > 0 ? row.height + row.margins * 2 : 0
4239
4340 Row {
@@ -110,49 +107,6 @@ Item {
110107 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
111108 color: fontColor
112109 }
113−
114− Row {
115− id: prices
116− objectName: "prices"
117− anchors { left: parent.left; right: parent.right }
118−
119− property int labels: {
120− var labels = 1; // price always visible
121− if (oldPriceLabel.text !== "") labels += 1;
122− if (altPriceLabel.text !== "") labels += 1;
123− return labels;
124− }
125− property real labelWidth: width / labels
126−
127− Label {
128− id: priceLabel
129− width: parent.labelWidth
130− elide: Text.ElideRight
131− font.weight: Font.DemiBold
132− color: "#ff990000"
133− visible: text
134− }
135−
136− Label {
137− id: oldPriceLabel
138− objectName: "oldPriceLabel"
139− width: parent.labelWidth
140− elide: Text.ElideRight
141− horizontalAlignment: parent.labels === 3 ? Text.AlignHCenter : Text.AlignRight
142− font.strikeout: true
143− color: "black"
144− visible: text
145− }
146−
147− Label {
148− id: altPriceLabel
149− width: parent.labelWidth
150− elide: Text.ElideRight
151− horizontalAlignment: Text.AlignRight
152− color: fontColor
153− visible: text
154− }
155− }
156110 }
157111 }
158112}
tests/qmltests/Dash/tst_CardHeader.qml−27
@@ -46,7 +46,6 @@ Rectangle {
4646 property Item mascot: findChild(cardHeader, "mascotShape")
4747 property Item titleLabel: findChild(cardHeader, "titleLabel")
4848 property Item subtitleLabel: findChild(cardHeader, "subtitleLabel")
49− property Item prices: findChild(cardHeader, "prices")
5049 property Item oldPriceLabel: findChild(cardHeader, "oldPriceLabel")
5150 property Item outerRow: findChild(cardHeader, "outerRow")
5251 property Item column: findChild(cardHeader, "column")
@@ -55,7 +54,6 @@ Rectangle {
5554 verify(typeof testCase.mascot === "object", "Couldn't find mascot object.");
5655 verify(typeof testCase.titleLabel === "object", "Couldn't find titleLabel object.");
5756 verify(typeof testCase.subtitleLabel === "object", "Couldn't find subtitleLabel object.");
58− verify(typeof testCase.prices === "object", "Couldn't find prices object.");
5957 verify(typeof testCase.oldPriceLabel === "object", "Couldn't find oldPriceLabel object.");
6058 }
6159
@@ -63,9 +61,6 @@ Rectangle {
6361 cardHeader.mascot = "";
6462 cardHeader.title = "";
6563 cardHeader.subtitle = "";
66− cardHeader.price = "";
67− cardHeader.oldPrice = "";
68− cardHeader.altPrice = "";
6964 }
7065
7166 function test_mascot_data() {
@@ -96,28 +91,6 @@ Rectangle {
9691 tryCompare(cardHeader, "visible", data.visible);
9792 }
9893
99− function test_prices_data() {
100− return [
101− { tag: "Main", main: "$1.25", visible: true },
102− { tag: "Alt", alt: "€1.00", visible: false },
103− { tag: "Old", old: "€2.00", visible: false },
104− { tag: "Main and Alt", main: "$1.25", alt: "€1.00", visible: true },
105− { tag: "Main and Old", main: "$1.25", old: "$2.00", visible: true, oldAlign: Text.AlignRight },
106− { tag: "Alt and Old", alt: "€1.00", old: "$2.00", visible: false },
107− { tag: "All", main: "$1.25", alt: "€1.00", old: "$2.00", visible: true, oldAlign: Text.AlignHCenter },
108− ]
109− }
110−
111− function test_prices(data) {
112− cardHeader.price = data.main !== undefined ? data.main : "";
113− cardHeader.oldPrice = data.old !== undefined ? data.old : "";
114− cardHeader.altPrice = data.alt !== undefined ? data.alt : "";
115− tryCompare(cardHeader, "visible", data.visible);
116− if (data.hasOwnProperty("oldAlign")) {
117− compare(testCase.oldPriceLabel.horizontalAlignment, data.oldAlign, "Old price label is aligned wrong.")
118− }
119− }
120−
12194 function test_dimensions_data() {
12295 return [
12396 { tag: "Column width", object: column, width: cardHeader.width },