[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [elisa/file_browser] src: Merge branch 'master' into file_browser
From: Matthieu Gallien <null () kde ! org>
Date: 2018-05-31 21:55:53
Message-ID: E1fOVY1-0006tX-Fb () code ! kde ! org
[Download RAW message or body]
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 = 1
+ localArtistsLoader.opacity = 0
+ localTracksLoader.opacity = 0
+ localAlbumsLoader.opacity = 1
++ localFilesLoader.opacity = 0
+ }
+
+ onSwitchOneAlbumView: {
+ elisa.singleAlbumProxyModel.loadAlbumData(databaseId)
+ currentStackView.push(albumView, {
+ mainTitle: mainTitle,
+ secondaryTitle: secondaryTitle,
+ image: imageUrl,
+ stackView: currentStackView,
+ })
+ oneAlbumViewIsLoaded()
+ }
+
+ onSwitchAllArtistsView: {
+ listViews.currentIndex = 2
+ localArtistsLoader.opacity = 1
+ localTracksLoader.opacity = 0
+ localAlbumsLoader.opacity = 0
++ localFilesLoader.opacity = 0
+ }
+
+ onSwitchOneArtistView: {
+ elisa.singleArtistProxyModel.setArtistFilterText(mainTitle)
+ currentStackView.push(innerAlbumView, {
+ mainTitle: mainTitle,
+ secondaryTitle: secondaryTitle,
+ image: imageUrl,
+ stackView: currentStackView,
+ })
+ oneArtistViewIsLoaded()
+ }
+
+ onSwitchAllTracksView: {
+ listViews.currentIndex = 3
+ localArtistsLoader.opacity = 0
+ localTracksLoader.opacity = 1
+ localAlbumsLoader.opacity = 0
++ localFilesLoader.opacity = 0
++ }
++
++ onSwitchFilesBrowserView: {
++ listViews.currentIndex = 4
++ localArtistsLoader.opacity = 0
++ localTracksLoader.opacity = 0
++ localAlbumsLoader.opacity = 0
++ localFilesLoader.opacity = 1
+ }
+
+ onSwitchOffAllViews: {
+ localArtistsLoader.opacity = 0
+ localTracksLoader.opacity = 0
+ localAlbumsLoader.opacity = 0
++ localFilesLoader.opacity = 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 === 1) {
+ viewManager.openAllAlbums()
+ } else if (index === 2) {
+ viewManager.openAllArtists()
+ } else if (index === 3) {
+ viewManager.openAllTracks()
++ } else if (index === 4) {
++ viewManager.openFilesBrowser()
+ } else {
+ viewManager.closeAllViews()
+ }
}
Rectangle {
@@@ -311,40 -385,15 +399,58 @@@
onFilterViewChanged: \
persistentSettings.expandedFilterView = 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.layoutHorizontalMargin
+ rightMargin: elisaTheme.layoutHorizontalMargin
+ }
+
++ onLoaded: viewManager.filesBrowserViewIsLoaded(item)
++
+ sourceComponent: FileBrowserView {
+ id: localFiles
+
+ focus: true
+
+ contentModel: elisa.fileBrowserProxyModel
+
+ Binding {
+ target: localFiles
+ property: 'expandedFilterView'
+ value: persistentSettings.expandedFilterView
+ }
+
+ onFilterViewChanged: \
persistentSettings.expandedFilterView = 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 <matthieu_gallien@yahoo.fr>
+ *
+ * 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 License
+ * 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, url \
imageUrl, string secondaryTitle, int databaseId) + signal switchAllTracksView()
++ signal switchFilesBrowserView()
+ signal switchOffAllViews()
+
+ function closeAllViews()
+ {
+ currentView = ViewManager.ViewsType.NoViews
+ targetView = ViewManager.ViewsType.NoViews
+ switchOffAllViews()
+ }
+
+ function openAllAlbums()
+ {
+ targetView = ViewManager.ViewsType.AllAlbums
+
+ if (currentView != targetView) {
+ switchAllAlbumsView()
+ }
+ }
+
+ function openOneAlbum(stackView, albumTitle, albumAuthor, albumCover, \
albumDatabaseId) + {
+ targetAlbumTitle = albumTitle
+ targetAlbumAuthor = albumAuthor
+ targetDatabaseId = albumDatabaseId
+ targetImageUrl = albumCover
+ currentStackView = stackView
+
+ if (currentView == ViewManager.ViewsType.AllAlbums) {
+ targetView = ViewManager.ViewsType.OneAlbum
+ switchOneAlbumView(currentStackView, targetAlbumTitle, targetImageUrl, \
targetAlbumAuthor, targetDatabaseId) + } else if (currentView == \
ViewManager.ViewsType.OneArtist) { + targetView = \
ViewManager.ViewsType.OneAlbumFromArtist + \
switchOneAlbumView(currentStackView, targetAlbumTitle, targetImageUrl, \
targetAlbumAuthor, targetDatabaseId) + } else {
+ switchAllAlbumsView()
+ }
+ }
+
+ function openAllArtists()
+ {
+ targetView = ViewManager.ViewsType.AllArtists
+
+ if (currentView != targetView) {
+ switchAllArtistsView()
+ }
+ }
+
+ function openOneArtist(stackView, artistName, artistImageUrl, artistDatabaseId)
+ {
+ targetArtistName = artistName
+ targetDatabaseId = artistDatabaseId
+ targetImageUrl = artistImageUrl
+ currentStackView = stackView
+
+ targetView = ViewManager.ViewsType.OneArtist
+
+ if (currentView == ViewManager.ViewsType.AllArtists && targetView == \
ViewManager.ViewsType.OneArtist) { + \
switchOneArtistView(currentStackView, targetArtistName, targetImageUrl, '', \
targetDatabaseId) + } else if (currentView == ViewManager.ViewsType.OneArtist \
&& currentArtistName != targetArtistName && + targetView == \
ViewManager.ViewsType.OneArtist) { + currentStackView.pop()
+ switchOneArtistView(currentStackView, targetArtistName, targetImageUrl, \
'', targetDatabaseId) + } else if (currentView == \
ViewManager.ViewsType.OneAlbumFromArtist && currentArtistName != targetArtistName && \
+ targetView == ViewManager.ViewsType.OneArtist) { + \
currentStackView.pop() + currentStackView.pop()
+ switchOneArtistView(currentStackView, targetArtistName, targetImageUrl, \
'', targetDatabaseId) + } else {
+ switchAllArtistsView()
+ }
+ }
+
+ function openAllTracks()
+ {
+ targetView = ViewManager.ViewsType.AllTracks
+ if (currentView != targetView) {
+ switchAllTracksView()
+ }
+ }
+
++ function openFilesBrowser()
++ {
++ targetView = ViewManager.ViewsType.FilesBrowser
++ if (currentView != targetView) {
++ switchFilesBrowserView()
++ }
++ }
++
+ function allAlbumsViewIsLoaded(stackView)
+ {
+ currentStackView = stackView
+ currentView = ViewManager.ViewsType.AllAlbums
+ if (targetView == ViewManager.ViewsType.OneAlbum) {
+ switchOneAlbumView(currentStackView, targetAlbumTitle, targetImageUrl, \
targetArtistName, targetDatabaseId) + }
+ }
+
+ function oneAlbumViewIsLoaded()
+ {
+ currentAlbumTitle = targetAlbumTitle
+ currentAlbumAuthor = targetAlbumAuthor
+
+ if (targetView == ViewManager.ViewsType.OneAlbum) {
+ currentView = ViewManager.ViewsType.OneAlbum
+ } else if (targetView == ViewManager.ViewsType.OneAlbumFromArtist) {
+ currentView = ViewManager.ViewsType.OneAlbumFromArtist
+ }
+ }
+
+ function allArtistsViewIsLoaded(stackView)
+ {
+ currentStackView = stackView
+ currentView = ViewManager.ViewsType.AllArtists
+ if (targetView == ViewManager.ViewsType.OneArtist) {
+ switchOneArtistView(currentStackView, targetArtistName, targetImageUrl, \
'', targetDatabaseId) + }
+ }
+
+ function oneArtistViewIsLoaded()
+ {
+ currentArtistName = targetArtistName
+ if (targetView == ViewManager.ViewsType.OneArtist) {
+ currentView = ViewManager.ViewsType.OneArtist
+ }
+ }
+
+ function allTracksViewIsLoaded(allTracksView)
+ {
+ currentView = ViewManager.ViewsType.AllTracks
+ }
+
++ function filesBrowserViewIsLoaded()
++ {
++ currentView = ViewManager.ViewsType.FilesBrowser
++ }
++
+ function goBack()
+ {
+ currentStackView.pop()
+
+ if (currentView == ViewManager.ViewsType.OneAlbum) {
+ currentView = ViewManager.ViewsType.AllAlbums
+ } else if (currentView == ViewManager.ViewsType.OneArtist) {
+ currentView = ViewManager.ViewsType.AllArtists
+ } else if (currentView == ViewManager.ViewsType.OneAlbumFromArtist) {
+ currentView = 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 @@@
<file>qml/GridBrowserView.qml</file>
<file>qml/GridBrowserDelegate.qml</file>
<file>qml/ListBrowserView.qml</file>
+ <file>qml/FileBrowserDelegate.qml</file>
+ <file>qml/FileBrowserView.qml</file>
<file>qtquickcontrols2.conf</file>
<file>background.png</file>
+ <file>qml/ViewManager.qml</file>
</qresource>
<qresource prefix="/qml/+windows">
<file alias="Theme.qml">windows/WindowsTheme.qml</file>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic