Warning, /multimedia/plasmatube/src/ui/components/BottomNavBar.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick
0005 
0006 import org.kde.kirigami as Kirigami
0007 
0008 Kirigami.NavigationTabBar {
0009     id: root
0010 
0011     property bool shouldShow: applicationWindow().pageStack.currentIndex === 0
0012     onShouldShowChanged: {
0013         if (shouldShow) {
0014             hideAnim.stop();
0015             showAnim.restart();
0016         } else {
0017             showAnim.stop();
0018             hideAnim.restart();
0019         }
0020     }
0021 
0022     visible: height !== 0
0023 
0024     // animate showing and hiding of navbar
0025     ParallelAnimation {
0026         id: showAnim
0027         onFinished: root.height = Qt.binding(() => root.implicitHeight);
0028         NumberAnimation {
0029             target: root
0030             property: "height"
0031             to: root.implicitHeight
0032             duration: Kirigami.Units.longDuration
0033             easing.type: Easing.InOutQuad
0034         }
0035         NumberAnimation {
0036             target: root
0037             property: "opacity"
0038             to: 1
0039             duration: Kirigami.Units.longDuration
0040             easing.type: Easing.InOutQuad
0041         }
0042     }
0043 
0044     SequentialAnimation {
0045         id: hideAnim
0046         onFinished: root.height = Qt.binding(() => root.implicitHeight);
0047         NumberAnimation {
0048             target: root
0049             property: "opacity"
0050             to: 0
0051             duration: Kirigami.Units.longDuration
0052             easing.type: Easing.InOutQuad
0053         }
0054         NumberAnimation {
0055             target: root
0056             property: "height"
0057             to: 0
0058             duration: Kirigami.Units.longDuration
0059             easing.type: Easing.InOutQuad
0060         }
0061     }
0062 
0063     property var pageStack: applicationWindow().pageStack
0064 
0065     actions: [
0066         Kirigami.Action {
0067             icon.name
0068     :
0069     "videoclip-amarok"
0070             text: i18n("Videos")
0071             checked: true // initial page that opens
0072             onTriggered: {
0073                 while (applicationWindow().pageStack.depth > 0) {
0074                     applicationWindow().pageStack.pop();
0075                 }
0076                 applicationWindow().pageStack.push(Qt.createComponent("org.kde.plasmatube", "TrendingPage"));
0077                 applicationWindow().closePlayer();
0078             }
0079         },
0080         Kirigami.Action {
0081             icon.name: "search"
0082             text: i18n("Search")
0083             onTriggered: {
0084                 while (applicationWindow().pageStack.depth > 0) {
0085                     applicationWindow().pageStack.pop();
0086                 }
0087                 applicationWindow().pageStack.push(Qt.createComponent("org.kde.plasmatube", "SearchPage"));
0088                 applicationWindow().closePlayer();
0089             }
0090         },
0091         Kirigami.Action {
0092             icon.name: "settings-configure"
0093             text: i18n("Settings")
0094             onTriggered: {
0095                 while (applicationWindow().pageStack.depth > 0) {
0096                     applicationWindow().pageStack.pop();
0097                 }
0098                 applicationWindow().pageStack.push(Qt.createComponent("org.kde.plasmatube", "SettingsPage"));
0099                 applicationWindow().closePlayer();
0100             }
0101         }
0102     ]
0103 }
0104