"Now playing" as attached page; seek bar + seek wheel
This commit is contained in:
parent
a4bb12bee6
commit
0fd24272d1
7 changed files with 132 additions and 53 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 32d95cd1620eb92cf901554182e8fd2481f4af4b
|
||||
Subproject commit e6869016f21e1f59c3a12daf9f3e3d463e0875ca
|
|
@ -29,6 +29,8 @@ Page {
|
|||
property int episode_id
|
||||
property string title
|
||||
|
||||
onStatusChanged: pgst.handlePageStatusChange(status)
|
||||
|
||||
Component.onCompleted: {
|
||||
label.text = 'Loading...';
|
||||
py.call('main.show_episode', [episode_id], function (episode) {
|
||||
|
@ -42,13 +44,6 @@ Page {
|
|||
|
||||
VerticalScrollDecorator { flickable: flickable }
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: 'Now playing'
|
||||
onClicked: pgst.loadPage('PlayerPage.qml');
|
||||
}
|
||||
}
|
||||
|
||||
contentWidth: detailColumn.width
|
||||
contentHeight: detailColumn.height + detailColumn.spacing
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ Page {
|
|||
property int podcast_id
|
||||
property string title
|
||||
|
||||
onStatusChanged: pgst.handlePageStatusChange(status)
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
|
@ -79,11 +81,6 @@ Page {
|
|||
model: ListModel { id: episodeListModel }
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: 'Now playing'
|
||||
onClicked: pgst.loadPage('PlayerPage.qml');
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: 'Unsubscribe'
|
||||
onClicked: {
|
||||
|
|
|
@ -47,11 +47,6 @@ Page {
|
|||
VerticalScrollDecorator { flickable: freshEpisodesList }
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: 'Now playing'
|
||||
onClicked: pgst.loadPage('PlayerPage.qml');
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: 'Mark all as old'
|
||||
}
|
||||
|
|
24
qml/Main.qml
24
qml/Main.qml
|
@ -29,6 +29,19 @@ PodcastsPage {
|
|||
|
||||
property real scalef: width / 480
|
||||
|
||||
property var playerPage: undefined
|
||||
|
||||
onStatusChanged: pgst.handlePageStatusChange(status)
|
||||
|
||||
function handlePageStatusChange(st) {
|
||||
if (st == PageStatus.Active) {
|
||||
if (playerPage === undefined) {
|
||||
playerPage = Qt.createComponent('PlayerPage.qml').createObject(pgst);
|
||||
}
|
||||
pageStack.pushAttached(playerPage);
|
||||
}
|
||||
}
|
||||
|
||||
function update(page, x) {
|
||||
var index = -1;
|
||||
for (var i=0; i<children.length; i++) {
|
||||
|
@ -49,16 +62,21 @@ PodcastsPage {
|
|||
id: player
|
||||
}
|
||||
|
||||
function loadPage(filename, properties) {
|
||||
function loadPage(filename, properties, replace) {
|
||||
var component = Qt.createComponent(filename);
|
||||
if (component.status != Component.Ready) {
|
||||
console.log('Error loading ' + filename + ':' +
|
||||
component.errorString());
|
||||
}
|
||||
|
||||
if (properties === undefined) {
|
||||
pageStack.push(component.createObject(pgst));
|
||||
} else {
|
||||
properties = {};
|
||||
}
|
||||
|
||||
if (replace != true) {
|
||||
pageStack.push(component.createObject(pgst, properties));
|
||||
} else {
|
||||
pageStack.replace(component.createObject(pgst, properties));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,16 +22,19 @@ import QtQuick 2.0
|
|||
import Sailfish.Silica 1.0
|
||||
|
||||
import 'constants.js' as Constants
|
||||
import 'common/util.js' as Util
|
||||
|
||||
Page {
|
||||
id: playerPage
|
||||
|
||||
property string episodeTitle
|
||||
|
||||
Component.onCompleted: {
|
||||
py.call('main.show_episode', [player.episode], function (episode) {
|
||||
playerPage.episodeTitle = episode.title;
|
||||
});
|
||||
onStatusChanged: {
|
||||
if (status == PageStatus.Activating) {
|
||||
py.call('main.show_episode', [player.episode], function (episode) {
|
||||
playerPage.episodeTitle = episode.title;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
SilicaFlickable {
|
||||
|
@ -41,41 +44,117 @@ Page {
|
|||
contentWidth: column.width
|
||||
contentHeight: column.height + column.spacing
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: player.isPlaying ? 'Pause': 'Play'
|
||||
onClicked: {
|
||||
if (player.isPlaying) {
|
||||
player.pause();
|
||||
} else {
|
||||
player.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column
|
||||
|
||||
width: playerPage.width
|
||||
spacing: 10 * pgst.scalef
|
||||
|
||||
PageHeader {
|
||||
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
|
||||
});
|
||||
}}
|
||||
]
|
||||
Label {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: Theme.paddingLarge
|
||||
}
|
||||
|
||||
truncationMode: TruncationMode.Fade
|
||||
horizontalAlignment: Text.AlignRight
|
||||
text: episodeTitle
|
||||
color: Theme.rgba(Theme.highlightColor, 0.7)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: player
|
||||
onPositionChanged: {
|
||||
if (!positionSlider.down) {
|
||||
positionSlider.value = player.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Theme.itemSizeSmall
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
text: Util.formatPosition(positionSlider.value/1000, player.duration/1000)
|
||||
color: positionSlider.highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Theme.paddingMedium
|
||||
}
|
||||
|
||||
Slider {
|
||||
width: playerPage.width
|
||||
value: player.playbackRate
|
||||
minimumValue: 0.5
|
||||
maximumValue: 3.0
|
||||
onSliderValueChanged: {
|
||||
player.playbackRate = sliderValue
|
||||
id: positionSlider
|
||||
width: parent.width
|
||||
|
||||
value: player.position
|
||||
minimumValue: 0
|
||||
maximumValue: player.duration
|
||||
onDownChanged: {
|
||||
if (!down) {
|
||||
player.seek(sliderValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Theme.itemSizeLarge
|
||||
}
|
||||
|
||||
TimePicker {
|
||||
hourMode: DateTime.TwentyFourHours
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
property int oldHour: hour
|
||||
property int oldMinute: minute
|
||||
|
||||
onHourChanged: {
|
||||
var diff = hour - oldHour;
|
||||
if (diff > 12) {
|
||||
diff -= 24;
|
||||
} else if (diff < -12) {
|
||||
diff += 24;
|
||||
}
|
||||
player.seek(player.position + 1000 * 60 * diff);
|
||||
oldHour = hour;
|
||||
}
|
||||
|
||||
onMinuteChanged: {
|
||||
var diff = minute - oldMinute;
|
||||
if (diff > 30) {
|
||||
diff -= 60;
|
||||
} else if (diff < -30) {
|
||||
diff += 60;
|
||||
}
|
||||
player.seek(player.position + 1000 * 10 * diff);
|
||||
oldMinute = minute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,11 +70,6 @@ Page {
|
|||
VerticalScrollDecorator { flickable: podcastList }
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: 'Now playing'
|
||||
onClicked: pgst.loadPage('PlayerPage.qml');
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Settings"
|
||||
onClicked: pgst.loadPage('Settings.qml');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue