Warning, /multimedia/plasmatube/src/ui/settings/SourcesPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im> 0002 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu> 0003 // SPDX-License-Identifier: GPL-3.0-or-later 0004 0005 import QtQuick 0006 import QtQuick.Layouts 0007 import QtQuick.Window 0008 import QtQuick.Controls as QQC2 0009 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.kirigamiaddons.formcard as FormCard 0012 import org.kde.coreaddons as KCoreAddons 0013 0014 import org.kde.plasmatube 0015 import org.kde.plasmatube.private 0016 import org.kde.plasmatube.invidious 0017 0018 FormCard.FormCardPage { 0019 id: root 0020 0021 title: i18n("Sources") 0022 0023 FormCard.FormCard { 0024 Layout.fillWidth: true 0025 Layout.topMargin: Kirigami.Units.largeSpacing 0026 0027 Repeater { 0028 model: PlasmaTube.sourceManager 0029 0030 ColumnLayout { 0031 required property var source 0032 required property int index 0033 0034 spacing: 0 0035 0036 FormCard.FormDelegateSeparator { 0037 visible: index !== 0 0038 } 0039 0040 FormCard.FormButtonDelegate { 0041 text: source.url 0042 0043 icon.name: { 0044 switch (source.type) { 0045 case VideoSource.Invidious: 0046 return "plasmatube-invidious"; 0047 case VideoSource.PeerTube: 0048 return "plasmatube-peertube"; 0049 case VideoSource.Piped: 0050 return "plasmatube-piped"; 0051 } 0052 } 0053 0054 description: { 0055 switch (source.type) { 0056 case VideoSource.Invidious: 0057 return i18n("Invidious"); 0058 case VideoSource.PeerTube: 0059 return i18n("PeerTube"); 0060 case VideoSource.Piped: 0061 return i18n("Piped"); 0062 } 0063 } 0064 0065 onClicked: { 0066 let pageName; 0067 switch (source.type) { 0068 case VideoSource.Invidious: 0069 pageName = "InvidiousSourcePage"; 0070 break; 0071 case VideoSource.PeerTube: 0072 pageName = "PeerTubeSourcePage"; 0073 break; 0074 case VideoSource.Piped: 0075 pageName = "PipedSourcePage"; 0076 break; 0077 } 0078 0079 root.Window.window.pageStack.layers.push(Qt.createComponent("org.kde.plasmatube", pageName), { 0080 source 0081 }) 0082 } 0083 } 0084 } 0085 } 0086 } 0087 0088 FormCard.FormCard { 0089 Layout.topMargin: Kirigami.Units.gridUnit 0090 0091 FormCard.FormButtonDelegate { 0092 text: i18n("Add Source") 0093 icon.name: "list-add" 0094 onClicked: root.Window.window.pageStack.pushDialogLayer(Qt.createComponent("org.kde.plasmatube", "WelcomePage"), {}, { title: i18nc("@title:window", "Welcome") }) 0095 } 0096 } 0097 }