on f110847 help sign in
unity8/Dash/Previews/Header.qml
109 lines 3.2 kB history raw
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components"
21Row {
22 id: root
23 property alias icon: image.source
24 property alias title: titleLabel.text
25 property alias subtitle: subtitleLabel.text
26 property alias rating: ratingStars.rating
27 property int rated: 0
28 property int reviews: 0
30 spacing: units.gu(2)
31 height: imageShape.visible ? imageShape.height : contentColumn.height
33 UbuntuShape {
34 id: imageShape
35 width: height
36 height: Math.max(units.gu(6), contentColumn.height)
37 visible: image.source.toString().length > 0
38 image: Image {
39 id: image
40 sourceSize { width: imageShape.width; height: imageShape.height }
41 asynchronous: true
42 fillMode: Image.PreserveAspectFit
43 }
44 }
46 Column {
47 id: contentColumn
48 spacing: units.gu(1)
49 width: parent.width - x
51 Label {
52 id: titleLabel
53 objectName: "titleLabel"
54 fontSize: "large"
55 color: "white"
56 style: Text.Raised
57 styleColor: "black"
58 opacity: .9
59 width: parent.width
60 elide: Text.ElideRight
61 }
63 Label {
64 id: subtitleLabel
65 objectName: "subtitleLabel"
66 fontSize: "medium"
67 color: "white"
68 style: Text.Raised
69 styleColor: "black"
70 opacity: .6
71 visible: text.length > 0
72 }
74 Row {
75 visible: root.rating >= 0
76 spacing: units.gu(1)
78 RatingStars {
79 id: ratingStars
80 maximumRating: 10
81 rating: -1
82 }
84 Label {
85 id: ratedLabel
86 objectName: "ratedLabel"
87 fontSize: "medium"
88 color: "white"
89 style: Text.Raised
90 styleColor: "black"
91 opacity: .6
92 //TRANSLATORS: Number of persons who rated this app/video/whatever
93 text: i18n.tr("(%1)").arg(root.rated)
94 }
96 Label {
97 id: reviewsLabel
98 objectName: "reviewsLabel"
99 fontSize: "medium"
100 color: "white"
101 style: Text.Raised
102 styleColor: "black"
103 opacity: .6
104 //TRANSLATORS: Number of persons who wrote reviews for this app/video/whatever
105 text: i18n.tr("%1 review", "%1 reviews", root.reviews).arg(root.reviews)
106 }
107 }
108 }