From 579b88cdac1e1f6b0212282fd905c984227adcee Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Sat, 15 Mar 2014 20:30:34 +0100 Subject: [PATCH] Remove start page --- touch/AboutPage.qml | 40 +++++--- touch/Directory.qml | 20 ++-- touch/Main.qml | 3 +- touch/PTextField.qml | 11 +- touch/PodcastsPage.qml | 19 ++++ touch/SelectionDialog.qml | 4 +- touch/StartPage.qml | 211 -------------------------------------- touch/StartPageButton.qml | 42 -------- touch/Subscribe.qml | 21 ++-- 9 files changed, 79 insertions(+), 292 deletions(-) delete mode 100644 touch/StartPage.qml delete mode 100644 touch/StartPageButton.qml diff --git a/touch/AboutPage.qml b/touch/AboutPage.qml index 8d86d8e..ac8691b 100644 --- a/touch/AboutPage.qml +++ b/touch/AboutPage.qml @@ -20,6 +20,8 @@ import QtQuick 2.0 +import 'common/constants.js' as Constants + SlidePage { id: aboutPage @@ -35,35 +37,39 @@ SlidePage { id: detailColumn width: aboutPage.width - spacing: 5 * pgst.scalef + spacing: 15 * pgst.scalef SlidePageHeader { title: 'About gPodder' } - SectionHeader { - text: 'How to use' + Column { width: parent.width + + PLabel { + width: parent.width * .95 + font.pixelSize: 30 * pgst.scalef + anchors.horizontalCenter: parent.horizontalCenter + wrapMode: Text.WordWrap + text: 'gPodder ' + py.uiversion + color: Constants.colors.highlight + } + + PLabel { + width: parent.width * .95 + font.pixelSize: 20 * pgst.scalef + anchors.horizontalCenter: parent.horizontalCenter + wrapMode: Text.WordWrap + text: 'http://gpodder.org/' + color: Constants.colors.placeholder + } } PLabel { - width: parent.width * .9 + width: parent.width * .95 font.pixelSize: 30 * pgst.scalef anchors.horizontalCenter: parent.horizontalCenter wrapMode: Text.WordWrap - text: 'Swipe left on a page to reveal the menu for that page. Go back by swiping pages to the right.\n\nAdd subscriptions via their feed URL or use gpodder.net to search for podcasts.' - } - - SectionHeader { - text: 'More information' - width: parent.width - } - - PLabel { - width: parent.width * .9 - font.pixelSize: 20 * pgst.scalef - anchors.horizontalCenter: parent.horizontalCenter - wrapMode: Text.WordWrap text: [ '© 2005-2014 Thomas Perl and the gPodder Team', 'License: ISC / GPLv3 or later', diff --git a/touch/Directory.qml b/touch/Directory.qml index a98705e..f47f937 100644 --- a/touch/Directory.qml +++ b/touch/Directory.qml @@ -25,10 +25,20 @@ import 'common' SlidePage { id: directory + function search(text) { + loading.visible = true; + directorySearchModel.search(text, function() { + loading.visible = false; + }); + } + ListView { + id: listView + anchors.fill: parent boundsBehavior: Flickable.StopAtBounds - PScrollDecorator {} + + PScrollDecorator { flickable: listView } model: GPodderDirectorySearchModel { id: directorySearchModel } @@ -53,6 +63,7 @@ SlidePage { id: input width: parent.width placeholderText: 'Search term' + onAccepted: directory.search(input.text); } ButtonArea { @@ -65,12 +76,7 @@ SlidePage { text: 'Search' } - onClicked: { - loading.visible = true; - directorySearchModel.search(input.text, function() { - loading.visible = false; - }); - } + onClicked: directory.search(input.text); } } } diff --git a/touch/Main.qml b/touch/Main.qml index 748dece..fc282c9 100644 --- a/touch/Main.qml +++ b/touch/Main.qml @@ -130,8 +130,7 @@ Item { onClicked: loadPage('PlayerPage.qml'); } - StartPage { - id: startPage + PodcastsPage { visible: py.ready } } diff --git a/touch/PTextField.qml b/touch/PTextField.qml index 9506604..4533ebe 100644 --- a/touch/PTextField.qml +++ b/touch/PTextField.qml @@ -27,25 +27,30 @@ Item { property alias text: textInput.text property string placeholderText: '' + signal accepted height: 50 * pgst.scalef TextInput { anchors { - fill: parent + verticalCenter: parent.verticalCenter + left: parent.left + right: parent.right margins: 5 * pgst.scalef } color: Constants.colors.text selectionColor: Constants.colors.background id: textInput - font.pixelSize: height + font.pixelSize: parent.height * 0.7 font.family: placeholder.font.family + focus: true + onAccepted: textField.accepted() } PLabel { id: placeholder anchors.fill: textInput - visible: !textInput.focus && (textInput.text == '') + visible: (textInput.text == '') text: textField.placeholderText color: Constants.colors.placeholder font.pixelSize: textInput.font.pixelSize diff --git a/touch/PodcastsPage.qml b/touch/PodcastsPage.qml index b085d3a..916b51a 100644 --- a/touch/PodcastsPage.qml +++ b/touch/PodcastsPage.qml @@ -27,6 +27,7 @@ import 'common/constants.js' as Constants SlidePage { id: podcastsPage + canClose: false PListView { id: podcastList @@ -45,12 +46,30 @@ SlidePage { py.call('main.check_for_episodes'); } }, + { + label: 'Filter episodes', + callback: function () { + pgst.loadPage('EpisodeQueryPage.qml'); + } + }, + { + label: 'About', + callback: function () { + pgst.loadPage('AboutPage.qml'); + }, + }, { label: 'Add new podcast', callback: function () { pgst.loadPage('Subscribe.qml'); }, }, + { + label: 'Search gpodder.net', + callback: function () { + pgst.loadPage('Directory.qml'); + }, + }, ]); } diff --git a/touch/SelectionDialog.qml b/touch/SelectionDialog.qml index e4e1a37..b023594 100644 --- a/touch/SelectionDialog.qml +++ b/touch/SelectionDialog.qml @@ -54,6 +54,8 @@ Dialog { model: selectionDialog.items delegate: ButtonArea { + id: buttonArea + width: parent.width height: 60 * pgst.scalef @@ -67,7 +69,7 @@ Dialog { } text: modelData - color: (index == selectionDialog.selectedIndex) ? Constants.colors.highlight : Constants.colors.text + color: (index == selectionDialog.selectedIndex || buttonArea.pressed) ? Constants.colors.highlight : Constants.colors.text } onClicked: { diff --git a/touch/StartPage.qml b/touch/StartPage.qml deleted file mode 100644 index 2902627..0000000 --- a/touch/StartPage.qml +++ /dev/null @@ -1,211 +0,0 @@ - -/** - * - * gPodder QML UI Reference Implementation - * Copyright (c) 2013, Thomas Perl - * - * 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 'icons/icons.js' as Icons -import 'common/constants.js' as Constants -import 'common/util.js' as Util - -SlidePage { - id: startPage - canClose: false - - function update_stats() { - py.call('main.get_stats', [], function (result) { - stats.text = Util.format( - '{podcasts} podcasts\n' + - '{episodes} episodes\n' + - '{newEpisodes} new episodes\n' + - '{downloaded} downloaded', - result); - }); - - py.call('main.get_fresh_episodes_summary', [3], function (episodes) { - freshEpisodesRepeater.model = episodes; - }); - } - - Item { - Connections { - target: py - onUpdateStats: startPage.update_stats(); - } - } - - Flickable { - id: flickable - boundsBehavior: Flickable.StopAtBounds - - Connections { - target: py - onReadyChanged: { - if (py.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 - - SlidePageHeader { - title: 'gPodder' - } - - StartPageButton { - id: subscriptionsPane - - title: 'Subscriptions' - onClicked: pgst.loadPage('PodcastsPage.qml'); - - PLabel { - id: stats - - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - 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 - - PIcon { - id: subscriptions - icon: Icons.plus - color: Constants.colors.download - - anchors { - bottom: parent.bottom - right: parent.right - margins: 20 * pgst.scalef - } - } - } - } - - StartPageButton { - id: freshEpisodes - - title: py.refreshing ? 'Refreshing feeds' : 'Episodes' - onClicked: pgst.loadPage('EpisodeQueryPage.qml'); - - Row { - id: freshEpisodesRow - - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 * pgst.scalef - anchors.leftMargin: 20 * pgst.scalef - anchors.left: parent.left - spacing: 10 * pgst.scalef - - PLabel { - color: Constants.colors.placeholder - text: 'No fresh episodes' - visible: freshEpisodesRepeater.count == 0 - } - - Repeater { - id: freshEpisodesRepeater - - CoverArt { - source: modelData.coverart - text: modelData.title - - width: 80 * pgst.scalef - height: 80 * pgst.scalef - } - } - } - - ButtonArea { - id: refresherButtonArea - visible: !py.refreshing - - 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 - - PIcon { - id: refresher - icon: Icons.loop_alt2 - color: Constants.colors.highlight - - anchors { - bottom: parent.bottom - right: parent.right - margins: 20 * pgst.scalef - } - } - } - } - - Repeater { - model: ListModel { - ListElement { caption: 'gpodder.net'; target: 'Directory.qml' } - ListElement { caption: 'Help'; target: 'AboutPage.qml' } - } - - delegate: ButtonArea { - onClicked: pgst.loadPage(target) - - anchors { - left: freshEpisodes.left - right: freshEpisodes.right - } - - height: 80 * pgst.scalef - - PLabel { - anchors.centerIn: parent - text: caption - } - } - } - } - } - - PScrollDecorator { flickable: flickable } -} - diff --git a/touch/StartPageButton.qml b/touch/StartPageButton.qml deleted file mode 100644 index 7c4917e..0000000 --- a/touch/StartPageButton.qml +++ /dev/null @@ -1,42 +0,0 @@ - -/** - * - * gPodder QML UI Reference Implementation - * Copyright (c) 2013, Thomas Perl - * - * 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 - -ButtonArea { - 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 - } - - text: startPageButton.title - } -} - diff --git a/touch/Subscribe.qml b/touch/Subscribe.qml index 1c99829..4238533 100644 --- a/touch/Subscribe.qml +++ b/touch/Subscribe.qml @@ -27,16 +27,26 @@ Dialog { contentHeight: contentColumn.height + function accepted() { + loading.visible = true; + button.visible = false; + input.visible = false; + py.call('main.subscribe', [input.text], function () { + subscribe.closePage(); + }); + } + Column { id: contentColumn anchors.centerIn: parent - spacing: 30 * pgst.scalef + spacing: 20 * pgst.scalef PTextField { id: input width: subscribe.width *.8 placeholderText: 'Feed URL' + onAccepted: subscribe.accepted(); } ButtonArea { @@ -49,14 +59,7 @@ Dialog { text: 'Subscribe' } - onClicked: { - loading.visible = true; - button.visible = false; - input.visible = false; - py.call('main.subscribe', [input.text], function () { - subscribe.closePage(); - }); - } + onClicked: subscribe.accepted(); } PBusyIndicator {