Sidebar playlist to improve interaction

pull/3/head
reionwong 5 years ago
parent a6b4a24d8e
commit 496abc3382

@ -29,7 +29,7 @@ QtObject {
property Action togglePlaylistAction: Action {
id: togglePlaylistAction
property var qaction: app.action("togglePlaylist")
text: qaction.text
// text: qaction.text
shortcut: qaction.shortcutName
icon.name: qaction.iconName()

@ -25,8 +25,8 @@ Item {
property alias volume: volume
height: mainLayout.childrenRect.height + FishUI.Units.largeSpacing * 2
visible: mpv.mouseY > window.height - footer.height - FishUI.Units.largeSpacing * 3
opacity: visible ? 1 : 0
visible: true
opacity: mpv.mouseY > window.height - footer.height - FishUI.Units.largeSpacing * 3 ? 1 : 0
Behavior on opacity {
NumberAnimation {
@ -91,26 +91,6 @@ Item {
RowLayout {
id: footerRow
// ToolButton {
// icon.name: "application-menu"
// visible: !menuBar.visible
// focusPolicy: Qt.NoFocus
// onClicked: {
// if (mpvContextMenu.visible) {
// return
// }
// mpvContextMenu.visible = !mpvContextMenu.visible
// const menuHeight = mpvContextMenu.count * mpvContextMenu.itemAt(0).height
// mpvContextMenu.popup(footer, 0, -menuHeight)
// }
// }
Loader {
sourceComponent: togglePlaylistButton
visible: !PlaylistSettings.canToggleWithMouse && PlaylistSettings.position === "left"
}
ToolButton {
id: playPreviousFile
action: actions.playPreviousAction
@ -174,7 +154,7 @@ Item {
Loader {
sourceComponent: togglePlaylistButton
visible: !PlaylistSettings.canToggleWithMouse && PlaylistSettings.position === "right"
visible: true
}
}
}

@ -220,21 +220,21 @@ MpvObject {
if (!playList.canToggleWithMouse || playList.playlistView.count <= 1) {
return
}
if (playList.position === "right") {
if (mouseX > width - 50) {
playList.state = "visible"
}
if (mouseX < width - playList.width - 20) {
playList.state = "hidden"
}
} else {
if (mouseX < 50) {
playList.state = "visible"
}
if (mouseX > playList.width + 20) {
playList.state = "hidden"
}
}
// if (playList.position === "right") {
// if (mouseX > width - 50) {
// playList.state = "visible"
// }
// if (mouseX < width - playList.width - 20) {
// playList.state = "hidden"
// }
// } else {
// if (mouseX < 50) {
// playList.state = "visible"
// }
// if (mouseX > playList.width + 20) {
// playList.state = "hidden"
// }
// }
}
onWheel: {
@ -251,6 +251,10 @@ MpvObject {
onPressed: {
focus = true
// Hide play list
playList.state = "hidden"
if (mouse.button === Qt.LeftButton) {
if (MouseSettings.left) {
actions[MouseSettings.left].trigger()

@ -18,7 +18,8 @@ Item {
property alias scrollPositionTimer: scrollPositionTimer
property alias playlistView: playlistView
property bool canToggleWithMouse: PlaylistSettings.canToggleWithMouse
// property bool canToggleWithMouse: PlaylistSettings.canToggleWithMouse
property bool canToggleWithMouse: true
property string position: PlaylistSettings.position
property int rowHeight: PlaylistSettings.rowHeight
property int bigFont: PlaylistSettings.bigFontFullscreen
@ -50,15 +51,12 @@ Item {
id: playlistView
model: mpv.playlistModel
spacing: 1
delegate: playListItemSimple
delegate: PlayListItem {
onDoubleClicked: root.state = "hidden"
}
}
}
Component {
id: playListItemSimple
PlayListItem {}
}
Timer {
id: scrollPositionTimer
interval: 50

@ -23,6 +23,8 @@ Item {
height: label.font.pointSize * 3 + PlaylistSettings.rowHeight
width: ListView.view.width
signal doubleClicked()
Rectangle {
anchors.fill: parent
color: FishUI.Theme.backgroundColor
@ -33,6 +35,8 @@ Item {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onDoubleClicked: {
root.doubleClicked()
mpv.playlistModel.setPlayingVideo(index)
mpv.loadFile(path, !isYouTubePlaylist)
mpv.pause = false

Loading…
Cancel
Save