Move to one less MouseArea.
This commit is contained in:
parent
370b5eb752
commit
6eb6c21688
|
@ -39,12 +39,6 @@ Dialog {
|
||||||
text: translate.getTranslation("TITLE_ONLY_ON_FULLSCREEN", i18n.language)
|
text: translate.getTranslation("TITLE_ONLY_ON_FULLSCREEN", i18n.language)
|
||||||
Layout.leftMargin: 30
|
Layout.leftMargin: 30
|
||||||
}
|
}
|
||||||
CheckBox {
|
|
||||||
checked: appearance.clickToPause
|
|
||||||
onClicked: appearance.clickToPause = !appearance.clickToPause
|
|
||||||
text: translate.getTranslation("CLICK_TO_PAUSE", i18n.language)
|
|
||||||
Layout.leftMargin: 30
|
|
||||||
}
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
checked: appearance.doubleTapToSeek
|
checked: appearance.doubleTapToSeek
|
||||||
onClicked: appearance.doubleTapToSeek = !appearance.doubleTapToSeek
|
onClicked: appearance.doubleTapToSeek = !appearance.doubleTapToSeek
|
||||||
|
|
|
@ -122,7 +122,6 @@ MenuBar {
|
||||||
|
|
||||||
delegate: MenuBarItem {
|
delegate: MenuBarItem {
|
||||||
id: menuBarItem
|
id: menuBarItem
|
||||||
|
|
||||||
padding: 4
|
padding: 4
|
||||||
topPadding: padding
|
topPadding: padding
|
||||||
leftPadding: padding
|
leftPadding: padding
|
||||||
|
|
|
@ -61,7 +61,6 @@ Window {
|
||||||
id: appearance
|
id: appearance
|
||||||
category: "Appearance"
|
category: "Appearance"
|
||||||
property bool titleOnlyOnFullscreen: true
|
property bool titleOnlyOnFullscreen: true
|
||||||
property bool clickToPause: false
|
|
||||||
property bool useMpvSubs: false
|
property bool useMpvSubs: false
|
||||||
property string themeName: "YouTube"
|
property string themeName: "YouTube"
|
||||||
property string fontName: "Roboto"
|
property string fontName: "Roboto"
|
||||||
|
@ -301,39 +300,6 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors {
|
|
||||||
fill: parent
|
|
||||||
bottomMargin: controlsBar.combinedHeight
|
|
||||||
}
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
enabled: appearance.swipeToResize
|
|
||||||
property real velocity: 0.0
|
|
||||||
property int xStart: 0
|
|
||||||
property int xPrev: 0
|
|
||||||
hoverEnabled: false
|
|
||||||
propagateComposedEvents: true
|
|
||||||
z: 1010
|
|
||||||
onPressed: {
|
|
||||||
xStart = mouse.x
|
|
||||||
xPrev = mouse.x
|
|
||||||
velocity = 0
|
|
||||||
}
|
|
||||||
onPositionChanged: {
|
|
||||||
var currVel = (mouse.x - xPrev)
|
|
||||||
velocity = (velocity + currVel) / 2.0
|
|
||||||
xPrev = mouse.x
|
|
||||||
}
|
|
||||||
onReleased: {
|
|
||||||
if (velocity > 2 && mouse.x > parent.width * 0.2) {
|
|
||||||
appearance.scaleFactor += 0.2
|
|
||||||
} else if (velocity < -2 && mouse.x > parent.width * 0.2) {
|
|
||||||
appearance.scaleFactor -= 0.2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: controlsOverlay
|
id: controlsOverlay
|
||||||
anchors.centerIn: player
|
anchors.centerIn: player
|
||||||
|
@ -373,6 +339,9 @@ Window {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
|
property real velocity: 0.0
|
||||||
|
property int xStart: 0
|
||||||
|
property int xPrev: 0
|
||||||
anchors {
|
anchors {
|
||||||
bottom: mouseAreaBar.top
|
bottom: mouseAreaBar.top
|
||||||
bottomMargin: 10
|
bottomMargin: 10
|
||||||
|
@ -388,15 +357,12 @@ Window {
|
||||||
id: mouseTapTimer
|
id: mouseTapTimer
|
||||||
interval: 200
|
interval: 200
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (appearance.clickToPause) {
|
|
||||||
player.playerCommand(Enums.Commands.TogglePlayPause)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (topBar.visible) {
|
if (topBar.visible) {
|
||||||
globalConnections.hideUI()
|
globalConnections.hideUI()
|
||||||
} else {
|
} else {
|
||||||
globalConnections.showUI()
|
globalConnections.showUI()
|
||||||
}
|
}
|
||||||
|
mouseAreaPlayerTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,8 +379,10 @@ Window {
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: function (mouse) {
|
onClicked: function (mouse) {
|
||||||
|
xStart = mouse.x
|
||||||
|
xPrev = mouse.x
|
||||||
|
velocity = 0
|
||||||
if (mouseTapTimer.running) {
|
if (mouseTapTimer.running) {
|
||||||
doubleMouseClick(mouse)
|
doubleMouseClick(mouse)
|
||||||
mouseTapTimer.stop()
|
mouseTapTimer.stop()
|
||||||
|
@ -422,6 +390,28 @@ Window {
|
||||||
mouseTapTimer.restart()
|
mouseTapTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onReleased: {
|
||||||
|
var isLongEnough = Math.hypot(xStart, mouse.x) > mainWindow.width * 0.3
|
||||||
|
if (velocity > 2 && isLongEnough) {
|
||||||
|
appearance.scaleFactor += 0.2
|
||||||
|
} else if (velocity < -2 && isLongEnough) {
|
||||||
|
if (appearance.scaleFactor > 0.8) {
|
||||||
|
appearance.scaleFactor -= 0.2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onPositionChanged: {
|
||||||
|
//console.warn(mouseAreaPlayer.mapToItem(controlsBar, mouse.x, mouse.y).y)
|
||||||
|
if (mouseAreaPlayer.containsPress) {
|
||||||
|
var currVel = (mouse.x - xPrev)
|
||||||
|
velocity = (velocity + currVel) / 2.0
|
||||||
|
xPrev = mouse.x
|
||||||
|
}
|
||||||
|
if (!topBar.visible) {
|
||||||
|
globalConnections.showUI()
|
||||||
|
mouseAreaPlayerTimer.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
Action {
|
Action {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
|
@ -438,10 +428,6 @@ Window {
|
||||||
globalConnections.hideUI()
|
globalConnections.hideUI()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
|
||||||
globalConnections.showUI()
|
|
||||||
mouseAreaPlayerTimer.restart()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
|
Loading…
Reference in a new issue