Warning, /multimedia/amarok/src/context/applets/currenttrack/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /****************************************************************************************
0002  * Copyright (c) 2017 Malte Veerman <malte.veerman@gmail.com>                           *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 import QtQuick 2.4
0018 import QtQuick.Controls 2.0
0019 import QtQuick.Layouts 1.3
0020 import org.kde.kirigami 2.0 as Kirigami
0021 import org.kde.amarok.qml 1.0 as AmarokQml
0022 import org.kde.amarok.currenttrack 1.0
0023 
0024 AmarokQml.Applet {
0025     id: applet
0026 
0027     //album art
0028     Loader {
0029         id: cover
0030 
0031         height: parent.height
0032         width: height
0033 
0034         sourceComponent: CurrentTrackEngine.hasValidCover ? coverComponent : emptyComponent
0035     }
0036 
0037     ColumnLayout {
0038         anchors {
0039             left: cover.right
0040             leftMargin: applet.spacing
0041             right: parent.right
0042             top: parent.top
0043             bottom: parent.bottom
0044         }
0045 
0046         RowLayout {
0047             Layout.fillWidth: true
0048             Layout.fillHeight: true
0049             Layout.alignment: Qt.AlignTop
0050 
0051             InfoItem {
0052                 id: infoItem
0053 
0054                 Layout.fillHeight: true
0055                 Layout.fillWidth: true
0056                 Layout.alignment: Qt.AlignLeft
0057             }
0058             AmarokQml.RatingItem {
0059                 id: ratingItem
0060 
0061                 Layout.preferredWidth: height * 6
0062                 Layout.preferredHeight: parent.height / 5
0063                 Layout.alignment: Qt.AlignTop | Qt.AlignRight
0064                 rating: CurrentTrackEngine.rating
0065                 onClicked: CurrentTrackEngine.rating = newRating
0066             }
0067         }
0068         StatsItem {
0069             id: statsItem
0070 
0071             Layout.fillWidth: true
0072             Layout.alignment: Qt.AlignBottom
0073             Layout.preferredHeight: parent.height / 5
0074         }
0075     }
0076 
0077     Component {
0078         id: coverComponent
0079 
0080         Rectangle {
0081             id: cover
0082 
0083             color: "white"
0084             radius: Kirigami.Units.smallSpacing / 2
0085             border.width: 1
0086             border.color: applet.palette.light
0087 
0088 
0089             AmarokQml.PixmapItem {
0090                 id: iconItem
0091 
0092                 anchors.fill: parent
0093                 anchors.margins: parent.radius
0094                 source: CurrentTrackEngine.cover
0095             }
0096         }
0097     }
0098     Component {
0099         id: emptyComponent
0100 
0101         AmarokQml.PixmapItem {
0102             source: Svg.renderSvg(applet.imageUrl("amarok-currenttrack.svg"),
0103                                   "CurrentTrack",
0104                                   width,
0105                                   height,
0106                                   "album_old");
0107         }
0108     }
0109 }