feat: add KDE Plasma podcast plasmoid
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import QtQuick
|
||||
import org.kde.plasma.configuration
|
||||
|
||||
ConfigModel {
|
||||
ConfigCategory {
|
||||
name: i18n("Podcast")
|
||||
icon: "audio-x-generic"
|
||||
source: "configGeneral.qml"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kirigami as Kirigami
|
||||
import "../ui/podcastCatalog.js" as PodcastCatalog
|
||||
|
||||
Kirigami.FormLayout {
|
||||
id: page
|
||||
|
||||
property alias cfg_favoritePodcastIds: favoriteIds.text
|
||||
property alias cfg_maxEpisodes: maxEpisodes.value
|
||||
property alias cfg_refreshIntervalSec: refreshInterval.value
|
||||
property alias cfg_favoritesOnly: favoritesOnly.checked
|
||||
|
||||
function selectedIds() {
|
||||
return favoriteIds.text.split(",").map(function (id) { return id.trim() }).filter(function (id) { return id.length > 0 })
|
||||
}
|
||||
|
||||
function hasId(id) {
|
||||
return selectedIds().indexOf(String(id)) >= 0
|
||||
}
|
||||
|
||||
function toggleId(id, enabled) {
|
||||
var ids = selectedIds()
|
||||
var value = String(id)
|
||||
var index = ids.indexOf(value)
|
||||
if (enabled && index < 0)
|
||||
ids.push(value)
|
||||
else if (!enabled && index >= 0)
|
||||
ids.splice(index, 1)
|
||||
favoriteIds.text = ids.join(",")
|
||||
}
|
||||
|
||||
QQC2.TextField {
|
||||
id: favoriteIds
|
||||
Kirigami.FormData.label: i18n("Preferiti:")
|
||||
placeholderText: i18n("Seleziona dall'elenco sotto")
|
||||
visible: false
|
||||
}
|
||||
|
||||
QQC2.Label {
|
||||
Kirigami.FormData.label: i18n("Programmi:")
|
||||
text: i18n("Seleziona i programmi da mettere in cima alla lista.")
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.maximumWidth: 440
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Kirigami.FormData.label: ""
|
||||
Layout.preferredWidth: 440
|
||||
Layout.preferredHeight: 240
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
border.color: Kirigami.Theme.disabledTextColor
|
||||
radius: 4
|
||||
|
||||
QQC2.ScrollView {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 6
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 2
|
||||
|
||||
Repeater {
|
||||
model: PodcastCatalog.catalog
|
||||
delegate: QQC2.CheckBox {
|
||||
width: parent.width
|
||||
text: modelData.title + " (" + modelData.id + ")"
|
||||
checked: page.hasId(modelData.id)
|
||||
onClicked: page.toggleId(modelData.id, checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QQC2.SpinBox {
|
||||
id: maxEpisodes
|
||||
Kirigami.FormData.label: i18n("Episodi da mostrare:")
|
||||
from: 1
|
||||
to: 30
|
||||
}
|
||||
|
||||
QQC2.SpinBox {
|
||||
id: refreshInterval
|
||||
Kirigami.FormData.label: i18n("Aggiornamento (secondi):")
|
||||
from: 120
|
||||
to: 86400
|
||||
stepSize: 60
|
||||
editable: true
|
||||
}
|
||||
|
||||
QQC2.CheckBox {
|
||||
id: favoritesOnly
|
||||
Kirigami.FormData.label: i18n("Filtro:")
|
||||
text: i18n("Mostra solo i preferiti")
|
||||
}
|
||||
|
||||
QQC2.Label {
|
||||
Kirigami.FormData.label: ""
|
||||
text: i18n("Le credenziali vengono richieste nel widget e conservate in KWallet, non nella configurazione Plasma.")
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.maximumWidth: 440
|
||||
color: Kirigami.Theme.disabledTextColor
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0">
|
||||
<kcfgfile name=""/>
|
||||
<group name="General">
|
||||
<entry name="favoritePodcastIds" type="String">
|
||||
<default></default>
|
||||
<label>ID dei programmi preferiti</label>
|
||||
</entry>
|
||||
<entry name="maxEpisodes" type="Int">
|
||||
<default>8</default>
|
||||
<min>1</min>
|
||||
<max>30</max>
|
||||
<label>Numero massimo di episodi</label>
|
||||
</entry>
|
||||
<entry name="refreshIntervalSec" type="Int">
|
||||
<default>900</default>
|
||||
<min>120</min>
|
||||
<max>86400</max>
|
||||
<label>Intervallo aggiornamento (secondi)</label>
|
||||
</entry>
|
||||
<entry name="favoritesOnly" type="Bool">
|
||||
<default>false</default>
|
||||
<label>Mostra solo i programmi preferiti</label>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
Reference in New Issue
Block a user