diff --git a/src/qml/AlbumsView.qml b/src/qml/AlbumsView.qml index 9d6a4d12..5c83d07c 100644 --- a/src/qml/AlbumsView.qml +++ b/src/qml/AlbumsView.qml @@ -1,78 +1,79 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias image: gridView.image property var modelType + property alias defaultIcon: gridView.defaultIcon + property alias showRating: gridView.showRating + property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText focus: true DataModel { id: realModel } AllAlbumsProxyModel { id: proxyModel sourceModel: realModel onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent - defaultIcon: elisaTheme.albumCoverIcon - contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openOneAlbum(innerMainTitle, innerSecondaryTitle, innerImage, databaseId) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } } diff --git a/src/qml/ArtistsView.qml b/src/qml/ArtistsView.qml index 018f67f8..8a957d94 100644 --- a/src/qml/ArtistsView.qml +++ b/src/qml/ArtistsView.qml @@ -1,81 +1,80 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias image: gridView.image property var modelType + property alias defaultIcon: gridView.defaultIcon + property alias showRating: gridView.showRating + property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText focus: true DataModel { id: realModel } AllArtistsProxyModel { id: proxyModel sourceModel: realModel onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent - showRating: false - delegateDisplaySecondaryText: false - defaultIcon: elisaTheme.artistIcon - contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openOneArtist(innerMainTitle, innerImage, 0) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } } diff --git a/src/qml/ContentView.qml b/src/qml/ContentView.qml index 5271deb1..057f5ab4 100644 --- a/src/qml/ContentView.qml +++ b/src/qml/ContentView.qml @@ -1,628 +1,641 @@ /* * Copyright 2016-2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import org.kde.elisa 1.0 RowLayout { id: contentViewContainer spacing: 0 property bool showPlaylist property alias currentViewIndex: listViews.currentIndex signal toggleSearch() function goBack() { viewManager.goBack() } ViewManager { id: viewManager onSwitchOffAllViews: { listViews.currentIndex = 0 while(browseStackView.depth > 1) { browseStackView.pop() } } onSwitchRecentlyPlayedTracksView: { listViews.currentIndex = 1 while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allRecentlyPlayedTracksView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, stackView: browseStackView, opacity: 0, }) recentlyPlayedTracksIsLoaded() } onSwitchFrequentlyPlayedTracksView: { listViews.currentIndex = 2 while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allRecentlyPlayedTracksView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, stackView: browseStackView, opacity: 0, }) frequentlyPlayedTracksIsLoaded() } onSwitchAllAlbumsView: { listViews.currentIndex = 3 while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allAlbumsView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, + defaultIcon: viewDefaultIcon, + showRating: viewShowRating, + delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, stackView: browseStackView, opacity: 0, }) allAlbumsViewIsLoaded() } onSwitchOneAlbumView: { browseStackView.push(albumView, { mainTitle: mainTitle, secondaryTitle: secondaryTitle, image: imageUrl, stackView: browseStackView, opacity: 0, }) oneAlbumViewIsLoaded() } onSwitchAllArtistsView: { listViews.currentIndex = 4 while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allArtistsView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, + defaultIcon: viewDefaultIcon, + showRating: viewShowRating, + delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, stackView: browseStackView, opacity: 0, }) allArtistsViewIsLoaded() } onSwitchOneArtistView: { browseStackView.push(innerAlbumView, { mainTitle: mainTitle, secondaryTitle: secondaryTitle, image: imageUrl, stackView: browseStackView, artistFilter: mainTitle, opacity: 0, }) oneArtistViewIsLoaded() } - onSwitchOneArtistFromGenreView: { - browseStackView.push(innerAlbumView, { - mainTitle: mainTitle, - secondaryTitle: secondaryTitle, - image: imageUrl, - stackView: browseStackView, - genreFilterText: genreName, - artistFilter: mainTitle, - opacity: 0, - }) - - oneArtistViewIsLoaded() - } - onSwitchAllTracksView: { listViews.currentIndex = 5 while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allTracksView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, stackView: browseStackView, opacity: 0, }) allTracksViewIsLoaded() } onSwitchAllGenresView: { listViews.currentIndex = 6 while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allGenresView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, + defaultIcon: viewDefaultIcon, + showRating: viewShowRating, + delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, stackView: browseStackView, opacity: 0, }) allGenresViewIsLoaded() } - onSwitchFilesBrowserView: { - listViews.currentIndex = 7 + onSwitchAllArtistsFromGenreView: { + browseStackView.push(innerArtistView, { + mainTitle: mainTitle, + image: imageUrl, + modelType: dataType, + defaultIcon: viewDefaultIcon, + showRating: viewShowRating, + delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, + genreFilterText: mainTitle, + opacity: 0, + }) - while(browseStackView.depth > 1) { - browseStackView.pop() - } + allArtistsFromGenreViewIsLoaded() } - onSwitchAllArtistsFromGenreView: { - browseStackView.push(innerArtistView, { - mainTitle: genreName, - secondaryTitle: '', - image: elisaTheme.artistIcon, - stackView: browseStackView, + onSwitchOneArtistFromGenreView: { + browseStackView.push(innerAlbumView, { + mainTitle: mainTitle, + image: imageUrl, + modelType: dataType, + defaultIcon: viewDefaultIcon, + showRating: viewShowRating, + delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, genreFilterText: genreName, + artistFilter: mainTitle, opacity: 0, }) - allArtistsFromGenreViewIsLoaded() + oneArtistViewIsLoaded() + } + + onSwitchFilesBrowserView: { + listViews.currentIndex = 7 + + while(browseStackView.depth > 1) { + browseStackView.pop() + } } onPopOneView: browseStackView.pop() } ViewSelector { id: listViews Layout.fillHeight: true Layout.maximumWidth: mainWindow.width * 0.14 maximumSize: mainWindow.width * 0.14 Behavior on Layout.maximumWidth { NumberAnimation { duration: 150 } } onSwitchView: if (index === 1) { viewManager.openRecentlyPlayedTracks(mainTitle, imageUrl) } else if (index === 2) { viewManager.openFrequentlyPlayedTracks(mainTitle, imageUrl) } else if (index === 3) { viewManager.openAllAlbums(mainTitle, imageUrl) } else if (index === 4) { viewManager.openAllArtists(mainTitle, imageUrl) } else if (index === 5) { viewManager.openAllTracks(mainTitle, imageUrl) } else if (index === 6) { viewManager.openAllGenres(mainTitle, imageUrl) } else if (index === 7) { viewManager.openFilesBrowser(mainTitle, imageUrl) } else { viewManager.closeAllViews() } } Rectangle { id: viewSelectorSeparatorItem border.width: 1 border.color: myPalette.mid color: myPalette.mid visible: true Layout.bottomMargin: elisaTheme.layoutVerticalMargin Layout.topMargin: elisaTheme.layoutVerticalMargin Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.fillHeight: true Layout.preferredWidth: 1 Layout.minimumWidth: 1 Layout.maximumWidth: 1 } ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true spacing: 0 TopNotification { id: invalidBalooConfiguration Layout.fillWidth: true musicManager: elisa.musicManager focus: true } Item { Layout.fillHeight: true Layout.fillWidth: true RowLayout { anchors.fill: parent spacing: 0 id: contentZone FocusScope { id: mainContentView focus: true Layout.fillHeight: true Layout.minimumWidth: 0 Layout.maximumWidth: 0 Layout.preferredWidth: 0 visible: Layout.minimumWidth != 0 Rectangle { border { color: (mainContentView.activeFocus ? myPalette.highlight : myPalette.base) width: 1 } radius: 3 color: myPalette.base anchors.fill: parent StackView { id: browseStackView anchors.fill: parent clip: true initialItem: Item { } popEnter: Transition { OpacityAnimator { from: 0.0 to: 1.0 duration: 300 } } popExit: Transition { OpacityAnimator { from: 1.0 to: 0.0 duration: 300 } } pushEnter: Transition { OpacityAnimator { from: 0.0 to: 1.0 duration: 300 } } pushExit: Transition { OpacityAnimator { from: 1.0 to: 0.0 duration: 300 } } replaceEnter: Transition { OpacityAnimator { from: 0.0 to: 1.0 duration: 300 } } replaceExit: Transition { OpacityAnimator { from: 1.0 to: 0.0 duration: 300 } } } Behavior on border.color { ColorAnimation { duration: 300 } } } } Rectangle { id: firstViewSeparatorItem border.width: 1 border.color: myPalette.mid color: myPalette.mid visible: true Layout.bottomMargin: elisaTheme.layoutVerticalMargin Layout.topMargin: elisaTheme.layoutVerticalMargin Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.fillHeight: true Layout.preferredWidth: 1 Layout.minimumWidth: 1 Layout.maximumWidth: 1 } MediaPlayListView { id: playList Layout.fillHeight: true Layout.leftMargin: elisaTheme.layoutHorizontalMargin Layout.rightMargin: elisaTheme.layoutHorizontalMargin Layout.minimumWidth: contentZone.width Layout.maximumWidth: contentZone.width Layout.preferredWidth: contentZone.width onStartPlayback: elisa.audioControl.ensurePlay() onPausePlayback: elisa.audioControl.playPause() onDisplayError: messageNotification.showNotification(errorText) } Rectangle { id: viewSeparatorItem border.width: 1 border.color: myPalette.mid color: myPalette.mid visible: Layout.minimumWidth != 0 Layout.bottomMargin: elisaTheme.layoutVerticalMargin Layout.topMargin: elisaTheme.layoutVerticalMargin Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.fillHeight: true Layout.preferredWidth: 1 Layout.minimumWidth: 1 Layout.maximumWidth: 1 } ContextView { id: albumContext Layout.fillHeight: true Layout.minimumWidth: contentZone.width Layout.maximumWidth: contentZone.width Layout.preferredWidth: contentZone.width visible: Layout.minimumWidth != 0 artistName: elisa.manageHeaderBar.artist albumName: elisa.manageHeaderBar.album albumArtUrl: elisa.manageHeaderBar.image } } } states: [ State { name: 'playList' when: listViews.currentIndex === 0 PropertyChanges { target: mainContentView Layout.fillWidth: false Layout.minimumWidth: 0 Layout.maximumWidth: 0 Layout.preferredWidth: 0 } PropertyChanges { target: firstViewSeparatorItem Layout.minimumWidth: 0 Layout.maximumWidth: 0 Layout.preferredWidth: 0 } PropertyChanges { target: playList Layout.minimumWidth: contentZone.width / 2 Layout.maximumWidth: contentZone.width / 2 Layout.preferredWidth: contentZone.width / 2 } PropertyChanges { target: viewSeparatorItem Layout.minimumWidth: 1 Layout.maximumWidth: 1 Layout.preferredWidth: 1 } PropertyChanges { target: albumContext Layout.minimumWidth: contentZone.width / 2 Layout.maximumWidth: contentZone.width / 2 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 PropertyChanges { target: mainContentView Layout.fillWidth: true Layout.minimumWidth: contentZone.width * 0.66 Layout.maximumWidth: contentZone.width * 0.68 Layout.preferredWidth: contentZone.width * 0.68 } PropertyChanges { target: firstViewSeparatorItem Layout.minimumWidth: 1 Layout.maximumWidth: 1 Layout.preferredWidth: 1 } PropertyChanges { target: playList Layout.minimumWidth: contentZone.width * 0.33 Layout.maximumWidth: contentZone.width * 0.33 Layout.preferredWidth: contentZone.width * 0.33 } PropertyChanges { target: viewSeparatorItem Layout.minimumWidth: 0 Layout.maximumWidth: 0 Layout.preferredWidth: 0 } PropertyChanges { target: albumContext Layout.minimumWidth: 0 Layout.maximumWidth: 0 Layout.preferredWidth: 0 } } ] transitions: Transition { NumberAnimation { properties: "Layout.minimumWidth, Layout.maximumWidth, Layout.preferredWidth, opacity" easing.type: Easing.InOutQuad duration: 300 } } } Component { id: allFrequentlyPlayedTracksView FrequentlyPlayedTracks { } } Component { id: allRecentlyPlayedTracksView RecentlyPlayedTracks { } } Component { id: allAlbumsView AlbumsView { } } Component { id: allArtistsView ArtistsView { } } Component { id: allGenresView GenresView { } } Component { id: allTracksView TracksView { } } Component { id: innerAlbumView OneArtistView { } } Component { id: innerArtistView OneGenreView { } } Component { id: albumView AlbumView { } } } diff --git a/src/qml/GenresView.qml b/src/qml/GenresView.qml index 8545e35e..ff154d54 100644 --- a/src/qml/GenresView.qml +++ b/src/qml/GenresView.qml @@ -1,80 +1,79 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias image: gridView.image property var modelType + property alias defaultIcon: gridView.defaultIcon + property alias showRating: gridView.showRating + property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText focus: true DataModel { id: realModel } AllArtistsProxyModel { id: proxyModel sourceModel: realModel onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent - showRating: false - delegateDisplaySecondaryText: false - defaultIcon: elisaTheme.genresIcon - contentModel: proxyModel onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openAllArtistsFromGenre(innerMainTitle) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initialize(elisa.musicManager, modelType) } Component.onCompleted: { if (elisa.musicManager) { realModel.initialize(elisa.musicManager, modelType) } } } diff --git a/src/qml/OneArtistView.qml b/src/qml/OneArtistView.qml index 80c871bc..1dae69ca 100644 --- a/src/qml/OneArtistView.qml +++ b/src/qml/OneArtistView.qml @@ -1,90 +1,91 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image + property alias defaultIcon: gridView.defaultIcon + property alias showRating: gridView.showRating + property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property string genreFilterText property string artistFilter DataModel { id: realModel } AllAlbumsProxyModel { id: proxyModel sourceModel: realModel onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView focus: true anchors.fill: parent - defaultIcon: elisaTheme.albumCoverIcon - contentModel: proxyModel isSubPage: true onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Album, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Album, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openOneAlbum(innerMainTitle, innerSecondaryTitle, innerImage, databaseId) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: { if (genreFilterText) { realModel.initializeByGenreAndArtist(elisa.musicManager, ElisaUtils.Album, genreFilterText, artistFilter) } else { realModel.initializeByArtist(elisa.musicManager, ElisaUtils.Album, artistFilter) } } } Component.onCompleted: { if (elisa.musicManager) { if (genreFilterText) { realModel.initializeByGenreAndArtist(elisa.musicManager, ElisaUtils.Album, genreFilterText, artistFilter) } else { realModel.initializeByArtist(elisa.musicManager, ElisaUtils.Album, artistFilter) } } } } diff --git a/src/qml/OneGenreView.qml b/src/qml/OneGenreView.qml index bf0ea35c..3db6f3ba 100644 --- a/src/qml/OneGenreView.qml +++ b/src/qml/OneGenreView.qml @@ -1,81 +1,80 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.3 import org.kde.elisa 1.0 FocusScope { id: viewHeader property alias mainTitle: gridView.mainTitle property alias secondaryTitle: gridView.secondaryTitle property alias image: gridView.image + property alias defaultIcon: gridView.defaultIcon + property alias showRating: gridView.showRating + property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText property string genreFilterText DataModel { id: realModel } AllArtistsProxyModel { id: proxyModel sourceModel: realModel onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) } GridBrowserView { id: gridView contentModel: proxyModel focus: true anchors.fill: parent - defaultIcon: elisaTheme.artistIcon - - delegateDisplaySecondaryText: false - isSubPage: true onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Artist, ElisaUtils.AppendPlayList, ElisaUtils.DoNotTriggerPlay) onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Artist, ElisaUtils.ReplacePlayList, ElisaUtils.TriggerPlay) onOpen: viewManager.openOneArtist(innerMainTitle, innerImage, 0) onGoBack: viewManager.goBack() } Connections { target: elisa onMusicManagerChanged: realModel.initializeByGenre(elisa.musicManager, ElisaUtils.Artist, genreFilterText) } Component.onCompleted: { if (elisa.musicManager) { realModel.initializeByGenre(elisa.musicManager, ElisaUtils.Artist, genreFilterText) } } } diff --git a/src/viewmanager.cpp b/src/viewmanager.cpp index 0057e1ea..0a428af0 100644 --- a/src/viewmanager.cpp +++ b/src/viewmanager.cpp @@ -1,248 +1,257 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "viewmanager.h" ViewManager::ViewManager(QObject *parent) : QObject(parent) { } void ViewManager::closeAllViews() { mCurrentView = ViewsType::NoViews; mTargetView = ViewsType::NoViews; Q_EMIT switchOffAllViews(); } void ViewManager::openRecentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::RecentlyPlayedTracks; if (mCurrentView != mTargetView) { Q_EMIT switchRecentlyPlayedTracksView(mainTitle, imageUrl, ElisaUtils::Track); } } void ViewManager::openFrequentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::FrequentlyPlayedTracks; if (mCurrentView != mTargetView) { Q_EMIT switchFrequentlyPlayedTracksView(mainTitle, imageUrl, ElisaUtils::Track); } } void ViewManager::openAllAlbums(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::AllAlbums; if (mCurrentView != mTargetView) { - Q_EMIT switchAllAlbumsView(mainTitle, imageUrl, ElisaUtils::Album); + Q_EMIT switchAllAlbumsView(mainTitle, imageUrl, ElisaUtils::Album, + QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true); } } void ViewManager::openOneAlbum(const QString &albumTitle, const QString &albumAuthor, const QUrl &albumCover, qulonglong albumDatabaseId) { mTargetAlbumTitle = albumTitle; mTargetAlbumAuthor = albumAuthor; mTargetDatabaseId = albumDatabaseId; mTargetImageUrl = albumCover; if (mCurrentView == ViewsType::AllAlbums) { mTargetView = ViewsType::OneAlbum; Q_EMIT switchOneAlbumView(mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneArtist) { mTargetView = ViewsType::OneAlbumFromArtist; Q_EMIT switchOneAlbumView(mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneArtistFromGenre) { mTargetView = ViewsType::OneAlbumFromArtistAndGenre; Q_EMIT switchOneAlbumView(mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); } else { - switchAllAlbumsView({}, {}, ElisaUtils::Album); + switchAllAlbumsView({}, {}, ElisaUtils::Album, + QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true); } } void ViewManager::openAllArtists(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::AllArtists; if (mCurrentView != mTargetView) { - Q_EMIT switchAllArtistsView(mainTitle, imageUrl, ElisaUtils::Artist); + Q_EMIT switchAllArtistsView(mainTitle, imageUrl, ElisaUtils::Artist, + QUrl(QStringLiteral("image://icon/view-media-artist")), false, false); } } void ViewManager::openOneArtist(const QString &artistName, const QUrl &artistImageUrl, qulonglong artistDatabaseId) { mTargetArtistName = artistName; mTargetDatabaseId = artistDatabaseId; mTargetImageUrl = artistImageUrl; if (mCurrentView == ViewsType::AllArtistsFromGenre) { mTargetView = ViewsType::OneArtistFromGenre; } else { mTargetView = ViewsType::OneArtist; } if (mCurrentView == ViewsType::AllArtists && mTargetView == ViewsType::OneArtist) { Q_EMIT switchOneArtistView(mTargetArtistName, mTargetImageUrl, {}, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneArtist && mCurrentArtistName != mTargetArtistName && mTargetView == ViewsType::OneArtist) { Q_EMIT popOneView(); Q_EMIT switchOneArtistView(mTargetArtistName, mTargetImageUrl, {}, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneAlbumFromArtist && mCurrentArtistName != mTargetArtistName && mTargetView == ViewsType::OneArtist) { Q_EMIT popOneView(); Q_EMIT popOneView(); Q_EMIT switchOneArtistView(mTargetArtistName, mTargetImageUrl, {}, mTargetDatabaseId); } else if (mCurrentView == ViewsType::AllArtistsFromGenre && mTargetView == ViewsType::OneArtistFromGenre) { - Q_EMIT switchOneArtistFromGenreView(mTargetArtistName, mTargetImageUrl, {}, mTargetDatabaseId, mTargetGenreName); + Q_EMIT switchOneArtistFromGenreView(mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, + QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true, + mTargetDatabaseId, mTargetGenreName); } else { - Q_EMIT switchAllArtistsView({}, {}, ElisaUtils::Artist); + Q_EMIT switchAllArtistsView({}, {}, ElisaUtils::Artist, + QUrl(QStringLiteral("image://icon/view-media-artist")), false, false); } } void ViewManager::openAllTracks(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::AllTracks; if (mCurrentView != mTargetView) { Q_EMIT switchAllTracksView(mainTitle, imageUrl, ElisaUtils::Track); } } void ViewManager::openAllGenres(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::AllGenres; if (mCurrentView != mTargetView) { - Q_EMIT switchAllGenresView(mainTitle, imageUrl, ElisaUtils::Genre); + Q_EMIT switchAllGenresView(mainTitle, imageUrl, ElisaUtils::Genre, + QUrl(QStringLiteral("image://icon/view-media-genre")), false, false); } } void ViewManager::openAllArtistsFromGenre(const QString &genreName) { mTargetView = ViewsType::AllArtistsFromGenre; mTargetGenreName = genreName; if (mCurrentView == ViewsType::AllGenres) { - Q_EMIT switchAllArtistsFromGenreView(mTargetGenreName); + Q_EMIT switchAllArtistsFromGenreView(mTargetGenreName, {}, QUrl(QStringLiteral("image://icon/view-media-artist")), + ElisaUtils::Artist, QUrl(QStringLiteral("image://icon/view-media-artist")), false, false); } else { - Q_EMIT switchAllGenresView({}, {}, ElisaUtils::Genre); + Q_EMIT switchAllGenresView({}, {}, ElisaUtils::Genre, + QUrl(QStringLiteral("image://icon/view-media-genre")), false, false); } } void ViewManager::openFilesBrowser(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::FilesBrowser; if (mCurrentView != mTargetView) { Q_EMIT switchFilesBrowserView(mainTitle, imageUrl); } } void ViewManager::recentlyPlayedTracksIsLoaded() { mCurrentView = ViewsType::RecentlyPlayedTracks; } void ViewManager::frequentlyPlayedTracksIsLoaded() { mCurrentView = ViewsType::FrequentlyPlayedTracks; } void ViewManager::allAlbumsViewIsLoaded() { mCurrentView = ViewsType::AllAlbums; if (mTargetView == ViewsType::OneAlbum) { Q_EMIT switchOneAlbumView(mTargetAlbumTitle, mTargetImageUrl, mTargetArtistName, mTargetDatabaseId); } } void ViewManager::oneAlbumViewIsLoaded() { mCurrentAlbumTitle = mTargetAlbumTitle; mCurrentAlbumAuthor = mTargetAlbumAuthor; if (mTargetView == ViewsType::OneAlbum) { mCurrentView = ViewsType::OneAlbum; } else if (mTargetView == ViewsType::OneAlbumFromArtist) { mCurrentView = ViewsType::OneAlbumFromArtist; } else if (mTargetView == ViewsType::OneAlbumFromArtistAndGenre) { mCurrentView = ViewsType::OneAlbumFromArtistAndGenre; } } void ViewManager::allArtistsViewIsLoaded() { mCurrentView = ViewsType::AllArtists; if (mTargetView == ViewsType::OneArtist) { Q_EMIT switchOneArtistView(mTargetArtistName, mTargetImageUrl, {}, mTargetDatabaseId); } } void ViewManager::oneArtistViewIsLoaded() { mCurrentArtistName = mTargetArtistName; if (mTargetView == ViewsType::OneArtist) { mCurrentView = ViewsType::OneArtist; } else { mCurrentGenreName = mTargetGenreName; mCurrentView = ViewsType::OneArtistFromGenre; } } void ViewManager::allTracksViewIsLoaded() { mCurrentView = ViewsType::AllTracks; } void ViewManager::allGenresViewIsLoaded() { mCurrentView = ViewsType::AllGenres; } void ViewManager::allArtistsFromGenreViewIsLoaded() { mCurrentGenreName = mTargetGenreName; mCurrentView = ViewsType::AllArtistsFromGenre; } void ViewManager::filesBrowserViewIsLoaded() { mCurrentView = ViewsType::FilesBrowser; } void ViewManager::goBack() { Q_EMIT popOneView(); if (mCurrentView == ViewsType::OneAlbum) { mCurrentView = ViewsType::AllAlbums; } else if (mCurrentView == ViewsType::OneArtist) { mCurrentView = ViewsType::AllArtists; } else if (mCurrentView == ViewsType::OneAlbumFromArtist) { mCurrentView = ViewsType::OneArtist; } else if (mCurrentView == ViewsType::AllArtistsFromGenre) { mCurrentView = ViewsType::AllGenres; } else if (mCurrentView == ViewsType::OneArtistFromGenre) { mCurrentView = ViewsType::AllArtistsFromGenre; } else if (mCurrentView == ViewsType::OneAlbumFromArtistAndGenre) { mCurrentView = ViewsType::OneArtistFromGenre; } } #include "moc_viewmanager.cpp" diff --git a/src/viewmanager.h b/src/viewmanager.h index 5c78c56a..6d6f8ddc 100644 --- a/src/viewmanager.h +++ b/src/viewmanager.h @@ -1,149 +1,161 @@ /* * Copyright 2018 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef VIEWMANAGER_H #define VIEWMANAGER_H #include "elisaLib_export.h" #include "elisautils.h" #include #include class ELISALIB_EXPORT ViewManager : public QObject { Q_OBJECT public: enum ViewsType { NoViews, AllAlbums, OneAlbum, AllArtists, OneArtist, OneAlbumFromArtist, AllTracks, AllGenres, AllArtistsFromGenre, OneArtistFromGenre, OneAlbumFromArtistAndGenre, FrequentlyPlayedTracks, RecentlyPlayedTracks, FilesBrowser }; Q_ENUM(ViewsType) explicit ViewManager(QObject *parent = nullptr); Q_SIGNALS: - void switchRecentlyPlayedTracksView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); + void switchRecentlyPlayedTracksView(const QString &mainTitle, const QUrl &imageUrl, + ElisaUtils::PlayListEntryType dataType); void switchFrequentlyPlayedTracksView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); - void switchAllAlbumsView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); + void switchAllAlbumsView(const QString &mainTitle, const QUrl &imageUrl, + ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, + bool viewShowRating, bool viewDelegateDisplaySecondaryText); void switchOneAlbumView(const QString &mainTitle, const QUrl &imageUrl, const QString &secondaryTitle, qulonglong databaseId); - void switchAllArtistsView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); + void switchAllArtistsView(const QString &mainTitle, const QUrl &imageUrl, + ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, + bool viewShowRating, bool viewDelegateDisplaySecondaryText); void switchOneArtistView(const QString &mainTitle, const QUrl &imageUrl, const QString &secondaryTitle, qulonglong databaseId); void switchAllTracksView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); - void switchAllGenresView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); + void switchAllGenresView(const QString &mainTitle, const QUrl &imageUrl, + ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, + bool viewShowRating, bool viewDelegateDisplaySecondaryText); - void switchAllArtistsFromGenreView(const QString &genreName); + void switchAllArtistsFromGenreView(const QString &mainTitle, const QString &secondaryTitle, + const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, + const QUrl &viewDefaultIcon, bool viewShowRating, + bool viewDelegateDisplaySecondaryText); - void switchOneArtistFromGenreView(const QString &mainTitle, const QUrl &imageUrl, - const QString &secondaryTitle, qulonglong databaseId, + void switchOneArtistFromGenreView(const QString &mainTitle, const QString &secondaryTitle, + const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, + const QUrl &viewDefaultIcon, bool viewShowRating, + bool viewDelegateDisplaySecondaryText, qulonglong databaseId, const QString &genreName); void switchFilesBrowserView(const QString &mainTitle, const QUrl &imageUrl); void switchOffAllViews(); void popOneView(); public Q_SLOTS: void closeAllViews(); void openRecentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl); void openFrequentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl); void openAllAlbums(const QString &mainTitle, const QUrl &imageUrl); void openOneAlbum(const QString &albumTitle, const QString &albumAuthor, const QUrl &albumCover, qulonglong albumDatabaseId); void openAllArtists(const QString &mainTitle, const QUrl &imageUrl); void openOneArtist(const QString &artistName, const QUrl &artistImageUrl, qulonglong artistDatabaseId); void openAllTracks(const QString &mainTitle, const QUrl &imageUrl); void openAllGenres(const QString &mainTitle, const QUrl &imageUrl); void openAllArtistsFromGenre(const QString &genreName); void openFilesBrowser(const QString &mainTitle, const QUrl &imageUrl); void recentlyPlayedTracksIsLoaded(); void frequentlyPlayedTracksIsLoaded(); void allAlbumsViewIsLoaded(); void oneAlbumViewIsLoaded(); void allArtistsViewIsLoaded(); void oneArtistViewIsLoaded(); void allTracksViewIsLoaded(); void allGenresViewIsLoaded(); void allArtistsFromGenreViewIsLoaded(); void filesBrowserViewIsLoaded(); void goBack(); private: ViewsType mCurrentView = ViewsType::NoViews; QString mCurrentAlbumTitle; QString mCurrentAlbumAuthor; QString mCurrentArtistName; QString mCurrentGenreName; ViewsType mTargetView = ViewsType::NoViews; QString mTargetAlbumTitle; QString mTargetAlbumAuthor; QString mTargetArtistName; QString mTargetGenreName; QUrl mTargetImageUrl; qulonglong mTargetDatabaseId = 0; }; #endif // VIEWMANAGER_H