-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.qml
113 lines (99 loc) · 3.26 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.XmlListModel 2.0
import Material 0.2
import Material.ListItems 0.1 as ListItem
ApplicationWindow {
title: "Niftly"
width: 640
height: 480
visible: true
theme {
primaryColor: Palette.colors["blue"]["500"]
accentColor: Palette.colors["blue"]["900"]
tabHighlightColor: Palette.colors["blue"]["900"]
}
property var feeds: [
{ name: "Planet KDE", feed: "https://planetkde.org/rss20.xml", icon: "awesome/rss" },
{ name: "Planet Qt", feed: "http://planet.qt.io/rss20.xml", icon: "awesome/rss" },
]
property var selectedFeed: feeds[0]
XmlListModel {
id: feedModel
source: selectedFeed.feed
query: "/rss/channel/item"
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "author"; query: "author/string()" }
XmlRole { name: "description"; query: "description/string()" }
}
initialPage: page
Page {
title: "Niftly"
id: page
actions: [
Action {
name: "Notifications"
iconName: "social/notifications_active"
}
]
backAction: navDrawer.action
NavigationDrawer {
id: navDrawer
enabled: true
width: Units.dp(275)
Flickable {
anchors.fill: parent
contentHeight: Math.max(content.implicitHeight, height)
Column {
id: content
anchors.fill: parent
Image {
width: parent.width
fillMode: Image.PreserveAspectFit
source: "qrc:/images/niftly-drawer.png"
}
Repeater {
model: feeds
ListItem.Standard {
text: modelData.name
iconName: modelData.icon
selected: (selectedFeed !== undefined) ? (selectedFeed.name === text):false
onClicked: {
selectedFeed = modelData
navDrawer.close()
}
}
}
}
}
}
Item {
anchors.fill: parent
Flickable {
id: flickable
anchors.fill: parent
clip: true
contentHeight: Math.max(rssContent.implicitHeight + 40, height)
Column {
id: rssContent
anchors.fill: parent
Repeater {
model: feedModel
ListItem.Subtitled {
text: title
subText: author
iconName: "awesome/rss"
}
}
}
ProgressCircle {
anchors.centerIn: parent
visible: feedModel.status !== XmlListModel.Ready
}
}
Scrollbar {
flickableItem: flickable
}
}
}
}