@@ -1,194 +0,0 @@
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− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import Ubuntu.Components.ListItems 0.1 as ListItem
20−import "../../Components"
21−
22−Column {
23− id: root
24−
25− property var model
26− property alias textArea: reviewField
27−
28− signal sendReview(string review)
29− signal editing
30−
31− spacing: units.gu(2)
32− state: ""
33−
34− states: [
35− State {
36− name: ""
37− PropertyChanges { target: reviewField; width: root.width }
38− PropertyChanges { target: sendButton; opacity: 0 }
39− PropertyChanges { target: inverseArea; enabled: false }
40− },
41− State {
42− name: "editing"
43− PropertyChanges { target: reviewField; width: (root.width - row.spacing - sendButton.width) }
44− PropertyChanges { target: sendButton; opacity: 1 }
45− PropertyChanges { target: inverseArea; enabled: true }
46− }
47− ]
48−
49− transitions: [
50− Transition {
51− from: ""
52− to: "editing"
53− SequentialAnimation {
54− UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration }
55− UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration }
56− }
57− },
58− Transition {
59− from: "editing"
60− to: ""
61− SequentialAnimation {
62− UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration }
63− UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration }
64− }
65− }
66− ]
67−
68− Label {
69− fontSize: "medium"
70− color: "white"
71− style: Text.Raised
72− styleColor: "black"
73− opacity: .9
74− text: i18n.tr("Add a review")
75− }
76−
77− Row {
78− id: row
79− spacing: units.gu(1)
80− width: root.width
81−
82− // FIXME: needs to react to Qt.inputMethod geometry
83− TextArea {
84− id: reviewField
85− objectName: "reviewField"
86− placeholderText: i18n.tr("Review")
87− width: parent.width
88− verticalAlignment: Text.AlignVCenter
89− autoSize: true
90− maximumLineCount: 5
91−
92− Behavior on height { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
93−
94− onFocusChanged: {
95− if(reviewField.focus){
96− root.state = "editing";
97− reviewField.selectAll();
98− root.editing();
99− }
100− }
101−
102− // FIXME: not active when in wide mode
103− InverseMouseArea {
104− id: inverseArea
105− anchors.fill: parent
106− enabled: false
107− onPressed: {
108− reviewField.focus = false;
109− root.state = "";
110− }
111− }
112− }
113−
114− Button {
115− id: sendButton
116− objectName: "sendButton"
117− width: units.gu(10)
118− height: units.gu(4)
119− anchors.bottom: reviewField.bottom
120− color: Theme.palette.selected.foreground
121− text: i18n.tr("Send")
122− opacity: 0
123−
124− onClicked: {
125− root.sendReview(reviewField.text);
126− reviewField.text = ""
127− }
128− }
129− }
130−
131− ListItem.ThinDivider {}
132−
133− Label {
134− fontSize: "medium"
135− color: "white"
136− style: Text.Raised
137− styleColor: "black"
138− opacity: .9
139− text: i18n.tr("Comments:")
140− }
141−
142− Repeater {
143− objectName: "commentsArea"
144− model: root.model
145−
146− Column {
147− anchors { left: parent.left; right: parent.right }
148−
149− Column {
150− anchors { left: parent.left; right: parent.right }
151−
152− Label {
153− anchors { left: parent.left; right: parent.right }
154− text: modelData[0]
155− fontSize: "medium"
156− color: "white"
157− opacity: .8
158− wrapMode: Text.WordWrap
159− style: Text.Raised
160− styleColor: "black"
161− }
162−
163− Row {
164− spacing: units.gu(1)
165−
166− RatingStars {
167− maximumRating: 10
168− rating: modelData[1]
169− }
170−
171− Label {
172− text: modelData[2]
173− fontSize: "medium"
174− color: Theme.palette.selected.backgroundText
175− opacity: .6
176− style: Text.Raised
177− styleColor: "black"
178− }
179− }
180− }
181−
182− Label {
183− anchors { left: parent.left; right: parent.right }
184− text: modelData[3]
185− fontSize: "medium"
186− color: Theme.palette.selected.backgroundText
187− opacity: .6
188− wrapMode: Text.WordWrap
189− style: Text.Raised
190− styleColor: "black"
191− }
192− }
193− }
194−}