diff --git a/main.py b/main.py index 255a334..9b6e27f 100644 --- a/main.py +++ b/main.py @@ -116,6 +116,7 @@ class gPotherSide: 'id': episode.id, 'title': episode.title, 'progress': episode.download_progress(), + 'downloadState': episode.state, } def load_episodes(self, id): @@ -142,6 +143,7 @@ class gPotherSide: 'podcast': episode.channel.title, 'published': util.format_date(episode.published), 'progress': episode.download_progress(), + 'downloadState': episode.state, } def get_fresh_episodes(self): diff --git a/qml/EpisodeItem.qml b/qml/EpisodeItem.qml index 431b0b0..e0354b6 100644 --- a/qml/EpisodeItem.qml +++ b/qml/EpisodeItem.qml @@ -47,7 +47,7 @@ ButtonArea { PLabel { anchors { left: parent.left - right: parent.right + right: downloadStatusIcon.left verticalCenter: parent.verticalCenter margins: 30 * pgst.scalef } @@ -55,5 +55,23 @@ ButtonArea { elide: Text.ElideRight text: title } + + Image { + id: downloadStatusIcon + + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + margins: 30 * pgst.scalef + } + + source: { + switch (downloadState) { + case Constants.state.normal: return ''; + case Constants.state.downloaded: return 'images/play.png'; + case Constants.state.deleted: return 'images/delete.png'; + } + } + } } diff --git a/qml/constants.js b/qml/constants.js index 80e4adc..28e3076 100644 --- a/qml/constants.js +++ b/qml/constants.js @@ -31,3 +31,9 @@ var colors = { playback: '#729fcf', /* playback blue */ }; +var state = { + normal: 0, + downloaded: 1, + deleted: 2, +}; +