on xenial help sign in
Lot of fixes based on the reviews
commit8f4c32df18cada26f0330868252186b485f1e0a4 authorDiego Sarmentero <diego.sarmentero@gmail.com> dateThu 18 Jul 2013, 11:30 (13 years ago) parent8e937f6
7 files changed+653−4
Dash/Apps/AppInfo.qml+86 Dash/Apps/AppPreview.qml+136 Dash/Apps/AppReviews.qml+165 Dash/Apps/AppScreenshotsList.qml+34 Dash/Apps/DelegateScreenshots.qml+42 Dash/DashApps.qml+4−4 Dash/DashBasePreview.qml+186
Dash/Apps/AppInfo.qmlnew file+86
@@ -0,0 +1,86 @@
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 "../../Components"
20+
21+Row {
22+ id: root
23+ property alias icon: imgIcon.source
24+ property alias appName: lblAppName.text
25+ property alias rating: ratingStars.rating
26+ property int rated: 0
27+ property int reviews: 0
28+
29+ spacing: units.gu(2)
30+
31+ UbuntuShape {
32+ id: imgShape
33+ width: units.gu(6)
34+ height: units.gu(6)
35+ image: Image {
36+ id: imgIcon
37+ sourceSize { width: imgShape.width; height: imgShape.height }
38+ asynchronous: true
39+ fillMode: Image.PreserveAspectFit
40+ }
41+ }
42+
43+ Column {
44+ spacing: units.gu(1)
45+
46+ Label {
47+ id: lblAppName
48+ fontSize: "large"
49+ color: "white"
50+ style: Text.Raised
51+ styleColor: "black"
52+ opacity: .9
53+ }
54+
55+ Row {
56+ spacing: units.gu(1)
57+
58+ RatingStars {
59+ id: ratingStars
60+ maximumRating: 10
61+ }
62+
63+ Label {
64+ id: lblRated
65+ fontSize: "medium"
66+ color: "white"
67+ style: Text.Raised
68+ styleColor: "black"
69+ opacity: .6
70+ //TRANSLATORS: Number of persons who rated this app
71+ text: i18n.tr("(%1)").arg(root.rated)
72+ }
73+
74+ Label {
75+ id: lblReviews
76+ fontSize: "medium"
77+ color: "white"
78+ style: Text.Raised
79+ styleColor: "black"
80+ opacity: .6
81+ //TRANSLATORS: Number of persons who wrote reviews for this app
82+ text: i18n.tr("%1 reviews").arg(root.reviews)
83+ }
84+ }
85+ }
86+}
Dash/Apps/AppPreview.qmlnew file+136
@@ -0,0 +1,136 @@
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 ".."
21+import "../../Applications"
22+import "../../Components"
23+
24+DashBasePreview {
25+ id: root
26+
27+ property var previewData
28+
29+ signal download
30+ signal open
31+ signal sendUserReview(string review)
32+
33+ title: "" // FROM PREVIEW DATA (FIXME: need scope format data)
34+
35+ header: AppScreenshotsList {
36+ height: units.gu(20)
37+ anchors {
38+ left: parent.left
39+ right: parent.right
40+ }
41+
42+ model: 0 // FROM PREVIEW DATA (FIXME: need scope format data)
43+ }
44+
45+ buttons: GridView {
46+ id: buttons
47+ model: root.previewData.actions
48+
49+ property int numOfRows: (count + 1) / 2
50+ property int spacing: units.gu(1)
51+ height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
52+
53+ cellWidth: Math.max(units.gu(9), width / 2)
54+ cellHeight: buttonHeight + spacing
55+ property int buttonWidth: Math.max(0, width / 2 - spacing)
56+ property int buttonHeight: units.gu(4)
57+
58+ delegate: Button {
59+ width: Math.max(units.gu(4), buttons.buttonWidth)
60+ height: buttons.buttonHeight
61+ color: Theme.palette.selected.foreground
62+ text: modelData.displayName
63+ iconSource: modelData.iconHint
64+ iconPosition: "right"
65+ visible: true
66+ onClicked: {
67+ root.previewData.execute(modelData.id, { })
68+ }
69+ }
70+ focus: false
71+ }
72+
73+ body: Column {
74+ spacing: units.gu(1)
75+
76+ AppInfo {
77+ appName: "" // FROM PREVIEW DATA (FIXME: need scope format data)
78+ icon: "" // FROM PREVIEW DATA (FIXME: need scope format data)
79+ rating: 0 // FROM PREVIEW DATA (FIXME: need scope format data)
80+ rated: 0 // FROM PREVIEW DATA (FIXME: need scope format data)
81+ reviews: 0 // FROM PREVIEW DATA (FIXME: need scope format data)
82+
83+ width: root.width
84+ }
85+
86+ Label {
87+ text: "" // FROM PREVIEW DATA (FIXME: need scope format data)
88+ fontSize: "medium"
89+ color: "#f3f3e7"
90+ opacity: .6
91+ width: parent.width
92+ wrapMode: Text.WordWrap
93+ style: Text.Raised
94+ styleColor: "black"
95+ }
96+
97+ ListItem.ThinDivider {}
98+
99+ Item {
100+ anchors {
101+ left: parent.left
102+ right: parent.right
103+ }
104+ height: childrenRect.height
105+
106+ Label {
107+ fontSize: "medium"
108+ color: "white"
109+ style: Text.Raised
110+ styleColor: "black"
111+ opacity: .9
112+ text: i18n.tr("Rate this")
113+
114+ anchors.left: parent.left
115+ anchors.verticalCenter: parent.verticalCenter
116+ }
117+
118+ RatingStars {
119+ anchors.right: parent.right
120+ anchors.verticalCenter: parent.verticalCenter
121+ }
122+ }
123+
124+ ListItem.ThinDivider {}
125+
126+ AppReviews {
127+ anchors {
128+ left: parent.left
129+ right: parent.right
130+ }
131+
132+ onSendReview: root.sendUserReview(review);
133+ }
134+
135+ }
136+}
Dash/Apps/AppReviews.qmlnew file+165
@@ -0,0 +1,165 @@
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+
27+ signal sendReview(string review)
28+
29+ spacing: units.gu(1)
30+ state: ""
31+
32+ states: [
33+ State {
34+ name: ""
35+ PropertyChanges { target: sendButton; opacity: 0; }
36+ PropertyChanges { target: reviewField; width: root.width; }
37+ },
38+ State {
39+ name: "editing"
40+ PropertyChanges { target: reviewField; width: (root.width - row.spacing - sendButton.width); }
41+ PropertyChanges { target: sendButton; opacity: 1; }
42+ }
43+ ]
44+
45+ transitions: [
46+ Transition {
47+ from: ""
48+ to: "editing"
49+ SequentialAnimation {
50+ UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration }
51+ UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration }
52+ }
53+ },
54+ Transition {
55+ from: "editing"
56+ to: ""
57+ SequentialAnimation {
58+ UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration }
59+ UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration }
60+ }
61+ }
62+ ]
63+
64+ Label {
65+ fontSize: "medium"
66+ color: "white"
67+ style: Text.Raised
68+ styleColor: "black"
69+ opacity: .9
70+ text: i18n.tr("Add a review")
71+ }
72+
73+ Row {
74+ id: row
75+ spacing: units.gu(1)
76+ width: root.width
77+ height: childrenRect.height
78+
79+ TextField {
80+ id: reviewField
81+ placeholderText: i18n.tr("Review")
82+ width: parent.width
83+ height: units.gu(5)
84+
85+ onFocusChanged: {
86+ root.state = "editing";
87+ }
88+ }
89+
90+ Button {
91+ id: sendButton
92+ width: units.gu(10)
93+ color: Theme.palette.selected.foreground
94+ text: i18n.tr("Send")
95+ opacity: 0
96+
97+ onClicked: {
98+ root.sendReview(reviewField.text);
99+ root.state = "";
100+ }
101+ }
102+ }
103+
104+ ListItem.ThinDivider {}
105+
106+ Column {
107+ width: parent.width
108+ height: childrenRect.height
109+ spacing: units.gu(2)
110+
111+ Label {
112+ fontSize: "medium"
113+ color: "white"
114+ style: Text.Raised
115+ styleColor: "black"
116+ opacity: .9
117+ text: i18n.tr("Comments:")
118+ }
119+
120+ Repeater {
121+ model: root.model
122+
123+ Column {
124+ width: root.width
125+ height: childrenRect.height
126+ Column {
127+ Label {
128+ text: "" // FROM PREVIEW DATA (FIXME: need scope format data)
129+ fontSize: "medium"
130+ color: "white"
131+ opacity: .8
132+ wrapMode: Text.WordWrap
133+ style: Text.Raised
134+ styleColor: "black"
135+ }
136+ Row {
137+ spacing: units.gu(1)
138+ RatingStars {
139+ maximumRating: 10
140+ rating: 0 // FROM PREVIEW DATA (FIXME: need scope format data)
141+ }
142+ Label {
143+ text: "" // FROM PREVIEW DATA (FIXME: need scope format data)
144+ fontSize: "medium"
145+ color: "#f3f3e7"
146+ opacity: .6
147+ style: Text.Raised
148+ styleColor: "black"
149+ }
150+ }
151+ }
152+ Label {
153+ text: "" // FROM PREVIEW DATA (FIXME: need scope format data)
154+ fontSize: "medium"
155+ color: "#f3f3e7"
156+ opacity: .6
157+ width: root.width
158+ wrapMode: Text.WordWrap
159+ style: Text.Raised
160+ styleColor: "black"
161+ }
162+ }
163+ }
164+ }
165+}
Dash/Apps/AppScreenshotsList.qmlnew file+34
@@ -0,0 +1,34 @@
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 "../../Components"
19+
20+ListView {
21+ id: screenshots
22+ spacing: units.gu(1)
23+ orientation: ListView.Horizontal
24+
25+ delegate: DelegateScreenshots {
26+ height: screenshots.height
27+ width: units.gu(12)
28+ }
29+
30+ MouseArea {
31+ id: mouseArea
32+ anchors.fill: parent
33+ }
34+}
Dash/Apps/DelegateScreenshots.qmlnew file+42
@@ -0,0 +1,42 @@
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+
20+Item {
21+ id: item
22+
23+ UbuntuShape {
24+ anchors.fill: parent
25+ radius: "medium"
26+ borderSource: ""
27+ image: Image {
28+ asynchronous: true
29+ sourceSize { width: item.width; height: item.height }
30+ source: model ? model.modelData : ""
31+ }
32+ }
33+
34+ BorderImage {
35+ anchors.centerIn: parent
36+ opacity: 0.6
37+ source: "../../Components/graphics/non-selected.sci"
38+ width: parent.width + units.gu(1.5)
39+ height: parent.height + units.gu(1.5)
40+ }
41+
42+}
Dash/DashApps.qml+4−4
@@ -135,9 +135,9 @@ ScopeView {
135135 function activateApplication(index, data) {
136136 //Check somehow if the app is not installed
137137 // IF NOT INSTALLED:
138− //previewLoader.previewData = data;
139− //previewLoader.open = true;
140− //effect.positionPx = mapToItem(categoryView, 0, itemY).y;
138+// previewLoader.previewData = data;
139+// previewLoader.open = true;
140+// effect.positionPx = mapToItem(categoryView, 0, itemY).y;
141141 // IF INSTALLED:
142142 shell.activateApplication(data);
143143 }
@@ -239,7 +239,7 @@ ScopeView {
239239 left: parent.left
240240 right: parent.right
241241 }
242− source: onScreen ? previewDelegateMapper.map("preview-app") : ""
242+ source: onScreen ? previewDelegateMapper.map("preview-application") : ""
243243
244244 property bool open: false
245245 property bool onScreen: false
Dash/DashBasePreview.qmlnew file+186
@@ -0,0 +1,186 @@
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+
20+Rectangle {
21+ id: root
22+ property string title: ""
23+ property url url: ""
24+ property real previewWidthRatio: 0.5
25+
26+ property Component header
27+ property Component buttons
28+ property Component body
29+
30+ readonly property bool narrowMode: width <= height
31+ readonly property int contentSpacing: units.gu(3)
32+
33+ signal close()
34+ signal previewImageClicked()
35+
36+ color: Qt.rgba(0, 0, 0, .3)
37+ clip: true
38+
39+ Connections {
40+ target: shell.applicationManager
41+ onMainStageFocusedApplicationChanged: {
42+ root.close();
43+ }
44+ onSideStageFocusedApplicationChanged: {
45+ root.close();
46+ }
47+ }
48+
49+ MouseArea {
50+ anchors.fill: parent
51+ }
52+
53+ Item {
54+ id: headerRow
55+ height: units.gu(4)
56+ anchors {
57+ top: parent.top
58+ left: parent.left
59+ right: parent.right
60+ margins: root.contentSpacing
61+ }
62+
63+ MouseArea {
64+ anchors {
65+ fill: parent
66+ leftMargin: -root.contentSpacing
67+ rightMargin: -root.contentSpacing
68+ topMargin: -root.contentSpacing
69+ }
70+
71+ onClicked: root.close();
72+ }
73+
74+ Item {
75+ id: labelItem
76+ anchors {
77+ fill: parent
78+ rightMargin: closePreviewImage.width + spacing
79+ }
80+
81+ property int spacing: units.gu(2)
82+
83+ Label {
84+ id: title
85+ objectName: "titleLabel"
86+ anchors {
87+ left: parent.left
88+ right: parent.right
89+ }
90+
91+ elide: Text.ElideRight
92+ fontSize: "x-large"
93+ font.weight: Font.Light
94+ color: "#f3f3e7"
95+ opacity: 0.9
96+ text: root.title
97+ style: Text.Raised
98+ styleColor: "black"
99+ }
100+ Image {
101+ id: closePreviewImage
102+ source: "graphics/tablet/icon_close_preview.png"
103+ width: units.gu(4)
104+ height: units.gu(1.5)
105+ anchors {
106+ bottom: title.bottom
107+ bottomMargin: units.dp(7)
108+ left: parent.left
109+ leftMargin: title.paintedWidth + labelItem.spacing
110+ }
111+ }
112+ }
113+ }
114+
115+ Row {
116+ id: contentRow
117+ anchors {
118+ left: parent.left
119+ right: parent.right
120+ top: headerRow.bottom
121+ bottom: parent.bottom
122+ margins: root.contentSpacing
123+ }
124+
125+ spacing: units.gu(2)
126+
127+ Flickable {
128+ id: leftFlickable
129+ anchors.top: parent.top
130+ anchors.bottom: parent.bottom
131+ width: root.narrowMode ? contentRow.width : contentRow.width * root.previewWidthRatio
132+ contentHeight: leftColumn.height
133+ clip: true
134+
135+ Column {
136+ id: leftColumn
137+ objectName: "leftColumn"
138+ anchors {
139+ left: parent.left
140+ right: parent.right
141+ }
142+ height: childrenRect.height
143+ spacing: units.gu(1)
144+
145+ Loader {
146+ id: headerLoader
147+ anchors.left: parent.left
148+ anchors.right: parent.right
149+ sourceComponent: root.header
150+ }
151+ Loader {
152+ id: buttonLoader
153+ anchors.left: parent.left
154+ anchors.right: parent.right
155+ sourceComponent: root.buttons
156+ }
157+ }
158+ }
159+
160+ Flickable {
161+ id: rightFlickable
162+ anchors.top: parent.top
163+ anchors.bottom: parent.bottom
164+ width: narrowMode ? 0 : (contentRow.width - leftColumn.width - contentRow.spacing)
165+ contentHeight: rightColumn.height
166+ clip: true
167+
168+ Column {
169+ id: rightColumn
170+ objectName: "rightColumn"
171+ height: childrenRect.height
172+ anchors {
173+ left: parent.left
174+ right: parent.right
175+ }
176+ }
177+ }
178+ }
179+
180+ Loader {
181+ parent: root.narrowMode ? leftColumn : rightColumn
182+ anchors.left: parent.left
183+ anchors.right: parent.right
184+ sourceComponent: root.body
185+ }
186+}