diff --git a/src/elisaapplication.h b/src/elisaapplication.h --- a/src/elisaapplication.h +++ b/src/elisaapplication.h @@ -220,6 +220,8 @@ void find(); + void togglePlaylist(); + private: void initializeModels(); diff --git a/src/elisaapplication.cpp b/src/elisaapplication.cpp --- a/src/elisaapplication.cpp +++ b/src/elisaapplication.cpp @@ -168,6 +168,12 @@ 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::find() {} +void ElisaApplication::togglePlaylist() {} + QStringList ElisaApplication::checkFileListAndMakeAbsolute(const QStringList &filesList, const QString &workingDirectory) const { QStringList filesToOpen; diff --git a/src/qml/ApplicationMenu.qml b/src/qml/ApplicationMenu.qml --- a/src/qml/ApplicationMenu.qml +++ b/src/qml/ApplicationMenu.qml @@ -1,7 +1,7 @@ /* * Copyright 2016-2018 Matthieu Gallien * Copyright 2018 Alexander Stippich - * + * * 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 @@ 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 @@ 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 !== "" } diff --git a/src/qml/ContentView.qml b/src/qml/ContentView.qml --- a/src/qml/ContentView.qml +++ b/src/qml/ContentView.qml @@ -27,6 +27,9 @@ id: contentViewContainer spacing: 0 + property bool showPlaylist + property alias currentViewIndex: listViews.currentIndex + signal toggleSearch() function goBack() { @@ -678,6 +681,24 @@ 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 diff --git a/src/qml/ElisaMainWindow.qml b/src/qml/ElisaMainWindow.qml --- a/src/qml/ElisaMainWindow.qml +++ b/src/qml/ElisaMainWindow.qml @@ -30,7 +30,7 @@ visible: true - minimumWidth: 1100 + minimumWidth: contentView.showPlaylist ? 1100 : 700 minimumHeight: 600 LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft @@ -57,7 +57,8 @@ } } } - Controls1.Action { + + Controls1.Action { shortcut: goBackAction.shortcut onTriggered: contentView.goBack() } @@ -102,6 +103,7 @@ property bool expandedFilterView: false + property bool showPlaylist: true } Connections { @@ -121,6 +123,7 @@ persistentSettings.playControlItemRepeat = headerBar.playerControl.repeat persistentSettings.playControlItemShuffle = headerBar.playerControl.shuffle + persistentSettings.showPlaylist = contentView.showPlaylist } } @@ -258,6 +261,7 @@ id: contentView Layout.fillHeight: true Layout.fillWidth: true + showPlaylist: persistentSettings.showPlaylist } } }