Warning, /plasma-bigscreen/youtube-voice-application/ui/+mediacenter/views/BackupListTileView.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 ListView {
0028 id: view
0029 property int columns: parent.width >= 1500 ? Math.max(3, Math.floor(width / (Kirigami.Units.gridUnit * 14))) : 5
0030
0031 readonly property int cellWidth: width / columns
0032
0033 Layout.fillWidth: true
0034 Layout.preferredHeight: Kirigami.Units.gridUnit * 15
0035 z: activeFocus ? 10: 1
0036 keyNavigationEnabled: true
0037 highlightFollowsCurrentItem: true
0038 snapMode: ListView.SnapToItem
0039 cacheBuffer: width
0040
0041 displayMarginBeginning: rotation.angle != 0 ? width*2 : 0
0042 displayMarginEnd: rotation.angle != 0 ? width*2 : 0
0043 highlightMoveDuration: Kirigami.Units.longDuration
0044 transform: Rotation {
0045 id: rotation
0046 axis { x: 0; y: 1; z: 0 }
0047 angle: 0
0048 property real targetAngle: 30
0049 Behavior on angle {
0050 SmoothedAnimation {
0051 duration: Kirigami.Units.longDuration * 10
0052 }
0053 }
0054 origin.x: width/2
0055 }
0056
0057 Timer {
0058 id: rotateTimeOut
0059 interval: 25
0060 }
0061 Timer {
0062 id: rotateTimer
0063 interval: 500
0064 onTriggered: {
0065 if (rotateTimeOut.running) {
0066 rotation.angle = rotation.targetAngle;
0067 restart();
0068 } else {
0069 rotation.angle = 0;
0070 }
0071 }
0072 }
0073 spacing: 0
0074 orientation: ListView.Horizontal
0075
0076 property real oldContentX
0077 onContentXChanged: {
0078 if (oldContentX < contentX) {
0079 rotation.targetAngle = 30;
0080 } else {
0081 rotation.targetAngle = -30;
0082 }
0083 PlasmaComponents.ScrollBar.horizontal.opacity = 1;
0084 if (!rotateTimeOut.running) {
0085 rotateTimer.restart();
0086 }
0087 rotateTimeOut.restart();
0088 oldContentX = contentX;
0089 }
0090
0091 PlasmaComponents.ScrollBar.horizontal: PlasmaComponents.ScrollBar {
0092 id: scrollBar
0093 opacity: 0
0094 interactive: false
0095 onOpacityChanged: disappearTimer.restart()
0096 Timer {
0097 id: disappearTimer
0098 interval: 1000
0099 onTriggered: scrollBar.opacity = 0;
0100 }
0101 Behavior on opacity {
0102 OpacityAnimator {
0103 duration: Kirigami.Units.longDuration
0104 easing.type: Easing.InOutQuad
0105 }
0106 }
0107 }
0108
0109 move: Transition {
0110 SmoothedAnimation {
0111 property: "x"
0112 duration: Kirigami.Units.longDuration
0113 }
0114 }
0115 }