Skip to content

Commit

Permalink
Added number of unseen episodes to cover
Browse files Browse the repository at this point in the history
  • Loading branch information
scharel committed Jun 4, 2014
1 parent c084c1a commit 9c6f709
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 13 deletions.
5 changes: 4 additions & 1 deletion qml/content/FeedData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ListModel {
property int progress: 0
Component.onCompleted: load()
function load() {
nUnSeen = 0
clear()
console.log("Loading content from local storage")
var count = settings.value("content/count", 0)
Expand Down Expand Up @@ -61,8 +62,10 @@ ListModel {
"enclosure_length": settings.value("content/" + actSeason + "/" + actEpisode + "/enclosure_length", noDataString),
"enclosure_type": settings.value("content/" + actSeason + "/" + actEpisode + "/enclosure_type", noDataString),
"itunes_duration": settings.value("content/" + actSeason + "/" + actEpisode + "/itunes_duration", noDataString),
"seen": settings.value("downloads/" + actSeason + "/" + actEpisode + "/seen", noDataString)
"seen": settings.value("downloads/" + actSeason + "/" + actEpisode + "/seen", "false") === "true"
} )
if (settings.value("downloads/" + actSeason + "/" + actEpisode + "/seen", "false") !== "true")
nUnSeen = nUnSeen + 1
}
}
}
Expand Down
24 changes: 19 additions & 5 deletions qml/cover/CoverPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,37 @@ CoverBackground {
icon.source: "BV.png"
}

Label {
/*Label {
y: 220
anchors.horizontalCenter: parent.horizontalCenter
color: Theme.highlightColor
text: player.stopped ? "Bad Voltage" : getPrettyNumber(player.season, player.episode)
}*/

Label {
id: updatingLabel
y: 235
visible: feedModel.progress !== 1
anchors.horizontalCenter: parent.horizontalCenter
text: "Updating..."
}

Label {
id: audioPositionLabel
y: 250
visible: !player.stopped
y: 235
visible: !updatingLabel.visible && !player.stopped
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
text: getTimeFromMs(player.position) + "/" + getTimeFromMs(player.duration)
}

Label {
id: newEpsiodesLabel
y: 235
visible: !updatingLabel.visible && !audioPositionLabel.visible
anchors.horizontalCenter: parent.horizontalCenter
text: (nUnSeen === 0 ? "No" : nUnSeen) + " new Episode" + (nUnSeen > 1 ? "s" : "")
}

CoverActionList {
enabled: player.stopped
CoverAction {
Expand Down
1 change: 1 addition & 0 deletions qml/harbour-badvoltage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ApplicationWindow

property var feedModel: FeedData { }
Component.onCompleted: feedModel.reloadData()
property int nUnSeen: 0

cover: Qt.resolvedUrl("cover/CoverPage.qml")
initialPage: Component { FeedPage { } }
Expand Down
15 changes: 13 additions & 2 deletions qml/pages/FeedPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ Page {
property bool isDownloaded: downloader.isDownloaded(season, episode)
property bool isSeen: settings.value("downloads/" + season + "/" + episode + "/seen", false) === "true"

/*ListView.onAdd: AddAnimation {
target: myListItem
}
ListView.onRemove: RemoveAnimation {
target: myListItem
}*/

Connections {
target: downloader
onDownloadStarted: {
Expand Down Expand Up @@ -312,8 +319,12 @@ Page {

function setSeen(index, isSeen) {
listView.currentIndex = index
listView.currentItem.isSeen = isSeen
settings.setValue("downloads/" + listView.model.get(index).season + "/" + listView.model.get(index).episode + "/seen", isSeen)
if (listView.currentItem.isSeen !== isSeen) {
nUnSeen = isSeen ? nUnSeen-1 : nUnSeen+1
listView.currentItem.isSeen = isSeen
settings.setValue("downloads/" + listView.model.get(index).season + "/" + listView.model.get(index).episode + "/seen", isSeen)
settings.sync()
}
}
}
}
4 changes: 4 additions & 0 deletions rpm/harbour-badvoltage.changes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# * date Author's Name <author's email> version-release
# - Summary of changes

* Wed Jun 04 2014 Scharel Clemens <scharelc@gmail.com> 0.2-0
- Added number of unseen episodes to cover
- Small typo correction

* Sun Jun 01 2014 Scharel Clemens <scharelc@gmail.com> 0.1-3
- Longpress on Play/Pause button now stoppes the audio player
- Speaker symbol is not any more displayed in FeedPage when audio is paused
Expand Down
4 changes: 2 additions & 2 deletions rpm/harbour-badvoltage.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Name: harbour-badvoltage
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Bad Voltage
Version: 0.1
Release: 3
Version: 0.2
Release: 1
Group: Applications/Internet
License: GNU General Public License
URL: https://github.com/scharel/harbour-badvoltage
Expand Down
4 changes: 2 additions & 2 deletions rpm/harbour-badvoltage.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: harbour-badvoltage
Summary: Bad Voltage
Version: 0.1
Release: 3
Version: 0.2
Release: 1
# The contents of the Group field must be one of the groups listed here:
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
Group: Applications/Internet
Expand Down
2 changes: 1 addition & 1 deletion src/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Settings : public QObject {
_settings->beginGroup("app");
//_settings->setValue("mail", "scharelc@gmail.com");
_settings->setValue("gitUrl", "https://github.com/scharel/harbour-badvoltage");
_settings->setValue("version", "0.1-3");
_settings->setValue("version", "0.2-1");
_settings->endGroup();
}

Expand Down

0 comments on commit 9c6f709

Please sign in to comment.