Commit a9f85d8d authored by Michael Pyne's avatar Michael Pyne
Browse files

nowplaying: Improve clickable link search in Now Playing bar.

* The "album" link now searches for any matching tracks of the same album,
  even with different artists.
* The search applies to the playlist that is selected, even if you're
  playing from a different playlist.
* The playing item is reset to the Collection List when the "return to
  playlist" link is selected rather than pulling from the internal
  search playlist (which is likely to be destroyed by a subsequent
  search).
parent 83cb227e
......@@ -286,7 +286,7 @@ void TrackItem::slotOpenLink(const QString &link)
if(link == "artist")
collection->showMore(m_file.tag()->artist());
else if(link == "album")
collection->showMore(m_file.tag()->artist(), m_file.tag()->album());
collection->showMore(QString(), m_file.tag()->album());
else if(link == "clear")
collection->clearShowMore();
......
......@@ -209,20 +209,17 @@ void PlaylistCollection::createDynamicPlaylist(const PlaylistList &playlists)
void PlaylistCollection::showMore(const QString &artist, const QString &album)
{
if(showMoreActive()) {
clearShowMore();
}
PlaylistList playlists;
PlaylistSearch::ComponentList components;
if(currentPlaylist() != CollectionList::instance() &&
currentPlaylist() != m_showMorePlaylist)
{
playlists.append(currentPlaylist());
}
playlists.append(CollectionList::instance());
playlists.append(visiblePlaylist());
if(!artist.isNull())
{ // Just setting off the artist stuff in its own block.
if(!artist.isEmpty()) {
// Just setting off the artist stuff in its own block.
ColumnList columns;
columns.append(PlaylistItem::ArtistColumn);
PlaylistSearch::Component c(artist, false, columns,
......@@ -230,7 +227,7 @@ void PlaylistCollection::showMore(const QString &artist, const QString &album)
components.append(c);
}
if(!album.isNull()) {
if(!album.isEmpty()) {
ColumnList columns;
columns.append(PlaylistItem::AlbumColumn);
PlaylistSearch::Component c(album, false, columns,
......@@ -716,6 +713,12 @@ void PlaylistCollection::clearShowMore(bool raisePlaylist)
if(!m_showMorePlaylist)
return;
const auto playingItem = currentPlaylist()->playingItem();
if(playingItem && playingItem->playlist() == m_showMorePlaylist) {
// Reset the playing indicator to the corresponding CollectionList item
playingItem->collectionItem()->setPlaying(true, true);
}
if(raisePlaylist) {
if(m_belowShowMorePlaylist)
raise(m_belowShowMorePlaylist);
......@@ -723,7 +726,7 @@ void PlaylistCollection::clearShowMore(bool raisePlaylist)
raise(CollectionList::instance());
}
m_belowShowMorePlaylist = 0;
m_belowShowMorePlaylist = nullptr;
}
void PlaylistCollection::enableDirWatch(bool enable)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment