From kde-commits Wed Feb 28 23:43:03 2018 From: Alexander Stippich Date: Wed, 28 Feb 2018 23:43:03 +0000 To: kde-commits Subject: [elisa] src/qml: make the navigation bar filter view state a persistent setting Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=151986139622013 Git commit 383feeee9d174165d0d57082373ffac1df038f65 by Alexander Stippich. Committed on 28/02/2018 at 23:42. Pushed by astippich into branch 'master'. make the navigation bar filter view state a persistent setting Summary: the view state of the navigation action bar is now stored persisen= tly Reviewers: #elisa, mgallien Reviewed By: #elisa, mgallien Subscribers: mgallien Tags: #elisa Differential Revision: https://phabricator.kde.org/D10488 M +47 -1 src/qml/ElisaMainWindow.qml M +4 -0 src/qml/GridBrowserView.qml M +4 -0 src/qml/MediaAlbumView.qml M +5 -0 src/qml/MediaAllTracksView.qml M +8 -7 src/qml/NavigationActionBar.qml https://commits.kde.org/elisa/383feeee9d174165d0d57082373ffac1df038f65 diff --git a/src/qml/ElisaMainWindow.qml b/src/qml/ElisaMainWindow.qml index 6df2b4e..869aabf 100644 --- a/src/qml/ElisaMainWindow.qml +++ b/src/qml/ElisaMainWindow.qml @@ -91,7 +91,10 @@ ApplicationWindow { = property double playControlItemVolume : 100.0 property bool playControlItemMuted : false - } + + property string filterState + + } = Connections { target: Qt.application @@ -460,6 +463,14 @@ ApplicationWindow { = }) } onGoBack: localAlbums.stackVie= w.pop() + + Binding { + target: allAlbumsView + property: 'filterState' + value: persistentSettings.= filterState + } + + onFilterViewChanged: persisten= tSettings.filterState =3D filterState } = visible: opacity > 0 @@ -500,6 +511,14 @@ ApplicationWindow { = } onGoBack: localArtists.stackVi= ew.pop() + + Binding { + target: allArtistsView + property: 'filterState' + value: persistentSettings.= filterState + } + + onFilterViewChanged: persisten= tSettings.filterState =3D filterState } = visible: opacity > 0 @@ -518,10 +537,19 @@ ApplicationWindow { } = firstPage: MediaAllTracksView { + id: allTracksView focus: true stackView: localTracks.stackVi= ew = contentModel: elisa.allTracksP= roxyModel + + Binding { + target: allTracksView + property: 'filterState' + value: persistentSettings.= filterState + } + + onFilterViewChanged: persisten= tSettings.filterState =3D filterState } = visible: opacity > 0 @@ -832,6 +860,7 @@ ApplicationWindow { id: innerAlbumView = GridBrowserView { + id: innerAlbumGridView property var stackView = contentModel: elisa.singleArtistProxyModel @@ -848,6 +877,14 @@ ApplicationWindow { }) } onGoBack: stackView.pop() + + Binding { + target: innerAlbumGridView + property: 'filterState' + value: persistentSettings.filterState + } + + onFilterViewChanged: persistentSettings.filterState =3D filter= State } } = @@ -855,6 +892,7 @@ ApplicationWindow { id: albumView = MediaAlbumView { + id: albumGridView property var stackView = contentModel: elisa.singleAlbumProxyModel @@ -875,6 +913,14 @@ ApplicationWindow { allArtistsView.open(name, name, elisaTheme.defaultArtistIm= age, '') } onGoBack: stackView.pop() + + Binding { + target: albumGridView + property: 'filterState' + value: persistentSettings.filterState + } + + onFilterViewChanged: persistentSettings.filterState =3D filter= State } } = diff --git a/src/qml/GridBrowserView.qml b/src/qml/GridBrowserView.qml index 60e1bb9..e57c933 100644 --- a/src/qml/GridBrowserView.qml +++ b/src/qml/GridBrowserView.qml @@ -37,9 +37,11 @@ FocusScope { property alias contentModel: contentDirectoryView.model property bool showRating: true property bool delegateDisplaySecondaryText: true + property alias filterState: navigationBar.state = signal open(var innerMainTitle, var innerSecondaryTitle, var innerImag= e, var databaseId) signal goBack() + signal filterViewChanged(string filterState) = SystemPalette { id: myPalette @@ -85,6 +87,8 @@ FocusScope { onReplaceAndPlay:contentModel.replaceAndPlayOfPlayList() = onGoBack: gridView.goBack() + + onFilterViewChanged: gridView.filterViewChanged(filterState) } = Rectangle { diff --git a/src/qml/MediaAlbumView.qml b/src/qml/MediaAlbumView.qml index d8dcc8a..f053cde 100644 --- a/src/qml/MediaAlbumView.qml +++ b/src/qml/MediaAlbumView.qml @@ -32,11 +32,13 @@ FocusScope { property var artistName property var albumArtUrl property bool isSingleDiscAlbum + property alias filterState: navigationBar.state property var albumId property alias contentModel: contentDirectoryView.model = signal showArtist(var name) signal goBack(); + signal filterViewChanged(string filterState) = function loadAlbumData(id) { @@ -85,6 +87,8 @@ FocusScope { = onGoBack: topListing.goBack() = + onFilterViewChanged: topListing.filterViewChanged(filterState) + onShowArtist: topListing.showArtist(topListing.contentModel.so= urceModel.author) = onEnqueue: contentModel.enqueueToPlayList() diff --git a/src/qml/MediaAllTracksView.qml b/src/qml/MediaAllTracksView.qml index f7edda1..f37eff7 100644 --- a/src/qml/MediaAllTracksView.qml +++ b/src/qml/MediaAllTracksView.qml @@ -32,6 +32,9 @@ FocusScope { = property var stackView property alias contentModel: contentDirectoryView.model + property alias filterState: navigationBar.state + + signal filterViewChanged(string filterState) = SystemPalette { id: myPalette @@ -74,6 +77,8 @@ FocusScope { = onEnqueue: contentModel.enqueueToPlayList() = + onFilterViewChanged: rootElement.filterViewChanged(filterState) + onReplaceAndPlay: contentModel.replaceAndPlayOfPlayList() } = diff --git a/src/qml/NavigationActionBar.qml b/src/qml/NavigationActionBar.= qml index d087d7b..c592c91 100644 --- a/src/qml/NavigationActionBar.qml +++ b/src/qml/NavigationActionBar.qml @@ -36,12 +36,12 @@ FocusScope { property alias filterText: filterTextInput.text property alias filterRating: ratingFilter.starRating property bool enableGoBack: true - property bool collapsed: true = signal enqueue(); signal replaceAndPlay(); signal goBack(); signal showArtist(); + signal filterViewChanged(string filterState); = Action { id: goPreviousAction @@ -52,9 +52,12 @@ FocusScope { = Action { id: showFilterAction - text: collapsed ? i18nc("Show filters in the navigation bar", "Sho= w Search Options") : i18nc("Hide filters in the navigation bar", "Hide Sear= ch Options") - iconName: collapsed ? "go-down-search" : "go-up-search" - onTriggered: collapsed ? collapsed =3D false : collapsed =3D true + text: navigationBar.state =3D=3D=3D "" ? i18nc("Show filters in th= e navigation bar", "Show Search Options") : i18nc("Hide filters in the navi= gation bar", "Hide Search Options") + iconName: navigationBar.state =3D=3D=3D "" ? "go-down-search" : "g= o-up-search" + onTriggered: { + navigationBar.state =3D=3D=3D "" ? navigationBar.state =3D 'ex= panded' : navigationBar.state =3D "" + filterViewChanged(navigationBar.state) + } } = ColumnLayout { @@ -313,8 +316,7 @@ FocusScope { = states: [ State { - name: 'collapsed' - when: collapsed + name: "" PropertyChanges { target: navigationBar height: elisaTheme.navigationBarHeight @@ -326,7 +328,6 @@ FocusScope { }, State { name: 'expanded' - when: !collapsed PropertyChanges { target: navigationBar height: elisaTheme.navigationBarHeight + elisaTheme.naviga= tionBarFilterHeight