1
0
Fork 0

Fix mouse ui showhide. Fix settings button icon.

This commit is contained in:
namedkitten 2020-05-12 14:38:39 +01:00
parent a0cb65ceeb
commit f1eac8be96
6 changed files with 37 additions and 51 deletions

View file

@ -6,23 +6,12 @@ import player 1.0
Item {
id: controlsBarItem
property var combinedHeight: progressBar.height + controlsBackground.height
property bool controlsShowing: true
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
}
Connections {
target: globalConnections
onHideUI: function (force) {
controlsBarItem.controlsShowing = false
}
onShowUI: {
controlsBarItem.controlsShowing = true
}
}
Connections {
target: appearance
onThemeNameChanged: setControlsTheme(appearance.themeName)
@ -48,7 +37,7 @@ Item {
VideoProgress {
id: progressBar
visible: controlsBarItem.controlsShowing
visible: mainWindow.controlsShowing
&& appearance.themeName != "RoosterTeeth"
bottomPadding: 0
rightPadding: 0
@ -72,7 +61,7 @@ Item {
Layout.fillWidth: true
Layout.fillHeight: true
color: getAppearanceValueForTheme(appearance.themeName, "mainBackground")
visible: controlsBarItem.controlsShowing
visible: mainWindow.controlsShowing
z: 10
anchors {
bottom: parent.bottom
@ -83,8 +72,8 @@ Item {
Item {
id: controlsBar
height: controlsBar.visible ? mainWindow.virtualHeight / 20 : 0
visible: controlsBarItem.controlsShowing
height: mainWindow.controlsShowing ? mainWindow.virtualHeight / 20 : 0
visible: mainWindow.controlsShowing
z: 30
anchors {
right: parent.right

View file

@ -16,6 +16,7 @@ MenuBar {
return true
}
}
return false
}
Connections {

View file

@ -5,25 +5,18 @@ import QtQuick.Window 2.2
Item {
id: menuTitleBar
height: menuBar.height
visible: true
visible: mainWindow.controlsShowing
function anythingOpen() {
return menuBar.anythingOpen()
}
anchors {
left: parent.left
right: parent.right
top: parent.top
}
Connections {
target: globalConnections
onHideUI: function () {
if (!menuBar.anythingOpen()) {
menuTitleBar.visible = false
}
}
onShowUI: {
menuTitleBar.visible = true
}
}
MainMenu {
id: menuBar
}

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 00-3.38 1.97L9.9 10.1a1 1 0 00-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 003.38-1.97l4.98 2.01a1 1 0 001.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><g><path d="M0,0h24v24H0V0z" fill="none"/><path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/></g></svg>

Before

Width:  |  Height:  |  Size: 748 B

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 00-3.38 1.97L9.9 10.1a1 1 0 00-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 003.38-1.97l4.98 2.01a1 1 0 001.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" viewBox="0 0 24 24" fill="black" width="18px" height="18px"><g><path d="M0,0h24v24H0V0z" fill="none"/><path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/></g></svg>

Before

Width:  |  Height:  |  Size: 748 B

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -10,6 +10,7 @@ Window {
visible: true
width: Math.min(720, Screen.width)
height: Math.min(480, Screen.height)
property bool controlsShowing: true
property int virtualHeight: Screen.height * appearance.scaleFactor
property int virtualWidth: Screen.width * appearance.scaleFactor
property bool onTop: false
@ -300,19 +301,8 @@ Window {
anchors.centerIn: player
height: player.height
width: player.width
property bool controlsShowing: true
z: 2
Connections {
target: globalConnections
onHideUI: function () {
mouseAreaPlayer.cursorShape = Qt.BlankCursor
}
onShowUI: {
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
}
}
MouseArea {
id: mouseAreaBar
width: parent.width
@ -334,6 +324,7 @@ Window {
width: parent.width
hoverEnabled: true
propagateComposedEvents: true
cursorShape: mainWindow.controlsShowing ? Qt.ArrowCursor : Qt.BlankCursor
property real velocity: 0.0
property int xStart: 0
property int xPrev: 0
@ -352,11 +343,7 @@ Window {
id: mouseTapTimer
interval: 200
onTriggered: {
if (topBar.visible) {
globalConnections.hideUI()
} else {
globalConnections.showUI()
}
mainWindow.controlsShowing = !mainWindow.controlsShowing || topBar.anythingOpen() || mouseAreaTopBar.containsMouse
mouseAreaPlayerTimer.restart()
}
}
@ -402,10 +389,8 @@ Window {
velocity = (velocity + currVel) / 2.0
xPrev = mouse.x
}
if (!topBar.visible) {
globalConnections.showUI()
mouseAreaPlayerTimer.restart()
}
mainWindow.controlsShowing = true
mouseAreaPlayerTimer.restart()
}
Action {
onTriggered: {
@ -421,7 +406,7 @@ Window {
repeat: false
onTriggered: {
if (!(appearance.uiFadeTimer == 0)) {
globalConnections.hideUI()
mainWindow.controlsShowing = !mainWindow.controlsShowing || topBar.anythingOpen() || mouseAreaTopBar.containsMouse
}
}
}
@ -472,4 +457,22 @@ Window {
id: controlsBar
}
}
MouseArea {
id: mouseAreaTopBar
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: topBar.height * 3
hoverEnabled: true
propagateComposedEvents: true
}
MouseArea {
anchors.fill: parent
onExited: {
mouseAreaPlayerTimer.start()
}
}
}