2 * Copyright (C) 2015 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 1.3
20 /*! \brief Preview widget for comments.
22 This widget shows an (optional) avatar contained in widgetData["source"]
23 along with a label that comes from widgetData["author"],
24 a (optional) subtitle from widgetData["subtitle"] and the comment widgetData["comment"].
29 implicitHeight: Math.max(avatar.height, column.implicitHeight)
41 source: widgetData["source"]
44 opacity: source.status === Image.Ready ? 1 : 0
45 visible: widgetData["source"] !== ""
52 left: avatar.visible ? avatar.right : parent.left
55 topMargin: units.gu(0.5)
56 leftMargin: avatar.visible ? units.gu(1) : 0
58 spacing: units.gu(0.24)
62 text: widgetData["author"] || ""
65 elide: Text.ElideRight
68 objectName: "subtitle"
71 text: widgetData["subtitle"] || ""
74 elide: Text.ElideRight
78 text: widgetData["comment"] || ""