Commit 01e999d8 authored by Carl Schwan's avatar Carl Schwan 🚴 Committed by Matthieu Gallien
Browse files

Add a mode where all the bottom part can be hidden

Summary:
Referencing https://phabricator.kde.org/T7676

In HeaderBar, if playerControl.maximized == true, then we are in 'party
mode' otherwise we are in normal mode.

Reviewers: #elisa, januz, mgallien

Reviewed By: #elisa, mgallien

Subscribers: januz, mgallien, astippich

Differential Revision: https://phabricator.kde.org/D14736
parent 2979a10f
......@@ -104,6 +104,8 @@ ApplicationWindow {
property bool expandedFilterView: false
property bool showPlaylist: true
property bool headerBarIsMaximized: false
}
Connections {
......@@ -124,6 +126,8 @@ ApplicationWindow {
persistentSettings.playControlItemRepeat = headerBar.playerControl.repeat
persistentSettings.playControlItemShuffle = headerBar.playerControl.shuffle
persistentSettings.showPlaylist = contentView.showPlaylist
persistentSettings.headerBarIsMaximized = headerBar.isMaximized
}
}
......@@ -175,10 +179,11 @@ ApplicationWindow {
spacing: 0
Item {
Layout.preferredHeight: mainWindow.height * 0.2 + elisaTheme.mediaPlayerControlHeight
id: headerBarParent
Layout.minimumHeight: mainWindow.height * 0.2 + elisaTheme.mediaPlayerControlHeight
Layout.maximumHeight: mainWindow.height * 0.2 + elisaTheme.mediaPlayerControlHeight
Layout.fillWidth: true
HeaderBar {
id: headerBar
......@@ -216,6 +221,8 @@ ApplicationWindow {
playerControl.onPlayPrevious: elisa.mediaPlayList.skipPreviousTrack()
playerControl.onPlayNext: elisa.mediaPlayList.skipNextTrack()
playerControl.isMaximized: persistentSettings.headerBarIsMaximized
TrackImportNotification {
id: importedTracksCountNotification
......@@ -266,6 +273,33 @@ ApplicationWindow {
}
}
StateGroup {
id: mainWindowState
states: [
State {
name: "headerBarIsMaximized"
when: headerBar.isMaximized
changes: [
PropertyChanges {
target: mainWindow
minimumHeight: 120 + elisaTheme.mediaPlayerControlHeight
explicit: true
},
PropertyChanges {
target: headerBarParent
Layout.minimumHeight: mainWindow.height
Layout.maximumHeight: mainWindow.height
},
PropertyChanges {
target: contentView
height: 0
visible: false
}
]
}
]
}
Component.onCompleted:
{
elisa.initialize()
......
......@@ -36,6 +36,7 @@ FocusScope {
property int trackRating
property bool ratingVisible
property alias playerControl: playControlItem
property alias isMaximized: playControlItem.isMaximized
onImageChanged:
{
......
......@@ -35,6 +35,7 @@ FocusScope {
property bool playEnabled
property bool skipForwardEnabled
property bool skipBackwardEnabled
property bool isMaximized
property bool shuffle
property bool repeat
......@@ -45,6 +46,9 @@ FocusScope {
signal playNext()
signal seek(int position)
signal maximize()
signal minimize()
id: musicWidget
SystemPalette {
......@@ -67,6 +71,41 @@ FocusScope {
anchors.fill: parent
spacing: 5
Button {
Layout.preferredWidth: elisaTheme.smallControlButtonSize
Layout.preferredHeight: elisaTheme.smallControlButtonSize
Layout.alignment: Qt.AlignVCenter
Layout.maximumWidth: elisaTheme.smallControlButtonSize
Layout.maximumHeight: elisaTheme.smallControlButtonSize
Layout.minimumWidth: elisaTheme.smallControlButtonSize
Layout.minimumHeight: elisaTheme.smallControlButtonSize
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.mediaPlayerHorizontalMargin : 0
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.mediaPlayerHorizontalMargin : 0
contentItem: Image {
anchors.fill: parent
source: Qt.resolvedUrl(musicWidget.isMaximized ? elisaTheme.minimizeIcon : elisaTheme.maximizeIcon)
width: elisaTheme.smallControlButtonSize
height: elisaTheme.smallControlButtonSize
sourceSize.width: elisaTheme.smallControlButtonSize
sourceSize.height: elisaTheme.smallControlButtonSize
fillMode: Image.PreserveAspectFit
opacity: 1.0
}
background: Rectangle {
border.width: 0
opacity: 0.0
}
onClicked: {
musicWidget.isMaximized = !musicWidget.isMaximized
}
}
RoundButton {
focus: skipBackwardEnabled
......@@ -568,5 +607,14 @@ FocusScope {
{
console.log('volume of player controls changed: ' + volume)
}
onIsMaximizedChanged:
{
if (musicWidget.isMaximized) {
musicWidget.maximize()
} else {
musicWidget.minimize()
}
}
}
......@@ -51,6 +51,8 @@ Item {
property string noRepeatIcon: 'image://icon/media-repeat-none'
property string noShuffleIcon: 'image://icon/media-playlist-normal'
property string folderIcon: 'image://icon/document-open-folder'
property string maximizeIcon: 'image://icon/draw-arrow-down'
property string minimizeIcon: 'image://icon/draw-arrow-up'
property int layoutHorizontalMargin: dp(8)
property int layoutVerticalMargin: dp(6)
......
......@@ -51,6 +51,8 @@ Item {
property string noRepeatIcon: 'image://icon/media-repeat-none'
property string noShuffleIcon: 'image://icon/media-playlist-normal'
property string folderIcon: 'image://icon/document-open-folder'
property string maximizeIcon: 'image://icon/draw-arrow-down'
property string minimizeIcon: 'image://icon/draw-arrow-up'
property int layoutHorizontalMargin: dp(8)
property int layoutVerticalMargin: dp(6)
......
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