diff --git a/gpodder-ui-qml b/gpodder-ui-qml index 3b53c3c..3e45909 160000 --- a/gpodder-ui-qml +++ b/gpodder-ui-qml @@ -1 +1 @@ -Subproject commit 3b53c3c557b06e1c3653539462c11664966a1140 +Subproject commit 3e4590955126042273352e6745d4230f81627845 diff --git a/qml/CoverContainer.qml b/qml/CoverContainer.qml new file mode 100644 index 0000000..909118c --- /dev/null +++ b/qml/CoverContainer.qml @@ -0,0 +1,61 @@ + +/** + * + * gPodder QML UI Reference Implementation + * Copyright (c) 2013, 2014, Thomas Perl + * + * 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); + } + } + } + } +} diff --git a/qml/Main.qml b/qml/Main.qml index ba00cc1..6493826 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -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) { diff --git a/qml/PlayerCover.qml b/qml/PlayerCover.qml new file mode 100644 index 0000000..b29156b --- /dev/null +++ b/qml/PlayerCover.qml @@ -0,0 +1,58 @@ + +/** + * + * gPodder QML UI Reference Implementation + * Copyright (c) 2013, 2014, Thomas Perl + * + * 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 + } +} diff --git a/qml/PlayerPage.qml b/qml/PlayerPage.qml index 7505ff3..4b7681c 100644 --- a/qml/PlayerPage.qml +++ b/qml/PlayerPage.qml @@ -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 } diff --git a/qml/PodcastsCover.qml b/qml/PodcastsCover.qml new file mode 100644 index 0000000..e745d03 --- /dev/null +++ b/qml/PodcastsCover.qml @@ -0,0 +1,28 @@ + +/** + * + * gPodder QML UI Reference Implementation + * Copyright (c) 2013, 2014, Thomas Perl + * + * 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' +} diff --git a/qml/PodcastsPage.qml b/qml/PodcastsPage.qml index 13f4173..05e6887 100644 --- a/qml/PodcastsPage.qml +++ b/qml/PodcastsPage.qml @@ -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}); diff --git a/qml/harbour-org.gpodder.sailfish.qml b/qml/harbour-org.gpodder.sailfish.qml index 8111022..a629950 100644 --- a/qml/harbour-org.gpodder.sailfish.qml +++ b/qml/harbour-org.gpodder.sailfish.qml @@ -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 }