Merge lp:~nik90/podbird/downloaded-view-devel into lp:podbird/devel
- downloaded-view-devel
- Merge into devel
Proposed by
Nekhelesh Ramananthan
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 107 | ||||
Proposed branch: | lp:~nik90/podbird/downloaded-view-devel | ||||
Merge into: | lp:podbird/devel | ||||
Diff against target: |
507 lines (+184/-104) 5 files modified
app/podbird.qml (+3/-19) app/ui/EpisodesTab.qml (+149/-75) app/ui/PodcastsTab.qml (+3/-3) app/ui/SearchPage.qml (+4/-2) app/ui/SettingsPage.qml (+25/-5) |
||||
To merge this branch: | bzr merge lp:~nik90/podbird/downloaded-view-devel | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Podbird Developers | Pending | ||
Review via email: mp+258989@code.launchpad.net |
Commit message
Description of the change
This MP implements the following,
- Moved the settings option to set podcasts list/grid view to the settings page
- Added back the add new podcasts option as a header button rather than a dedicated tab since it rarely used once the user has added all podcasts he needs.
- Replaced What's New Tab with the Episodes Tab and then adds What's New view and Downloaded View as header sections.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'app/podbird.qml' | |||
2 | --- app/podbird.qml 2015-05-12 21:35:11 +0000 | |||
3 | +++ app/podbird.qml 2015-05-13 11:43:12 +0000 | |||
4 | @@ -55,7 +55,7 @@ | |||
5 | 55 | // visible on application start. | 55 | // visible on application start. |
6 | 56 | function refreshModels() { | 56 | function refreshModels() { |
7 | 57 | if (tabs.selectedTabIndex === 0) { | 57 | if (tabs.selectedTabIndex === 0) { |
9 | 58 | whatsNewTab.refreshModel() | 58 | episodesTab.refreshModel() |
10 | 59 | } else if (tabs.selectedTabIndex === 1) { | 59 | } else if (tabs.selectedTabIndex === 1) { |
11 | 60 | podcastPage.item.refreshModel() | 60 | podcastPage.item.refreshModel() |
12 | 61 | } | 61 | } |
13 | @@ -239,9 +239,8 @@ | |||
14 | 239 | } | 239 | } |
15 | 240 | } | 240 | } |
16 | 241 | 241 | ||
20 | 242 | WhatsNewTab { | 242 | EpisodesTab { |
21 | 243 | id: whatsNewTab | 243 | id: episodesTab |
19 | 244 | objectName: "whatsNewTab" | ||
22 | 245 | } | 244 | } |
23 | 246 | 245 | ||
24 | 247 | Tab { | 246 | Tab { |
25 | @@ -259,21 +258,6 @@ | |||
26 | 259 | } | 258 | } |
27 | 260 | 259 | ||
28 | 261 | Tab { | 260 | Tab { |
29 | 262 | id: searchTab | ||
30 | 263 | |||
31 | 264 | title: i18n.tr("Add New Podcasts") | ||
32 | 265 | |||
33 | 266 | // Dynamically load/unload the search tab as required | ||
34 | 267 | page: Loader { | ||
35 | 268 | parent: searchTab | ||
36 | 269 | anchors.left: parent.left | ||
37 | 270 | anchors.right: parent.right | ||
38 | 271 | anchors.bottom: parent.bottom | ||
39 | 272 | source: (tabs.selectedTab === searchTab) ? Qt.resolvedUrl("ui/SearchPage.qml") : "" | ||
40 | 273 | } | ||
41 | 274 | } | ||
42 | 275 | |||
43 | 276 | Tab { | ||
44 | 277 | id: settingsTab | 261 | id: settingsTab |
45 | 278 | 262 | ||
46 | 279 | title: i18n.tr("Settings") | 263 | title: i18n.tr("Settings") |
47 | 280 | 264 | ||
48 | === renamed file 'app/ui/WhatsNewTab.qml' => 'app/ui/EpisodesTab.qml' | |||
49 | --- app/ui/WhatsNewTab.qml 2015-05-02 09:24:19 +0000 | |||
50 | +++ app/ui/EpisodesTab.qml 2015-05-13 11:43:12 +0000 | |||
51 | @@ -12,7 +12,7 @@ | |||
52 | 12 | Tab { | 12 | Tab { |
53 | 13 | id: whatsNewTab | 13 | id: whatsNewTab |
54 | 14 | 14 | ||
56 | 15 | title: i18n.tr("What's New") | 15 | title: i18n.tr("Episodes") |
57 | 16 | 16 | ||
58 | 17 | property var today: new Date() | 17 | property var today: new Date() |
59 | 18 | property int dayToMs: 86400000 | 18 | property int dayToMs: 86400000 |
60 | @@ -20,33 +20,45 @@ | |||
61 | 20 | property bool episodesUpdating: false | 20 | property bool episodesUpdating: false |
62 | 21 | 21 | ||
63 | 22 | page: Page { | 22 | page: Page { |
65 | 23 | id: whatsNewPage | 23 | id: episodesPage |
66 | 24 | |||
67 | 25 | flickable: null | ||
68 | 26 | |||
69 | 27 | head { | ||
70 | 28 | sections { | ||
71 | 29 | model: [i18n.tr("What's New"), i18n.tr("Downloaded")] | ||
72 | 30 | onSelectedIndexChanged: { | ||
73 | 31 | refreshModel(); | ||
74 | 32 | } | ||
75 | 33 | } | ||
76 | 34 | } | ||
77 | 24 | 35 | ||
78 | 25 | state: "default" | 36 | state: "default" |
79 | 26 | states: [ | 37 | states: [ |
80 | 27 | PageHeadState { | 38 | PageHeadState { |
81 | 28 | name: "default" | 39 | name: "default" |
83 | 29 | head: whatsNewPage.head | 40 | head: episodesPage.head |
84 | 30 | actions: [ | 41 | actions: [ |
85 | 31 | Action { | 42 | Action { |
86 | 32 | iconName: "search" | 43 | iconName: "search" |
87 | 33 | text: i18n.tr("Search Episode") | 44 | text: i18n.tr("Search Episode") |
88 | 34 | onTriggered: { | 45 | onTriggered: { |
90 | 35 | whatsNewPage.state = "search" | 46 | episodesPage.state = "search" |
91 | 36 | searchField.item.forceActiveFocus() | 47 | searchField.item.forceActiveFocus() |
92 | 37 | } | 48 | } |
93 | 38 | }, | 49 | }, |
94 | 39 | 50 | ||
95 | 40 | Action { | 51 | Action { |
96 | 41 | iconName: "select" | 52 | iconName: "select" |
97 | 53 | visible: episodesPage.head.sections.selectedIndex === 0 | ||
98 | 42 | text: i18n.tr("Mark all listened") | 54 | text: i18n.tr("Mark all listened") |
99 | 43 | onTriggered: { | 55 | onTriggered: { |
100 | 44 | var db = Podcasts.init(); | 56 | var db = Podcasts.init(); |
101 | 45 | db.transaction(function (tx) { | 57 | db.transaction(function (tx) { |
104 | 46 | for (var i=0; i<whatsNewModel.count; i++) { | 58 | for (var i=0; i<episodesModel.count; i++) { |
105 | 47 | tx.executeSql("UPDATE Episode SET listened=1 WHERE guid=?", [whatsNewModel.get(i).guid]); | 59 | tx.executeSql("UPDATE Episode SET listened=1 WHERE guid=?", [episodesModel.get(i).guid]); |
106 | 48 | } | 60 | } |
108 | 49 | whatsNewModel.clear() | 61 | episodesModel.clear() |
109 | 50 | }); | 62 | }); |
110 | 51 | } | 63 | } |
111 | 52 | }, | 64 | }, |
112 | @@ -54,17 +66,37 @@ | |||
113 | 54 | Action { | 66 | Action { |
114 | 55 | iconName: "save" | 67 | iconName: "save" |
115 | 56 | text: i18n.tr("Download all") | 68 | text: i18n.tr("Download all") |
127 | 57 | onTriggered: { | 69 | visible: episodesPage.head.sections.selectedIndex === 0 |
128 | 58 | var db = Podcasts.init(); | 70 | onTriggered: { |
129 | 59 | db.transaction(function (tx) { | 71 | var db = Podcasts.init(); |
130 | 60 | for (var i=0; i<whatsNewModel.count; i++) { | 72 | db.transaction(function (tx) { |
131 | 61 | if (!whatsNewModel.get(i).downloadedfile) { | 73 | for (var i=0; i<episodesModel.count; i++) { |
132 | 62 | whatsNewModel.setProperty(i, "queued", 1) | 74 | if (!episodesModel.get(i).downloadedfile) { |
133 | 63 | tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [whatsNewModel.get(i).guid]); | 75 | episodesModel.setProperty(i, "queued", 1) |
134 | 64 | downloader.addDownload(whatsNewModel.get(i).guid, whatsNewModel.get(i).audiourl); | 76 | tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [episodesModel.get(i).guid]); |
135 | 65 | } | 77 | downloader.addDownload(episodesModel.get(i).guid, episodesModel.get(i).audiourl); |
136 | 66 | } | 78 | } |
137 | 67 | }); | 79 | } |
138 | 80 | }); | ||
139 | 81 | } | ||
140 | 82 | }, | ||
141 | 83 | |||
142 | 84 | Action { | ||
143 | 85 | iconName: "delete" | ||
144 | 86 | text: i18n.tr("Delete all") | ||
145 | 87 | visible: episodesPage.head.sections.selectedIndex === 1 | ||
146 | 88 | onTriggered: { | ||
147 | 89 | var db = Podcasts.init(); | ||
148 | 90 | db.transaction(function (tx) { | ||
149 | 91 | for (var i=0; i<episodesModel.count; i++) { | ||
150 | 92 | if (episodesModel.get(i).downloadedfile) { | ||
151 | 93 | fileManager.deleteFile(episodesModel.get(i).downloadedfile); | ||
152 | 94 | tx.executeSql("UPDATE Episode SET downloadedfile = NULL WHERE guid = ?", [episodesModel.get(i).guid]); | ||
153 | 95 | episodesModel.setProperty(i, "downloadedfile", "") | ||
154 | 96 | } | ||
155 | 97 | } | ||
156 | 98 | }); | ||
157 | 99 | refreshModel(); | ||
158 | 68 | } | 100 | } |
159 | 69 | } | 101 | } |
160 | 70 | ] | 102 | ] |
161 | @@ -72,19 +104,19 @@ | |||
162 | 72 | 104 | ||
163 | 73 | PageHeadState { | 105 | PageHeadState { |
164 | 74 | name: "search" | 106 | name: "search" |
166 | 75 | head: whatsNewPage.head | 107 | head: episodesPage.head |
167 | 76 | backAction: Action { | 108 | backAction: Action { |
168 | 77 | iconName: "back" | 109 | iconName: "back" |
169 | 78 | text: i18n.tr("Back") | 110 | text: i18n.tr("Back") |
170 | 79 | onTriggered: { | 111 | onTriggered: { |
171 | 80 | episodeList.forceActiveFocus() | 112 | episodeList.forceActiveFocus() |
173 | 81 | whatsNewPage.state = "default" | 113 | episodesPage.state = "default" |
174 | 82 | } | 114 | } |
175 | 83 | } | 115 | } |
176 | 84 | 116 | ||
177 | 85 | contents: Loader { | 117 | contents: Loader { |
178 | 86 | id: searchField | 118 | id: searchField |
180 | 87 | sourceComponent: whatsNewPage.state === "search" ? searchFieldComponent : undefined | 119 | sourceComponent: episodesPage.state === "search" ? searchFieldComponent : undefined |
181 | 88 | anchors.left: parent ? parent.left : undefined | 120 | anchors.left: parent ? parent.left : undefined |
182 | 89 | anchors.right: parent ? parent.right : undefined | 121 | anchors.right: parent ? parent.right : undefined |
183 | 90 | anchors.rightMargin: units.gu(2) | 122 | anchors.rightMargin: units.gu(2) |
184 | @@ -111,7 +143,7 @@ | |||
185 | 111 | verticalCenterOffset: Qt.inputMethod.visible ? units.gu(4) : 0 | 143 | verticalCenterOffset: Qt.inputMethod.visible ? units.gu(4) : 0 |
186 | 112 | } | 144 | } |
187 | 113 | 145 | ||
189 | 114 | sourceComponent: whatsNewModel.count === 0 || sortedEpisodeModel.count === 0 ? emptyStateComponent : undefined | 146 | sourceComponent: episodesModel.count === 0 || sortedEpisodeModel.count === 0 ? emptyStateComponent : undefined |
190 | 115 | } | 147 | } |
191 | 116 | 148 | ||
192 | 117 | Component { | 149 | Component { |
193 | @@ -119,21 +151,21 @@ | |||
194 | 119 | EmptyState { | 151 | EmptyState { |
195 | 120 | iconHeight: units.gu(12) | 152 | iconHeight: units.gu(12) |
196 | 121 | iconWidth: units.gu(22) | 153 | iconWidth: units.gu(22) |
200 | 122 | iconSource: whatsNewModel.count === 0 ? Qt.resolvedUrl("../graphics/owlSearch.svg") : Qt.resolvedUrl("../graphics/notFound.svg") | 154 | iconSource: episodesModel.count === 0 ? Qt.resolvedUrl("../graphics/owlSearch.svg") : Qt.resolvedUrl("../graphics/notFound.svg") |
201 | 123 | title: whatsNewModel.count === 0 ? i18n.tr("No New Episodes") : i18n.tr("No Episodes Found") | 155 | title: episodesModel.count === 0 ? episodesPage.head.sections.selectedIndex === 0 ? i18n.tr("No New Episodes") : i18n.tr("No Downloaded Episodes") : i18n.tr("No Episodes Found") |
202 | 124 | subTitle: whatsNewModel.count === 0 ? i18n.tr("No more episodes to listen to!") : i18n.tr("No Episodes found matching the search term.") | 156 | subTitle: episodesModel.count === 0 ? episodesPage.head.sections.selectedIndex === 0 ? i18n.tr("No more episodes to listen to!") : i18n.tr("No episodes have been downloaded") : i18n.tr("No Episodes found matching the search term.") |
203 | 125 | } | 157 | } |
204 | 126 | } | 158 | } |
205 | 127 | 159 | ||
206 | 128 | ListModel { | 160 | ListModel { |
208 | 129 | id: whatsNewModel | 161 | id: episodesModel |
209 | 130 | } | 162 | } |
210 | 131 | 163 | ||
211 | 132 | SortFilterModel { | 164 | SortFilterModel { |
212 | 133 | id: sortedEpisodeModel | 165 | id: sortedEpisodeModel |
214 | 134 | model: whatsNewModel | 166 | model: episodesModel |
215 | 135 | filter.property: "name" | 167 | filter.property: "name" |
217 | 136 | filter.pattern: whatsNewPage.state === "search" && searchField.status == Loader.Ready ? RegExp(searchField.item.text, "gi") | 168 | filter.pattern: episodesPage.state === "search" && searchField.status == Loader.Ready ? RegExp(searchField.item.text, "gi") |
218 | 137 | : RegExp("", "gi") | 169 | : RegExp("", "gi") |
219 | 138 | } | 170 | } |
220 | 139 | 171 | ||
221 | @@ -152,15 +184,15 @@ | |||
222 | 152 | db.transaction(function (tx) { | 184 | db.transaction(function (tx) { |
223 | 153 | /* | 185 | /* |
224 | 154 | If tempGuid is NULL, then the episode currently being downloaded is not found within | 186 | If tempGuid is NULL, then the episode currently being downloaded is not found within |
226 | 155 | this podcast. On the other hand, if it is within this podcast, then update the whatsNewModel | 187 | this podcast. On the other hand, if it is within this podcast, then update the episodesModel |
227 | 156 | with the downloadedfile location we just received from the downloader. | 188 | with the downloadedfile location we just received from the downloader. |
228 | 157 | */ | 189 | */ |
229 | 158 | if (tempGuid != "NULL") { | 190 | if (tempGuid != "NULL") { |
230 | 159 | var rs2 = tx.executeSql("SELECT downloadedfile FROM Episode WHERE guid=?", [tempGuid]); | 191 | var rs2 = tx.executeSql("SELECT downloadedfile FROM Episode WHERE guid=?", [tempGuid]); |
233 | 160 | for (var i=0; i<whatsNewModel.count; i++) { | 192 | for (var i=0; i<episodesModel.count; i++) { |
234 | 161 | if (whatsNewModel.get(i).guid == tempGuid) { | 193 | if (episodesModel.get(i).guid == tempGuid) { |
235 | 162 | console.log("[LOG]: Setting episode download URL to " + rs2.rows.item(0).downloadedfile) | 194 | console.log("[LOG]: Setting episode download URL to " + rs2.rows.item(0).downloadedfile) |
237 | 163 | whatsNewModel.setProperty(i, "downloadedfile", rs2.rows.item(0).downloadedfile) | 195 | episodesModel.setProperty(i, "downloadedfile", rs2.rows.item(0).downloadedfile) |
238 | 164 | break | 196 | break |
239 | 165 | } | 197 | } |
240 | 166 | } | 198 | } |
241 | @@ -192,6 +224,7 @@ | |||
242 | 192 | flickDeceleration = flickDeceleration * scaleFactor; | 224 | flickDeceleration = flickDeceleration * scaleFactor; |
243 | 193 | } | 225 | } |
244 | 194 | 226 | ||
245 | 227 | clip: true | ||
246 | 195 | anchors.fill: parent | 228 | anchors.fill: parent |
247 | 196 | model: sortedEpisodeModel | 229 | model: sortedEpisodeModel |
248 | 197 | 230 | ||
249 | @@ -201,7 +234,7 @@ | |||
250 | 201 | section.delegate: Rectangle { | 234 | section.delegate: Rectangle { |
251 | 202 | width: parent.width | 235 | width: parent.width |
252 | 203 | color: "Transparent" | 236 | color: "Transparent" |
254 | 204 | height: header.implicitHeight + units.gu(2) | 237 | height: header.text !== "" ? header.implicitHeight + units.gu(2) : units.gu(0) |
255 | 205 | Label { | 238 | Label { |
256 | 206 | id: header | 239 | id: header |
257 | 207 | anchors { | 240 | anchors { |
258 | @@ -222,6 +255,9 @@ | |||
259 | 222 | 255 | ||
260 | 223 | else if (section === "Older") | 256 | else if (section === "Older") |
261 | 224 | return i18n.tr("Older") | 257 | return i18n.tr("Older") |
262 | 258 | |||
263 | 259 | else | ||
264 | 260 | return "" | ||
265 | 225 | } | 261 | } |
266 | 226 | } | 262 | } |
267 | 227 | } | 263 | } |
268 | @@ -262,24 +298,36 @@ | |||
269 | 262 | db.transaction(function (tx) { | 298 | db.transaction(function (tx) { |
270 | 263 | tx.executeSql("UPDATE Episode SET downloadedfile = NULL WHERE guid = ?", [model.guid]); | 299 | tx.executeSql("UPDATE Episode SET downloadedfile = NULL WHERE guid = ?", [model.guid]); |
271 | 264 | }); | 300 | }); |
273 | 265 | whatsNewModel.setProperty(model.index, "downloadedfile", "") | 301 | episodesModel.setProperty(model.index, "downloadedfile", "") |
274 | 302 | if (episodesPage.head.sections.selectedIndex === 1) { | ||
275 | 303 | episodesModel.remove(model.index, 1) | ||
276 | 304 | } | ||
277 | 266 | } else { | 305 | } else { |
278 | 267 | db.transaction(function (tx) { | 306 | db.transaction(function (tx) { |
279 | 268 | tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [model.guid]); | 307 | tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [model.guid]); |
280 | 269 | }); | 308 | }); |
282 | 270 | whatsNewModel.setProperty(model.index, "queued", 1) | 309 | episodesModel.setProperty(model.index, "queued", 1) |
283 | 271 | downloader.addDownload(model.guid, model.audiourl); | 310 | downloader.addDownload(model.guid, model.audiourl); |
284 | 272 | } | 311 | } |
285 | 273 | } | 312 | } |
286 | 274 | }, | 313 | }, |
287 | 275 | 314 | ||
288 | 276 | Action { | 315 | Action { |
290 | 277 | iconName: "select" | 316 | iconName: model.listened ? "view-collapse" : "select" |
291 | 278 | onTriggered: { | 317 | onTriggered: { |
292 | 279 | var db = Podcasts.init(); | 318 | var db = Podcasts.init(); |
293 | 280 | db.transaction(function (tx) { | 319 | db.transaction(function (tx) { |
296 | 281 | tx.executeSql("UPDATE Episode SET listened=1 WHERE guid=?", [model.guid]) | 320 | if (model.listened) { |
297 | 282 | whatsNewModel.remove(model.index, 1) | 321 | tx.executeSql("UPDATE Episode SET listened=0 WHERE guid=?", [model.guid]) |
298 | 322 | episodesModel.setProperty(model.index, "listened", 0) | ||
299 | 323 | } | ||
300 | 324 | else { | ||
301 | 325 | tx.executeSql("UPDATE Episode SET listened=1 WHERE guid=?", [model.guid]) | ||
302 | 326 | episodesModel.setProperty(model.index, "listened", 1) | ||
303 | 327 | if (episodesPage.head.sections.selectedIndex === 0) { | ||
304 | 328 | episodesModel.remove(model.index, 1) | ||
305 | 329 | } | ||
306 | 330 | } | ||
307 | 283 | }); | 331 | }); |
308 | 284 | } | 332 | } |
309 | 285 | }, | 333 | }, |
310 | @@ -331,44 +379,70 @@ | |||
311 | 331 | } | 379 | } |
312 | 332 | 380 | ||
313 | 333 | function refreshModel() { | 381 | function refreshModel() { |
323 | 334 | var today = new Date() | 382 | var i, j, episode |
315 | 335 | var dayToMs = 86400000; //1 * 24 * 60 * 60 * 1000 | ||
316 | 336 | var i, j, episode, diff | ||
317 | 337 | var todayCount, yesterdayCount | ||
318 | 338 | |||
319 | 339 | whatsNewModel.clear() | ||
320 | 340 | todayCount = 0 | ||
321 | 341 | yesterdayCount = 0 | ||
322 | 342 | |||
324 | 343 | var db = Podcasts.init() | 383 | var db = Podcasts.init() |
353 | 344 | db.transaction(function (tx) { | 384 | |
354 | 345 | var rs = tx.executeSql("SELECT rowid, * FROM Podcast ORDER BY name ASC"); | 385 | episodesModel.clear() |
355 | 346 | for (i=0; i < rs.rows.length; i++) { | 386 | |
356 | 347 | var podcast = rs.rows.item(i); | 387 | // Episode Model for the what's new view |
357 | 348 | var rs2 = tx.executeSql("SELECT rowid, * FROM Episode WHERE podcast=? ORDER BY published DESC", [rs.rows.item(i).rowid]); | 388 | if (episodesPage.head.sections.selectedIndex === 0) { |
358 | 349 | for (j=0; j < rs2.rows.length; j++) { | 389 | var today = new Date() |
359 | 350 | episode = rs2.rows.item(j) | 390 | var dayToMs = 86400000; //1 * 24 * 60 * 60 * 1000 |
360 | 351 | diff = Math.floor((today - episode.published)/dayToMs) | 391 | var todayCount, yesterdayCount, diff |
361 | 352 | if (diff < 7 && !episode.listened) { | 392 | |
362 | 353 | if (diff < 1) { | 393 | todayCount = 0 |
363 | 354 | whatsNewModel.insert(todayCount, {"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Today"}) | 394 | yesterdayCount = 0 |
364 | 355 | todayCount++; | 395 | |
365 | 356 | } else if (diff < 2) { | 396 | db.transaction(function (tx) { |
366 | 357 | whatsNewModel.insert(todayCount + yesterdayCount, {"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Yesterday"}) | 397 | var rs = tx.executeSql("SELECT rowid, * FROM Podcast ORDER BY name ASC"); |
367 | 358 | yesterdayCount++; | 398 | for (i=0; i < rs.rows.length; i++) { |
368 | 359 | } else { | 399 | var podcast = rs.rows.item(i); |
369 | 360 | whatsNewModel.append({"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Older"}) | 400 | var rs2 = tx.executeSql("SELECT rowid, * FROM Episode WHERE podcast=? ORDER BY published DESC", [rs.rows.item(i).rowid]); |
370 | 361 | } | 401 | for (j=0; j < rs2.rows.length; j++) { |
371 | 362 | } else if (diff >= 7){ | 402 | episode = rs2.rows.item(j) |
372 | 363 | break | 403 | diff = Math.floor((today - episode.published)/dayToMs) |
373 | 364 | } | 404 | if (diff < 7 && !episode.listened) { |
374 | 365 | } | 405 | if (diff < 1) { |
375 | 366 | 406 | episodesModel.insert(todayCount, {"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Today"}) | |
376 | 367 | if (podcast.lastupdate === null && !episodesUpdating) { | 407 | todayCount++; |
377 | 368 | updateEpisodesDatabase(); | 408 | } else if (diff < 2) { |
378 | 369 | } | 409 | episodesModel.insert(todayCount + yesterdayCount, {"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Yesterday"}) |
379 | 370 | } | 410 | yesterdayCount++; |
380 | 371 | }); | 411 | } else { |
381 | 412 | episodesModel.append({"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Older"}) | ||
382 | 413 | } | ||
383 | 414 | } else if (diff >= 7){ | ||
384 | 415 | break | ||
385 | 416 | } | ||
386 | 417 | } | ||
387 | 418 | |||
388 | 419 | if (podcast.lastupdate === null && !episodesUpdating) { | ||
389 | 420 | updateEpisodesDatabase(); | ||
390 | 421 | } | ||
391 | 422 | } | ||
392 | 423 | }); | ||
393 | 424 | } | ||
394 | 425 | |||
395 | 426 | // Episode Model for the downloaded view | ||
396 | 427 | else if (episodesPage.head.sections.selectedIndex === 1) { | ||
397 | 428 | db.transaction(function (tx) { | ||
398 | 429 | var rs = tx.executeSql("SELECT rowid, * FROM Podcast ORDER BY name ASC"); | ||
399 | 430 | for (i=0; i < rs.rows.length; i++) { | ||
400 | 431 | var podcast = rs.rows.item(i); | ||
401 | 432 | var rs2 = tx.executeSql("SELECT rowid, * FROM Episode WHERE podcast=? ORDER BY published DESC", [rs.rows.item(i).rowid]); | ||
402 | 433 | for (j=0; j < rs2.rows.length; j++) { | ||
403 | 434 | episode = rs2.rows.item(j) | ||
404 | 435 | if (episode.downloadedfile) { | ||
405 | 436 | episodesModel.append({"guid" : episode.guid, "listened" : episode.listened, "published": episode.published, "name" : episode.name, "description" : episode.description, "duration" : episode.duration, "position" : episode.position, "downloadedfile" : episode.downloadedfile, "image" : podcast.image, "artist" : podcast.artist, "audiourl" : episode.audiourl, "queued": episode.queued, "diff": "Null"}) | ||
406 | 437 | } | ||
407 | 438 | } | ||
408 | 439 | |||
409 | 440 | if (podcast.lastupdate === null && !episodesUpdating) { | ||
410 | 441 | updateEpisodesDatabase(); | ||
411 | 442 | } | ||
412 | 443 | } | ||
413 | 444 | }); | ||
414 | 445 | } | ||
415 | 372 | 446 | ||
416 | 373 | episodesUpdating = false; | 447 | episodesUpdating = false; |
417 | 374 | } | 448 | } |
418 | 375 | 449 | ||
419 | === modified file 'app/ui/PodcastsTab.qml' | |||
420 | --- app/ui/PodcastsTab.qml 2015-05-02 08:51:10 +0000 | |||
421 | +++ app/ui/PodcastsTab.qml 2015-05-13 11:43:12 +0000 | |||
422 | @@ -71,10 +71,10 @@ | |||
423 | 71 | }, | 71 | }, |
424 | 72 | 72 | ||
425 | 73 | Action { | 73 | Action { |
428 | 74 | iconName: podbird.settings.showListView ? "view-grid-symbolic" : "view-list-symbolic" | 74 | iconName: "add" |
429 | 75 | text: podbird.settings.showListView ? i18n.tr("Grid View") : i18n.tr("List View") | 75 | text: i18n.tr("Add New Podcasts") |
430 | 76 | onTriggered: { | 76 | onTriggered: { |
432 | 77 | podbird.settings.showListView = !podbird.settings.showListView | 77 | mainStack.push(Qt.resolvedUrl("SearchPage.qml")) |
433 | 78 | } | 78 | } |
434 | 79 | } | 79 | } |
435 | 80 | ] | 80 | ] |
436 | 81 | 81 | ||
437 | === modified file 'app/ui/SearchPage.qml' | |||
438 | --- app/ui/SearchPage.qml 2015-05-02 08:51:10 +0000 | |||
439 | +++ app/ui/SearchPage.qml 2015-05-13 11:43:12 +0000 | |||
440 | @@ -46,6 +46,8 @@ | |||
441 | 46 | } | 46 | } |
442 | 47 | } | 47 | } |
443 | 48 | 48 | ||
444 | 49 | title: i18n.tr("Add New Podcasts") | ||
445 | 50 | |||
446 | 49 | state: "default" | 51 | state: "default" |
447 | 50 | states: [ | 52 | states: [ |
448 | 51 | PageHeadState { | 53 | PageHeadState { |
449 | @@ -266,7 +268,7 @@ | |||
450 | 266 | } | 268 | } |
451 | 267 | }); | 269 | }); |
452 | 268 | } | 270 | } |
454 | 269 | tabs.selectedTabIndex = 1; | 271 | mainStack.pop(); |
455 | 270 | } | 272 | } |
456 | 271 | } | 273 | } |
457 | 272 | ] | 274 | ] |
458 | @@ -393,7 +395,7 @@ | |||
459 | 393 | Podcasts.subscribe(artist, name, feed, image); | 395 | Podcasts.subscribe(artist, name, feed, image); |
460 | 394 | imageDownloader.feed = feed; | 396 | imageDownloader.feed = feed; |
461 | 395 | imageDownloader.download(image); | 397 | imageDownloader.download(image); |
463 | 396 | tabs.selectedTabIndex = 1; | 398 | mainStack.pop() |
464 | 397 | } else { | 399 | } else { |
465 | 398 | PopupUtils.open(subscribeFailedDialog); | 400 | PopupUtils.open(subscribeFailedDialog); |
466 | 399 | searchPage.state = "add" | 401 | searchPage.state = "add" |
467 | 400 | 402 | ||
468 | === modified file 'app/ui/SettingsPage.qml' | |||
469 | --- app/ui/SettingsPage.qml 2015-05-12 21:35:11 +0000 | |||
470 | +++ app/ui/SettingsPage.qml 2015-05-13 11:43:12 +0000 | |||
471 | @@ -105,11 +105,31 @@ | |||
472 | 105 | right: parent.right | 105 | right: parent.right |
473 | 106 | } | 106 | } |
474 | 107 | 107 | ||
480 | 108 | // HeaderListItem { | 108 | HeaderListItem { |
481 | 109 | // // TRANSLATORS: Shortened form of "Miscellaneous" which is shown to denote other setting options | 109 | // TRANSLATORS: Shortened form of "Miscellaneous" which is shown to denote other setting options |
482 | 110 | // // that doesn't fit into any other category. | 110 | // that doesn't fit into any other category. |
483 | 111 | // title: i18n.tr("General Settings") | 111 | title: i18n.tr("General Settings") |
484 | 112 | // } | 112 | } |
485 | 113 | |||
486 | 114 | ListItem { | ||
487 | 115 | height: control.implicitHeight + units.gu(2) | ||
488 | 116 | divider.visible: false | ||
489 | 117 | |||
490 | 118 | Label { | ||
491 | 119 | id: contentLabel2 | ||
492 | 120 | anchors { left: parent.left; leftMargin: units.gu(2); right: control2.left; rightMargin: units.gu(1); verticalCenter: parent.verticalCenter } | ||
493 | 121 | text: i18n.tr("Displays podcasts in a list view") | ||
494 | 122 | } | ||
495 | 123 | |||
496 | 124 | Switch { | ||
497 | 125 | id: control2 | ||
498 | 126 | anchors { right: parent.right; rightMargin: units.gu(2); verticalCenter: parent.verticalCenter } | ||
499 | 127 | checked: podbird.settings.showListView | ||
500 | 128 | onClicked: podbird.settings.showListView = checked | ||
501 | 129 | } | ||
502 | 130 | |||
503 | 131 | onClicked: podbird.settings.showListView = !podbird.settings.showListView | ||
504 | 132 | } | ||
505 | 113 | 133 | ||
506 | 114 | // ListItems.SingleValue { | 134 | // ListItems.SingleValue { |
507 | 115 | // progression: true | 135 | // progression: true |