diff --git a/src/qml/ControlsBar.qml b/src/qml/ControlsBar.qml index 6e08854..c133d4c 100644 --- a/src/qml/ControlsBar.qml +++ b/src/qml/ControlsBar.qml @@ -64,7 +64,7 @@ Item { opacity: 1 background: Rectangle { id: subsBackground - color: Qt.rgba(0, 0, 0, 0.6) + color: appearance.mainBackground width: subsContainer.childrenRect.width height: subsContainer.childrenRect.height } @@ -88,8 +88,7 @@ Item { anchors.right: parent.right Layout.fillWidth: true Layout.fillHeight: true - color: "black" - opacity: 0.6 + color: appearance.mainBackground } Rectangle { diff --git a/src/qml/CustomComboBox.qml b/src/qml/CustomComboBox.qml index fa33139..29561c0 100644 --- a/src/qml/CustomComboBox.qml +++ b/src/qml/CustomComboBox.qml @@ -45,7 +45,6 @@ ComboBox { implicitWidth: 120 implicitHeight: 40 color: "transparent" - opacity: 0.6 } popup: Popup { diff --git a/src/qml/CustomMenu.qml b/src/qml/CustomMenu.qml index fcefee4..9da3a6d 100644 --- a/src/qml/CustomMenu.qml +++ b/src/qml/CustomMenu.qml @@ -6,8 +6,7 @@ Menu { background: Rectangle { implicitWidth: parent.width implicitHeight: 10 - color: "black" - opacity: 0.6 + color: appearance.mainBackground } delegate: CustomMenuItem { } diff --git a/src/qml/MainMenu.qml b/src/qml/MainMenu.qml index 41c6f7f..ccbc796 100644 --- a/src/qml/MainMenu.qml +++ b/src/qml/MainMenu.qml @@ -12,38 +12,28 @@ MenuBar { id: menuBar //width: parent.width height: Math.max(24, Screen.height / 32) - property bool anythingOpen: fileMenuBarItem.opened - || playbackMenuBarItem.opened - || viewMenuBarItem.opened - || audioMenuBarItem.opened - || videoMenuBarItem.opened - || subsMenuBarItem.opened - || aboutMenuBarItem.opened + function anythingOpen() { + for (var i = 0, len = menuBar.count; i < len; i++) { + if (menuBar.menuAt(i).opened) { return true } + } + } Component.onCompleted: { player.tracksChanged.connect(updateTracks) } - function updateTracks() { - for (var i = 0, len = audioMenu.count; i < len; i++) { - var audioAction = audioMenu.actionAt(i) - if (audioAction.trackID != "no") { - audioMenu.removeAction(audioAction) - } - } - for (var i = 0, len = videoMenu.count; i < len; i++) { - var videoAction = videoMenu.actionAt(i) - if (videoAction.trackID != "no") { - videoMenu.removeAction(videoAction) - } - } - for (var i = 0, len = subMenu.count; i < len; i++) { - var subAction = subMenu.actionAt(i) - if (subAction.trackID != "no") { - subMenu.removeAction(subAction) + var trackMenus = [audioMenu, videoMenu, subMenu] + for (var a = 0; i < trackMenus.length; a++) { + var menu = trackMenus[a] + for (var i = 0, len = menu.count; i < len; i++) { + var action = menu.actionAt(i) + if (action.trackID != "no") { + menu.removeAction(action) + } } } + var newTracks = player.playerCommand(Enums.Commands.GetTracks) for (var i = 0, len = newTracks.length; i < len; i++) { @@ -168,8 +158,7 @@ MenuBar { background: Rectangle { width: parent.width implicitHeight: 10 - color: "black" - opacity: 0.6 + color: appearance.mainBackground } CustomMenu { diff --git a/src/qml/main.qml b/src/qml/main.qml index d839de3..4c79310 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -26,6 +26,7 @@ ApplicationWindow { property bool clickToPause: true property bool useMpvSubs: false property string fontName: "Roboto" + property string mainBackground: "#9C000000" } Settings { id: i18n @@ -111,6 +112,7 @@ ApplicationWindow { width: parent.width height: parent.height z: 1 + property bool controlsShowing: true function startPlayer() { console.log(player) @@ -188,37 +190,30 @@ ApplicationWindow { } function isAnyMenuOpen() { - return menuBar.anythingOpen + return menuBar.anythingOpen() } function hideControls(force) { if (!isAnyMenuOpen() || force) { - controlsBar.controls.visible = false - controlsBar.background.visible = false - titleBar.visible = false - titleBackground.visible = false - menuBar.visible = false; + controlsShowing = false mouseAreaPlayer.cursorShape = Qt.BlankCursor } } function showControls() { if (!controlsBar.controls.visible) { - controlsBar.controls.visible = true - controlsBar.background.visible = true - if (appearance.titleOnlyOnFullscreen) { - if (mainWindow.visibility == Window.FullScreen) { - titleBar.visible = true - } - } else { - titleBar.visible = true - } - titleBackground.visible = true - menuBar.visible = true + controlsShowing = true mouseAreaPlayer.cursorShape = Qt.ArrowCursor } } + } + Item { + anchors.centerIn: player + height: player.height + width: player.width + z: 2 + MouseArea { id: mouseAreaBar x: 0 @@ -289,18 +284,7 @@ ApplicationWindow { MainMenu { id: menuBar - } - - Rectangle { - id: titleBackground - height: titleBar.height - anchors.top: titleBar.top - anchors.left: titleBar.left - anchors.right: titleBar.right - Layout.fillWidth: true - Layout.fillHeight: true - color: "black" - opacity: 0.6 + visible: player.controlsShowing } Rectangle { @@ -309,9 +293,9 @@ ApplicationWindow { anchors.right: parent.right anchors.left: menuBar.right anchors.top: parent.top + visible: player.controlsShowing - visible: !appearance.titleOnlyOnFullscreen - color: "transparent" + color: appearance.mainBackground Text { id: titleLabel @@ -330,6 +314,7 @@ ApplicationWindow { font.pixelSize: 14 font.bold: true opacity: 1 + visible: player.controlsShowing && ((!appearance.titleOnlyOnFullscreen) || (mainWindow.visibility == Window.FullScreen) ) Component.onCompleted: { player.titleChanged.connect(function(title) { text = title @@ -340,6 +325,7 @@ ApplicationWindow { ControlsBar { id: controlsBar + visible: player.controlsShowing } } }