on xenial help sign in
And now with the files we need \o/
commitf59f12cf3749395366672e05454fa24b0293f012 authorAlbert Astals <albert.astals@canonical.com> dateFri 19 Sep 2014, 12:23 (12 years ago) parent5636a44
2 files changed+194
qml/Dash/ScopesList.qml+90 qml/Dash/ScopesListCategory.qml+104
qml/Dash/ScopesList.qmlnew file+90
@@ -0,0 +1,90 @@
1+/*
2+ * Copyright (C) 2014 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 Dash 0.1
19+
20+Item {
21+ id: root
22+
23+ // Properties set by parent
24+ property var scope: null
25+
26+ // Properties used by parent
27+ readonly property bool processing: false /*TODO*/
28+
29+ // Signals
30+ signal backClicked()
31+ signal requestFavorite(string scopeId, bool favorite)
32+
33+ ScopeStyle {
34+ id: scopeStyle
35+ style: { "foreground-color" : "gray",
36+ "background-color" : "transparent",
37+ "page-header": {
38+ "background": "color:///transparent"
39+ }
40+ }
41+ }
42+
43+ DashBackground {
44+ anchors.fill: parent
45+ }
46+
47+ PageHeader {
48+ id: header
49+ title: i18n.tr("My Feeds")
50+ width: parent.width
51+ showBackButton: true
52+ searchEntryEnabled: true
53+ onBackClicked: root.backClicked()
54+ }
55+
56+ Flickable {
57+ anchors {
58+ top: header.bottom
59+ bottom: parent.bottom
60+ left: parent.left
61+ right: parent.right
62+ }
63+ clip: true
64+ contentWidth: root.width
65+ contentHeight: column.height
66+ onContentHeightChanged: console.log("column.height", column.height);
67+ Column {
68+ id: column
69+ Repeater {
70+ model: scope && scope.searchQuery == "" ? scope.categories : null
71+
72+ delegate: Loader {
73+ source: "ScopesListCategory.qml";
74+ asynchronous: true
75+ width: root.width
76+ onLoaded: {
77+ item.isFavoriteFeeds = index == 0;
78+ item.scopeStyle = scopeStyle;
79+ item.model = Qt.binding(function() { return results });
80+ console.log(results, renderer);
81+ }
82+ Connections {
83+ target: item
84+ onRequestFavorite: root.requestFavorite(scopeId, favorite)
85+ }
86+ }
87+ }
88+ }
89+ }
90+}
qml/Dash/ScopesListCategory.qmlnew file+104
@@ -0,0 +1,104 @@
1+/*
2+ * Copyright (C) 2014 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 1.1;
19+import Dash 0.1
20+import "../Components/ListItems" as ListItems
21+
22+Item {
23+ id: root
24+
25+ property alias model: repeater.model
26+ property var scopeStyle
27+ property bool isFavoriteFeeds: false
28+
29+ signal requestFavorite(string scopeId, bool favorite)
30+
31+ implicitHeight: childrenRect.height
32+
33+ ListItems.Header {
34+ id: header
35+ width: root.width
36+ height: units.gu(5)
37+ text: isFavoriteFeeds ? i18n.tr("Favourite Feeds") : i18n.tr("Other Subscribed Feeds")
38+ color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
39+ }
40+
41+ property var myTemplate: JSON.parse('{"card-layout":"horizontal","card-size":"small","category-layout":"grid","collapsed-rows":2}')
42+ property var myComponents: JSON.parse('{"art":{"aspect-ratio":1,"field":"art"},"title":{"field":"title"},"attributes":{}}')
43+
44+
45+ Column {
46+ anchors.top: header.bottom
47+ Repeater {
48+ id: repeater
49+
50+ delegate: Loader {
51+ asynchronous: true
52+ width: root.width
53+ sourceComponent: Item {
54+ height: units.gu(6)
55+ UbuntuShape {
56+ id: shape
57+ anchors {
58+ left: parent.left
59+ leftMargin: units.gu(1)
60+ verticalCenter: parent.verticalCenter
61+ }
62+ width: units.gu(5)
63+ height: units.gu(5)
64+ image: Image {
65+ source: model["art"] || ""
66+ cache: true
67+ fillMode: Image.PreserveAspectCrop
68+ }
69+ }
70+ Label {
71+ id: titleLabel
72+ anchors {
73+ left: shape.right
74+ leftMargin: units.gu(1)
75+ right: star.right
76+ rightMargin: units.gu(1)
77+ verticalCenter: parent.verticalCenter
78+ }
79+ text: model["title"] || ""
80+ elide: Text.ElideRight
81+ wrapMode: Text.Wrap
82+ maximumLineCount: 1
83+ verticalAlignment: Text.AlignHCenter
84+ }
85+ Icon {
86+ id: star
87+ anchors {
88+ right: parent.right
89+ rightMargin: units.gu(1)
90+ verticalCenter: parent.verticalCenter
91+ }
92+ height: units.gu(2)
93+ width: units.gu(2)
94+ source: isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
95+ MouseArea {
96+ anchors.fill: parent
97+ onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
98+ }
99+ }
100+ }
101+ }
102+ }
103+ }
104+}