Warning, /plasma-bigscreen/youtube-voice-application/ui/+mediacenter/YoutubeSearch.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2018 by Aditya Mehra <aix.m@outlook.com>
0003 * Copyright 2018 Marco Martin <mart@kde.org>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013 * GNU General Public License for more details.
0014
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0017 */
0018
0019 import QtQuick 2.9
0020 import QtQuick.Layouts 1.4
0021 import QtGraphicalEffects 1.0
0022 import QtQuick.Controls 2.2
0023 import org.kde.kirigami 2.8 as Kirigami
0024 import org.kde.plasma.core 2.0 as PlasmaCore
0025 import org.kde.plasma.components 2.0 as PlasmaComponents
0026 import Mycroft 1.0 as Mycroft
0027
0028 Mycroft.Delegate {
0029 id: delegate
0030
0031 property var videoListModel: sessionData.videoListBlob.videoList
0032 property var currentSongUrl: sessionData.currenturl
0033 property var currenttitle: sessionData.currenttitle
0034 property Component highlighter: PlasmaComponents.Highlight{}
0035 property Component emptyHighlighter: Item{}
0036
0037 skillBackgroundSource: "https://source.unsplash.com/weekly?music"
0038
0039 leftPadding: 0
0040 rightPadding: 0
0041 topPadding: 0
0042 bottomPadding: 0
0043
0044 onVideoListModelChanged: {
0045 leftSearchView.forceLayout()
0046 }
0047
0048 Keys.onBackPressed: {
0049 parent.parent.parent.currentIndex--
0050 parent.parent.parent.currentItem.contentItem.forceActiveFocus()
0051 }
0052
0053 contentItem: ColumnLayout {
0054 id: recentlyPlayerColumn
0055 spacing: Kirigami.Units.smallSpacing
0056
0057 Kirigami.Heading {
0058 id: watchItemList
0059 text: "Watch More.."
0060 level: 3
0061 }
0062
0063 Kirigami.Separator {
0064 id: sept2
0065 Layout.fillWidth: true
0066 Layout.preferredHeight: 1
0067 z: 100
0068 }
0069
0070 ListView {
0071 id: leftSearchView
0072 keyNavigationEnabled: true
0073 highlight: focus ? highlighter : emptyHighlighter
0074 model: videoListModel
0075 focus: false
0076 interactive: true
0077 bottomMargin: delegate.controlBarItem.height + Kirigami.Units.largeSpacing
0078 Layout.fillWidth: true
0079 Layout.fillHeight: true
0080 spacing: Kirigami.Units.largeSpacing
0081 currentIndex: 0
0082 highlightRangeMode: ListView.StrictlyEnforceRange
0083 snapMode: ListView.SnapToItem
0084
0085 delegate: Control {
0086 width: parent.width
0087 height: Kirigami.Units.gridUnit * 4
0088
0089 background: PlasmaCore.FrameSvgItem {
0090 id: frame
0091 anchors {
0092 fill: parent
0093 }
0094 imagePath: "widgets/background"
0095
0096 width: parent.width
0097 height: parent.height
0098 opacity: 0.9
0099 }
0100
0101
0102 contentItem: Item {
0103 width: parent.width
0104 height: parent.height
0105
0106 RowLayout {
0107 id: delegateItem
0108 anchors.fill: parent
0109 anchors.margins: Kirigami.Units.smallSpacing
0110 spacing: Kirigami.Units.largeSpacing
0111
0112 Image {
0113 id: videoImage
0114 source: modelData.videoImage
0115 Layout.preferredHeight: parent.height
0116 Layout.preferredWidth: Kirigami.Units.gridUnit * 4
0117 Layout.alignment: Qt.AlignHCenter
0118 fillMode: Image.Stretch
0119 }
0120
0121 Label {
0122 id: videoLabel
0123 Layout.fillWidth: true
0124 text: modelData.videoTitle
0125 wrapMode: Text.WordWrap
0126 }
0127 }
0128 }
0129
0130 Keys.onReturnPressed: {
0131 Mycroft.MycroftController.sendRequest("aiix.youtube-skill.playvideo_id", {vidID: modelData.videoID, vidTitle: modelData.videoTitle, vidImage: modelData.videoImage, vidChannel: modelData.videoChannel, vidViews: modelData.videoViews, vidUploadDate: modelData.videoUploadDate, vidDuration: modelData.videoDuration})
0132 }
0133 }
0134 }
0135 }
0136
0137 Component.onCompleted: {
0138 leftSearchView.forceActiveFocus()
0139 }
0140 }
0141