Warning, /plasma-bigscreen/youtube-voice-application/ui/+mediacenter/views/BigTileView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  Copyright 2019 Aditya Mehra <aix.m@outlook.com>
0003  *  Copyright 2019 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 2 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, write to the Free Software
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  2.010-1301, USA.
0018  */
0019 
0020 import QtQuick 2.12
0021 import QtQuick.Layouts 1.4
0022 import QtQuick.Controls 2.4 as Controls
0023 import org.kde.plasma.components 3.0 as PlasmaComponents
0024 import org.kde.kirigami 2.5 as Kirigami
0025 
0026 
0027 FocusScope {
0028     id: root
0029     signal activated
0030     property string title
0031     property alias view: view
0032     property alias delegate: view.delegate
0033     property alias model: view.model
0034     property alias count: view.count
0035     property alias currentIndex: view.currentIndex
0036     property alias currentItem: view.currentItem
0037     Layout.fillWidth: true
0038     implicitHeight: view.implicitHeight + header.implicitHeight
0039     property alias cellWidth: view.cellWidth
0040     property alias cellHeight: view.cellHeight
0041     
0042     property Item navigationUp
0043     property Item navigationDown
0044 
0045     Kirigami.Heading {
0046         id: header
0047         anchors {
0048             left: parent.left
0049             right: parent.right
0050             top: parent.top
0051             leftMargin: Kirigami.Units.largeSpacing * 3
0052         }
0053         text: title
0054         color: "white"
0055     }
0056 
0057     Kirigami.Separator {
0058         z: 2
0059         anchors {
0060             bottom: view.top
0061             left: view.left
0062             right: parent.right
0063         }
0064         height: 1
0065         color: "white"
0066         opacity: 0.4
0067         visible: view.contentY > 0
0068     }
0069 
0070     GridView {
0071         id: view
0072         anchors {
0073                 left: parent.left
0074                 right: parent.right
0075                 top: header.bottom
0076                 bottom: parent.bottom
0077                 topMargin: Kirigami.Units.largeSpacing * 2
0078                 leftMargin: Kirigami.Units.largeSpacing * 2
0079                 rightMargin: Kirigami.Units.largeSpacing * 2
0080         }
0081         focus: true
0082         z: activeFocus ? 10: 1 
0083         cellWidth: parent.width / 4
0084         cellHeight: parent.height / 1.5
0085         keyNavigationEnabled: true
0086         highlightFollowsCurrentItem: true
0087         snapMode: ListView.SnapToItem
0088         cacheBuffer: width
0089         highlightMoveDuration: Kirigami.Units.longDuration
0090         clip: true
0091         
0092         onCurrentItemChanged: {
0093             positionViewAtIndex(currentIndex, GridView.Center)
0094         }
0095         
0096         move: Transition {
0097             SmoothedAnimation {
0098                 property: "x"
0099                 duration: Kirigami.Units.longDuration
0100             }
0101         }
0102 
0103         KeyNavigation.left: root
0104         KeyNavigation.right: root
0105     }
0106 }