Commit 8e519573 authored by Diego Gangl's avatar Diego Gangl
Browse files

Allow playlist to be hidden

Summary:
This patch adds an option to the main menu to hide/show the side playlist.
This was an often requested feature (and it also looks kind of cool).

Feature: 392781

Reviewers: mgallien, astippich

Reviewed By: mgallien

Subscribers: ngraham

Tags: #elisa

Differential Revision: https://phabricator.kde.org/D13834
parent b22b1356
......@@ -168,6 +168,12 @@ void ElisaApplication::setupActions(const QString &actionName)
d->mCollection.addAction(goBackAction->objectName(), goBackAction);
}
if (actionName == QStringLiteral("toggle_playlist") && KAuthorized::authorizeAction(actionName)) {
auto togglePlaylistAction = d->mCollection.addAction(actionName, this, &ElisaApplication::togglePlaylist);
togglePlaylistAction->setShortcut(QKeySequence(Qt::Key_F9));
togglePlaylistAction->setText(QStringLiteral("Toggle Playlist"));
}
if (actionName == QStringLiteral("edit_find") && KAuthorized::authorizeAction(actionName)) {
auto findAction = KStandardAction::find(this, &ElisaApplication::find, this);
d->mCollection.addAction(findAction->objectName(), findAction);
......@@ -265,6 +271,8 @@ void ElisaApplication::goBack() {}
void ElisaApplication::find() {}
void ElisaApplication::togglePlaylist() {}
QStringList ElisaApplication::checkFileListAndMakeAbsolute(const QStringList &filesList, const QString &workingDirectory) const
{
QStringList filesToOpen;
......
......@@ -220,6 +220,8 @@ private Q_SLOTS:
void find();
void togglePlaylist();
private:
void initializeModels();
......
/*
* Copyright 2016-2018 Matthieu Gallien <matthieu_gallien@yahoo.fr>
* Copyright 2018 Alexander Stippich <a.stippich@gmx.net>
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
......@@ -21,6 +21,7 @@
import QtQuick 2.7
//explore menu from Qt 5.10 once we can require it, but it is item-based
import QtQuick.Controls 1.4
import org.kde.elisa 1.0
Menu {
id: applicationMenu
......@@ -32,6 +33,7 @@ Menu {
property var aboutAppAction: elisa.action("help_about_app")
property var configureShortcutsAction: elisa.action("options_configure_keybinding")
property var configureAction: elisa.action("options_configure")
property var togglePlaylistAction: elisa.action("toggle_playlist")
MenuItem {
text: configureAction.text
......@@ -49,6 +51,14 @@ Menu {
visible: configureShortcutsAction.text !== ""
}
MenuItem {
shortcut: togglePlaylistAction.shortcut
text: contentView.showPlaylist ? i18nc("Hide playlist", "Hide Playlist") : i18nc("Show playlist", "Show Playlist")
iconName: "view-media-playlist"
onTriggered: contentView.showPlaylist = !contentView.showPlaylist
enabled: contentView.currentViewIndex != 0
}
MenuSeparator {
visible: reportBugAction.text !== ""
}
......
......@@ -27,6 +27,9 @@ RowLayout {
id: contentViewContainer
spacing: 0
property bool showPlaylist
property alias currentViewIndex: listViews.currentIndex
signal toggleSearch()
function goBack() {
......@@ -678,6 +681,24 @@ RowLayout {
Layout.preferredWidth: contentZone.width / 2
}
},
State {
name: "browsingViewsNoPlaylist"
when: listViews.currentIndex !== 0 && contentViewContainer.showPlaylist !== true
extend: "browsingViews"
PropertyChanges {
target: mainContentView
Layout.fillWidth: true
Layout.minimumWidth: contentZone.width
Layout.maximumWidth: contentZone.width
Layout.preferredWidth: contentZone.width
}
PropertyChanges {
target: playList
Layout.minimumWidth: 0
Layout.maximumWidth: 0
Layout.preferredWidth: 0
}
},
State {
name: 'browsingViews'
when: listViews.currentIndex !== 0
......
......@@ -30,7 +30,7 @@ ApplicationWindow {
visible: true
minimumWidth: 1100
minimumWidth: contentView.showPlaylist ? 1100 : 700
minimumHeight: 600
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
......@@ -57,7 +57,8 @@ ApplicationWindow {
}
}
}
Controls1.Action {
Controls1.Action {
shortcut: goBackAction.shortcut
onTriggered: contentView.goBack()
}
......@@ -102,6 +103,7 @@ ApplicationWindow {
property bool expandedFilterView: false
property bool showPlaylist: true
}
Connections {
......@@ -121,6 +123,7 @@ ApplicationWindow {
persistentSettings.playControlItemRepeat = headerBar.playerControl.repeat
persistentSettings.playControlItemShuffle = headerBar.playerControl.shuffle
persistentSettings.showPlaylist = contentView.showPlaylist
}
}
......@@ -258,6 +261,7 @@ ApplicationWindow {
id: contentView
Layout.fillHeight: true
Layout.fillWidth: true
showPlaylist: persistentSettings.showPlaylist
}
}
}
......
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