diff --git a/src/elisaqmlplugin.cpp b/src/elisaqmlplugin.cpp index b64e3550..7c72e914 100644 --- a/src/elisaqmlplugin.cpp +++ b/src/elisaqmlplugin.cpp @@ -1,182 +1,183 @@ /* * 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 "elisaqmlplugin.h" #if defined UPNPQT_FOUND && UPNPQT_FOUND #include "upnp/upnpcontrolconnectionmanager.h" #include "upnp/upnpcontrolmediaserver.h" #include "upnp/upnpcontrolcontentdirectory.h" #include "upnp/upnpcontentdirectorymodel.h" #include "upnpdevicedescription.h" #include "upnp/didlparser.h" #include "upnp/upnpdiscoverallmusic.h" #include "upnpssdpengine.h" #include "upnpabstractservice.h" #include "upnpcontrolabstractdevice.h" #include "upnpcontrolabstractservice.h" #include "upnpbasictypes.h" #endif #include "elisautils.h" #include "elisaapplication.h" #include "progressindicator.h" #include "mediaplaylist.h" #include "managemediaplayercontrol.h" #include "manageheaderbar.h" #include "manageaudioplayer.h" #include "musicaudiotrack.h" #include "musiclistenersmanager.h" #include "trackslistener.h" #include "viewmanager.h" #include "databaseinterface.h" #include "models/datamodel.h" #include "models/trackmetadatamodel.h" #include "models/viewsmodel.h" #include "models/gridviewproxymodel.h" #include "models/alltracksproxymodel.h" #include "models/singlealbumproxymodel.h" #if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND #include "embeddedcoverageimageprovider.h" #endif #if defined KF5KIO_FOUND && KF5KIO_FOUND #include "models/filebrowsermodel.h" #include "models/filebrowserproxymodel.h" #endif #include "audiowrapper.h" #include "notificationitem.h" #include "topnotificationmanager.h" #include "elisautils.h" #include "datatype.h" #if defined Qt5DBus_FOUND && Qt5DBus_FOUND #include "mpris2/mpris2.h" #include "mpris2/mediaplayer2player.h" #endif #include #include #include #include #include #include void ElisaQmlTestPlugin::initializeEngine(QQmlEngine *engine, const char *uri) { QQmlExtensionPlugin::initializeEngine(engine, uri); #if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND engine->addImageProvider(QStringLiteral("cover"), new EmbeddedCoverageImageProvider); #endif } void ElisaQmlTestPlugin::registerTypes(const char *uri) { #if defined UPNPQT_FOUND && UPNPQT_FOUND qmlRegisterType(uri, 1, 0, "UpnpSsdpEngine"); qmlRegisterType(uri, 1, 0, "UpnpDiscoverAllMusic"); qmlRegisterType(uri, 1, 0, "UpnpAbstractDevice"); qmlRegisterType(uri, 1, 0, "UpnpAbstractService"); qmlRegisterType(uri, 1, 0, "UpnpControlAbstractDevice"); qmlRegisterType(uri, 1, 0, "UpnpControlAbstractService"); qmlRegisterType(uri, 1, 0, "UpnpControlConnectionManager"); qmlRegisterType(uri, 1, 0, "UpnpControlMediaServer"); qmlRegisterType(uri, 1, 0, "UpnpContentDirectoryModel"); qmlRegisterType(uri, 1, 0, "DidlParser"); qmlRegisterType(uri, 1, 0, "UpnpControlContentDirectory"); qmlRegisterType(uri, 1, 0, "UpnpDeviceDescription"); qRegisterMetaType(); qRegisterMetaType >(); qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); #endif qRegisterMetaType("DataUtils::DataType"); qmlRegisterType(uri, 1, 0, "MediaPlayList"); qmlRegisterType(uri, 1, 0, "ManageMediaPlayerControl"); qmlRegisterType(uri, 1, 0, "ManageHeaderBar"); qmlRegisterType(uri, 1, 0, "ManageAudioPlayer"); qmlRegisterType(uri, 1, 0, "ProgressIndicator"); qmlRegisterType(uri, 1, 0, "MusicListenersManager"); qmlRegisterType(uri, 1, 0, "ViewManager"); qmlRegisterType(uri, 1, 0, "DataModel"); qmlRegisterType(uri, 1, 0, "TrackMetadataModel"); qmlRegisterType(uri, 1, 0, "ViewsModel"); qmlRegisterType(uri, 1, 0, "GridViewProxyModel"); qmlRegisterType(uri, 1, 0, "AllTracksProxyModel"); qmlRegisterType(uri, 1, 0, "SingleAlbumProxyModel"); #if defined KF5KIO_FOUND && KF5KIO_FOUND qmlRegisterType(uri, 1, 0, "FileBrowserModel"); qmlRegisterType(uri, 1, 0, "FileBrowserProxyModel"); #endif qmlRegisterType(uri, 1, 0, "AudioWrapper"); qmlRegisterType(uri, 1, 0, "TopNotificationManager"); qmlRegisterUncreatableMetaObject(DataUtils::staticMetaObject, uri, 1, 0, "DataUtils", QStringLiteral("Only enums")); qmlRegisterUncreatableType(uri, 1, 0, "DatabaseInterface", QStringLiteral("Only created in c++")); #if defined Qt5DBus_FOUND && Qt5DBus_FOUND qmlRegisterType(uri, 1, 0, "Mpris2"); qRegisterMetaType(); #endif qRegisterMetaType(); qRegisterMetaType>("QHash"); qRegisterMetaType>("QHash"); qRegisterMetaType>("QList"); qRegisterMetaType>("QVector"); qRegisterMetaType>("QVector"); qRegisterMetaType>("QHash"); qRegisterMetaType("DatabaseInterface::ListTrackDataType"); qRegisterMetaType("DatabaseInterface::ListAlbumDataType"); qRegisterMetaType("DatabaseInterface::ListArtistDataType"); qRegisterMetaType("DatabaseInterface::ListGenreDataType"); qRegisterMetaType("ModelDataLoader::ListTrackDataType"); qRegisterMetaType("ModelDataLoader::ListAlbumDataType"); qRegisterMetaType("ModelDataLoader::ListArtistDataType"); qRegisterMetaType("ModelDataLoader::ListGenreDataType"); qRegisterMetaType("TracksListener::ListTrackDataType"); qRegisterMetaType>(); qRegisterMetaType(); qRegisterMetaType("NotificationItem"); qRegisterMetaType>("QMap"); qRegisterMetaType("PlayListEnqueueMode"); qRegisterMetaType("PlayListEnqueueTriggerPlay"); qRegisterMetaType("PlayListEntryType"); qRegisterMetaType("EntryData"); qRegisterMetaType("EntryDataList"); qRegisterMetaType("DatabaseInterface::TrackDataType"); qRegisterMetaType("DatabaseInterface::AlbumDataType"); qRegisterMetaType("DatabaseInterface::ArtistDataType"); qRegisterMetaType("DatabaseInterface::GenreDataType"); qRegisterMetaType("ModelDataLoader::TrackDataType"); qRegisterMetaType("TracksListener::TrackDataType"); + qRegisterMetaType("ViewManager::ViewsType"); qRegisterMetaTypeStreamOperators("PlayListControler::PlayerState"); qmlRegisterUncreatableType(uri, 1, 0, "ElisaApplication", QStringLiteral("only one and done in c++")); qmlRegisterUncreatableMetaObject(ElisaUtils::staticMetaObject, uri, 1, 0, "ElisaUtils", QStringLiteral("Namespace ElisaUtils")); } diff --git a/src/models/viewsmodel.cpp b/src/models/viewsmodel.cpp index 39633213..553feb45 100644 --- a/src/models/viewsmodel.cpp +++ b/src/models/viewsmodel.cpp @@ -1,151 +1,183 @@ /* * 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 "viewsmodel.h" #include "viewmanager.h" #include #include class ViewsModelPrivate { public: QList mTypes; QHash mNames; QHash mIcons; ViewsModelPrivate() { mTypes = {ViewManager::NoViews, ViewManager::RecentlyPlayedTracks, ViewManager::FrequentlyPlayedTracks, ViewManager::AllAlbums, ViewManager::AllArtists, ViewManager::AllTracks, ViewManager::AllGenres, ViewManager::FilesBrowser}; mNames = {{ViewManager::NoViews, {i18nc("Title of the view of the playlist", "Now Playing")}}, {ViewManager::RecentlyPlayedTracks, {i18nc("Title of the view of recently played tracks", "Recently Played")}}, {ViewManager::FrequentlyPlayedTracks, {i18nc("Title of the view of frequently played tracks", "Frequently Played")}}, {ViewManager::AllAlbums, {i18nc("Title of the view of all albums", "Albums")}}, {ViewManager::AllArtists, {i18nc("Title of the view of all artists", "Artists")}}, {ViewManager::AllTracks, {i18nc("Title of the view of all tracks", "Tracks")}}, {ViewManager::AllGenres, {i18nc("Title of the view of all genres", "Genres")}}, {ViewManager::FilesBrowser, {i18nc("Title of the file browser view", "Files")}}}; mIcons = {{ViewManager::NoViews, QUrl{QStringLiteral("image://icon/view-media-playlist")}}, {ViewManager::RecentlyPlayedTracks, QUrl{QStringLiteral("image://icon/media-playlist-play")}}, {ViewManager::FrequentlyPlayedTracks, QUrl{QStringLiteral("image://icon/amarok_playcount")}}, {ViewManager::AllAlbums, QUrl{QStringLiteral("image://icon/view-media-album-cover")}}, {ViewManager::AllArtists, QUrl{QStringLiteral("image://icon/view-media-artist")}}, {ViewManager::AllTracks, QUrl{QStringLiteral("image://icon/view-media-track")}}, {ViewManager::AllGenres, QUrl{QStringLiteral("image://icon/view-media-genre")}}, {ViewManager::FilesBrowser, QUrl{QStringLiteral("image://icon/document-open-folder")}}}; } }; ViewsModel::ViewsModel(QObject *parent) : QAbstractListModel(parent), d(std::make_unique()) { } ViewsModel::~ViewsModel() = default; QHash ViewsModel::roleNames() const { auto result = QAbstractListModel::roleNames(); result[ItemType] = "type"; result[ImageName] = "image"; return result; } Qt::ItemFlags ViewsModel::flags(const QModelIndex &index) const { if (!index.isValid()) { return Qt::NoItemFlags; } return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } int ViewsModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) { return 0; } return d->mTypes.count(); } QVariant ViewsModel::data(const QModelIndex &index, int role) const { auto result = QVariant{}; if (!index.isValid()) { return result; } switch(role) { case Qt::DisplayRole: result = d->mNames[d->mTypes[index.row()]]; break; case ColumnRoles::ImageName: result = d->mIcons[d->mTypes[index.row()]]; break; case ColumnRoles::ItemType: result = d->mTypes[index.row()]; break; } return result; } QModelIndex ViewsModel::index(int row, int column, const QModelIndex &parent) const { auto result = QModelIndex(); if (column != 0) { return result; } if (parent.isValid()) { return result; } result = createIndex(row, column); return result; } QModelIndex ViewsModel::parent(const QModelIndex &child) const { Q_UNUSED(child) auto result = QModelIndex(); return result; } +int ViewsModel::indexFromViewType(ViewManager::ViewsType type) +{ + switch(type) + { + case ViewManager::NoViews: + return 0; + case ViewManager::RecentlyPlayedTracks: + return 1; + case ViewManager::FrequentlyPlayedTracks: + return 2; + case ViewManager::AllAlbums: + return 3; + case ViewManager::AllArtists: + return 4; + case ViewManager::AllTracks: + return 5; + case ViewManager::AllGenres: + return 6; + case ViewManager::FilesBrowser: + return 7; + case ViewManager::OneAlbum: + case ViewManager::OneArtist: + case ViewManager::OneAlbumFromArtist: + case ViewManager::OneArtistFromGenre: + case ViewManager::OneAlbumFromArtistAndGenre: + case ViewManager::AllArtistsFromGenre: + break; + } + + return -1; +} + #include "moc_viewsmodel.cpp" diff --git a/src/models/viewsmodel.h b/src/models/viewsmodel.h index 3c691717..4e274d55 100644 --- a/src/models/viewsmodel.h +++ b/src/models/viewsmodel.h @@ -1,62 +1,66 @@ /* * 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 VIEWSMODEL_H #define VIEWSMODEL_H #include "elisaLib_export.h" +#include "viewmanager.h" + #include #include class ViewsModelPrivate; class ELISALIB_EXPORT ViewsModel : public QAbstractListModel { Q_OBJECT public: enum ColumnRoles { ItemType = Qt::UserRole + 1, ImageName, }; explicit ViewsModel(QObject *parent = nullptr); ~ViewsModel() override; QHash roleNames() const override; Qt::ItemFlags flags(const QModelIndex &index) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &child) const override; + Q_INVOKABLE int indexFromViewType(ViewManager::ViewsType type); + private: std::unique_ptr d; }; #endif // VIEWSMODEL_H diff --git a/src/qml/ContentView.qml b/src/qml/ContentView.qml index 138af942..5938fd74 100644 --- a/src/qml/ContentView.qml +++ b/src/qml/ContentView.qml @@ -1,605 +1,611 @@ /* * 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 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } } onSwitchRecentlyPlayedTracksView: { - listViews.currentIndex = 1 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allRecentlyPlayedTracksView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, stackView: browseStackView, opacity: 0, }) recentlyPlayedTracksIsLoaded() } onSwitchFrequentlyPlayedTracksView: { - listViews.currentIndex = 2 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allRecentlyPlayedTracksView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, stackView: browseStackView, opacity: 0, }) frequentlyPlayedTracksIsLoaded() } onSwitchAllAlbumsView: { - listViews.currentIndex = 3 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(dataGridView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, defaultIcon: viewDefaultIcon, showRating: viewShowRating, delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, isSubPage: false, stackView: browseStackView, opacity: 0, }) allAlbumsViewIsLoaded() } onSwitchOneAlbumView: { browseStackView.push(albumView, { mainTitle: mainTitle, secondaryTitle: secondaryTitle, image: imageUrl, stackView: browseStackView, opacity: 0, }) oneAlbumViewIsLoaded() } onSwitchAllArtistsView: { - listViews.currentIndex = 4 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(dataGridView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, defaultIcon: viewDefaultIcon, showRating: viewShowRating, delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, isSubPage: false, stackView: browseStackView, opacity: 0, }) allArtistsViewIsLoaded() } onSwitchOneArtistView: { browseStackView.push(dataGridView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, defaultIcon: viewDefaultIcon, showRating: viewShowRating, delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, isSubPage: true, artistFilter: mainTitle, opacity: 0, }) oneArtistViewIsLoaded() } onSwitchAllTracksView: { - listViews.currentIndex = 5 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(allTracksView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, stackView: browseStackView, opacity: 0, }) allTracksViewIsLoaded() } onSwitchAllGenresView: { - listViews.currentIndex = 6 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } browseStackView.push(dataGridView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, defaultIcon: viewDefaultIcon, showRating: viewShowRating, delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, isSubPage: false, stackView: browseStackView, opacity: 0, }) allGenresViewIsLoaded() } onSwitchAllArtistsFromGenreView: { browseStackView.push(dataGridView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, defaultIcon: viewDefaultIcon, showRating: viewShowRating, delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, isSubPage: true, genreFilterText: mainTitle, opacity: 0, }) allArtistsFromGenreViewIsLoaded() } onSwitchOneArtistFromGenreView: { browseStackView.push(dataGridView, { mainTitle: mainTitle, image: imageUrl, modelType: dataType, defaultIcon: viewDefaultIcon, showRating: viewShowRating, delegateDisplaySecondaryText: viewDelegateDisplaySecondaryText, isSubPage: true, genreFilterText: genreName, artistFilter: mainTitle, opacity: 0, }) oneArtistViewIsLoaded() } onSwitchFilesBrowserView: { - listViews.currentIndex = 7 + listViews.currentIndex = pageModel.indexFromViewType(viewType) while(browseStackView.depth > 1) { browseStackView.pop() } } onPopOneView: browseStackView.pop() } + ViewsModel { + id: pageModel + } + ViewSelector { id: listViews - Layout.fillHeight: true + model: pageModel + Layout.fillHeight: true Layout.maximumWidth: mainWindow.width * 0.14 + maximumSize: mainWindow.width * 0.14 Behavior on Layout.maximumWidth { NumberAnimation { duration: 150 } } onSwitchView: viewManager.openParentView(viewType, mainTitle, imageUrl) } 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: dataGridView DataGridView { } } Component { id: allTracksView TracksView { } } Component { id: albumView AlbumView { } } } diff --git a/src/qml/ViewSelector.qml b/src/qml/ViewSelector.qml index 3f8ef0fa..1f6f8bdf 100644 --- a/src/qml/ViewSelector.qml +++ b/src/qml/ViewSelector.qml @@ -1,250 +1,247 @@ /* * Copyright 2016-2017 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 QtQml.Models 2.2 import QtGraphicalEffects 1.0 import org.kde.elisa 1.0 FocusScope { id: rootFocusScope property alias currentIndex: viewModeView.currentIndex property double textOpacity property double maximumSize + property alias model: pageDelegateModel.model signal switchView(int index, string mainTitle, url imageUrl, var viewType) implicitWidth: elisaTheme.dp(500) Rectangle { anchors.fill: parent color: myPalette.base border { color: (rootFocusScope.activeFocus ? myPalette.highlight : "transparent") width: 1 } ScrollView { focus: true anchors.fill: parent clip: true ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ListView { id: viewModeView focus: true z: 2 anchors.topMargin: elisaTheme.layoutHorizontalMargin * 2 model: DelegateModel { id: pageDelegateModel - model: ViewsModel { - id: pageModel - } - delegate: MouseArea { id: itemMouseArea height: elisaTheme.viewSelectorDelegateHeight * 1.4 width: viewModeView.width hoverEnabled: true acceptedButtons: Qt.LeftButton Loader { anchors.fill: parent active: itemMouseArea && itemMouseArea.containsMouse && !nameLabel.visible sourceComponent: ToolTip { delay: Qt.styleHints.mousePressAndHoldInterval text: model.display visible: itemMouseArea && itemMouseArea.containsMouse && !nameLabel.visible contentItem: Label { text: model.display color: myPalette.highlightedText } enter: Transition { NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; from: 0.0; to: 1.0; duration: 300; } } exit: Transition { NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; from: 1.0; to: 0.0; duration: 300; } } background: Rectangle { color: myPalette.shadow radius: elisaTheme.tooltipRadius layer.enabled: true layer.effect: DropShadow { horizontalOffset: elisaTheme.shadowOffset verticalOffset: elisaTheme.shadowOffset radius: 8 samples: 17 color: myPalette.shadow } } } } Image { id: viewIcon z: 2 anchors { verticalCenter: parent.verticalCenter leftMargin: elisaTheme.layoutHorizontalMargin left: parent.left } height: elisaTheme.viewSelectorDelegateHeight width: elisaTheme.viewSelectorDelegateHeight sourceSize { width: elisaTheme.viewSelectorDelegateHeight height: elisaTheme.viewSelectorDelegateHeight } source: model.image layer.effect: ColorOverlay { color: (index === viewModeView.currentIndex || itemMouseArea.containsMouse ? myPalette.highlight : "transparent") Behavior on color { ColorAnimation { duration: 300 } } } } LabelWithToolTip { id: nameLabel z: 2 anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: elisaTheme.layoutHorizontalMargin anchors.left: viewIcon.right anchors.right: parent.right anchors.rightMargin: elisaTheme.layoutHorizontalMargin verticalAlignment: "AlignVCenter" font.pointSize: elisaTheme.defaultFontPointSize * 1.4 text: model.display elide: Text.ElideRight opacity: textOpacity visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: 150 } } color: (viewModeView.currentIndex === index || itemMouseArea.containsMouse ? myPalette.highlight : myPalette.text) Behavior on color { ColorAnimation { duration: 300 } } } onClicked: { viewModeView.currentIndex = index rootFocusScope.focus = true switchView(index, model.display, model.image, model.type) } } } footer: MouseArea { width: viewModeView.width height: viewModeView.height - y acceptedButtons: Qt.LeftButton onClicked: { rootFocusScope.focus = true } } } } Behavior on border.color { ColorAnimation { duration: 300 } } } Connections { target: elisa onInitializationDone: { viewModeView.currentIndex = 0 switchView(viewModeView.currentIndex, "", "", "") } } Behavior on implicitWidth { NumberAnimation { duration: 150 } } Behavior on width { NumberAnimation { duration: 150 } } states: [ State { name: 'iconsAndText' when: maximumSize >= elisaTheme.viewSelectorSmallSizeThreshold PropertyChanges { target: rootFocusScope textOpacity: 1 implicitWidth: elisaTheme.dp(500) } }, State { name: 'iconsOnly' when: maximumSize < elisaTheme.viewSelectorSmallSizeThreshold PropertyChanges { target: rootFocusScope textOpacity: 0 implicitWidth: elisaTheme.viewSelectorDelegateHeight + 2 * elisaTheme.layoutHorizontalMargin } } ] } diff --git a/src/viewmanager.cpp b/src/viewmanager.cpp index 4519c28b..8805b445 100644 --- a/src/viewmanager.cpp +++ b/src/viewmanager.cpp @@ -1,325 +1,329 @@ /* * 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(); + Q_EMIT switchOffAllViews(mTargetView); } void ViewManager::openParentView(ViewManager::ViewsType viewType, const QString &mainTitle, const QUrl &mainImage) { switch(viewType) { case NoViews: closeAllViews(); break; case RecentlyPlayedTracks: openRecentlyPlayedTracks(mainTitle, mainImage); break; case FrequentlyPlayedTracks: openFrequentlyPlayedTracks(mainTitle, mainImage); break; case AllAlbums: openAllAlbums(mainTitle, mainImage); break; case AllArtists: openAllArtists(mainTitle, mainImage); break; case AllTracks: openAllTracks(mainTitle, mainImage); break; case AllGenres: openAllGenres(mainTitle, mainImage); break; case FilesBrowser: openFilesBrowser(mainTitle, mainImage); break; case OneAlbum: case OneArtist: case OneAlbumFromArtist: case OneArtistFromGenre: case OneAlbumFromArtistAndGenre: case AllArtistsFromGenre: break; } } void ViewManager::openChildView(const QString &innerMainTitle, const QString &innerSecondaryTitle, const QUrl &innerImage, qulonglong databaseId, ElisaUtils::PlayListEntryType dataType) { switch(dataType) { case ElisaUtils::Album: openOneAlbum(innerMainTitle, innerSecondaryTitle, innerImage, databaseId); break; case ElisaUtils::Artist: openOneArtist(innerMainTitle, innerImage, databaseId); break; case ElisaUtils::Genre: openAllArtistsFromGenre(innerMainTitle); break; case ElisaUtils::Track: case ElisaUtils::FileName: case ElisaUtils::Unknown: break; } } void ViewManager::openRecentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) { mTargetView = ViewsType::RecentlyPlayedTracks; if (mCurrentView != mTargetView) { - Q_EMIT switchRecentlyPlayedTracksView(mainTitle, imageUrl, ElisaUtils::Track); + Q_EMIT switchRecentlyPlayedTracksView(mTargetView, 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); + Q_EMIT switchFrequentlyPlayedTracksView(mTargetView, 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(mTargetView, + 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); + Q_EMIT switchOneAlbumView(mTargetView, + mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneArtist) { mTargetView = ViewsType::OneAlbumFromArtist; - Q_EMIT switchOneAlbumView(mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); + Q_EMIT switchOneAlbumView(mTargetView, + mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneArtistFromGenre) { mTargetView = ViewsType::OneAlbumFromArtistAndGenre; - Q_EMIT switchOneAlbumView(mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); + Q_EMIT switchOneAlbumView(mTargetView, + mTargetAlbumTitle, mTargetImageUrl, mTargetAlbumAuthor, mTargetDatabaseId); } else { - switchAllAlbumsView({}, {}, ElisaUtils::Album, + switchAllAlbumsView(ViewsType::AllAlbums, {}, {}, 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(ViewsType::AllArtists, 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, ElisaUtils::Album, + Q_EMIT switchOneArtistView(mTargetView, mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneArtist && mCurrentArtistName != mTargetArtistName && mTargetView == ViewsType::OneArtist) { Q_EMIT popOneView(); - Q_EMIT switchOneArtistView(mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, + Q_EMIT switchOneArtistView(mTargetView, mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true, mTargetDatabaseId); } else if (mCurrentView == ViewsType::OneAlbumFromArtist && mCurrentArtistName != mTargetArtistName && mTargetView == ViewsType::OneArtist) { Q_EMIT popOneView(); Q_EMIT popOneView(); - Q_EMIT switchOneArtistView(mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, + Q_EMIT switchOneArtistView(mTargetView, mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true, mTargetDatabaseId); } else if (mCurrentView == ViewsType::AllArtistsFromGenre && mTargetView == ViewsType::OneArtistFromGenre) { - Q_EMIT switchOneArtistFromGenreView(mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, + Q_EMIT switchOneArtistFromGenreView(mTargetView, mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true, mTargetDatabaseId, mTargetGenreName); } else { - Q_EMIT switchAllArtistsView({}, {}, ElisaUtils::Artist, + Q_EMIT switchAllArtistsView(ViewsType::AllArtists, {}, {}, 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); + Q_EMIT switchAllTracksView(mTargetView, 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(mTargetView, 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, {}, QUrl(QStringLiteral("image://icon/view-media-artist")), + Q_EMIT switchAllArtistsFromGenreView(mTargetView, 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(ViewsType::AllGenres, {}, {}, 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); + Q_EMIT switchFilesBrowserView(mTargetView, 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); + Q_EMIT switchOneAlbumView(mTargetView, 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, ElisaUtils::Album, + Q_EMIT switchOneArtistView(mTargetView, mTargetArtistName, {}, mTargetImageUrl, ElisaUtils::Album, QUrl(QStringLiteral("image://icon/media-optical-audio")), true, true, 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 1f54a95f..9dbe5a3b 100644 --- a/src/viewmanager.h +++ b/src/viewmanager.h @@ -1,170 +1,181 @@ /* * 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, + void switchRecentlyPlayedTracksView(ViewManager::ViewsType viewType, + const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); - void switchFrequentlyPlayedTracksView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); + void switchFrequentlyPlayedTracksView(ViewManager::ViewsType viewType, + const QString &mainTitle, const QUrl &imageUrl, + ElisaUtils::PlayListEntryType dataType); - void switchAllAlbumsView(const QString &mainTitle, const QUrl &imageUrl, + void switchAllAlbumsView(ViewManager::ViewsType viewType, + 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 switchOneAlbumView(ViewManager::ViewsType viewType, + const QString &mainTitle, const QUrl &imageUrl, const QString &secondaryTitle, qulonglong databaseId); - void switchAllArtistsView(const QString &mainTitle, const QUrl &imageUrl, + void switchAllArtistsView(ViewManager::ViewsType viewType, + const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, bool viewShowRating, bool viewDelegateDisplaySecondaryText); - void switchOneArtistView(const QString &mainTitle, const QString &secondaryTitle, + void switchOneArtistView(ViewManager::ViewsType viewType, + const QString &mainTitle, const QString &secondaryTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, bool viewShowRating, bool viewDelegateDisplaySecondaryText, qulonglong databaseId); - void switchAllTracksView(const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); + void switchAllTracksView(ViewManager::ViewsType viewType, const QString &mainTitle, + const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType); - void switchAllGenresView(const QString &mainTitle, const QUrl &imageUrl, + void switchAllGenresView(ViewManager::ViewsType viewType, + const QString &mainTitle, const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, bool viewShowRating, bool viewDelegateDisplaySecondaryText); - void switchAllArtistsFromGenreView(const QString &mainTitle, const QString &secondaryTitle, + void switchAllArtistsFromGenreView(ViewManager::ViewsType viewType, + 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 QString &secondaryTitle, + void switchOneArtistFromGenreView(ViewManager::ViewsType viewType, + 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 switchFilesBrowserView(ViewManager::ViewsType viewType, const QString &mainTitle, const QUrl &imageUrl); - void switchOffAllViews(); + void switchOffAllViews(ViewManager::ViewsType viewType); void popOneView(); public Q_SLOTS: void closeAllViews(); void openParentView(ViewManager::ViewsType viewType, const QString &mainTitle, const QUrl &mainImage); void openChildView(const QString &innerMainTitle, const QString & innerSecondaryTitle, const QUrl &innerImage, qulonglong databaseId, ElisaUtils::PlayListEntryType dataType); void recentlyPlayedTracksIsLoaded(); void frequentlyPlayedTracksIsLoaded(); void allAlbumsViewIsLoaded(); void oneAlbumViewIsLoaded(); void allArtistsViewIsLoaded(); void oneArtistViewIsLoaded(); void allTracksViewIsLoaded(); void allGenresViewIsLoaded(); void allArtistsFromGenreViewIsLoaded(); void filesBrowserViewIsLoaded(); void goBack(); private: 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 openAllArtists(const QString &mainTitle, const QUrl &imageUrl); void openAllTracks(const QString &mainTitle, const QUrl &imageUrl); void openAllGenres(const QString &mainTitle, const QUrl &imageUrl); void openFilesBrowser(const QString &mainTitle, const QUrl &imageUrl); void openOneAlbum(const QString &albumTitle, const QString &albumAuthor, const QUrl &albumCover, qulonglong albumDatabaseId); void openOneArtist(const QString &artistName, const QUrl &artistImageUrl, qulonglong artistDatabaseId); void openAllArtistsFromGenre(const QString &genreName); 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