Commit 1fd3f827 authored by Tranter Madi's avatar Tranter Madi 🌧 Committed by Nicolás Alvarez
Browse files

Improve Player Control

* Make Playlist and Menu buttons more consistent with the others.
* Fix the bug that you can't close the opening menu by clicking on the menu button.
* Add largeSpacing between the volume slider and the shuffle button

This is a re-merge of !232.
parent cb2051f1
Pipeline #60327 passed with stage
in 7 minutes and 55 seconds
......@@ -105,10 +105,6 @@ Kirigami.ApplicationWindow {
onTriggered: persistentSettings.expandedFilterView = !persistentSettings.expandedFilterView
}
ApplicationMenu {
id: applicationMenu
}
SystemPalette {
id: myPalette
colorGroup: SystemPalette.Active
......@@ -318,14 +314,6 @@ Kirigami.ApplicationWindow {
onOpenNowPlaying: { contentView.openNowPlaying() }
onOpenAlbum: { contentView.openAlbum(album, albumArtist, image, albumID) }
playerControl.onOpenMenu: {
if (applicationMenu.visible) {
applicationMenu.close()
} else {
applicationMenu.popup(mainWindow.width - applicationMenu.width, headerBar.height)
}
}
// animations
StateGroup {
id: mainWindowState
......
......@@ -20,8 +20,6 @@ BasePlayerControl {
property alias volume: volumeSlider.sliderValue
property bool isMaximized
signal openMenu()
signal maximize()
signal minimize()
......@@ -119,11 +117,14 @@ BasePlayerControl {
sliderBorderActiveColor: myPalette.text
}
Item { implicitWidth: Kirigami.Units.largeSpacing }
FlatButtonWithToolTip {
id: shuffleButton
text: i18nc("toggle shuffle mode for playlist", "Toggle Shuffle")
icon.name: "media-playlist-shuffle"
onClicked: musicWidget.shuffle = !musicWidget.shuffle
checkable: true
checked: musicWidget.shuffle
}
......@@ -145,6 +146,8 @@ BasePlayerControl {
}
return map[musicWidget.repeat]
}
checkable: true
checked: repeat !== 0
onClicked: {
let nextRepeat = musicWidget.repeat + 1
......@@ -175,8 +178,7 @@ BasePlayerControl {
}
}
// Not a FlatButtonWithToolTip because we want text
Button {
FlatButtonWithToolTip {
id: showHidePlaylistAction
action: Action {
shortcut: ElisaApplication.action("toggle_playlist").shortcut
......@@ -185,24 +187,38 @@ BasePlayerControl {
visible: !musicWidget.isMaximized && mainWindow.width >= elisaTheme.viewSelectorSmallSizeThreshold
flat: true
display: AbstractButton.TextBesideIcon
text: i18n("Show Playlist")
icon.name: "view-media-playlist"
checkable: true
checked: contentView.showPlaylist
activeFocusOnTab: true
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
}
FlatButtonWithToolTip {
id: menuButton
text: i18nc("open application menu", "Application Menu")
icon.name: "application-menu"
onClicked: openMenu()
checkable: true
checked: applicationMenu.visible
onClicked: {
if (applicationMenu.visible) {
applicationMenu.close()
} else {
var pos = menuButton.mapFromItem(headerBar, headerBar.width - applicationMenu.width, headerBar.height)
applicationMenu.popup(pos.x, pos.y)
}
}
ApplicationMenu {
id: applicationMenu
// otherwise clicking on the menu button will not close it
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}
}
Item { implicitWidth: Math.floor(Kirigami.Units.smallSpacing / 2) }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment