Cleanup episode events, mark episodes as old, fresh episodes fix

This commit is contained in:
Thomas Perl 2014-02-10 19:09:51 +01:00
parent 8eebb09707
commit 0ff355737c
11 changed files with 126 additions and 93 deletions

View file

@ -63,7 +63,7 @@ Item {
text: 'Download'
color: (episodeItem.isPlaying || progress > 0) ? titleLabel.color : Constants.colors.download
icon: Icons.cloud_download
visible: downloadState != Constants.state.downloaded
enabled: downloadState != Constants.state.downloaded
onClicked: {
episodeList.selectedIndex = -1;
py.call('main.download_episode', [id]);
@ -74,7 +74,7 @@ Item {
text: 'Delete'
color: (episodeItem.isPlaying || progress > 0) ? titleLabel.color : Constants.colors.destructive
icon: Icons.trash
visible: downloadState != Constants.state.deleted
enabled: downloadState != Constants.state.deleted
onClicked: {
var ctx = { py: py, id: id };
pgst.showConfirmation('Delete episode', Icons.trash, function () {
@ -96,6 +96,7 @@ Item {
color: titleLabel.color
icon: Icons.article
onClicked: pgst.loadPage('EpisodeDetail.qml', {episode_id: id, title: title});
enabled: hasShownotes
}
}
}
@ -175,8 +176,10 @@ Item {
return Constants.colors.download;
} else if (episodeItem.opened) {
return Constants.colors.highlight;
} else if (isNew) {
} else if (isNew && downloadState == Constants.state.downloaded) {
return Constants.colors.highlight;
} else if (isNew) {
return Constants.colors.fresh;
} else {
return Constants.colors.text;
}
@ -202,7 +205,7 @@ Item {
}
visible: downloadState == Constants.state.downloaded
icon: Icons.cd
icon: Icons.folder
}
}
}

View file

@ -49,6 +49,16 @@ SlidePage {
}
}
PullMenuItem {
text: 'Mark all as old'
icon: Icons.eye
color: Constants.colors.text
onClicked: {
py.call('main.mark_episodes_as_old', [episodesPage.podcast_id]);
episodesPage.unPull();
}
}
PullMenuItem {
text: 'Unsubscribe'
icon: Icons.trash

View file

@ -20,6 +20,7 @@
import QtQuick 2.0
import 'common'
import 'common/util.js' as Util
SlidePage {
@ -27,8 +28,7 @@ SlidePage {
property bool ready: false
Component.onCompleted: {
py.call('main.get_fresh_episodes', [], function (episodes) {
Util.updateModelFrom(freshEpisodesListModel, episodes);
freshEpisodesListModel.loadFreshEpisodes(function () {
freshEpisodes.ready = true;
});
}
@ -39,33 +39,16 @@ SlidePage {
}
PListView {
id: freshEpisodesList
id: episodeList
property int selectedIndex: -1
title: 'Fresh episodes'
model: ListModel { id: freshEpisodesListModel }
model: GPodderEpisodeListModel { id: freshEpisodesListModel }
section.property: 'published'
section.delegate: SectionHeader { text: section }
delegate: EpisodeItem {
onClicked: py.call('main.download_episode', [id]);
Connections {
target: py
onDownloadProgress: {
if (episode_id == id) {
freshEpisodesListModel.setProperty(index, 'progress', progress);
}
}
onDownloaded: {
if (id == episode_id) {
freshEpisodesListModel.remove(index);
}
}
}
//pgst.loadPage('EpisodeDetail.qml', {episode_id: id, title: title});
}
delegate: EpisodeItem { }
}
}

View file

@ -27,6 +27,7 @@ ButtonArea {
property alias text: label.text
property color color: Constants.colors.secondaryHighlight
property color _real_color: enabled ? color : Constants.colors.placeholder
property alias icon: icon.icon
property alias size: icon.size
property bool alwaysShowText: false
@ -48,7 +49,7 @@ ButtonArea {
id: label
font.pixelSize: 15 * pgst.scalef
visible: parent.pressed || parent.alwaysShowText
color: parent.pressed ? Qt.darker(iconMenuItem.color, 1.1) : iconMenuItem.color
color: parent.pressed ? Qt.darker(iconMenuItem._real_color, 1.1) : iconMenuItem._real_color
anchors {
bottom: icon.top

View file

@ -20,6 +20,8 @@
import QtQuick 2.0
import 'common/constants.js' as Constants
ButtonArea {
id: podcastItem
@ -58,12 +60,24 @@ ButtonArea {
left: cover.right
leftMargin: 10 * pgst.scalef
rightMargin: 10 * pgst.scalef
right: parent.right
right: downloadsLabel.left
verticalCenter: parent.verticalCenter
}
elide: Text.ElideRight
text: title
color: newEpisodes ? Constants.colors.fresh : Constants.colors.text
}
PLabel {
id: downloadsLabel
anchors {
right: parent.right
rightMargin: 10 * pgst.scalef
verticalCenter: parent.verticalCenter
}
text: downloaded ? downloaded : ''
color: Constants.colors.text
}
}

View file

@ -42,7 +42,7 @@ SlidePage {
PullMenuItem {
text: 'Refresh feeds'
icon: Icons.reload
icon: Icons.loop_alt2
onClicked: {
podcastsPage.unPull();
py.call('main.check_for_episodes');

View file

@ -116,35 +116,35 @@ SlidePage {
StartPageButton {
id: freshEpisodesPage
enabled: freshEpisodesRepeater.count > 0
title: py.refreshing ? 'Refreshing feeds' : 'Fresh episodes'
onClicked: pgst.loadPage('FreshEpisodes.qml');
Row {
id: freshEpisodesRow
anchors.bottom: parent.bottom
anchors.bottomMargin: 50 * pgst.scalef
anchors.bottomMargin: 20 * pgst.scalef
anchors.leftMargin: 20 * pgst.scalef
anchors.left: parent.left
spacing: 10 * pgst.scalef
PLabel {
color: Constants.colors.placeholder
text: 'No fresh episodes'
visible: freshEpisodesRepeater.count == 0
}
Repeater {
id: freshEpisodesRepeater
Image {
CoverArt {
source: modelData.coverart
sourceSize { width: 80 * pgst.scalef; height: 80 * pgst.scalef }
text: modelData.title
width: 80 * pgst.scalef
height: 80 * pgst.scalef
PLabel {
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.bottom
margins: 5 * pgst.scalef
}
text: modelData.newEpisodes
}
}
}
}
@ -165,7 +165,7 @@ SlidePage {
PIcon {
id: refresher
icon: Icons.reload
icon: Icons.loop_alt2
color: Constants.colors.highlight
anchors {

View file

@ -13,3 +13,6 @@ var arrow_left = '\u2190';
var arrow_right = '\u2192';
var last = '\ue04d';
var aperture = '\ue026';
var eye = '\ue025';
var loop_alt2 = '\ue033';
var folder = '\ue065';