2 * Copyright (C) 2014 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/>.
18 import Ubuntu.Components 0.1
19 import "../../Components"
21 /*! \brief Preview widget for rating display.
23 The widget can show a rating widget and a field showing a comment.
24 The icons used in the rating widget can be customised with
25 widgetData["rating-icon-empty"], widgetData["rating-icon-full"]
26 and widgetData["rating-icon-half"].
28 This widget shows reviews contained in widgetData["reviews"], each of which should be of the form:
41 height: childrenRect.height
44 anchors { left: parent.left; right: parent.right; }
45 visible: reviewsRepeater.count > 0
49 objectName: "reviewsRepeater"
50 model: root.widgetData["reviews"]
54 objectName: "reviewItem" + index
55 anchors { left: parent.left; right: parent.right;}
62 value: modelData["rating"] || -1
66 property var urlIconEmpty: widgetData["rating-icon-empty"]
67 property var urlIconFull: widgetData["rating-icon-full"]
68 property var urlIconHalf: widgetData["rating-icon-half"]
73 objectName: "authorLabel"
74 anchors { left: parent.left; right: parent.right }
75 color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
77 text: modelData["author"] || ""
84 objectName: "reviewLabel"
85 anchors { left: parent.left; right: parent.right }
86 color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
88 text: modelData["review"] || ""
95 anchors { left: parent.left; right: parent.right }
97 visible: rating.visible || authorLabel.visible || reviewLabel.visible