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