Warning, /multimedia/haruna/src/qml/Header.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2020 George Florea Bănuș <georgefb899@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls
0009 import QtQuick.Layouts
0010 import QtQml
0011 
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.haruna
0014 import org.kde.haruna.settings
0015 
0016 ToolBar {
0017     id: root
0018 
0019     position: ToolBar.Header
0020     state: !window.isFullScreen() && GeneralSettings.showHeader ? "visible" : "hidden"
0021 
0022     onVisibleChanged: {
0023         window.resizeWindow()
0024     }
0025 
0026     RowLayout {
0027         id: headerRow
0028 
0029         width: parent.width
0030 
0031         Loader {
0032             asynchronous: true
0033             visible: menuBarLoader.state === "hidden"
0034             sourceComponent: HamburgerMenu {
0035                 position: HamburgerMenu.Position.Header
0036             }
0037         }
0038 
0039         ToolButton {
0040             action: appActions.openFileAction
0041             focusPolicy: Qt.NoFocus
0042         }
0043 
0044         ToolButton {
0045             action: appActions.openUrlAction
0046             focusPolicy: Qt.NoFocus
0047         }
0048 
0049         ToolSeparator {
0050             padding: vertical ? 10 : 2
0051             topPadding: vertical ? 2 : 10
0052             bottomPadding: vertical ? 2 : 10
0053 
0054             contentItem: Rectangle {
0055                 implicitWidth: parent.vertical ? 1 : 24
0056                 implicitHeight: parent.vertical ? 24 : 1
0057                 color: Kirigami.Theme.textColor
0058             }
0059         }
0060 
0061         ToolButton {
0062             id: subtitleMenuButton
0063 
0064             text: i18nc("@action:intoolbar", "Subtitles")
0065             icon.name: "add-subtitle"
0066             focusPolicy: Qt.NoFocus
0067 
0068             onReleased: {
0069                 subtitleMenu.visible = !subtitleMenu.visible
0070             }
0071 
0072             SubtitleTracksMenu {
0073                 id: subtitleMenu
0074 
0075                 y: parent.height
0076                 model: mpv.subtitleTracksModel
0077                 isPrimarySubtitleMenu: true
0078             }
0079         }
0080 
0081         ToolButton {
0082             text: i18nc("@action:intoolbar", "Audio")
0083             icon.name: "audio-volume-high"
0084             focusPolicy: Qt.NoFocus
0085 
0086             onReleased: {
0087                 audioMenu.visible = !audioMenu.visible
0088             }
0089 
0090             AudioTracksMenu {
0091                 id: audioMenu
0092 
0093                 y: parent.height
0094                 model: mpv.audioTracksModel
0095             }
0096         }
0097 
0098         Item {
0099             Layout.fillWidth: true
0100         }
0101 
0102         ToolButton {
0103             action: appActions.configureAction
0104             focusPolicy: Qt.NoFocus
0105         }
0106     }
0107 
0108 
0109     states: [
0110         State {
0111             name: "hidden"
0112             PropertyChanges {
0113                 target: root
0114                 height: 0
0115                 opacity: 0
0116                 visible: false
0117             }
0118         },
0119         State {
0120             name : "visible"
0121             PropertyChanges {
0122                 target: root
0123                 height: root.implicitHeight
0124                 opacity: 1
0125                 visible: true
0126             }
0127         }
0128     ]
0129 
0130     transitions: [
0131         Transition {
0132             from: "visible"
0133             to: "hidden"
0134 
0135             SequentialAnimation {
0136                 ParallelAnimation {
0137                     NumberAnimation {
0138                         target: root
0139                         property: "opacity"
0140                         duration: Kirigami.Units.veryShortDuration
0141                         easing.type: Easing.Linear
0142                     }
0143                     NumberAnimation {
0144                         target: root
0145                         property: "height"
0146                         duration: Kirigami.Units.veryShortDuration
0147                         easing.type: Easing.Linear
0148                     }
0149                 }
0150                 PropertyAction {
0151                     target: root
0152                     property: "visible"
0153                     value: false
0154                 }
0155             }
0156         },
0157         Transition {
0158             from: "hidden"
0159             to: "visible"
0160 
0161             SequentialAnimation {
0162                 PropertyAction {
0163                     target: root
0164                     property: "visible"
0165                     value: true
0166                 }
0167                 ParallelAnimation {
0168                     NumberAnimation {
0169                         target: root
0170                         property: "height"
0171                         duration: Kirigami.Units.veryShortDuration
0172                         easing.type: Easing.Linear
0173                     }
0174                     NumberAnimation {
0175                         target: root
0176                         property: "opacity"
0177                         duration: Kirigami.Units.veryShortDuration
0178                         easing.type: Easing.Linear
0179                     }
0180                 }
0181             }
0182         }
0183     ]
0184 }