From kde-commits Thu May 31 21:55:53 2018 From: Matthieu Gallien Date: Thu, 31 May 2018 21:55:53 +0000 To: kde-commits Subject: [elisa/file_browser] src: Merge branch 'master' into file_browser Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=152780376915046 Git commit 52dfbbc763ccbeca8bb9d1f09d57e8ae3139660e by Matthieu Gallien. Committed on 31/05/2018 at 21:55. Pushed by mgallien into branch 'file_browser'. Merge branch 'master' into file_browser M +1 -0 src/CMakeLists.txt M +157 -241 src/qml/ContentView.qml M +201 -0 src/qml/ViewManager.qml M +4 -0 src/qml/ViewSelector.qml M +1 -0 src/resources.qrc https://commits.kde.org/elisa/52dfbbc763ccbeca8bb9d1f09d57e8ae3139660e diff --cc src/qml/ContentView.qml index 153805b,c0cf886..b40b1ad --- a/src/qml/ContentView.qml +++ b/src/qml/ContentView.qml @@@ -30,8 -30,60 +30,72 @@@ RowLayout = signal toggleSearch() = function goBack() { - localAlbums.goBack() - localArtists.goBack() + viewManager.goBack() + } + = + ViewManager { + id: viewManager + = + onSwitchAllAlbumsView: { + listViews.currentIndex =3D 1 + localArtistsLoader.opacity =3D 0 + localTracksLoader.opacity =3D 0 + localAlbumsLoader.opacity =3D 1 ++ localFilesLoader.opacity =3D 0 + } + = + onSwitchOneAlbumView: { + elisa.singleAlbumProxyModel.loadAlbumData(databaseId) + currentStackView.push(albumView, { + mainTitle: mainTitle, + secondaryTitle: secondaryTitle, + image: imageUrl, + stackView: currentStackView, + }) + oneAlbumViewIsLoaded() + } + = + onSwitchAllArtistsView: { + listViews.currentIndex =3D 2 + localArtistsLoader.opacity =3D 1 + localTracksLoader.opacity =3D 0 + localAlbumsLoader.opacity =3D 0 ++ localFilesLoader.opacity =3D 0 + } + = + onSwitchOneArtistView: { + elisa.singleArtistProxyModel.setArtistFilterText(mainTitle) + currentStackView.push(innerAlbumView, { + mainTitle: mainTitle, + secondaryTitle: secondaryTitle, + image: imageUrl, + stackView: currentStackView, + }) + oneArtistViewIsLoaded() + } + = + onSwitchAllTracksView: { + listViews.currentIndex =3D 3 + localArtistsLoader.opacity =3D 0 + localTracksLoader.opacity =3D 1 + localAlbumsLoader.opacity =3D 0 ++ localFilesLoader.opacity =3D 0 ++ } ++ ++ onSwitchFilesBrowserView: { ++ listViews.currentIndex =3D 4 ++ localArtistsLoader.opacity =3D 0 ++ localTracksLoader.opacity =3D 0 ++ localAlbumsLoader.opacity =3D 0 ++ localFilesLoader.opacity =3D 1 + } + = + onSwitchOffAllViews: { + localArtistsLoader.opacity =3D 0 + localTracksLoader.opacity =3D 0 + localAlbumsLoader.opacity =3D 0 ++ localFilesLoader.opacity =3D 0 + } } = ViewSelector { @@@ -40,6 -92,16 +104,18 @@@ Layout.fillHeight: true Layout.preferredWidth: mainWindow.width * 0.11 Layout.maximumWidth: mainWindow.width * 0.11 + = + onSwitchView: if (index =3D=3D=3D 1) { + viewManager.openAllAlbums() + } else if (index =3D=3D=3D 2) { + viewManager.openAllArtists() + } else if (index =3D=3D=3D 3) { + viewManager.openAllTracks() ++ } else if (index =3D=3D=3D 4) { ++ viewManager.openFilesBrowser() + } else { + viewManager.closeAllViews() + } } = Rectangle { @@@ -311,40 -385,15 +399,58 @@@ onFilterViewChanged: persistentSettin= gs.expandedFilterView =3D expandedFilterView } } + = + Behavior on opacity { + NumberAnimation { + easing.type: Easing.InOutQuad + duration: 300 + } + } } = + Loader { + id: localFilesLoader + + active: opacity > 0 + + visible: opacity > 0 + ++ opacity: 0 ++ + anchors { + fill: parent + + leftMargin: elisaTheme.layoutHorizontalMa= rgin + rightMargin: elisaTheme.layoutHorizontalM= argin + } + ++ onLoaded: viewManager.filesBrowserViewIsLoade= d(item) ++ + sourceComponent: FileBrowserView { + id: localFiles + + focus: true + + contentModel: elisa.fileBrowserProxyModel + + Binding { + target: localFiles + property: 'expandedFilterView' + value: persistentSettings.expandedFil= terView + } + + onFilterViewChanged: persistentSettings.e= xpandedFilterView =3D expandedFilterView + } ++ ++ Behavior on opacity { ++ NumberAnimation { ++ easing.type: Easing.InOutQuad ++ duration: 300 ++ } ++ } + } + + Behavior on border.color { ColorAnimation { duration: 300 diff --cc src/qml/ViewManager.qml index 0000000,8e03875..ba78bcf mode 000000,100644..100644 --- a/src/qml/ViewManager.qml +++ b/src/qml/ViewManager.qml @@@ -1,0 -1,186 +1,201 @@@ + /* + * Copyright 2016-2017 Matthieu Gallien + * + * 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 + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public Lice= nse + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + = + import QtQuick 2.7 + = + QtObject { + = + enum ViewsType { + NoViews, + AllAlbums, + OneAlbum, + AllArtists, + OneArtist, + OneAlbumFromArtist, - AllTracks ++ AllTracks, ++ FilesBrowser + } + = + property int currentView: ViewManager.ViewsType.NoViews + property string currentAlbumTitle + property string currentAlbumAuthor + property string currentArtistName + property var currentStackView + = + property int targetView: ViewManager.ViewsType.NoViews + property string targetAlbumTitle + property string targetAlbumAuthor + property string targetArtistName + property url targetImageUrl + property int targetDatabaseId + = + signal switchAllAlbumsView() + signal switchOneAlbumView(var currentStackView, string mainTitle, url= imageUrl, string secondaryTitle, int databaseId) + signal switchAllArtistsView() + signal switchOneArtistView(var currentStackView, string mainTitle, ur= l imageUrl, string secondaryTitle, int databaseId) + signal switchAllTracksView() ++ signal switchFilesBrowserView() + signal switchOffAllViews() + = + function closeAllViews() + { + currentView =3D ViewManager.ViewsType.NoViews + targetView =3D ViewManager.ViewsType.NoViews + switchOffAllViews() + } + = + function openAllAlbums() + { + targetView =3D ViewManager.ViewsType.AllAlbums + = + if (currentView !=3D targetView) { + switchAllAlbumsView() + } + } + = + function openOneAlbum(stackView, albumTitle, albumAuthor, albumCover,= albumDatabaseId) + { + targetAlbumTitle =3D albumTitle + targetAlbumAuthor =3D albumAuthor + targetDatabaseId =3D albumDatabaseId + targetImageUrl =3D albumCover + currentStackView =3D stackView + = + if (currentView =3D=3D ViewManager.ViewsType.AllAlbums) { + targetView =3D ViewManager.ViewsType.OneAlbum + switchOneAlbumView(currentStackView, targetAlbumTitle, target= ImageUrl, targetAlbumAuthor, targetDatabaseId) + } else if (currentView =3D=3D ViewManager.ViewsType.OneArtist) { + targetView =3D ViewManager.ViewsType.OneAlbumFromArtist + switchOneAlbumView(currentStackView, targetAlbumTitle, target= ImageUrl, targetAlbumAuthor, targetDatabaseId) + } else { + switchAllAlbumsView() + } + } + = + function openAllArtists() + { + targetView =3D ViewManager.ViewsType.AllArtists + = + if (currentView !=3D targetView) { + switchAllArtistsView() + } + } + = + function openOneArtist(stackView, artistName, artistImageUrl, artistD= atabaseId) + { + targetArtistName =3D artistName + targetDatabaseId =3D artistDatabaseId + targetImageUrl =3D artistImageUrl + currentStackView =3D stackView + = + targetView =3D ViewManager.ViewsType.OneArtist + = + if (currentView =3D=3D ViewManager.ViewsType.AllArtists && target= View =3D=3D ViewManager.ViewsType.OneArtist) { + switchOneArtistView(currentStackView, targetArtistName, targe= tImageUrl, '', targetDatabaseId) + } else if (currentView =3D=3D ViewManager.ViewsType.OneArtist && = currentArtistName !=3D targetArtistName && + targetView =3D=3D ViewManager.ViewsType.OneArtist) { + currentStackView.pop() + switchOneArtistView(currentStackView, targetArtistName, targe= tImageUrl, '', targetDatabaseId) + } else if (currentView =3D=3D ViewManager.ViewsType.OneAlbumFromA= rtist && currentArtistName !=3D targetArtistName && + targetView =3D=3D ViewManager.ViewsType.OneArtist) { + currentStackView.pop() + currentStackView.pop() + switchOneArtistView(currentStackView, targetArtistName, targe= tImageUrl, '', targetDatabaseId) + } else { + switchAllArtistsView() + } + } + = + function openAllTracks() + { + targetView =3D ViewManager.ViewsType.AllTracks + if (currentView !=3D targetView) { + switchAllTracksView() + } + } + = ++ function openFilesBrowser() ++ { ++ targetView =3D ViewManager.ViewsType.FilesBrowser ++ if (currentView !=3D targetView) { ++ switchFilesBrowserView() ++ } ++ } ++ + function allAlbumsViewIsLoaded(stackView) + { + currentStackView =3D stackView + currentView =3D ViewManager.ViewsType.AllAlbums + if (targetView =3D=3D ViewManager.ViewsType.OneAlbum) { + switchOneAlbumView(currentStackView, targetAlbumTitle, target= ImageUrl, targetArtistName, targetDatabaseId) + } + } + = + function oneAlbumViewIsLoaded() + { + currentAlbumTitle =3D targetAlbumTitle + currentAlbumAuthor =3D targetAlbumAuthor + = + if (targetView =3D=3D ViewManager.ViewsType.OneAlbum) { + currentView =3D ViewManager.ViewsType.OneAlbum + } else if (targetView =3D=3D ViewManager.ViewsType.OneAlbumFromAr= tist) { + currentView =3D ViewManager.ViewsType.OneAlbumFromArtist + } + } + = + function allArtistsViewIsLoaded(stackView) + { + currentStackView =3D stackView + currentView =3D ViewManager.ViewsType.AllArtists + if (targetView =3D=3D ViewManager.ViewsType.OneArtist) { + switchOneArtistView(currentStackView, targetArtistName, targe= tImageUrl, '', targetDatabaseId) + } + } + = + function oneArtistViewIsLoaded() + { + currentArtistName =3D targetArtistName + if (targetView =3D=3D ViewManager.ViewsType.OneArtist) { + currentView =3D ViewManager.ViewsType.OneArtist + } + } + = + function allTracksViewIsLoaded(allTracksView) + { + currentView =3D ViewManager.ViewsType.AllTracks + } + = ++ function filesBrowserViewIsLoaded() ++ { ++ currentView =3D ViewManager.ViewsType.FilesBrowser ++ } ++ + function goBack() + { + currentStackView.pop() + = + if (currentView =3D=3D ViewManager.ViewsType.OneAlbum) { + currentView =3D ViewManager.ViewsType.AllAlbums + } else if (currentView =3D=3D ViewManager.ViewsType.OneArtist) { + currentView =3D ViewManager.ViewsType.AllArtists + } else if (currentView =3D=3D ViewManager.ViewsType.OneAlbumFromA= rtist) { + currentView =3D ViewManager.ViewsType.OneArtist + } + } + } diff --cc src/resources.qrc index ef00dd0,659a983..f312a7c --- a/src/resources.qrc +++ b/src/resources.qrc @@@ -26,10 -26,9 +26,11 @@@ qml/GridBrowserView.qml qml/GridBrowserDelegate.qml qml/ListBrowserView.qml + qml/FileBrowserDelegate.qml + qml/FileBrowserView.qml qtquickcontrols2.conf background.png + qml/ViewManager.qml windows/WindowsTheme.qml