desktop: Add/remove podcasts
This commit is contained in:
parent
cfed87916b
commit
f3fb2585dc
3 changed files with 140 additions and 8 deletions
36
desktop/dialogs/AddPodcastDialog.qml
Normal file
36
desktop/dialogs/AddPodcastDialog.qml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.0
|
||||||
|
import QtQuick.Layouts 1.0
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
|
import '../common'
|
||||||
|
import '../common/util.js' as Util
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
signal addUrl(string url)
|
||||||
|
|
||||||
|
width: 300
|
||||||
|
height: 100
|
||||||
|
title: 'Add new podcast'
|
||||||
|
standardButtons: StandardButton.Open | StandardButton.Cancel
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: 'URL:'
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: urlEntry
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
addUrl(urlEntry.text);
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
}
|
26
desktop/dialogs/EpisodeDetailsDialog.qml
Normal file
26
desktop/dialogs/EpisodeDetailsDialog.qml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.0
|
||||||
|
import QtQuick.Layouts 1.0
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
|
import '../common'
|
||||||
|
import '../common/util.js' as Util
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
property var episode
|
||||||
|
color: '#aa000000'
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: parent.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 50
|
||||||
|
readOnly: true
|
||||||
|
text: episode ? episode.description : '...'
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,16 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.0
|
import QtQuick.Controls 1.0
|
||||||
import QtQuick.Layouts 1.0
|
import QtQuick.Layouts 1.0
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
|
import 'dialogs'
|
||||||
|
|
||||||
import 'common'
|
import 'common'
|
||||||
import 'common/util.js' as Util
|
import 'common/util.js' as Util
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
id: appWindow
|
||||||
|
|
||||||
width: 500
|
width: 500
|
||||||
height: 400
|
height: 400
|
||||||
|
|
||||||
|
@ -15,47 +20,102 @@ ApplicationWindow {
|
||||||
id: py
|
id: py
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openDialog(filename, callback) {
|
||||||
|
var component = Qt.createComponent(filename);
|
||||||
|
|
||||||
|
function createDialog() {
|
||||||
|
if (component.status === Component.Ready) {
|
||||||
|
var dialog = component.createObject(appWindow, {});
|
||||||
|
dialog.visible = true;
|
||||||
|
callback(dialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.status == Component.Ready) {
|
||||||
|
createDialog();
|
||||||
|
} else {
|
||||||
|
component.statusChanged.connect(createDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
menuBar: MenuBar {
|
menuBar: MenuBar {
|
||||||
Menu { title: 'File'; MenuItem { text: 'Quit' } }
|
Menu {
|
||||||
|
title: 'File'
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
text: 'Add podcast'
|
||||||
|
onTriggered: {
|
||||||
|
openDialog('dialogs/AddPodcastDialog.qml', function (dialog) {
|
||||||
|
dialog.addUrl.connect(function (url) {
|
||||||
|
py.call('main.subscribe', [url]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
text: 'Quit'
|
||||||
|
onTriggered: Qt.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
TableView {
|
TableView {
|
||||||
|
id: podcastListView
|
||||||
|
|
||||||
width: 200
|
width: 200
|
||||||
model: GPodderPodcastListModel { id: podcastListModel }
|
model: GPodderPodcastListModel { id: podcastListModel }
|
||||||
GPodderPodcastListModelConnections {}
|
GPodderPodcastListModelConnections {}
|
||||||
headerVisible: false
|
headerVisible: false
|
||||||
alternatingRowColors: false
|
alternatingRowColors: false
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: podcastContextMenu
|
||||||
|
MenuItem {
|
||||||
|
text: 'Unsubscribe'
|
||||||
|
onTriggered: {
|
||||||
|
var podcast_id = podcastListModel.get(podcastListView.currentRow).id;
|
||||||
|
py.call('main.unsubscribe', [podcast_id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rowDelegate: Rectangle {
|
rowDelegate: Rectangle {
|
||||||
height: 60
|
height: 40
|
||||||
color: styleData.selected ? '#eee' : '#fff'
|
color: styleData.selected ? '#eee' : '#fff'
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: podcastContextMenu.popup()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TableViewColumn {
|
TableViewColumn {
|
||||||
role: 'coverart'
|
role: 'coverart'
|
||||||
title: 'Image'
|
title: 'Image'
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
height: 60
|
height: 32
|
||||||
width: 60
|
width: 32
|
||||||
Image {
|
Image {
|
||||||
source: styleData.value
|
source: styleData.value
|
||||||
width: 50
|
width: 32
|
||||||
height: 50
|
height: 32
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 60
|
width: 40
|
||||||
}
|
}
|
||||||
|
|
||||||
TableViewColumn {
|
TableViewColumn {
|
||||||
role: 'title'
|
role: 'title'
|
||||||
title: 'Podcast'
|
title: 'Podcast'
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
height: 60
|
height: 40
|
||||||
Text {
|
Text {
|
||||||
text: styleData.value
|
text: styleData.value
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
@ -75,6 +135,16 @@ ApplicationWindow {
|
||||||
GPodderEpisodeListModelConnections {}
|
GPodderEpisodeListModelConnections {}
|
||||||
|
|
||||||
TableViewColumn { role: 'title'; title: 'Title' }
|
TableViewColumn { role: 'title'; title: 'Title' }
|
||||||
|
|
||||||
|
onActivated: {
|
||||||
|
var episode_id = episodeListModel.get(currentRow).id;
|
||||||
|
|
||||||
|
openDialog('dialogs/EpisodeDetailsDialog.qml', function (dialog) {
|
||||||
|
py.call('main.show_episode', [episode_id], function (episode) {
|
||||||
|
dialog.episode = episode;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue