Files
ilpost-podcasts-plasmoid/package/contents/config/configGeneral.qml
T

108 lines
3.0 KiB
QML

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
}
}