Warning, /plasma-bigscreen/soundcloud-voice-application/ui/SoundcloudSearch.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.4
0020 import QtQuick.Layouts 1.4
0021 import QtGraphicalEffects 1.0
0022 import QtQuick.Controls 2.2
0023 import org.kde.kirigami 2.4 as Kirigami
0024 
0025 import Mycroft 1.0 as Mycroft
0026 
0027 Mycroft.ScrollableDelegate {
0028     id: delegate
0029 
0030     property var scSearchModel: JSON.parse(sessionData.scSearchBlob)
0031     property var scCurrentSongUrl: sessionData.audioSource
0032     property var scCurrentTitle: sessionData.audioTitle
0033 
0034     skillBackgroundSource: "https://source.unsplash.com/1920x1080/?+music"
0035     
0036     ToolButton {
0037         id: topbutton
0038         anchors.top: parent.top
0039         anchors.topMargin: Kirigami.Units.largeSpacing
0040         anchors.left: parent.left
0041         anchors.leftMargin: Kirigami.Units.largeSpacing
0042         width: Kirigami.Units.iconSizes.medium
0043         height: Kirigami.Units.iconSizes.medium
0044 
0045         background: Rectangle {
0046             color: "transparent"
0047         }
0048 
0049         contentItem: Image {
0050             width: Kirigami.Units.iconSizes.smallMedium
0051             height: Kirigami.Units.iconSizes.smallMedium
0052             source: "images/back.png"
0053         }
0054         onClicked: {
0055             root.parent.backRequested()
0056         }
0057     }
0058     
0059     Kirigami.CardsListView {
0060         anchors.top: topbutton.bottom
0061         anchors.topMargin: Kirigami.Units.largeSpacing
0062         model: scSearchModel
0063         delegate: Kirigami.AbstractCard {
0064             showClickFeedback: true
0065             Layout.fillWidth: true
0066             implicitHeight: delegateItem.implicitHeight + Kirigami.Units.largeSpacing * 3
0067             highlighted: modelData.url == scCurrentSongUrl ? 1 : 0
0068             contentItem: Item {
0069                 implicitWidth: parent.implicitWidth
0070                 implicitHeight: parent.implicitHeight
0071                 z: 1000
0072 
0073                 RowLayout {
0074                     id: delegateItem
0075                     anchors {
0076                         left: parent.left
0077                         right: parent.right
0078                         top: parent.top
0079                     }
0080                     spacing: Kirigami.Units.largeSpacing
0081 
0082                     Image {
0083                         id: videoImage
0084                         source: modelData.thumbnail
0085                         Layout.preferredHeight: Kirigami.Units.gridUnit * 3
0086                         Layout.preferredWidth: Kirigami.Units.gridUnit * 3
0087                         fillMode: Image.Stretch
0088                     }
0089 
0090                     Kirigami.Separator {
0091                         Layout.fillHeight: true
0092                         color: Kirigami.Theme.linkColor
0093                     }
0094 
0095                     Label {
0096                         id: videoLabel
0097                         Layout.fillWidth: true
0098                         text: modelData.title
0099                         wrapMode: Text.WordWrap
0100                     }
0101                 }
0102             }
0103                 onClicked: {
0104                     triggerGuiEvent("aiix.soundcloud-audio-player.playtitle", {playtitle: modelData.title})
0105             }
0106         }
0107     }
0108 }
0109