Warning, /multimedia/haruna/src/qml/MenuBarLoader.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2023 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 as QQC2
0009 import Qt.labs.platform as Platform
0010
0011 import org.kde.kirigami as Kirigami
0012
0013 import org.kde.haruna
0014 import org.kde.haruna.settings
0015
0016 Loader {
0017 id: root
0018
0019 property bool showGlobalMenu: app.platformName() !== "windows"
0020 && Kirigami.Settings.hasPlatformMenuBar
0021 && !Kirigami.Settings.isMobile
0022
0023 state: !window.isFullScreen() && GeneralSettings.showMenuBar ? "visible" : "hidden"
0024 sourceComponent: showGlobalMenu ? globalMenuBarComponent : menuBarComponent
0025
0026 onVisibleChanged: {
0027 window.resizeWindow()
0028 }
0029
0030 Component {
0031 id: menuBarComponent
0032
0033 QQC2.MenuBar {
0034 hoverEnabled: true
0035 Kirigami.Theme.colorSet: Kirigami.Theme.Header
0036
0037 FileMenu {}
0038 ViewMenu {}
0039 PlaybackMenu {}
0040 VideoMenu {}
0041 SubtitlesMenu {}
0042 AudioMenu {}
0043 SettingsMenu {}
0044 HelpMenu {}
0045 }
0046 }
0047
0048 Component {
0049 id: globalMenuBarComponent
0050
0051 Platform.MenuBar {
0052 GlobalFileMenu {}
0053 GlobalViewMenu {}
0054 GlobalPlaybackMenu {}
0055 GlobalVideoMenu {}
0056 GlobalSubtitlesMenu {}
0057 GlobalAudioMenu {}
0058 GlobalSettingsMenu {}
0059 GlobalHelpMenu {}
0060 }
0061 }
0062
0063 states: [
0064 State {
0065 name: "hidden"
0066 PropertyChanges {
0067 target: root
0068 height: 0
0069 opacity: 0
0070 visible: false
0071 }
0072 },
0073 State {
0074 name : "visible"
0075 PropertyChanges {
0076 target: root
0077 height: root.implicitHeight
0078 opacity: 1
0079 visible: true
0080 }
0081 }
0082 ]
0083
0084 transitions: [
0085 Transition {
0086 from: "visible"
0087 to: "hidden"
0088
0089 SequentialAnimation {
0090 ParallelAnimation {
0091 NumberAnimation {
0092 target: root
0093 property: "opacity"
0094 duration: Kirigami.Units.veryShortDuration
0095 easing.type: Easing.Linear
0096 }
0097 NumberAnimation {
0098 target: root
0099 property: "height"
0100 duration: Kirigami.Units.veryShortDuration
0101 easing.type: Easing.Linear
0102 }
0103 }
0104 PropertyAction {
0105 target: root
0106 property: "visible"
0107 value: false
0108 }
0109 }
0110 },
0111 Transition {
0112 from: "hidden"
0113 to: "visible"
0114
0115 SequentialAnimation {
0116 PropertyAction {
0117 target: root
0118 property: "visible"
0119 value: true
0120 }
0121 ParallelAnimation {
0122 NumberAnimation {
0123 target: root
0124 property: "height"
0125 duration: Kirigami.Units.veryShortDuration
0126 easing.type: Easing.Linear
0127 }
0128 NumberAnimation {
0129 target: root
0130 property: "opacity"
0131 duration: Kirigami.Units.veryShortDuration
0132 easing.type: Easing.Linear
0133 }
0134 }
0135 }
0136 }
0137 ]
0138 }