From 943ac98b01ccad8b2fdf70d1f3cbe793f6283b1c Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Mon, 10 Feb 2014 21:29:00 +0100 Subject: [PATCH] Stats on cover, refresh cover action, refresh spinner --- gpodder-ui-qml | 2 +- qml/CoverContainer.qml | 9 +++++++++ qml/PodcastsCover.qml | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/gpodder-ui-qml b/gpodder-ui-qml index 0ff3557..ccd4a4d 160000 --- a/gpodder-ui-qml +++ b/gpodder-ui-qml @@ -1 +1 @@ -Subproject commit 0ff355737c911e24fcf0404d083fa1c69f6b4a57 +Subproject commit ccd4a4dc17eba1effc40e3be449414f99c8a6d59 diff --git a/qml/CoverContainer.qml b/qml/CoverContainer.qml index aefcfc6..e7b7ac6 100644 --- a/qml/CoverContainer.qml +++ b/qml/CoverContainer.qml @@ -56,5 +56,14 @@ CoverBackground { iconSource: 'image://theme/icon-cover-play' onTriggered: player.play(); } + + CoverAction { + iconSource: 'image://theme/icon-cover-refresh' + onTriggered: { + if (!py.refreshing) { + py.call('main.check_for_episodes'); + } + } + } } } diff --git a/qml/PodcastsCover.qml b/qml/PodcastsCover.qml index e745d03..62d7d9f 100644 --- a/qml/PodcastsCover.qml +++ b/qml/PodcastsCover.qml @@ -21,8 +21,47 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 +import 'common/util.js' as Util CoverPlaceholder { + id: podcastsCover + icon.source: '/usr/share/icons/hicolor/86x86/apps/harbour-org.gpodder.sailfish.png' - text: 'gPodder\n' + podcastListModel.count + ' podcasts' + property string _info_text: 'gPodder' + text: refreshingIndicator.visible ? '' : _info_text + + function update_stats() { + py.call('main.get_stats', [], function (result) { + podcastsCover._info_text = Util.format( + '{podcasts} podcasts\n' + + '{episodes} episodes\n' + + '{newEpisodes} new episodes\n' + + '{downloaded} downloaded', + result); + }); + } + + Connections { + target: py + onUpdateStats: podcastsCover.update_stats(); + onReadyChanged: { + if (py.ready) { + podcastsCover.update_stats(); + } + } + } + + BusyIndicator { + id: refreshingIndicator + visible: running + running: py.refreshing + anchors.centerIn: parent + + NumberAnimation on rotation { + from: 0; to: 360 + duration: 2000 + running: py.refreshing + loops: Animation.Infinite + } + } }