Warning, /multimedia/kasts/src/qml/Mobile/FooterBar.qml is written in an unsupported language. File is not indexed.
0001 /** 0002 * SPDX-FileCopyrightText: 2020 Devin Lin <espidev@gmail.com> 0003 * SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 0009 import QtQuick.Controls as Controls 0010 import QtQuick.Layouts 0011 import QtQuick.Effects 0012 0013 import org.kde.kirigami as Kirigami 0014 0015 import org.kde.kasts 0016 0017 Flickable { 0018 id: footerBar 0019 0020 property bool portrait: (contentZone.height / contentZone.width) > 0.7 0021 0022 property bool isMaximized: contentY === contentHeight / 2 0023 0024 property int contentToPlayerSpacing: 0 0025 0026 boundsBehavior: Flickable.StopAtBounds 0027 0028 NumberAnimation on contentY { 0029 id: toOpen 0030 from: contentY 0031 to: contentHeight / 2 0032 duration: Kirigami.Units.longDuration * 2 0033 easing.type: Easing.OutCubic 0034 running: false 0035 } 0036 NumberAnimation on contentY { 0037 id: toClose 0038 from: contentY 0039 to: 0 0040 duration: Kirigami.Units.longDuration * 2 0041 easing.type: Easing.OutCubic 0042 running: false 0043 } 0044 0045 // snap to end 0046 MouseArea { 0047 anchors.fill: contentZone 0048 propagateComposedEvents: true 0049 onPressed: { 0050 toOpen.stop(); 0051 toClose.stop(); 0052 propagateComposedEvents = true; 0053 } 0054 onReleased: footerBar.resetToBoundsOnFlick() 0055 } 0056 0057 function close() { 0058 toClose.restart(); 0059 } 0060 0061 function resetToBoundsOnFlick() { 0062 if (!atYBeginning || !atYEnd) { 0063 if (footerBar.verticalVelocity > 0) { 0064 toOpen.restart(); 0065 } else if (footerBar.verticalVelocity < 0) { 0066 toClose.restart(); 0067 } else { // i.e. when verticalVelocity === 0 0068 if (contentY > contentHeight / 4) { 0069 toOpen.restart(); 0070 } else { 0071 toClose.restart(); 0072 } 0073 } 0074 } 0075 } 0076 0077 function resetToBoundsOnResize() { 0078 if (contentY > contentHeight / 4) { 0079 contentY = contentHeight / 2; 0080 } else { 0081 contentY = 0; 0082 } 0083 } 0084 0085 onMovementStarted: { 0086 toOpen.stop(); 0087 toClose.stop(); 0088 } 0089 onFlickStarted: resetToBoundsOnFlick() 0090 onMovementEnded: resetToBoundsOnFlick() 0091 onHeightChanged: resetToBoundsOnResize() 0092 0093 Item { 0094 id: background 0095 anchors.fill: contentZone 0096 0097 // a cover for content underneath the panel 0098 Rectangle { 0099 id: coverUnderneath 0100 anchors.fill: parent 0101 0102 Kirigami.Theme.colorSet: Kirigami.Theme.View 0103 Kirigami.Theme.inherit: false 0104 color: Kirigami.Theme.backgroundColor 0105 } 0106 } 0107 0108 ColumnLayout { 0109 id: contentZone 0110 0111 anchors.bottom: parent.bottom 0112 anchors.left: parent.left 0113 anchors.right: parent.right 0114 height: kastsMainWindow.height + kastsMainWindow.miniplayerSize + contentToPlayerSpacing 0115 spacing: 0 0116 0117 Controls.Control { 0118 implicitHeight: kastsMainWindow.miniplayerSize + contentToPlayerSpacing 0119 Layout.fillWidth: true 0120 padding: 0 0121 0122 background: MultiEffect { 0123 source: backgroundImage 0124 anchors.fill: parent 0125 opacity: 0.2 0126 0127 brightness: 0.3 0128 saturation: 2 0129 contrast: -0.7 0130 blurMax: 64 0131 blur: 1.0 0132 blurEnabled: true 0133 autoPaddingEnabled: false 0134 0135 Image { 0136 id: backgroundImage 0137 source: AudioManager.entry.cachedImage 0138 asynchronous: true 0139 visible: false 0140 anchors.fill: parent 0141 fillMode: Image.PreserveAspectCrop 0142 } 0143 } 0144 0145 MinimizedPlayerControls { 0146 id: playControlItem 0147 height: kastsMainWindow.miniplayerSize 0148 focus: true 0149 anchors.left: parent.left 0150 anchors.right: parent.right 0151 anchors.top: parent.top 0152 } 0153 } 0154 0155 MobilePlayerControls { 0156 id: mobileTrackPlayer 0157 Layout.fillWidth: true 0158 Layout.fillHeight: true 0159 } 0160 } 0161 }