Warning, /plasma-bigscreen/mycroft-skill-installer/app/qml/views/TileView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2019-2020 Aditya Mehra <aix.m@outlook.org>
0003  *   SPDX-FileCopyrightText: 2019-2020 Marco Martin <mart@kde.org>
0004  *
0005  *   SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 import QtQuick 2.12
0009 import QtQuick.Layouts 1.4
0010 import QtQuick.Controls 2.4 as Controls
0011 import org.kde.plasma.components 3.0 as PlasmaComponents
0012 import org.kde.kirigami 2.5 as Kirigami
0013 
0014 
0015 ListView {
0016     id: view
0017     property int columns: 5
0018     readonly property int cellWidth: width / columns
0019 
0020     property Item navigationUp
0021     property Item navigationDown
0022 
0023     Layout.fillWidth: true
0024     Layout.fillHeight: true
0025     z: activeFocus ? 10: 1
0026     keyNavigationEnabled: true
0027     highlightFollowsCurrentItem: true
0028     snapMode: ListView.SnapToItem
0029     cacheBuffer: width
0030 
0031     displayMarginBeginning: rotation.angle != 0 ? width*2 : 0
0032     displayMarginEnd: rotation.angle != 0 ? width*2 : 0
0033     highlightMoveDuration: Kirigami.Units.longDuration
0034     transform: Rotation {
0035         id: rotation
0036         axis { x: 0; y: 1; z: 0 }
0037         angle: 0
0038         property real targetAngle: 30
0039         Behavior on angle {
0040             SmoothedAnimation {
0041                 duration: Kirigami.Units.longDuration * 10
0042             }
0043         }
0044         origin.x: width/2
0045     }
0046 
0047     Timer {
0048         id: rotateTimeOut
0049         interval: 25
0050     }
0051     Timer {
0052         id: rotateTimer
0053         interval: 500
0054         onTriggered: {
0055             if (rotateTimeOut.running) {
0056                 rotation.angle = rotation.targetAngle;
0057                 restart();
0058             } else {
0059                 rotation.angle = 0;
0060             }
0061         }
0062     }
0063     spacing: 0
0064     orientation: ListView.Horizontal
0065 
0066     property real oldContentX
0067     onContentXChanged: {
0068         if (oldContentX < contentX) {
0069             rotation.targetAngle = 30;
0070         } else {
0071             rotation.targetAngle = -30;
0072         }
0073         PlasmaComponents.ScrollBar.horizontal.opacity = 1;
0074         if (!rotateTimeOut.running) {
0075             rotateTimer.restart();
0076         }
0077         rotateTimeOut.restart();
0078         oldContentX = contentX;
0079     }
0080     PlasmaComponents.ScrollBar.horizontal: PlasmaComponents.ScrollBar {
0081         id: scrollBar
0082         opacity: 0
0083         interactive: false
0084         onOpacityChanged: disappearTimer.restart()
0085         Timer {
0086             id: disappearTimer
0087             interval: 1000
0088             onTriggered: scrollBar.opacity = 0;
0089         }
0090         Behavior on opacity {
0091             OpacityAnimator {
0092                 duration: Kirigami.Units.longDuration
0093                 easing.type: Easing.InOutQuad
0094             }
0095         }
0096     }
0097 
0098     move: Transition {
0099         SmoothedAnimation {
0100             property: "x"
0101             duration: Kirigami.Units.longDuration
0102         }
0103     }
0104 }