Implement playback and podcasts cover

This commit is contained in:
Thomas Perl 2014-02-03 21:15:28 +01:00
parent 0322ab5d65
commit 776294cb05
8 changed files with 155 additions and 21 deletions

@ -1 +1 @@
Subproject commit 3b53c3c557b06e1c3653539462c11664966a1140
Subproject commit 3e4590955126042273352e6745d4230f81627845

61
qml/CoverContainer.qml Normal file
View file

@ -0,0 +1,61 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 2014, Thomas Perl <m@thp.io>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'common/util.js' as Util
CoverBackground {
PodcastsCover {
id: podcastsCover
visible: !playerCover.visible
}
PlayerCover {
id: playerCover
visible: player.episode != 0 && player.isPlaying
}
CoverActionList {
CoverAction {
iconSource: 'image://theme/icon-cover-' + (player.isPlaying ? 'pause' : 'play')
onTriggered: {
if (player.episode != 0) {
if (player.isPlaying) {
player.pause();
} else {
player.play();
}
}
}
}
CoverAction {
iconSource: 'image://theme/icon-cover-next'
onTriggered: {
if (player.episode != 0 && player.isPlaying) {
player.seekAndSync(player.position + 1000 * 30);
}
}
}
}
}

View file

@ -30,6 +30,7 @@ PodcastsPage {
property real scalef: width / 480
property var playerPage: undefined
property var cover: CoverContainer { }
onStatusChanged: pgst.handlePageStatusChange(status)
@ -70,6 +71,8 @@ PodcastsPage {
onPlayerCreated: pgst.createPlayerPage();
}
GPodderPodcastListModel { id: podcastListModel }
function loadPage(filename, properties, replace) {
var component = Qt.createComponent(filename);
if (component.status != Component.Ready) {

58
qml/PlayerCover.qml Normal file
View file

@ -0,0 +1,58 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 2014, Thomas Perl <m@thp.io>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'common/util.js' as Util
Column {
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
margins: Theme.paddingSmall
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Theme.fontSizeSmall
text: Util.formatPosition(player.position/1000, player.duration/1000)
color: Theme.primaryColor
}
Label {
text: player.episode_title
width: parent.width
horizontalAlignment: Text.AlignHCenter
color: Theme.highlightColor
wrapMode: Text.Wrap
}
Label {
text: player.podcast_title
width: parent.width
horizontalAlignment: Text.AlignHCenter
color: Theme.secondaryHighlightColor
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeExtraSmall
}
}

View file

@ -26,16 +26,6 @@ import 'common/util.js' as Util
Page {
id: playerPage
property string episodeTitle
onStatusChanged: {
if (status == PageStatus.Activating) {
py.call('main.show_episode', [player.episode], function (episode) {
playerPage.episodeTitle = episode.title;
});
}
}
SilicaFlickable {
id: flickable
anchors.fill: parent
@ -74,7 +64,7 @@ Page {
truncationMode: TruncationMode.Fade
horizontalAlignment: Text.AlignRight
text: episodeTitle
text: player.episode_title
color: Theme.rgba(Theme.highlightColor, 0.7)
font.pixelSize: Theme.fontSizeSmall
}

28
qml/PodcastsCover.qml Normal file
View file

@ -0,0 +1,28 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 2014, Thomas Perl <m@thp.io>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
CoverPlaceholder {
icon.source: '/usr/share/icons/hicolor/86x86/apps/harbour-org.gpodder.sailfish.png'
text: 'gPodder\n' + podcastListModel.count + ' podcasts'
}

View file

@ -57,7 +57,7 @@ Page {
section.property: 'section'
section.delegate: SectionHeader { text: section }
model: GPodderPodcastListModel { id: podcastListModel }
model: podcastListModel
delegate: PodcastItem {
onClicked: pgst.loadPage('EpisodesPage.qml', {'podcast_id': id, 'title': title});

View file

@ -21,12 +21,6 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
ApplicationWindow {
initialPage: Main {}
cover: CoverBackground {
CoverPlaceholder {
text: "gPodder"
icon.source: "/usr/share/icons/hicolor/86x86/apps/harbour-org.gpodder.sailfish.png"
}
}
initialPage: Main { id: main }
cover: main.cover
}