Warning, /plasma-bigscreen/peertube-voice-application/ui/+mediacenter/views/TileView.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     GridView {
0058         id: view
0059         anchors {
0060                 left: parent.left
0061                 right: parent.right
0062                 top: header.bottom
0063                 bottom: parent.bottom
0064                 topMargin: Kirigami.Units.largeSpacing * 2
0065                 leftMargin: Kirigami.Units.largeSpacing * 2
0066                 rightMargin: Kirigami.Units.largeSpacing * 2
0067         }
0068         focus: true
0069         z: activeFocus ? 10: 1 
0070         cellWidth: parent.width / 4
0071         cellHeight: parent.height / 1.5
0072         keyNavigationEnabled: true
0073         highlightFollowsCurrentItem: true
0074         highlightRangeMode: GridView.ApplyRange
0075         snapMode: GridView.SnapToRow
0076         cacheBuffer: width
0077         highlightMoveDuration: Kirigami.Units.longDuration
0078         clip: true
0079         
0080         onCurrentItemChanged: {
0081             positionViewAtIndex(view.currentIndex, GridView.SnapPosition)
0082         }
0083         
0084         move: Transition {
0085             SmoothedAnimation {
0086                 property: "x"
0087                 duration: Kirigami.Units.longDuration
0088             }
0089         }
0090 
0091         KeyNavigation.left: root
0092         KeyNavigation.right: root
0093     }
0094 }
0095