Show download status in episode list

This commit is contained in:
Thomas Perl 2013-09-29 14:31:59 +02:00
parent 90b4f04e35
commit 24f686fad6
3 changed files with 27 additions and 1 deletions

View file

@ -116,6 +116,7 @@ class gPotherSide:
'id': episode.id, 'id': episode.id,
'title': episode.title, 'title': episode.title,
'progress': episode.download_progress(), 'progress': episode.download_progress(),
'downloadState': episode.state,
} }
def load_episodes(self, id): def load_episodes(self, id):
@ -142,6 +143,7 @@ class gPotherSide:
'podcast': episode.channel.title, 'podcast': episode.channel.title,
'published': util.format_date(episode.published), 'published': util.format_date(episode.published),
'progress': episode.download_progress(), 'progress': episode.download_progress(),
'downloadState': episode.state,
} }
def get_fresh_episodes(self): def get_fresh_episodes(self):

View file

@ -47,7 +47,7 @@ ButtonArea {
PLabel { PLabel {
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: downloadStatusIcon.left
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
margins: 30 * pgst.scalef margins: 30 * pgst.scalef
} }
@ -55,5 +55,23 @@ ButtonArea {
elide: Text.ElideRight elide: Text.ElideRight
text: title 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';
}
}
}
} }

View file

@ -31,3 +31,9 @@ var colors = {
playback: '#729fcf', /* playback blue */ playback: '#729fcf', /* playback blue */
}; };
var state = {
normal: 0,
downloaded: 1,
deleted: 2,
};