From 79ecd8fbe4717ceec12013486ce43dc0a5e8adce Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 4 Feb 2014 23:15:24 +0100 Subject: [PATCH] touch: Add more PlayerPage implementation --- touch/EpisodeItem.qml | 2 +- touch/IconContextMenu.qml | 1 + touch/PlayerPage.qml | 64 ++++++++++++++++++++++++--------------- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/touch/EpisodeItem.qml b/touch/EpisodeItem.qml index 8c62de0..fddae22 100644 --- a/touch/EpisodeItem.qml +++ b/touch/EpisodeItem.qml @@ -47,7 +47,7 @@ Item { width: parent.width IconMenuItem { - text: 'Play' + text: episodeItem.isPlaying ? 'Pause' : 'Play' iconSource: 'icons/' + (episodeItem.isPlaying ? 'pause_24x32.png' : 'play_24x32.png') onClicked: { if (episodeItem.isPlaying) { diff --git a/touch/IconContextMenu.qml b/touch/IconContextMenu.qml index b6dbb11..a760cc9 100644 --- a/touch/IconContextMenu.qml +++ b/touch/IconContextMenu.qml @@ -23,6 +23,7 @@ import QtQuick 2.0 Rectangle { id: contextMenu default property alias children: contextMenuRow.children + height: 80 * pgst.scalef color: '#33000000' diff --git a/touch/PlayerPage.qml b/touch/PlayerPage.qml index c807798..24d6037 100644 --- a/touch/PlayerPage.qml +++ b/touch/PlayerPage.qml @@ -20,19 +20,11 @@ import QtQuick 2.0 -import 'constants.js' as Constants +import 'common/util.js' as Util SlidePage { id: playerPage - property string episodeTitle - - Component.onCompleted: { - py.call('main.show_episode', [player.episode], function (episode) { - playerPage.episodeTitle = episode.title; - }); - } - Flickable { id: flickable anchors.fill: parent @@ -50,25 +42,47 @@ SlidePage { title: 'Now playing' } - ButtonRow { - width: playerPage.width - model: [ - { label: 'Play', clicked: function() { - player.play(); - }}, - { label: 'Pause', clicked: function() { - player.pause(); - }}, - { label: 'Details', clicked: function() { - pgst.loadPage('EpisodeDetail.qml', { - episode_id: player.episode, - title: playerPage.episodeTitle - }); - }} - ] + Column { + anchors { + left: parent.left + right: parent.right + margins: 30 * pgst.scalef + } + + PLabel { + text: player.episode_title + elide: Text.ElideRight + } + + PLabel { + text: player.podcast_title + elide: Text.ElideRight + } + } + + IconContextMenu { + width: parent.width + + IconMenuItem { + text: player.isPlaying ? 'Pause' : 'Play' + iconSource: 'icons/' + (player.isPlaying ? 'pause_24x32.png' : 'play_24x32.png') + onClicked: { + if (player.isPlaying) { + player.pause(); + } else { + player.play(); + } + } + } + } + + PLabel { + anchors.horizontalCenter: parent.horizontalCenter + text: Util.formatPosition(slider.displayedValue/1000, player.duration/1000) } PSlider { + id: slider width: playerPage.width value: player.position min: 0