Merge lp:~nik90/podbird/14-generic-listitem into lp:podbird
- 14-generic-listitem
- Merge into trunk
Proposed by
Nekhelesh Ramananthan
Status: | Merged |
---|---|
Approved by: | Michael Sheldon |
Approved revision: | 89 |
Merged at revision: | 90 |
Proposed branch: | lp:~nik90/podbird/14-generic-listitem |
Merge into: | lp:podbird |
Prerequisite: | lp:~nik90/podbird/13-statesaver |
Diff against target: |
919 lines (+317/-402) 8 files modified
app/components/CustomProgressBar.qml (+0/-1) app/components/ListDelegate.qml (+181/-0) app/components/Walkthrough.qml (+0/-1) app/ui/EpisodesPage.qml (+27/-93) app/ui/PodcastsTab.qml (+5/-57) app/ui/SearchPage.qml (+45/-111) app/ui/WhatsNewTab.qml (+45/-126) po/com.mikeasoft.podbird.pot (+14/-13) |
To merge this branch: | bzr merge lp:~nik90/podbird/14-generic-listitem |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Sheldon | Approve | ||
Review via email: mp+257469@code.launchpad.net |
Commit message
Description of the change
Created a generic listdelegate that the whatsnew, episodes and podcasts page uses resulting in a lot of code reduction and some performance boost ;)
No regressions afaik.
To post a comment you must log in.
- 88. By Nekhelesh Ramananthan
-
Removed unnecessary clipping
- 89. By Nekhelesh Ramananthan
-
merged prerequisite lp:~nik90/podbird/13-statesaver
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'app/components/CustomProgressBar.qml' |
2 | --- app/components/CustomProgressBar.qml 2015-04-22 23:06:03 +0000 |
3 | +++ app/components/CustomProgressBar.qml 2015-06-13 16:56:28 +0000 |
4 | @@ -26,7 +26,6 @@ |
5 | property bool indeterminateProgress: false |
6 | |
7 | radius: width/3 |
8 | - height: units.dp(5) |
9 | color: Theme.palette.normal.base |
10 | |
11 | Rectangle { |
12 | |
13 | === added file 'app/components/ListDelegate.qml' |
14 | --- app/components/ListDelegate.qml 1970-01-01 00:00:00 +0000 |
15 | +++ app/components/ListDelegate.qml 2015-06-13 16:56:28 +0000 |
16 | @@ -0,0 +1,181 @@ |
17 | +/* |
18 | + * Copyright 2015 Podbird Team |
19 | + * |
20 | + * This file is part of Podbird. |
21 | + * |
22 | + * Podbird is free software; you can redistribute it and/or modify |
23 | + * it under the terms of the GNU General Public License as published by |
24 | + * the Free Software Foundation; version 3. |
25 | + * |
26 | + * Podbird is distributed in the hope that it will be useful, |
27 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29 | + * GNU General Public License for more details. |
30 | + * |
31 | + * You should have received a copy of the GNU General Public License |
32 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
33 | + */ |
34 | + |
35 | +import QtQuick 2.3 |
36 | +import QtQuick.Layouts 1.1 |
37 | +import Ubuntu.Components 1.1 |
38 | +import Ubuntu.Components.ListItems 1.0 as ListItem |
39 | + |
40 | +ListItem.Empty { |
41 | + id: listDelegate |
42 | + |
43 | + // Public APIs |
44 | + property bool expanded: false |
45 | + |
46 | + property string coverArt: "" |
47 | + |
48 | + property alias title: _title.text |
49 | + property alias titleColor: _title.color |
50 | + property alias subtitle: _subtitle.text |
51 | + |
52 | + property string description: "" |
53 | + |
54 | + property bool isDownloaded: false |
55 | + |
56 | + property bool showProgressBar: false |
57 | + property bool isInDeterminateDownload: false |
58 | + property real progress: 0 |
59 | + |
60 | + property alias actionButton: actionButtonsLoader |
61 | + |
62 | + highlightWhenPressed: false |
63 | + showDivider: false |
64 | + height: mainColumn.height + units.gu(2) |
65 | + |
66 | + Column { |
67 | + id: mainColumn |
68 | + |
69 | + anchors { left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter } |
70 | + |
71 | + RowLayout { |
72 | + id: mainRow |
73 | + |
74 | + width: parent.width |
75 | + |
76 | + Loader { |
77 | + id: imgFrameLoader |
78 | + visible: coverArt !== "" |
79 | + sourceComponent: coverArt !== "" ? imgFrame : undefined |
80 | + } |
81 | + |
82 | + Item { |
83 | + id: gapFiller1 |
84 | + height: width |
85 | + width: coverArt !== "" ? units.gu(2) : 0 |
86 | + } |
87 | + |
88 | + Column { |
89 | + id: detailColumn |
90 | + |
91 | + anchors.verticalCenter: parent.verticalCenter |
92 | + Layout.fillWidth: true |
93 | + |
94 | + Label { |
95 | + id: _title |
96 | + textFormat: Text.PlainText |
97 | + width: parent.width |
98 | + maximumLineCount: 2 |
99 | + wrapMode: Text.WordWrap |
100 | + elide: Text.ElideRight |
101 | + color: podbird.appTheme.baseText |
102 | + } |
103 | + |
104 | + Row { |
105 | + height: _subtitle.height |
106 | + width: parent.width |
107 | + spacing: units.gu(1) |
108 | + |
109 | + Loader { |
110 | + id: downloadIconLoader |
111 | + height: _subtitle.height |
112 | + width: height |
113 | + visible: isDownloaded |
114 | + sourceComponent: downloadIcon |
115 | + } |
116 | + |
117 | + Label { |
118 | + id: _subtitle |
119 | + width: parent.width |
120 | + fontSize: "x-small" |
121 | + elide: Text.ElideRight |
122 | + color: podbird.appTheme.baseSubText |
123 | + } |
124 | + } |
125 | + } |
126 | + |
127 | + Loader { |
128 | + id: actionButtonsLoader |
129 | + } |
130 | + } |
131 | + |
132 | + Item { |
133 | + id: gapFiller2 |
134 | + height: showProgressBar || expanded ? units.gu(1) : 0 |
135 | + width: height |
136 | + } |
137 | + |
138 | + Loader { |
139 | + id: progressBarLoader |
140 | + width: parent.width |
141 | + height: showProgressBar ? units.dp(5) : 0 |
142 | + visible: sourceComponent !== undefined |
143 | + sourceComponent: showProgressBar ? progressBar : undefined |
144 | + } |
145 | + |
146 | + Loader { |
147 | + id: descriptionLoader |
148 | + width: parent.width |
149 | + height: expanded && loaded ? item.contentHeight : 0 |
150 | + visible: sourceComponent !== undefined |
151 | + sourceComponent: expanded ? _description : undefined |
152 | + Behavior on height { |
153 | + UbuntuNumberAnimation { |
154 | + duration: UbuntuAnimation.BriskDuration |
155 | + } |
156 | + } |
157 | + } |
158 | + } |
159 | + |
160 | + Component { |
161 | + id: imgFrame |
162 | + Image { |
163 | + height: width |
164 | + width: units.gu(6) |
165 | + source: coverArt |
166 | + sourceSize { width: width; height: height } |
167 | + } |
168 | + } |
169 | + |
170 | + Component { |
171 | + id: progressBar |
172 | + CustomProgressBar { |
173 | + indeterminateProgress: isInDeterminateDownload |
174 | + progress: listDelegate.progress |
175 | + } |
176 | + } |
177 | + |
178 | + Component { |
179 | + id: downloadIcon |
180 | + Icon { |
181 | + name: "attachment" |
182 | + } |
183 | + } |
184 | + |
185 | + Component { |
186 | + id: _description |
187 | + Label { |
188 | + clip: true |
189 | + text: description |
190 | + wrapMode: Text.WordWrap |
191 | + fontSize: "small" |
192 | + color: podbird.appTheme.baseSubText |
193 | + linkColor: podbird.appTheme.linkText |
194 | + onLinkActivated: Qt.openUrlExternally(link) |
195 | + } |
196 | + } |
197 | +} |
198 | |
199 | === modified file 'app/components/Walkthrough.qml' |
200 | --- app/components/Walkthrough.qml 2015-06-13 16:56:28 +0000 |
201 | +++ app/components/Walkthrough.qml 2015-06-13 16:56:28 +0000 |
202 | @@ -68,7 +68,6 @@ |
203 | delegate: Item { |
204 | width: listView.width |
205 | height: listView.height |
206 | - clip: true |
207 | |
208 | Loader { |
209 | anchors { |
210 | |
211 | === modified file 'app/ui/EpisodesPage.qml' |
212 | --- app/ui/EpisodesPage.qml 2015-04-22 23:07:23 +0000 |
213 | +++ app/ui/EpisodesPage.qml 2015-06-13 16:56:28 +0000 |
214 | @@ -440,79 +440,32 @@ |
215 | height: units.gu(8) |
216 | } |
217 | |
218 | - delegate: ListItem.Empty { |
219 | + delegate: ListDelegate { |
220 | id: listItem |
221 | |
222 | - property bool expanded |
223 | - |
224 | - height: dataColumn.height + units.gu(2) |
225 | - highlightWhenPressed: false |
226 | - showDivider: false |
227 | + title: model.name.trim() |
228 | + titleColor: listItem.expanded || currentGuid === model.guid || downloader.downloadingGuid === model.guid ? podbird.appTheme.focusText |
229 | + : podbird.appTheme.baseText |
230 | + |
231 | + subtitle: model.duration === 0 || model.duration === undefined ? Qt.formatDate(new Date(model.published), "MMM d, yyyy") : Podcasts.formatEpisodeTime(model.duration) + " | " + Qt.formatDate(new Date(model.published), "MMM d, yyyy") |
232 | + |
233 | + isDownloaded: model.downloadedfile ? true : false |
234 | + |
235 | + showProgressBar: downloader.downloadingGuid === model.guid |
236 | + isInDeterminateDownload: downloader.progress < 0 || downloader.progress > 100 && downloader.downloadingGuid === model.guid |
237 | + progress: downloader.progress |
238 | + |
239 | + description: model.description |
240 | + |
241 | + actionButton.sourceComponent: actionButtonComponent |
242 | |
243 | onClicked: { |
244 | expanded = !expanded; |
245 | } |
246 | |
247 | - Rectangle { |
248 | - visible: !model.listened |
249 | - width: parent.width |
250 | - height: dataColumn.height + units.gu(2) |
251 | - color: podbird.appTheme.hightlightListView |
252 | - } |
253 | - |
254 | - Column { |
255 | - id: dataColumn |
256 | - |
257 | - spacing: units.gu(1) |
258 | - anchors.left: parent.left |
259 | - anchors.right: parent.right |
260 | - anchors.margins: units.gu(2) |
261 | - anchors.top: parent.top |
262 | - anchors.topMargin: units.gu(0.5) |
263 | - |
264 | - RowLayout { |
265 | - id: rowlayout |
266 | - |
267 | - width: parent.width |
268 | - height: titleColumn.height |
269 | - |
270 | - Column { |
271 | - id: titleColumn |
272 | - Layout.fillWidth: true |
273 | - |
274 | - Label { |
275 | - text: model.name.trim() |
276 | - width: parent.width |
277 | - maximumLineCount: 2 |
278 | - wrapMode: Text.WordWrap |
279 | - elide: Text.ElideRight |
280 | - color: listItem.expanded || currentGuid === model.guid || downloader.downloadingGuid === model.guid ? podbird.appTheme.focusText |
281 | - : podbird.appTheme.baseText |
282 | - } |
283 | - |
284 | - Row { |
285 | - height:episodePublishDate.height |
286 | - width:parent.width |
287 | - spacing:units.gu(1) |
288 | - |
289 | - Icon{ |
290 | - height:episodePublishDate.height |
291 | - width:height |
292 | - name:"attachment" |
293 | - visible: model.downloadedfile ? true : false |
294 | - } |
295 | - |
296 | - Label { |
297 | - id: episodePublishDate |
298 | - width: parent.width |
299 | - text: model.duration === 0 || model.duration === undefined ? Qt.formatDate(new Date(model.published), "MMM d, yyyy") : Podcasts.formatEpisodeTime(model.duration) + " | " + Qt.formatDate(new Date(model.published), "MMM d, yyyy") |
300 | - fontSize: "x-small" |
301 | - elide: Text.ElideRight |
302 | - color: podbird.appTheme.baseSubText |
303 | - } |
304 | - } |
305 | - } |
306 | - |
307 | + Component { |
308 | + id: actionButtonComponent |
309 | + Row { |
310 | ActionButton { |
311 | id: contextualMenu |
312 | |
313 | @@ -520,7 +473,7 @@ |
314 | height: units.gu(4) |
315 | |
316 | iconName: "contextual-menu" |
317 | - color: progressBar.visible || listItem.expanded ? podbird.appTheme.focusText |
318 | + color: showProgressBar || expanded ? podbird.appTheme.focusText |
319 | : podbird.appTheme.baseIcon |
320 | onClicked: { |
321 | var popover = PopupUtils.open(popoverComponent, contextualMenu) |
322 | @@ -566,32 +519,13 @@ |
323 | } |
324 | } |
325 | } |
326 | - |
327 | - CustomProgressBar { |
328 | - id: progressBar |
329 | - width: parent.width |
330 | - visible: downloader.downloadingGuid === model.guid |
331 | - indeterminateProgress: downloader.progress < 0 || downloader.progress > 100 && downloader.downloadingGuid === model.guid |
332 | - progress: downloader.progress |
333 | - } |
334 | - |
335 | - Label { |
336 | - id: desc |
337 | - text: model.description |
338 | - clip: true |
339 | - height: listItem.expanded ? contentHeight : 0 |
340 | - wrapMode: Text.WordWrap |
341 | - width: parent.width |
342 | - fontSize: "small" |
343 | - linkColor: podbird.appTheme.linkText |
344 | - color: podbird.appTheme.baseSubText |
345 | - onLinkActivated: Qt.openUrlExternally(link) |
346 | - Behavior on height { |
347 | - UbuntuNumberAnimation { |
348 | - duration: UbuntuAnimation.BriskDuration |
349 | - } |
350 | - } |
351 | - } |
352 | + } |
353 | + |
354 | + Rectangle { |
355 | + visible: !model.listened |
356 | + anchors.fill: parent |
357 | + color: podbird.appTheme.hightlightListView |
358 | + z: -1 |
359 | } |
360 | } |
361 | |
362 | |
363 | === modified file 'app/ui/PodcastsTab.qml' |
364 | --- app/ui/PodcastsTab.qml 2015-04-22 23:06:03 +0000 |
365 | +++ app/ui/PodcastsTab.qml 2015-06-13 16:56:28 +0000 |
366 | @@ -193,16 +193,15 @@ |
367 | height: units.gu(8) |
368 | } |
369 | |
370 | - delegate: ListItem.Empty { |
371 | + delegate: ListDelegate { |
372 | id: listItem |
373 | |
374 | - property bool expanded: false |
375 | - |
376 | height: units.gu(8) |
377 | removable: true |
378 | confirmRemoval: true |
379 | - showDivider: false |
380 | - highlightWhenPressed: false |
381 | + title: model.name.trim() |
382 | + subtitle: i18n.tr("%1 unheard episode", "%1 unheard episodes", model.episodeCount).arg(model.episodeCount) |
383 | + coverArt: model.image |
384 | |
385 | onItemRemoved: { |
386 | var db = Podcasts.init(); |
387 | @@ -220,6 +219,7 @@ |
388 | Rectangle { |
389 | anchors.fill: parent |
390 | opacity: 0.3 |
391 | + z: -1 |
392 | color: index % 2 === 0 ? podbird.appTheme.hightlightListView : "Transparent" |
393 | } |
394 | |
395 | @@ -231,58 +231,6 @@ |
396 | } |
397 | mainStack.push(Qt.resolvedUrl("EpisodesPage.qml"), {"episodeName": model.name, "episodeId": model.id, "episodeArtist": model.artist, "episodeImage": model.image}) |
398 | } |
399 | - |
400 | - Column { |
401 | - id: mainColumn |
402 | - |
403 | - anchors.left: parent.left |
404 | - anchors.right: parent.right |
405 | - anchors.margins: units.gu(2) |
406 | - anchors.verticalCenter: parent.verticalCenter |
407 | - spacing: units.gu(1) |
408 | - |
409 | - RowLayout { |
410 | - id: titleRow |
411 | - |
412 | - width: parent.width |
413 | - spacing: units.gu(2) |
414 | - |
415 | - Image { |
416 | - id: imgFrame |
417 | - width: units.gu(6) |
418 | - height: width |
419 | - sourceSize.height: width |
420 | - sourceSize.width: width |
421 | - source: model.image |
422 | - } |
423 | - |
424 | - Column { |
425 | - id: detailColumn |
426 | - |
427 | - anchors.verticalCenter: imgFrame.verticalCenter |
428 | - Layout.fillWidth: true |
429 | - |
430 | - Label { |
431 | - id: podcastTitle |
432 | - textFormat: Text.PlainText |
433 | - text: model.name.trim() |
434 | - width: parent.width |
435 | - fontSize: "small" |
436 | - elide: Text.ElideRight |
437 | - color: podbird.appTheme.baseText |
438 | - } |
439 | - |
440 | - Label { |
441 | - id: episodeCount |
442 | - width: parent.width |
443 | - fontSize: "x-small" |
444 | - color: podbird.appTheme.baseSubText |
445 | - visible: model.episodeCount > 0 |
446 | - text: i18n.tr("%1 unheard episode", "%1 unheard episodes", model.episodeCount).arg(model.episodeCount) |
447 | - } |
448 | - } |
449 | - } |
450 | - } |
451 | } |
452 | |
453 | // #FIXME: Use SDK Scrollbar when it is themeable |
454 | |
455 | === modified file 'app/ui/SearchPage.qml' |
456 | --- app/ui/SearchPage.qml 2015-04-23 23:45:18 +0000 |
457 | +++ app/ui/SearchPage.qml 2015-06-13 16:56:28 +0000 |
458 | @@ -187,129 +187,64 @@ |
459 | height: units.gu(7) |
460 | } |
461 | |
462 | - delegate: ListItem.Empty { |
463 | + delegate: ListDelegate { |
464 | id: listItem |
465 | |
466 | - property bool expanded: false |
467 | property bool fetchedDescription: false |
468 | |
469 | - height: dataColumn.height + units.gu(2) |
470 | - showDivider: false |
471 | - highlightWhenPressed: false |
472 | + title: model.name |
473 | + subtitle: model.artist |
474 | + coverArt: model.image |
475 | + |
476 | + // TRANSLATORS: The first argument here is the date of when the podcast was last updated followed by |
477 | + // the podcast description. |
478 | + description: i18n.tr("Last Updated: %1\n%2").arg(model.releaseDate.split("T")[0]).arg(model.description) |
479 | + |
480 | + actionButton.sourceComponent: actionButtonComponent |
481 | + |
482 | + Rectangle { |
483 | + z: -1 |
484 | + anchors.fill: parent |
485 | + opacity: 0.3 |
486 | + color: index % 2 === 0 ? podbird.appTheme.hightlightListView : "Transparent" |
487 | + } |
488 | |
489 | onClicked: { |
490 | - expanded = !expanded; |
491 | + expanded = !expanded |
492 | if (expanded && !fetchedDescription) { |
493 | getPodcastDescription(model.feed, index) |
494 | fetchedDescription = true |
495 | } |
496 | } |
497 | |
498 | - Rectangle { |
499 | - anchors.fill: parent |
500 | - opacity: 0.3 |
501 | - color: index % 2 === 0 ? podbird.appTheme.hightlightListView : "Transparent" |
502 | - } |
503 | - |
504 | - Column { |
505 | - id: dataColumn |
506 | - |
507 | - spacing: units.gu(1) |
508 | - anchors.left: parent.left |
509 | - anchors.right: parent.right |
510 | - anchors.margins: units.gu(2) |
511 | - anchors.top: parent.top |
512 | - anchors.topMargin: units.gu(1) |
513 | - |
514 | - RowLayout { |
515 | - id: titleRow |
516 | - |
517 | - width: parent.width |
518 | - height: imgFrame.height |
519 | - |
520 | - spacing: units.gu(2) |
521 | - |
522 | - Image { |
523 | - id: imgFrame |
524 | - width: units.gu(6) |
525 | - height: width |
526 | - sourceSize.height: width |
527 | - sourceSize.width: width |
528 | - source: model.image |
529 | - } |
530 | - |
531 | - Column { |
532 | - id: detailColumn |
533 | - |
534 | - anchors.verticalCenter: imgFrame.verticalCenter |
535 | - Layout.fillWidth: true |
536 | - |
537 | - Label { |
538 | - id: podcastTitle |
539 | - textFormat: Text.PlainText |
540 | - text: model.name |
541 | - width: parent.width |
542 | - fontSize: "medium" |
543 | - elide: Text.ElideRight |
544 | - } |
545 | - |
546 | - Label { |
547 | - id: episodeCount |
548 | - width: parent.width |
549 | - color: "#999999" |
550 | - text: model.artist |
551 | - fontSize: "x-small" |
552 | - elide: Text.ElideRight |
553 | - } |
554 | - } |
555 | - |
556 | - Button { |
557 | - anchors.right: parent.right |
558 | - text: !model.subscribed ? i18n.tr("Subscribe") : i18n.tr("Unsubscribe") |
559 | - color: !model.subscribed ? UbuntuColors.green : UbuntuColors.red |
560 | - onClicked: { |
561 | - if (!model.subscribed) { |
562 | - Podcasts.subscribe(model.artist, model.name, model.feed, model.image); |
563 | - imageDownloader.feed = model.feed; |
564 | - imageDownloader.download(model.image); |
565 | - } else { |
566 | - var db = Podcasts.init(); |
567 | - db.transaction(function (tx) { |
568 | - var rs = tx.executeSql("SELECT rowid FROM Podcast WHERE feed = ?", model.feed); |
569 | - if (rs.rows.length !== 0) { |
570 | - var podcast = rs.rows.item(0) |
571 | - var rs2 = tx.executeSql("SELECT downloadedfile FROM Episode WHERE downloadedfile NOT NULL AND podcast=?", [podcast.rowid]); |
572 | - for(var i = 0; i < rs2.rows.length; i++) { |
573 | - fileManager.deleteFile(rs2.rows.item(i).downloadedfile); |
574 | - } |
575 | - tx.executeSql("DELETE FROM Episode WHERE podcast=?", [podcast.rowid]); |
576 | - tx.executeSql("DELETE FROM Podcast WHERE rowid=?", [podcast.rowid]); |
577 | + Component { |
578 | + id: actionButtonComponent |
579 | + Button { |
580 | + //anchors.right: parent.right |
581 | + text: !model.subscribed ? i18n.tr("Subscribe") : i18n.tr("Unsubscribe") |
582 | + color: !model.subscribed ? UbuntuColors.green : UbuntuColors.red |
583 | + onClicked: { |
584 | + if (!model.subscribed) { |
585 | + Podcasts.subscribe(model.artist, model.name, model.feed, model.image); |
586 | + imageDownloader.feed = model.feed; |
587 | + imageDownloader.download(model.image); |
588 | + } else { |
589 | + var db = Podcasts.init(); |
590 | + db.transaction(function (tx) { |
591 | + var rs = tx.executeSql("SELECT rowid FROM Podcast WHERE feed = ?", model.feed); |
592 | + if (rs.rows.length !== 0) { |
593 | + var podcast = rs.rows.item(0) |
594 | + var rs2 = tx.executeSql("SELECT downloadedfile FROM Episode WHERE downloadedfile NOT NULL AND podcast=?", [podcast.rowid]); |
595 | + for(var i = 0; i < rs2.rows.length; i++) { |
596 | + fileManager.deleteFile(rs2.rows.item(i).downloadedfile); |
597 | } |
598 | - }); |
599 | - } |
600 | - tabs.selectedTabIndex = 1; |
601 | - searchField.text = "" |
602 | - } |
603 | - } |
604 | - } |
605 | - |
606 | - Label { |
607 | - id: desc |
608 | - clip: true |
609 | - // TRANSLATORS: The first argument here is the date of when the podcast was last updated followed by |
610 | - // the podcast description. |
611 | - text: i18n.tr("Last Updated: %1\n%2").arg(model.releaseDate.split("T")[0]).arg(model.description) |
612 | - height: listItem.expanded ? contentHeight : 0 |
613 | - wrapMode: Text.WordWrap |
614 | - width: parent.width |
615 | - fontSize: "small" |
616 | - color: podbird.appTheme.baseSubText |
617 | - linkColor: podbird.appTheme.linkText |
618 | - onLinkActivated: Qt.openUrlExternally(link) |
619 | - Behavior on height { |
620 | - UbuntuNumberAnimation { |
621 | - duration: UbuntuAnimation.BriskDuration |
622 | - } |
623 | + tx.executeSql("DELETE FROM Episode WHERE podcast=?", [podcast.rowid]); |
624 | + tx.executeSql("DELETE FROM Podcast WHERE rowid=?", [podcast.rowid]); |
625 | + } |
626 | + }); |
627 | + } |
628 | + tabs.selectedTabIndex = 1; |
629 | + searchField.text = "" |
630 | } |
631 | } |
632 | } |
633 | @@ -375,7 +310,6 @@ |
634 | if (c.childNodes[j].nodeName === "description") { |
635 | description = c.childNodes[j].childNodes[0].nodeValue |
636 | if (description != undefined) { |
637 | - console.log(description) |
638 | searchResults.setProperty(index, "description", description) |
639 | return |
640 | } |
641 | |
642 | === modified file 'app/ui/WhatsNewTab.qml' |
643 | --- app/ui/WhatsNewTab.qml 2015-04-22 23:06:03 +0000 |
644 | +++ app/ui/WhatsNewTab.qml 2015-06-13 16:56:28 +0000 |
645 | @@ -347,7 +347,6 @@ |
646 | anchors.fill: parent |
647 | model: sortedEpisodeModel |
648 | |
649 | - clip: true |
650 | section.property: "diff" |
651 | section.labelPositioning: ViewSection.InlineLabels |
652 | |
653 | @@ -384,135 +383,55 @@ |
654 | height: units.gu(8) |
655 | } |
656 | |
657 | - delegate: ListItem.Empty { |
658 | + delegate: ListDelegate { |
659 | id: listItem |
660 | |
661 | - property bool expanded |
662 | - |
663 | - height: dataColumn.height + units.gu(2) |
664 | - highlightWhenPressed: false |
665 | - showDivider: false |
666 | + coverArt: model.image |
667 | + |
668 | + title: model.name.trim() |
669 | + titleColor: expanded || currentGuid === model.guid || downloader.downloadingGuid === model.guid ? podbird.appTheme.focusText |
670 | + : podbird.appTheme.baseText |
671 | + |
672 | + subtitle: model.duration === 0 || model.duration === undefined ? model.artist |
673 | + : Podcasts.formatEpisodeTime(model.duration) + " | " + model.artist |
674 | + |
675 | + description: model.description |
676 | + |
677 | + isDownloaded: model.downloadedfile ? true : false |
678 | + |
679 | + showProgressBar: downloader.downloadingGuid === model.guid |
680 | + isInDeterminateDownload: downloader.progress < 0 || downloader.progress > 100 && downloader.downloadingGuid === model.guid |
681 | + progress: downloader.progress |
682 | + |
683 | + actionButton.sourceComponent: contextualMenuComponent |
684 | + |
685 | + Component { |
686 | + id: contextualMenuComponent |
687 | + ActionButton { |
688 | + id: contextualMenu |
689 | + |
690 | + width: units.gu(5) |
691 | + height: units.gu(4) |
692 | + |
693 | + iconName: "contextual-menu" |
694 | + color: showProgressBar || listItem.expanded ? podbird.appTheme.focusText |
695 | + : podbird.appTheme.baseIcon |
696 | + onClicked: { |
697 | + var popover = PopupUtils.open(popoverComponent, contextualMenu) |
698 | + popover.queued = Qt.binding(function() { return whatsNewModel.get(index).queued }) |
699 | + popover.guid = Qt.binding(function() { return model.guid }) |
700 | + popover.audiourl = Qt.binding(function() { return model.audiourl }) |
701 | + popover.downloadedfile = Qt.binding(function() { return whatsNewModel.get(index).downloadedfile }) |
702 | + popover.index = Qt.binding(function() { return index }) |
703 | + popover.name = Qt.binding(function() { return model.name }) |
704 | + popover.artist = Qt.binding(function() { return model.artist }) |
705 | + popover.image = Qt.binding(function() { return model.image }) |
706 | + } |
707 | + } |
708 | + } |
709 | |
710 | onClicked: { |
711 | - expanded = !expanded; |
712 | - } |
713 | - |
714 | - Column { |
715 | - id: dataColumn |
716 | - |
717 | - spacing: units.gu(1) |
718 | - anchors.left: parent.left |
719 | - anchors.right: parent.right |
720 | - anchors.margins: units.gu(2) |
721 | - anchors.top: parent.top |
722 | - anchors.topMargin: units.gu(0.5) |
723 | - |
724 | - RowLayout { |
725 | - id: rowlayout |
726 | - |
727 | - width: parent.width |
728 | - height: imgFrame.height |
729 | - |
730 | - Image { |
731 | - id: imgFrame |
732 | - width: units.gu(6) |
733 | - height: width |
734 | - sourceSize.height: width |
735 | - sourceSize.width: width |
736 | - source: model.image |
737 | - } |
738 | - |
739 | - Item { |
740 | - width: units.gu(2) |
741 | - height: imgFrame.height |
742 | - } |
743 | - |
744 | - Column { |
745 | - id: titleColumn |
746 | - anchors.verticalCenter: imgFrame.verticalCenter |
747 | - Layout.fillWidth: true |
748 | - |
749 | - Label { |
750 | - text: model.name.trim() |
751 | - width: parent.width |
752 | - maximumLineCount: 2 |
753 | - wrapMode: Text.WordWrap |
754 | - elide: Text.ElideRight |
755 | - color: listItem.expanded || currentGuid === model.guid || downloader.downloadingGuid === model.guid ? podbird.appTheme.focusText |
756 | - : podbird.appTheme.baseText |
757 | - } |
758 | - |
759 | - Row { |
760 | - height:episodePublishDate.height |
761 | - width:parent.width |
762 | - spacing:units.gu(1) |
763 | - |
764 | - Icon{ |
765 | - height:episodePublishDate.height |
766 | - width:height |
767 | - name:"attachment" |
768 | - visible: model.downloadedfile ? true : false |
769 | - } |
770 | - |
771 | - Label { |
772 | - id: episodePublishDate |
773 | - width: parent.width |
774 | - text: model.duration === 0 || model.duration === undefined ? model.artist : Podcasts.formatEpisodeTime(model.duration) + " | " + model.artist |
775 | - fontSize: "x-small" |
776 | - elide: Text.ElideRight |
777 | - color: podbird.appTheme.baseSubText |
778 | - } |
779 | - } |
780 | - } |
781 | - |
782 | - ActionButton { |
783 | - id: contextualMenu |
784 | - |
785 | - width: units.gu(5) |
786 | - height: units.gu(4) |
787 | - |
788 | - iconName: "contextual-menu" |
789 | - color: progressBar.visible || listItem.expanded ? podbird.appTheme.focusText |
790 | - : podbird.appTheme.baseIcon |
791 | - onClicked: { |
792 | - var popover = PopupUtils.open(popoverComponent, contextualMenu) |
793 | - popover.queued = Qt.binding(function() { return model.queued }) |
794 | - popover.guid = Qt.binding(function() { return model.guid }) |
795 | - popover.audiourl = Qt.binding(function() { return model.audiourl }) |
796 | - popover.downloadedfile = Qt.binding(function() { return whatsNewModel.get(index).downloadedfile }) |
797 | - popover.index = Qt.binding(function() { return index }) |
798 | - popover.name = Qt.binding(function() { return model.name }) |
799 | - popover.artist = Qt.binding(function() { return model.artist }) |
800 | - popover.image = Qt.binding(function() { return model.image }) |
801 | - } |
802 | - } |
803 | - } |
804 | - |
805 | - CustomProgressBar { |
806 | - id: progressBar |
807 | - width: parent.width |
808 | - visible: downloader.downloadingGuid === model.guid |
809 | - indeterminateProgress: downloader.progress < 0 || downloader.progress > 100 && downloader.downloadingGuid === model.guid |
810 | - progress: downloader.progress |
811 | - } |
812 | - |
813 | - Label { |
814 | - id: desc |
815 | - text: model.description |
816 | - clip: true |
817 | - height: listItem.expanded ? contentHeight : 0 |
818 | - wrapMode: Text.WordWrap |
819 | - width: parent.width |
820 | - fontSize: "small" |
821 | - color: podbird.appTheme.baseSubText |
822 | - linkColor: podbird.appTheme.linkText |
823 | - onLinkActivated: Qt.openUrlExternally(link) |
824 | - Behavior on height { |
825 | - UbuntuNumberAnimation { |
826 | - duration: UbuntuAnimation.BriskDuration |
827 | - } |
828 | - } |
829 | - } |
830 | + expanded = !expanded |
831 | } |
832 | } |
833 | |
834 | |
835 | === modified file 'po/com.mikeasoft.podbird.pot' |
836 | --- po/com.mikeasoft.podbird.pot 2015-06-13 16:56:28 +0000 |
837 | +++ po/com.mikeasoft.podbird.pot 2015-06-13 16:56:28 +0000 |
838 | @@ -8,7 +8,7 @@ |
839 | msgstr "" |
840 | "Project-Id-Version: \n" |
841 | "Report-Msgid-Bugs-To: \n" |
842 | -"POT-Creation-Date: 2015-04-28 23:26+0000\n" |
843 | +"POT-Creation-Date: 2015-04-29 01:02+0000\n" |
844 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
845 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
846 | "Language-Team: LANGUAGE <LL@li.org>\n" |
847 | @@ -168,7 +168,7 @@ |
848 | msgstr "" |
849 | |
850 | #: ../app/ui/EpisodesPage.qml:110 ../app/ui/EpisodesPage.qml:188 |
851 | -#: ../app/ui/SearchPage.qml:268 |
852 | +#: ../app/ui/SearchPage.qml:224 |
853 | msgid "Unsubscribe" |
854 | msgstr "" |
855 | |
856 | @@ -294,7 +294,7 @@ |
857 | msgid "No podcasts found matching the search term." |
858 | msgstr "" |
859 | |
860 | -#: ../app/ui/PodcastsTab.qml:160 ../app/ui/PodcastsTab.qml:281 |
861 | +#: ../app/ui/PodcastsTab.qml:160 ../app/ui/PodcastsTab.qml:203 |
862 | #, qt-format |
863 | msgid "%1 unheard episode" |
864 | msgid_plural "%1 unheard episodes" |
865 | @@ -338,20 +338,20 @@ |
866 | "Click the 'magnifier' at the top to search or the 'plus' button to add by URL" |
867 | msgstr "" |
868 | |
869 | -#: ../app/ui/SearchPage.qml:268 |
870 | -msgid "Subscribe" |
871 | -msgstr "" |
872 | - |
873 | #. TRANSLATORS: The first argument here is the date of when the podcast was last updated followed by |
874 | #. the podcast description. |
875 | -#: ../app/ui/SearchPage.qml:301 |
876 | +#: ../app/ui/SearchPage.qml:201 |
877 | #, qt-format |
878 | msgid "" |
879 | "Last Updated: %1\n" |
880 | "%2" |
881 | msgstr "" |
882 | |
883 | -#: ../app/ui/SearchPage.qml:356 |
884 | +#: ../app/ui/SearchPage.qml:224 |
885 | +msgid "Subscribe" |
886 | +msgstr "" |
887 | + |
888 | +#: ../app/ui/SearchPage.qml:291 |
889 | msgid "Not Available" |
890 | msgstr "" |
891 | |
892 | @@ -426,15 +426,15 @@ |
893 | msgid "Play Episode" |
894 | msgstr "" |
895 | |
896 | -#: ../app/ui/WhatsNewTab.qml:369 |
897 | +#: ../app/ui/WhatsNewTab.qml:368 |
898 | msgid "Today" |
899 | msgstr "" |
900 | |
901 | -#: ../app/ui/WhatsNewTab.qml:373 |
902 | +#: ../app/ui/WhatsNewTab.qml:372 |
903 | msgid "Yesterday" |
904 | msgstr "" |
905 | |
906 | -#: ../app/ui/WhatsNewTab.qml:377 |
907 | +#: ../app/ui/WhatsNewTab.qml:376 |
908 | msgid "Older" |
909 | msgstr "" |
910 | |
911 | @@ -512,6 +512,7 @@ |
912 | msgid "Finish" |
913 | msgstr "" |
914 | |
915 | -#: /home/krnekhelesh/Documents/Ubuntu-Projects/MP-Reviews/builddir/build-13-statesaver-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/Podbird.desktop.in.h:1 |
916 | +#: ../builddir/po/Podbird.desktop.in.h:1 |
917 | +#: /home/krnekhelesh/Documents/Ubuntu-Projects/MP-Reviews/builddir/build-14-generic-listitem-UbuntuSDK_for_armhf_GCC_ubuntu_sdk_15_04_vivid-Default/po/Podbird.desktop.in.h:1 |
918 | msgid "The chirpiest podcast manager for Ubuntu" |
919 | msgstr "" |
Looks good :)