Remove start page, Silica-ize the UI more

This commit is contained in:
Thomas Perl 2014-01-30 20:36:21 +01:00
parent 982d2347da
commit c4d4d2961b
7 changed files with 22 additions and 220 deletions

View file

@ -78,7 +78,7 @@ ListItem {
margins: 30 * pgst.scalef
}
elide: Text.ElideRight
truncationMode: TruncationMode.Fade
text: title
opacity: {
@ -96,7 +96,7 @@ ListItem {
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
margins: 30 * pgst.scalef
rightMargin: (30 * pgst.scalef) * (text != '')
}
font.pixelSize: parent.contentHeight

View file

@ -92,6 +92,11 @@ Page {
delegate: EpisodeItem {
onClicked: pgst.loadPage('EpisodeDetail.qml', {episode_id: id, title: title});
}
ViewPlaceholder {
enabled: episodeList.count == 0
text: 'No episodes'
}
}
}

View file

@ -22,14 +22,12 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.0
Page {
PodcastsPage {
id: pgst
property bool ready: false
property real scalef: width / 480
anchors.fill: parent
function update(page, x) {
var index = -1;
for (var i=0; i<children.length; i++) {
@ -99,13 +97,9 @@ Page {
}
BusyIndicator {
size: BusyIndicatorSize.Large
anchors.centerIn: parent
visible: !pgst.ready
running: visible
}
StartPage {
id: startPage
visible: pgst.ready
}
}

View file

@ -78,7 +78,7 @@ ListItem {
verticalCenter: parent.verticalCenter
}
elide: Text.ElideRight
truncationMode: TruncationMode.Fade
text: title
}
}

View file

@ -27,10 +27,10 @@ Page {
id: podcastsPage
function reload() {
loading.visible = true;
pgst.ready = false;
py.call('main.load_podcasts', [], function (podcasts) {
Util.updateModelFrom(podcastListModel, podcasts);
loading.visible = false;
pgst.ready = true;
});
}
@ -65,12 +65,6 @@ Page {
py.setHandler('updated-podcast', undefined);
}
Label {
id: loading
anchors.centerIn: parent
text: 'Loading'
}
SilicaListView {
id: podcastList
anchors.fill: parent
@ -83,6 +77,11 @@ Page {
onClicked: pgst.loadPage('PlayerPage.qml');
}
MenuItem {
text: "Settings"
onClicked: pgst.loadPage('Settings.qml');
}
MenuItem {
text: 'Check for new episodes'
onClicked: py.call('main.check_for_episodes');
@ -106,6 +105,11 @@ Page {
delegate: PodcastItem {
onClicked: pgst.loadPage('EpisodesPage.qml', {'podcast_id': id, 'title': title});
}
ViewPlaceholder {
enabled: podcastList.count == 0
text: 'No subscriptions'
}
}
}

View file

@ -1,166 +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 Sailfish.Silica 1.0
Page {
id: startPage
function update_stats() {
py.call('main.get_stats', [], function (result) {
stats.text = result;
});
py.call('main.get_fresh_episodes_summary', [3], function (episodes) {
freshEpisodesRepeater.model = episodes;
});
}
Component.onCompleted: {
py.setHandler('update-stats', startPage.update_stats);
}
Component.onDestruction: {
py.setHandler('update-stats', undefined);
}
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: {
if (pgst.ready) {
startPage.update_stats();
}
}
}
anchors.fill: parent
contentWidth: startPageColumn.width
contentHeight: startPageColumn.height + startPageColumn.spacing
Column {
id: startPageColumn
width: startPage.width
spacing: 20 * pgst.scalef
PageHeader {
title: 'gPodder'
}
SectionHeader {
text: 'Subscriptions'
}
BackgroundItem {
id: subscriptionsPane
onClicked: pgst.loadPage('PodcastsPage.qml');
width: startPage.width
height: startPage.height / 5
Label {
id: stats
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
margins: 20 * pgst.scalef
}
}
}
SectionHeader {
id: freshEpisodesHeader
text: 'Fresh episodes'
}
BackgroundItem {
id: freshEpisodesPage
height: startPage.height / 6
width: parent.width
onClicked: pgst.loadPage('FreshEpisodes.qml');
Component.onCompleted: {
py.setHandler('refreshing', function (is_refreshing) {
if (!is_refreshing) {
freshEpisodesHeader.text = 'Fresh episodes';
}
});
py.setHandler('refresh-progress', function (pos, total) {
freshEpisodesHeader.text = 'Refreshing feeds (' + pos + '/' + total + ')';
});
}
Row {
id: freshRow
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.margins: spacing
spacing: 10 * pgst.scalef
Repeater {
id: freshEpisodesRepeater
Image {
source: modelData.coverart
sourceSize { width: 80 * pgst.scalef; height: 80 * pgst.scalef }
width: 80 * pgst.scalef
height: 80 * pgst.scalef
/*
Label {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
text: modelData.newEpisodes
}
*/
}
}
}
}
}
}
}

View file

@ -1,35 +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 Sailfish.Silica 1.0
Column {
id: startPageButton
property string title
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * .9
height: 200 * pgst.scalef
SectionHeader {
text: startPageButton.title
}
}