[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [elisa] src/qml: make the navigation bar filter view state a persistent setting
From:       Alexander Stippich <null () kde ! org>
Date:       2018-02-28 23:43:03
Message-ID: E1erBNH-0001xu-CW () code ! kde ! org
[Download RAW message or body]

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 persisently

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.stackView.pop()
+
+                                            Binding {
+                                                target: allAlbumsView
+                                                property: 'filterState'
+                                                value: \
persistentSettings.filterState +                                            }
+
+                                            onFilterViewChanged: \
persistentSettings.filterState = filterState  }
 
                                         visible: opacity > 0
@@ -500,6 +511,14 @@ ApplicationWindow {
 
                                             }
                                             onGoBack: localArtists.stackView.pop()
+
+                                            Binding {
+                                                target: allArtistsView
+                                                property: 'filterState'
+                                                value: \
persistentSettings.filterState +                                            }
+
+                                            onFilterViewChanged: \
persistentSettings.filterState = filterState  }
 
                                         visible: opacity > 0
@@ -518,10 +537,19 @@ ApplicationWindow {
                                         }
 
                                         firstPage: MediaAllTracksView {
+                                            id: allTracksView
                                             focus: true
                                             stackView: localTracks.stackView
 
                                             contentModel: elisa.allTracksProxyModel
+
+                                            Binding {
+                                                target: allTracksView
+                                                property: 'filterState'
+                                                value: \
persistentSettings.filterState +                                            }
+
+                                            onFilterViewChanged: \
persistentSettings.filterState = 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 = filterState
         }
     }
 
@@ -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.defaultArtistImage, '')
             }
             onGoBack: stackView.pop()
+
+            Binding {
+                target: albumGridView
+                property: 'filterState'
+                value: persistentSettings.filterState
+            }
+
+            onFilterViewChanged: persistentSettings.filterState = filterState
         }
     }
 
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 innerImage, 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.sourceModel.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", "Show Search \
                Options") : i18nc("Hide filters in the navigation bar", "Hide Search \
                Options")
-        iconName: collapsed ? "go-down-search" : "go-up-search"
-        onTriggered: collapsed ? collapsed = false : collapsed = true
+        text: navigationBar.state === "" ? i18nc("Show filters in the navigation \
bar", "Show Search Options") : i18nc("Hide filters in the navigation bar", "Hide \
Search Options") +        iconName: navigationBar.state === "" ? "go-down-search" : \
"go-up-search" +        onTriggered: {
+            navigationBar.state === "" ? navigationBar.state = 'expanded' : \
navigationBar.state = "" +            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.navigationBarFilterHeight


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic