Port to Sailfish Silica

This commit is contained in:
Thomas Perl 2014-01-04 14:33:38 +01:00
parent 51c6391249
commit 1d12cf8ac9
25 changed files with 206 additions and 756 deletions

@ -1 +1 @@
Subproject commit 0afaba02d0e92bcfb8e3a7b62b74cda5a7d39a72
Subproject commit 2e18f54e5e0c04e3e9c7eeeb6638b97531753440

View file

@ -22,7 +22,12 @@ import Sailfish.Silica 1.0
import 'qml'
ApplicationWindow {
initialPage: Page {
Main {}
initialPage: Main {}
cover: CoverBackground {
CoverPlaceholder {
text: "gPodder"
icon.source: "/usr/share/icons/hicolor/86x86/apps/org.gpodder.sailfish.png"
}
}
}

View file

@ -1,37 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
Rectangle {
id: buttonArea
signal clicked
property bool transparent: false
color: mouseArea.pressed?'#33ffffff':(transparent?'#00000000':'#88000000')
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: buttonArea.clicked();
}
}

View file

@ -19,6 +19,7 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
Row {
id: buttonRow
@ -30,12 +31,12 @@ Row {
id: repeater
model: buttonRow.model
delegate: ButtonArea {
delegate: BackgroundItem {
height: buttonRow.height
width: buttonRow.width / repeater.count
onClicked: buttonRow.model[index].clicked()
PLabel {
Label {
anchors.centerIn: parent
text: modelData.label
}

View file

@ -1,57 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
MouseArea {
id: dragging
property Item stacking
property bool hasPull: false
property bool canClose: true
signal pulled
anchors.fill: parent
drag {
target: parent
axis: Drag.XAxis
minimumX: dragging.hasPull ? (-parent.width/4) : 0
maximumX: canClose ? parent.width : 0
filterChildren: true
}
onPressedChanged: {
if (pressed) {
dragging.stacking.stopAllAnimations();
} else {
if (hasPull && parent.x < -parent.width / 4 + 10) {
pulled();
parent.x = -parent.width / 4;
//dragging.stacking.fadeInAgain();
} else if (parent.x > parent.width / 3) {
dragging.stacking.startFadeOut();
} else {
dragging.stacking.fadeInAgain();
}
}
}
}

View file

@ -19,10 +19,11 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'constants.js' as Constants
SlidePage {
Page {
id: detailPage
property int episode_id
@ -35,10 +36,24 @@ SlidePage {
});
}
Flickable {
SilicaFlickable {
id: flickable
anchors.fill: parent
VerticalScrollDecorator { flickable: flickable }
PullDownMenu {
MenuItem {
text: 'Now playing'
onClicked: pgst.loadPage('PlayerPage.qml');
}
MenuItem {
text: 'Play'
onClicked: player.playbackEpisode(detailPage.episode_id)
}
}
contentWidth: detailColumn.width
contentHeight: detailColumn.height + detailColumn.spacing
@ -48,22 +63,11 @@ SlidePage {
width: detailPage.width
spacing: 10 * pgst.scalef
SlidePageHeader {
PageHeader {
title: detailPage.title
}
ButtonArea {
width: detailPage.width
height: 100 * pgst.scalef
onClicked: player.playbackEpisode(detailPage.episode_id)
PLabel {
anchors.centerIn: parent
text: 'Play'
}
}
PLabel {
Label {
id: label
width: parent.width * .8
font.pixelSize: 30 * pgst.scalef

View file

@ -19,10 +19,11 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'constants.js' as Constants
ButtonArea {
BackgroundItem {
id: podcastItem
Rectangle {
@ -36,7 +37,6 @@ ButtonArea {
opacity: .4
}
transparent: true
height: 80 * pgst.scalef
anchors {
@ -44,7 +44,7 @@ ButtonArea {
right: parent.right
}
PLabel {
Label {
anchors {
left: parent.left
right: downloadStatusIcon.left

View file

@ -19,50 +19,59 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0
import 'util.js' as Util
SlidePage {
Page {
id: episodesPage
hasPull: true
property int podcast_id
property string title
width: parent.width
height: parent.height
RemorsePopup { id: remorse }
Component.onCompleted: {
py.call('main.load_episodes', [podcast_id], function (episodes) {
Util.updateModelFrom(episodeListModel, episodes);
});
}
PullMenu {
PullMenuItem {
source: 'images/play.png'
onClicked: {
pgst.loadPage('PlayerPage.qml');
episodesPage.unPull();
}
}
PullMenuItem {
source: 'images/delete.png'
onClicked: {
py.call('main.unsubscribe', [episodesPage.podcast_id]);
episodesPage.closePage();
}
}
}
PListView {
SilicaListView {
id: episodeList
VerticalScrollDecorator { flickable: episodeList }
anchors.fill: parent
header: PageHeader {
title: episodesPage.title
}
model: ListModel { id: episodeListModel }
PullDownMenu {
MenuItem {
text: 'Now playing'
onClicked: pgst.loadPage('PlayerPage.qml');
}
MenuItem {
text: 'Unsubscribe'
onClicked: {
remorse.execute("Unsubscribing", function() {
py.call('main.unsubscribe', [episodesPage.podcast_id]);
if (pageStack.currentPage == episodesPage) {
pageStack.pop();
}
})
}
}
}
delegate: EpisodeItem {
onClicked: pgst.loadPage('EpisodeDetail.qml', {episode_id: id, title: title});
}

View file

@ -19,10 +19,11 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'util.js' as Util
SlidePage {
Page {
id: freshEpisodes
property bool ready: false
@ -33,14 +34,36 @@ SlidePage {
});
}
PBusyIndicator {
BusyIndicator {
visible: !freshEpisodes.ready
running: visible
anchors.centerIn: parent
}
PListView {
SilicaListView {
id: freshEpisodesList
anchors.fill: parent
VerticalScrollDecorator { flickable: freshEpisodesList }
PullDownMenu {
MenuItem {
text: 'Now playing'
onClicked: pgst.loadPage('PlayerPage.qml');
}
MenuItem {
text: 'Mark all as old'
}
MenuItem {
text: 'Download all episodes'
}
}
header: PageHeader {
title: 'Fresh episodes'
}
model: ListModel { id: freshEpisodesListModel }

View file

@ -19,9 +19,10 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0
Item {
Page {
id: pgst
property bool ready: false
@ -52,9 +53,9 @@ Item {
component.errorString());
}
if (properties === undefined) {
component.createObject(pgst);
pageStack.push(component.createObject(pgst));
} else {
component.createObject(pgst, properties);
pageStack.push(component.createObject(pgst, properties));
}
}
@ -95,9 +96,10 @@ Item {
id: player
}
PBusyIndicator {
BusyIndicator {
anchors.centerIn: parent
visible: !pgst.ready
running: visible
}
StartPage {

View file

@ -1,53 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
Item {
height: 64 * pgst.scalef
width: 64 * pgst.scalef
Image {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 30*Math.abs(Math.sin(phase)) * pgst.scalef
}
transform: Scale {
origin.x: 32 * pgst.scalef
origin.y: 32 * pgst.scalef
xScale: 1.0 - 0.3 * (1.0 - Math.abs(Math.sin(phase)))
}
source: 'images/gpodder.png'
}
property real phase: 0
PropertyAnimation on phase {
loops: Animation.Infinite
duration: 2000
running: parent.visible
from: 0
to: 2*Math.PI
}
}

View file

@ -1,27 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
Text {
font.pixelSize: 30 * pgst.scalef
color: 'white'
}

View file

@ -1,34 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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 'constants.js' as Constants
ListView {
id: pListView
anchors.fill: parent
property string title
header: SlidePageHeader { title: pListView.title }
}

View file

@ -1,53 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
Rectangle {
id: slider
property real value
property real min: 0.0
property real max: 1.0
signal valueChangeRequested(real newValue)
color: '#aa000000'
height: 50 * pgst.scalef
MouseArea {
anchors.fill: parent
onClicked: slider.valueChangeRequested(min + (max - min) * (mouse.x / width))
}
Rectangle {
height: parent.height * 0.9
width: height
color: '#aaffffff'
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: parent.width * (parent.value - parent.min) / (parent.max - parent.min)
}
}
}

View file

@ -1,51 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
Rectangle {
id: textField
property alias text: textInput.text
property string placeholderText: ''
radius: 10 * pgst.scalef
height: 50 * pgst.scalef
color: 'white'
TextInput {
anchors {
fill: parent
margins: 5 * pgst.scalef
}
color: 'black'
id: textInput
font.pixelSize: height
}
Text {
anchors.fill: textInput
visible: !textInput.focus && (textInput.text == '')
text: textField.placeholderText
color: '#aaa'
font.pixelSize: textInput.font.pixelSize
}
}

View file

@ -19,10 +19,11 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'constants.js' as Constants
SlidePage {
Page {
id: playerPage
property string episodeTitle
@ -33,7 +34,7 @@ SlidePage {
});
}
Flickable {
SilicaFlickable {
id: flickable
anchors.fill: parent
@ -46,7 +47,7 @@ SlidePage {
width: playerPage.width
spacing: 10 * pgst.scalef
SlidePageHeader {
PageHeader {
title: 'Now playing'
}
@ -68,14 +69,13 @@ SlidePage {
]
}
PSlider {
Slider {
width: playerPage.width
value: player.playbackRate
min: 0.5
max: 3.0
onValueChangeRequested: {
player.playbackRate = newValue
value = player.playbackRate
minimumValue: 0.5
maximumValue: 3.0
onSliderValueChanged: {
player.playbackRate = sliderValue
}
}
}

View file

@ -19,12 +19,11 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
ButtonArea {
BackgroundItem {
id: podcastItem
transparent: true
height: 100 * pgst.scalef
anchors {
left: parent.left
@ -50,12 +49,13 @@ ButtonArea {
source: coverart
}
PBusyIndicator {
BusyIndicator {
anchors.centerIn: cover
visible: updating
running: visible
}
PLabel {
Label {
anchors {
left: cover.right
leftMargin: 10 * pgst.scalef

View file

@ -19,12 +19,12 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import 'util.js' as Util
SlidePage {
Page {
id: podcastsPage
hasPull: true
function reload() {
loading.visible = true;
@ -65,41 +65,38 @@ SlidePage {
py.setHandler('updated-podcast', undefined);
}
PullMenu {
PullMenuItem {
source: 'images/play.png'
onClicked: {
pgst.loadPage('PlayerPage.qml');
podcastsPage.unPull();
}
}
PullMenuItem {
source: 'images/search.png'
onClicked: {
podcastsPage.unPull();
py.call('main.check_for_episodes');
}
}
PullMenuItem {
source: 'images/subscriptions.png'
onClicked: {
pgst.loadPage('Subscribe.qml');
podcastsPage.unPull();
}
}
}
PLabel {
Label {
id: loading
anchors.centerIn: parent
text: 'Loading'
}
PListView {
SilicaListView {
id: podcastList
anchors.fill: parent
VerticalScrollDecorator { flickable: podcastList }
PullDownMenu {
MenuItem {
text: 'Now playing'
onClicked: pgst.loadPage('PlayerPage.qml');
}
MenuItem {
text: 'Check for new episodes'
onClicked: py.call('main.check_for_episodes');
}
MenuItem {
text: 'Add new podcast'
onClicked: pgst.loadPage('Subscribe.qml');
}
}
header: PageHeader {
title: 'Subscriptions'
}
section.property: 'section'
section.delegate: SectionHeader { text: section }

View file

@ -1,39 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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
Item {
property alias text: pLabel.text
height: 70 * pgst.scalef
PLabel {
id: pLabel
anchors {
left: parent.left
bottom: parent.bottom
margins: 10 * pgst.scalef
}
color: '#aaa'
}
}

View file

@ -19,14 +19,13 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
SlidePage {
SlidePageHeader { title: 'Settings' }
Page {
PageHeader { title: 'Settings' }
Text {
Label {
anchors.centerIn: parent
color: 'white'
font.pixelSize: 50 * pgst.scalef
text: 'TODO'
}
}

View file

@ -1,92 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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 'constants.js' as Constants
Rectangle {
id: page
color: '#88000000'
default property alias children: dragging.children
property alias hasPull: dragging.hasPull
property alias canClose: dragging.canClose
property real pullPhase: (x >= 0) ? 0 : (-x / (width / 4))
function unPull() {
stacking.fadeInAgain();
}
function closePage() {
stacking.startFadeOut();
}
onXChanged: pgst.update(page, x)
width: parent.width
height: parent.height
Stacking { id: stacking }
Dragging {
id: dragging
stacking: stacking
onPulled: console.log('have pulled it!')
}
Rectangle {
color: 'black'
anchors.fill: parent
opacity: page.pullPhase * 0.8
MouseArea {
enabled: parent.opacity > 0
anchors.fill: parent
onClicked: page.unPull();
}
}
Image {
anchors {
right: parent.left
top: parent.top
bottom: parent.bottom
}
width: 10 * pgst.scalef
source: 'images/pageshadow.png'
opacity: .2
}
Image {
anchors {
left: parent.right
top: parent.top
bottom: parent.bottom
}
mirror: true
width: 10 * pgst.scalef
source: 'images/pageshadow.png'
opacity: .2
}
}

View file

@ -1,60 +0,0 @@
/**
*
* gPodder QML UI Reference Implementation
* Copyright (c) 2013, 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 'constants.js' as Constants
Item {
id: slidePageHeader
property string title
width: parent.width
height: Constants.layout.header.height * pgst.scalef
Rectangle {
anchors {
left: parent.left
right: parent.right
top: parent.top
topMargin: slidePageHeader.height * 0.15
}
height: slidePageHeader.height * 0.7
color: '#33000000'
}
Text {
anchors {
left: parent.left
right: parent.right
rightMargin: 20 * pgst.scalef
leftMargin: 70 * pgst.scalef
verticalCenter: parent.verticalCenter
}
color: 'white'
horizontalAlignment: Text.AlignRight
font.pixelSize: parent.height * .4 * pgst.scalef
elide: Text.ElideRight
text: parent.title
}
}

View file

@ -19,10 +19,10 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
SlidePage {
Page {
id: startPage
canClose: false
function update_stats() {
py.call('main.get_stats', [], function (result) {
@ -42,7 +42,22 @@ SlidePage {
py.setHandler('update-stats', undefined);
}
Flickable {
SilicaFlickable {
id: startPageFlickable
PullDownMenu {
MenuItem {
text: 'Now playing'
onClicked: pgst.loadPage('PlayerPage.qml');
}
MenuItem {
text: "Settings"
onClicked: pgst.loadPage('Settings.qml');
}
}
VerticalScrollDecorator { flickable: startPageFlickable }
Connections {
target: pgst
onReadyChanged: {
@ -63,17 +78,22 @@ SlidePage {
width: startPage.width
spacing: 20 * pgst.scalef
SlidePageHeader {
PageHeader {
title: 'gPodder'
}
StartPageButton {
SectionHeader {
text: 'Subscriptions'
}
BackgroundItem {
id: subscriptionsPane
title: 'Subscriptions'
onClicked: pgst.loadPage('PodcastsPage.qml');
width: startPage.width
height: startPage.height / 5
PLabel {
Label {
id: stats
anchors {
@ -82,55 +102,40 @@ SlidePage {
margins: 20 * pgst.scalef
}
}
ButtonArea {
anchors {
bottom: parent.bottom
right: parent.right
}
transparent: true
onClicked: pgst.loadPage('Subscribe.qml');
width: subscriptions.width + 2*subscriptions.anchors.margins
height: subscriptions.height + 2*subscriptions.anchors.margins
Image {
id: subscriptions
source: 'images/subscriptions.png'
anchors {
bottom: parent.bottom
right: parent.right
margins: 20 * pgst.scalef
}
}
}
SectionHeader {
id: freshEpisodesHeader
text: 'Fresh episodes'
}
StartPageButton {
BackgroundItem {
id: freshEpisodesPage
height: startPage.height / 6
width: parent.width
title: 'Fresh episodes'
onClicked: pgst.loadPage('FreshEpisodes.qml');
Component.onCompleted: {
py.setHandler('refreshing', function (is_refreshing) {
refresherButtonArea.visible = !is_refreshing;
refresherButton.visible = !is_refreshing;
if (!is_refreshing) {
freshEpisodesPage.title = 'Fresh episodes';
freshEpisodesHeader.text = 'Fresh episodes';
}
});
py.setHandler('refresh-progress', function (pos, total) {
freshEpisodesPage.title = 'Refreshing feeds (' + pos + '/' + total + ')';
freshEpisodesHeader.text = 'Refreshing feeds (' + pos + '/' + total + ')';
});
}
Row {
anchors.bottom: parent.bottom
anchors.bottomMargin: 50 * pgst.scalef
anchors.leftMargin: 20 * pgst.scalef
id: freshRow
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.margins: spacing
spacing: 10 * pgst.scalef
Repeater {
@ -142,108 +147,19 @@ SlidePage {
width: 80 * pgst.scalef
height: 80 * pgst.scalef
PLabel {
/*
Label {
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.bottom
margins: 5 * pgst.scalef
bottom: parent.bottom
}
text: modelData.newEpisodes
}
*/
}
}
}
ButtonArea {
id: refresherButtonArea
anchors {
bottom: parent.bottom
right: parent.right
}
transparent: true
onClicked: py.call('main.check_for_episodes');
width: refresher.width + 2*refresher.anchors.margins
height: refresher.height + 2*refresher.anchors.margins
Image {
id: refresher
source: 'images/search.png'
anchors {
bottom: parent.bottom
right: parent.right
margins: 20 * pgst.scalef
}
}
}
}
ButtonArea {
onClicked: pgst.loadPage('PlayerPage.qml');
anchors {
left: recommendationsPane.left
right: recommendationsPane.right
}
height: 100 * pgst.scalef
PLabel {
anchors.centerIn: parent
text: 'Now playing'
}
}
ButtonArea {
onClicked: pgst.loadPage('Settings.qml');
anchors {
left: recommendationsPane.left
right: recommendationsPane.right
}
height: 100 * pgst.scalef
PLabel {
anchors.centerIn: parent
text: 'Settings'
}
}
StartPageButton {
id: recommendationsPane
title: 'Recommendations'
onClicked: pgst.loadPage('Settings.qml');
Row {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
margins: 40 * pgst.scalef
}
spacing: 20 * pgst.scalef
Connections {
target: pgst
onReadyChanged: {
if (pgst.ready) {
py.call('main.load_podcasts', [], function (podcasts) {
recommendationsRepeater.model = podcasts.splice(0, 4);
});
}
}
}
Repeater {
id: recommendationsRepeater
Image { source: modelData.coverart; sourceSize { width: 80 * pgst.scalef; height: 80 * pgst.scalef } }
}
}
}
}
}

View file

@ -19,24 +19,17 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
ButtonArea {
Column {
id: startPageButton
property string title
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * .9
height: 200 * pgst.scalef
PLabel {
anchors {
right: parent.right
top: parent.top
margins: 20 * pgst.scalef
}
SectionHeader {
text: startPageButton.title
}
}

View file

@ -19,28 +19,29 @@
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
SlidePage {
Page {
id: subscribe
SlidePageHeader { title: 'Add subscription' }
PageHeader { title: 'Add subscription' }
Column {
anchors.centerIn: parent
spacing: 30 * pgst.scalef
PTextField {
TextField {
id: input
width: subscribe.width *.8
placeholderText: 'Feed URL'
}
ButtonArea {
BackgroundItem {
id: button
width: input.width
height: input.height
PLabel {
Label {
anchors.centerIn: parent
text: 'Subscribe'
}
@ -50,14 +51,17 @@ SlidePage {
button.visible = false;
input.visible = false;
py.call('main.subscribe', [input.text], function () {
subscribe.closePage();
if (pageStack.currentPage == subscribe) {
pageStack.pop();
}
});
}
}
PBusyIndicator {
BusyIndicator {
id: loading
visible: false
running: visible
anchors.horizontalCenter: parent.horizontalCenter
}
}