Commit 6a4a8117 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵 Committed by Nate Graham
Browse files

remove unused private methods and simplicy handling of viewIsLoaded slot

parent fa9127e7
......@@ -64,7 +64,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllAlbums);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -76,7 +76,7 @@ private Q_SLOTS:
QCOMPARE(openListViewSpy.at(0).at(3), QStringLiteral("album1"));
QCOMPARE(openListViewSpy.at(0).at(4), QStringLiteral("artist1"));
viewManager.viewIsLoaded(openListViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -103,7 +103,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllAlbums);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -122,7 +122,7 @@ private Q_SLOTS:
QCOMPARE(openListViewSpy.at(0).at(3), QStringLiteral("album1"));
QCOMPARE(openListViewSpy.at(0).at(4), QStringLiteral("artist1"));
viewManager.viewIsLoaded(openListViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -139,7 +139,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::AllAlbums);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -158,7 +158,7 @@ private Q_SLOTS:
QCOMPARE(openListViewSpy.at(1).at(3), QStringLiteral("album1"));
QCOMPARE(openListViewSpy.at(1).at(4), QStringLiteral("artist1"));
viewManager.viewIsLoaded(openListViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 2);
......@@ -185,7 +185,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllAlbums);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -204,7 +204,7 @@ private Q_SLOTS:
QCOMPARE(openListViewSpy.at(0).at(3), QStringLiteral("album1"));
QCOMPARE(openListViewSpy.at(0).at(4), QStringLiteral("artist1"));
viewManager.viewIsLoaded(openListViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -218,7 +218,7 @@ private Q_SLOTS:
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 1);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -237,7 +237,7 @@ private Q_SLOTS:
QCOMPARE(openListViewSpy.at(1).at(3), QStringLiteral("album1"));
QCOMPARE(openListViewSpy.at(1).at(4), QStringLiteral("artist1"));
viewManager.viewIsLoaded(openListViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 2);
......@@ -264,7 +264,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtists);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -274,7 +274,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -301,7 +301,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtists);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -318,7 +318,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -335,7 +335,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(2).count(), 12);
QCOMPARE(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtists);
viewManager.viewIsLoaded(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -352,7 +352,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(3).count(), 12);
QCOMPARE(openGridViewSpy.at(3).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(3).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 4);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -379,7 +379,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtists);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -396,7 +396,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -410,7 +410,7 @@ private Q_SLOTS:
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 1);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -427,7 +427,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(2).count(), 12);
QCOMPARE(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -454,7 +454,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllGenres);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -464,7 +464,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtistsFromGenre);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -491,7 +491,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllGenres);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -508,7 +508,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtistsFromGenre);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -525,7 +525,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(2).count(), 12);
QCOMPARE(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>(), ViewManager::AllGenres);
viewManager.viewIsLoaded(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -542,7 +542,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(3).count(), 12);
QCOMPARE(openGridViewSpy.at(3).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtistsFromGenre);
viewManager.viewIsLoaded(openGridViewSpy.at(3).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 4);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -569,7 +569,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllGenres);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -586,7 +586,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtistsFromGenre);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -600,7 +600,7 @@ private Q_SLOTS:
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 1);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -617,7 +617,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(2).count(), 12);
QCOMPARE(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtistsFromGenre);
viewManager.viewIsLoaded(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -644,7 +644,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllGenres);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -661,7 +661,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtistsFromGenre);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
viewManager.openChildView(QStringLiteral("artist1"), {}, {}, 0, ElisaUtils::Artist);
......@@ -675,7 +675,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(2).at(8).toString(), QStringLiteral("genre1"));
QCOMPARE(openGridViewSpy.at(2).at(9).toString(), QStringLiteral("artist1"));
viewManager.viewIsLoaded(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -702,7 +702,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(0).count(), 12);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::AllArtists);
viewManager.viewIsLoaded(openGridViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -712,7 +712,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(1).count(), 12);
QCOMPARE(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(1).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 2);
QCOMPARE(openListViewSpy.count(), 0);
......@@ -729,7 +729,7 @@ private Q_SLOTS:
QCOMPARE(openGridViewSpy.at(2).count(), 12);
QCOMPARE(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>(), ViewManager::OneArtist);
viewManager.viewIsLoaded(openGridViewSpy.at(2).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 1);
......@@ -739,7 +739,7 @@ private Q_SLOTS:
QCOMPARE(openListViewSpy.at(0).count(), 13);
QCOMPARE(openListViewSpy.at(0).at(0).value<ViewManager::ViewsType>(), ViewManager::OneAlbumFromArtist);
viewManager.viewIsLoaded(openListViewSpy.at(0).at(0).value<ViewManager::ViewsType>());
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 3);
QCOMPARE(openListViewSpy.count(), 1);
......
......@@ -303,7 +303,7 @@ RowLayout {
id: dataGridView
DataGridView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
StackView.onActivated: viewManager.viewIsLoaded()
expandedFilterView: showExpandedFilterView
}
}
......@@ -312,7 +312,7 @@ RowLayout {
id: dataListView
DataListView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
StackView.onActivated: viewManager.viewIsLoaded()
expandedFilterView: showExpandedFilterView
}
}
......@@ -321,7 +321,7 @@ RowLayout {
id: filesBrowserView
FileBrowserView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
StackView.onActivated: viewManager.viewIsLoaded()
expandedFilterView: showExpandedFilterView
}
}
......@@ -330,7 +330,7 @@ RowLayout {
id: albumContext
ContextView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
StackView.onActivated: viewManager.viewIsLoaded()
databaseId: elisa.manageHeaderBar.databaseId
trackType: elisa.manageHeaderBar.trackType
......
......@@ -450,229 +450,13 @@ void ViewManager::openChildView(const QString &innerMainTitle, const QString & i
}
}
void ViewManager::viewIsLoaded(ViewManager::ViewsType viewType)
{
switch (viewType)
{
case ViewsType::RecentlyPlayedTracks:
recentlyPlayedTracksIsLoaded();
break;
case ViewsType::FrequentlyPlayedTracks:
frequentlyPlayedTracksIsLoaded();
break;
case ViewsType::AllAlbums:
allAlbumsViewIsLoaded();
break;
case ViewsType::OneAlbum:
oneAlbumViewIsLoaded();
break;
case ViewsType::AllArtists:
allArtistsViewIsLoaded();
break;
case ViewsType::OneArtist:
oneArtistViewIsLoaded();
break;
case ViewsType::OneAlbumFromArtist:
oneAlbumViewIsLoaded();
break;
case ViewsType::AllTracks:
allTracksViewIsLoaded();
break;
case ViewsType::AllGenres:
allGenresViewIsLoaded();
break;
case ViewsType::AllArtistsFromGenre:
allArtistsFromGenreViewIsLoaded();
break;
case ViewsType::OneArtistFromGenre:
oneArtistViewIsLoaded();
break;
case ViewsType::OneAlbumFromArtistAndGenre:
oneAlbumViewIsLoaded();
break;
case ViewsType::FilesBrowser:
filesBrowserViewIsLoaded();
break;
case ViewsType::Context:
contextViewIsLoaded();
break;
case ViewsType::RadiosBrowser:
radiosBrowserViewIsLoaded();
break;
case UnknownView:
break;
}
}
void ViewManager::openOneAlbum(const QString &albumTitle, const QString &albumAuthor,
const QUrl &albumCover, qulonglong albumDatabaseId,
AlbumViewStyle albumDiscHeader)
{
d->mTargetAlbumTitle = albumTitle;
d->mTargetAlbumAuthor = albumAuthor;
d->mTargetDatabaseId = albumDatabaseId;
d->mTargetImageUrl = albumCover;
d->mAlbumDiscHeader = albumDiscHeader;
if (d->mCurrentView == ViewsType::AllAlbums) {
d->mTargetView = ViewsType::OneAlbum;
Q_EMIT openListView(d->mTargetView, ElisaUtils::FilterById, 2, d->mTargetAlbumTitle, d->mTargetAlbumAuthor,
d->mTargetDatabaseId, d->mTargetImageUrl, ElisaUtils::Track, {},
SortOrder::NoSort, SingleAlbum, d->mAlbumDiscHeader, IsTrack);
} else if (d->mCurrentView == ViewsType::OneArtist && d->mCurrentArtistName == d->mTargetAlbumAuthor) {
d->mTargetView = ViewsType::OneAlbumFromArtist;
Q_EMIT openListView(d->mTargetView, ElisaUtils::FilterById, 3, d->mTargetAlbumTitle, d->mTargetAlbumAuthor,
d->mTargetDatabaseId, d->mTargetImageUrl, ElisaUtils::Track, {},
SortOrder::NoSort, SingleAlbum, d->mAlbumDiscHeader, IsTrack);
} else if (d->mCurrentView == ViewsType::OneArtist && d->mCurrentArtistName != d->mTargetAlbumAuthor) {
d->mTargetView = ViewsType::OneAlbumFromArtist;
Q_EMIT popOneView();
} else if (d->mCurrentView == ViewsType::OneArtistFromGenre) {
d->mTargetView = ViewsType::OneAlbumFromArtistAndGenre;
Q_EMIT openListView(d->mTargetView, ElisaUtils::FilterById, 4, d->mTargetAlbumTitle, d->mTargetAlbumAuthor,
d->mTargetDatabaseId, d->mTargetImageUrl, ElisaUtils::Track, {},
SortOrder::NoSort, SingleAlbum, d->mAlbumDiscHeader, IsTrack);
} else {
d->mTargetView = ViewsType::OneAlbum;
Q_EMIT openGridView(ViewsType::AllAlbums, ElisaUtils::NoFilter, 1, {}, {}, {}, ElisaUtils::Album,
QUrl(QStringLiteral("image://icon/media-optical-audio")), {}, {}, ViewShowRating, DelegateWithSecondaryText);
}
}
void ViewManager::openOneArtist(const QString &artistName, const QUrl &artistImageUrl, qulonglong artistDatabaseId)
{
d->mTargetArtistName = artistName;
d->mTargetDatabaseId = artistDatabaseId;
d->mTargetImageUrl = artistImageUrl;
if (d->mCurrentView == ViewsType::AllArtistsFromGenre) {
d->mTargetView = ViewsType::OneArtistFromGenre;
} else {
d->mTargetView = ViewsType::OneArtist;
}
if (d->mCurrentView == ViewsType::AllArtists && d->mTargetView == ViewsType::OneArtist) {
Q_EMIT openGridView(d->mTargetView, ElisaUtils::FilterByArtist, 2, d->mTargetArtistName, {}, d->mTargetImageUrl, ElisaUtils::Album,
QUrl(QStringLiteral("image://icon/media-optical-audio")), {}, d->mTargetArtistName, ViewShowRating, DelegateWithSecondaryText);
} else if (d->mCurrentView == ViewsType::OneArtist && d->mCurrentArtistName != d->mTargetArtistName &&
d->mTargetView == ViewsType::OneArtist) {
Q_EMIT openGridView(d->mTargetView, ElisaUtils::FilterByArtist, 2, d->mTargetArtistName, {}, d->mTargetImageUrl, ElisaUtils::Album,
QUrl(QStringLiteral("image://icon/media-optical-audio")), {}, d->mTargetArtistName, ViewShowRating, DelegateWithSecondaryText);
} else if (d->mCurrentView == ViewsType::OneAlbumFromArtist && d->mCurrentArtistName != d->mTargetArtistName &&
d->mTargetView == ViewsType::OneArtist) {
Q_EMIT openGridView(d->mTargetView, ElisaUtils::FilterByArtist, 2, d->mTargetArtistName, {}, d->mTargetImageUrl, ElisaUtils::Album,
QUrl(QStringLiteral("image://icon/media-optical-audio")), {}, d->mTargetArtistName, ViewShowRating, DelegateWithSecondaryText);
} else if (d->mCurrentView == ViewsType::AllArtistsFromGenre && d->mTargetView == ViewsType::OneArtistFromGenre) {
Q_EMIT openGridView(d->mTargetView, ElisaUtils::FilterByGenreAndArtist, 3, d->mTargetArtistName, {}, d->mTargetImageUrl, ElisaUtils::Album,
QUrl(QStringLiteral("image://icon/media-optical-audio")), d->mTargetGenreName, d->mTargetArtistName, ViewShowRating, DelegateWithSecondaryText);
} else {
Q_EMIT openGridView(ViewsType::AllArtists, ElisaUtils::NoFilter, 1, {}, {}, {}, ElisaUtils::Artist,
QUrl(QStringLiteral("image://icon/view-media-artist")), {}, {}, ViewHideRating, DelegateWithoutSecondaryText);
}
}
void ViewManager::openAllArtistsFromGenre(const QString &genreName)
{
d->mTargetView = ViewsType::AllArtistsFromGenre;
d->mTargetGenreName = genreName;
if (d->mCurrentView == ViewsType::AllGenres) {
Q_EMIT openGridView(d->mTargetView, ElisaUtils::FilterByGenre, 2, d->mTargetGenreName, {}, QUrl(QStringLiteral("image://icon/view-media-artist")),
ElisaUtils::Artist, QUrl(QStringLiteral("image://icon/view-media-artist")), d->mTargetGenreName, {}, ViewHideRating, DelegateWithoutSecondaryText);
} else {
Q_EMIT openGridView(ViewsType::AllGenres, ElisaUtils::NoFilter, 1, {}, {}, {}, ElisaUtils::Genre,
QUrl(QStringLiteral("image://icon/view-media-genre")), {}, {}, ViewHideRating, DelegateWithoutSecondaryText);
}
}
void ViewManager::recentlyPlayedTracksIsLoaded()
{
d->mCurrentView = ViewsType::RecentlyPlayedTracks;
}
void ViewManager::frequentlyPlayedTracksIsLoaded()
{
d->mCurrentView = ViewsType::FrequentlyPlayedTracks;
}
void ViewManager::allAlbumsViewIsLoaded()
{
if (d->mNextViewParameters.mIsValid && d->mNextViewParameters != d->mViewParametersStack.back()) {
openViewFromData(d->mNextViewParameters);
}
}
void ViewManager::oneAlbumViewIsLoaded()
{
d->mCurrentAlbumTitle = d->mTargetAlbumTitle;
d->mCurrentAlbumAuthor = d->mTargetAlbumAuthor;
if (d->mTargetView == ViewsType::OneAlbum) {
d->mCurrentView = ViewsType::OneAlbum;
} else if (d->mTargetView == ViewsType::OneAlbumFromArtist) {
d->mCurrentView = ViewsType::OneAlbumFromArtist;
} else if (d->mTargetView == ViewsType::OneAlbumFromArtistAndGenre) {
d->mCurrentView = ViewsType::OneAlbumFromArtistAndGenre;
}
}
void ViewManager::allArtistsViewIsLoaded()
{
if (d->mNextViewParameters.mIsValid && d->mNextViewParameters != d->mViewParametersStack.back()) {
openViewFromData(d->mNextViewParameters);
}
}
void ViewManager::oneArtistViewIsLoaded()
{
d->mCurrentArtistName = d->mTargetArtistName;
if (d->mTargetView == ViewsType::OneArtist) {
d->mCurrentView = ViewsType::OneArtist;
} else if (d->mTargetView == ViewsType::OneArtistFromGenre) {
d->mCurrentGenreName = d->mTargetGenreName;
d->mCurrentView = ViewsType::OneArtistFromGenre;
} else if (d->mTargetView == ViewsType::OneAlbumFromArtist) {
d->mCurrentView = ViewsType::OneArtist;
Q_EMIT openListView(d->mTargetView, ElisaUtils::FilterById, 3, d->mTargetAlbumTitle, d->mTargetAlbumAuthor,
d->mTargetDatabaseId, d->mTargetImageUrl, ElisaUtils::Track, Qt::DisplayRole,
SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders, IsTrack);
}
}
void ViewManager::allTracksViewIsLoaded()
{
d->mCurrentView = ViewsType::AllTracks;
}
void ViewManager::allGenresViewIsLoaded()
void ViewManager::viewIsLoaded()
{
if (d->mNextViewParameters.mIsValid && d->mNextViewParameters != d->mViewParametersStack.back()) {
openViewFromData(d->mNextViewParameters);
}
}
void ViewManager::allArtistsFromGenreViewIsLoaded()
{
d->mCurrentGenreName = d->mTargetGenreName;
d->mCurrentView = ViewsType::AllArtistsFromGenre;
}
void ViewManager::filesBrowserViewIsLoaded()
{
d->mCurrentView = ViewsType::FilesBrowser;
}
void ViewManager::contextViewIsLoaded()
{
d->mCurrentView = ViewsType::Context;
}
void ViewManager::radiosBrowserViewIsLoaded()
{
d->mCurrentView = ViewsType::RadiosBrowser;
}
void ViewManager::openViewFromData(const ViewParameters &viewParamaters)
{
d->mViewParametersStack.push_back(viewParamaters);
......
......@@ -146,43 +146,12 @@ public Q_SLOTS:
const QUrl &innerImage, qulonglong databaseId,
ElisaUtils::PlayListEntryType dataType);
void viewIsLoaded(ViewManager::ViewsType viewType);
void viewIsLoaded();