Warning, /multimedia/plasmatube/src/ui/ChannelPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: none
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtQuick.Controls as QQC2
0007 
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamiaddons.components as KirigamiComponents
0010 
0011 import org.kde.plasmatube
0012 import "components/utils.js" as Utils
0013 import "components"
0014 
0015 Kirigami.ScrollablePage {
0016     id: root
0017 
0018     required property string author
0019     required property string authorId
0020 
0021     title: author
0022 
0023     leftPadding: 0
0024     rightPadding: 0
0025     topPadding: 0
0026     bottomPadding: 0
0027 
0028     supportsRefreshing: true
0029     onRefreshingChanged: {
0030         if (refreshing && !videoModel.isLoading) {
0031             videoModel.refresh();
0032         }
0033     }
0034 
0035     header: KirigamiComponents.Banner {
0036         id: message
0037         type: Kirigami.MessageType.Error
0038         width: parent.width
0039 
0040         showCloseButton: true
0041 
0042         actions: Kirigami.Action {
0043             text: i18n("Proxy Settings")
0044             icon.name: "settings-configure"
0045             onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.plasmatube", "NetworkProxyPage"))
0046         }
0047     }
0048 
0049     Kirigami.Theme.colorSet: Kirigami.Theme.View
0050 
0051     ChannelController {
0052         id: channelController
0053     }
0054 
0055     BaseGridView {
0056         id: gridView
0057 
0058         header: ColumnLayout {
0059             width: parent.width
0060 
0061             spacing: 0
0062 
0063             Rectangle {
0064                 Layout.preferredHeight: Kirigami.Units.gridUnit * 7
0065                 Layout.fillWidth: true
0066                 clip: true
0067                 color: Kirigami.Theme.backgroundColor
0068                 Kirigami.Theme.colorSet: Kirigami.Theme.View
0069 
0070                 Image {
0071                     anchors.centerIn: parent
0072                     source: channelController.banner
0073                     fillMode: Image.PreserveAspectFit
0074                 }
0075             }
0076 
0077             RowLayout {
0078                 Layout.leftMargin: Kirigami.Units.largeSpacing
0079                 Layout.rightMargin: Kirigami.Units.largeSpacing
0080                 Layout.topMargin: Kirigami.Units.smallSpacing
0081                 Layout.bottomMargin: Kirigami.Units.smallSpacing
0082                 Item {
0083                     Layout.minimumWidth: Kirigami.Units.gridUnit * 5
0084                     Layout.alignment: Qt.AlignBottom
0085                     KirigamiComponents.Avatar {
0086                         anchors {
0087                             left: parent.left
0088                             bottom: parent.bottom
0089                         }
0090                         cache: true
0091                         source: channelController.avatar
0092                         width: Kirigami.Units.gridUnit * 5
0093                         height: Kirigami.Units.gridUnit * 5
0094                     }
0095                 }
0096 
0097                 Item {
0098                     Layout.fillWidth: true
0099                 }
0100 
0101                 SubscriptionButton {
0102                     channelId: root.authorId
0103                     subCountText: Utils.formatCount(channelController.subCount)
0104                 }
0105             }
0106 
0107             Kirigami.Heading {
0108                 Layout.fillWidth: true
0109                 Layout.leftMargin: Kirigami.Units.largeSpacing
0110                 Layout.rightMargin: Kirigami.Units.largeSpacing
0111                 text: channelController.name
0112             }
0113             QQC2.TextArea {
0114                 text: channelController.description
0115                 textFormat: TextEdit.RichText
0116                 readOnly: true
0117                 Layout.fillWidth: true
0118                 Layout.leftMargin: Kirigami.Units.largeSpacing
0119                 Layout.rightMargin: Kirigami.Units.largeSpacing
0120                 Layout.topMargin: Kirigami.Units.smallSpacing
0121                 Layout.bottomMargin: Kirigami.Units.smallSpacing
0122                 leftPadding: 0
0123                 rightPadding: 0
0124                 bottomPadding: 0
0125                 topPadding: 0
0126                 background: null
0127                 wrapMode: Text.WordWrap
0128                 onLinkActivated: (link) => applicationWindow().navigateLink(link, true)
0129                 onHoveredLinkChanged: if (hoveredLink.length > 0) {
0130                     applicationWindow().hoverLinkIndicator.text = hoveredLink;
0131                 } else {
0132                     applicationWindow().hoverLinkIndicator.text = "";
0133                 }
0134 
0135                 MouseArea {
0136                     anchors.fill: parent
0137                     acceptedButtons: Qt.NoButton // don't eat clicks on the Text
0138                     cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
0139                 }
0140             }
0141         }
0142 
0143         model: VideoListModel {
0144             id: videoModel
0145         }
0146     }
0147 
0148     Component.onCompleted: {
0149         videoModel.requestChannel(authorId);
0150         channelController.loadChannel(authorId);
0151     }
0152 }