diff --git a/gpodder-core b/gpodder-core index 3f75aaf..dc92d3c 160000 --- a/gpodder-core +++ b/gpodder-core @@ -1 +1 @@ -Subproject commit 3f75aaf9ceda24dfede262a218168d28a163cba1 +Subproject commit dc92d3c1154ded37e76d7e57024950a5c23e5088 diff --git a/gpodder-ui-qml b/gpodder-ui-qml index 77bac09..4680751 160000 --- a/gpodder-ui-qml +++ b/gpodder-ui-qml @@ -1 +1 @@ -Subproject commit 77bac09899d07aa51579759dc42499e485edf424 +Subproject commit 4680751494b5fcbc2fd29f179d6b09751a27801d diff --git a/podcastparser b/podcastparser index 378327c..f98acd2 160000 --- a/podcastparser +++ b/podcastparser @@ -1 +1 @@ -Subproject commit 378327cc793223326cb87bb8f8f1a9819225fa95 +Subproject commit f98acd22b14bc8459f7f695cf5fd6fad50324b8f diff --git a/qml/Directory.qml b/qml/Directory.qml index e98e087..176d4d4 100644 --- a/qml/Directory.qml +++ b/qml/Directory.qml @@ -26,9 +26,18 @@ import 'common' Page { id: directory + property string provider + property string query: '-' property var callback - function start(query, callback) { + Component.onCompleted: { + if (directory.query !== '-') { + directory.start(directory.provider, directory.query, directory.callback); + } + } + + function start(provider, query, callback) { + directory.provider = provider; directory.callback = callback; directorySearchModel.search(query, function() { busyIndicator.visible = false; @@ -39,12 +48,12 @@ Page { anchors.fill: parent header: PageHeader { - title: 'Search results' + title: directory.provider } VerticalScrollDecorator { } - model: GPodderDirectorySearchModel { id: directorySearchModel } + model: GPodderDirectorySearchModel { id: directorySearchModel; provider: directory.provider } delegate: DirectoryItem { onClicked: { diff --git a/qml/DirectoryDialog.qml b/qml/DirectoryDialog.qml index b68a49e..b15abe7 100644 --- a/qml/DirectoryDialog.qml +++ b/qml/DirectoryDialog.qml @@ -23,23 +23,24 @@ import Sailfish.Silica 1.0 Dialog { id: directory + + property string provider + property var callback + canAccept: input.text != '' acceptDestination: Component { Directory { } } acceptDestinationAction: PageStackAction.Replace onAccepted: { - var ctx = { py: py }; - acceptDestinationInstance.start(input.text, function (url) { - ctx.py.call('main.subscribe', [url]); - }); + acceptDestinationInstance.start(directory.provider, input.text, directory.callback); } Column { anchors.fill: parent DialogHeader { - title: 'Search gpodder.net' + title: directory.provider acceptText: 'Search' } diff --git a/qml/DirectoryItem.qml b/qml/DirectoryItem.qml index 6ce93be..73b2721 100644 --- a/qml/DirectoryItem.qml +++ b/qml/DirectoryItem.qml @@ -34,7 +34,7 @@ ListItem { Image { id: cover - opacity: scaled_logo_url && status == Image.Ready + opacity: image && status == Image.Ready Behavior on opacity { FadeAnimation { } } anchors { @@ -49,7 +49,7 @@ ListItem { width: Theme.iconSizeMedium height: Theme.iconSizeMedium - source: scaled_logo_url + source: image } Rectangle { @@ -73,12 +73,24 @@ ListItem { anchors { left: cover.right leftMargin: Theme.paddingSmall - rightMargin: Theme.paddingSmall - right: parent.right + rightMargin: subs.text ? Theme.paddingSmall : 0 + right: subs.left verticalCenter: parent.verticalCenter } truncationMode: TruncationMode.Fade text: title } + + Label { + id: subs + + anchors { + right: parent.right + rightMargin: Theme.paddingSmall + verticalCenter: parent.verticalCenter + } + + text: (subscribers > 0) ? subscribers : '' + } } diff --git a/qml/DirectorySelectionDialog.qml b/qml/DirectorySelectionDialog.qml new file mode 100644 index 0000000..0f1b699 --- /dev/null +++ b/qml/DirectorySelectionDialog.qml @@ -0,0 +1,86 @@ + +/** + * + * gPodder QML UI Reference Implementation + * Copyright (c) 2014, 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 Sailfish.Silica 1.0 + +Page { + id: directorySelectionDialog + + property var model + property int selectedIndex: -1 + + Component.onCompleted: { + py.call('main.get_directory_providers', [], function (result) { + directorySelectionDialog.model = result; + }); + } + + SilicaListView { + anchors.fill: parent + + header: PageHeader { + title: 'Select provider' + } + + model: directorySelectionDialog.model + + delegate: ListItem { + id: listItem + + highlighted: down || (index == directorySelectionDialog.selectedIndex) + + onClicked: { + directorySelectionDialog.selectedIndex = index; + var callback = (function (py) { + return (function (url) { + py.call('main.subscribe', [url]); + }); + })(py); + + if (!modelData.can_search) { + pgst.loadPage('Directory.qml', { + provider: modelData.label, + query: '', + callback: callback, + }, true); + } else { + pgst.loadPage('DirectoryDialog.qml', { + provider: modelData.label, + callback: callback, + }, true); + } + } + + Label { + anchors { + left: parent.left + verticalCenter: parent.verticalCenter + margins: Theme.paddingMedium + } + + color: listItem.highlighted ? Theme.highlightColor : Theme.primaryColor + text: modelData.label + } + } + + VerticalScrollDecorator { } + } +} diff --git a/qml/EpisodeQueryControl.qml b/qml/EpisodeQueryControl.qml deleted file mode 100644 index 63a2399..0000000 --- a/qml/EpisodeQueryControl.qml +++ /dev/null @@ -1,46 +0,0 @@ - -/** - * - * gPodder QML UI Reference Implementation - * Copyright (c) 2014, 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 - -Item { - id: episodeQueryControl - - property var model - property string title - - function showSelectionDialog() { - pgst.loadPage('SelectionDialog.qml', { - title: episodeQueryControl.title, - callback: function (index, result) { - episodeQueryControl.model.currentFilterIndex = index; - episodeQueryControl.model.reload(); - }, - items: function () { - var labels = []; - for (var i in episodeQueryControl.model.filters) { - labels.push(episodeQueryControl.model.filters[i].label); - } - return labels; - }(), - selectedIndex: episodeQueryControl.model.currentFilterIndex, - }); - } -} diff --git a/qml/PodcastsPage.qml b/qml/PodcastsPage.qml index 341e7ac..82752c6 100644 --- a/qml/PodcastsPage.qml +++ b/qml/PodcastsPage.qml @@ -60,8 +60,8 @@ Page { } MenuItem { - text: 'Search gpodder.net' - onClicked: pgst.loadPage('DirectoryDialog.qml'); + text: 'Discover new podcasts' + onClicked: pgst.loadPage('DirectorySelectionDialog.qml'); } }