Warning, /multimedia/amarok/src/context/context_qml_package/contents/ui/toolbar/AppletToolbarAddItem.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 1.4
0019 import QtQuick.Layouts 1.3
0020 import org.kde.kirigami 2.0 as Kirigami
0021 
0022 
0023 ScrollView {
0024     id: root
0025 
0026     verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff
0027     frameVisible: true
0028 
0029     ListView {
0030         id: listView
0031 
0032         anchors.margins: Kirigami.Units.smallSpacing
0033         orientation: ListView.Horizontal
0034         spacing: Kirigami.Units.smallSpacing
0035 
0036         model: AppletModel
0037 
0038         delegate: Rectangle {
0039             readonly property bool appletEnabled: AppletProxyModel.enabledApplets.indexOf(appletId) != -1
0040 
0041             height: root.height - 3 * Kirigami.Units.smallSpacing
0042             width: height
0043             radius: Kirigami.Units.smallSpacing
0044             color: delegateMouseArea.pressed ? palette.highlight : appletEnabled ? palette.highlight : "transparent"
0045             border.color: delegateMouseArea.containsMouse ? palette.highlight : "transparent"
0046             border.width: 2
0047 
0048             ColumnLayout {
0049                 anchors.fill: parent
0050 
0051                 Image {
0052                     source: icon
0053                     Layout.fillHeight: true
0054                     Layout.fillWidth: true
0055                     Layout.alignment: Qt.AlignTop
0056                     Layout.margins: Kirigami.Units.smallSpacing
0057                     sourceSize.width: width
0058                     sourceSize.height: height
0059                     fillMode: Image.PreserveAspectFit
0060                 }
0061                 Label {
0062                     Layout.alignment: Qt.AlignBottom
0063                     Layout.margins: Kirigami.Units.smallSpacing
0064                     Layout.fillWidth: true
0065                     text: name
0066                     wrapMode: Text.Wrap
0067                     horizontalAlignment: Text.AlignHCenter
0068                 }
0069             }
0070 
0071             MouseArea {
0072                 id: delegateMouseArea
0073 
0074                 anchors.fill: parent
0075                 hoverEnabled: true
0076                 acceptedButtons: Qt.LeftButton
0077 
0078                 onClicked: AppletProxyModel.setAppletEnabled(appletId, !appletEnabled);
0079             }
0080         }
0081 
0082         SystemPalette {
0083             id: palette
0084         }
0085     }
0086 }