1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

Show playing icon when playing grid-view playlists

This commit is contained in:
Leo Franchi 2012-07-29 17:55:28 -04:00
parent ea11f7c7be
commit e28d61935e
5 changed files with 70 additions and 2 deletions

View File

@ -74,6 +74,7 @@ set( libGuiSources
playlist/PlaylistLargeItemDelegate.cpp
playlist/PlaylistChartItemDelegate.cpp
playlist/PlayableItem.cpp
playlist/SingleTrackPlaylistInterface.h
playlist/dynamic/DynamicPlaylist.cpp
playlist/dynamic/DynamicView.cpp

View File

@ -42,6 +42,7 @@
#include "jobview/ErrorStatusMessage.h"
#include "utils/Logger.h"
#include "SingleTrackPlaylistInterface.h"
using namespace Tomahawk;
@ -582,7 +583,11 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
m_playlist.data()->reset();
setPlaylist( playlist );
m_currentTrackPlaylist = playlist;
if ( playlist.isNull() )
m_currentTrackPlaylist = playlistinterface_ptr( new SingleTrackPlaylistInterface( result->toQuery() ) );
else
m_currentTrackPlaylist = playlist;
if ( !result.isNull() )
{

View File

@ -219,7 +219,7 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
emit albums( m_query->id(), albumList );
}
if ( trackPairs.length() == 0 )
{
qDebug() << "No candidates found in first pass, aborting resolve" << m_query->fullTextQuery();

View File

@ -35,6 +35,7 @@
#include "AlbumModel.h"
#include "PlayableModel.h"
#include "PlayableProxyModelPlaylistInterface.h"
#include "SingleTrackPlaylistInterface.h"
#include "ContextMenu.h"
#include "ViewManager.h"
#include "utils/Logger.h"
@ -64,6 +65,8 @@ public:
return item->album()->playlistInterface( Tomahawk::Mixed ) == playlistInterface;
else if ( !item->artist().isNull() )
return item->artist()->playlistInterface( Tomahawk::Mixed ) == playlistInterface;
else if ( !item->query().isNull() && !playlistInterface.dynamicCast< SingleTrackPlaylistInterface >().isNull() )
return item->query() == playlistInterface.dynamicCast< SingleTrackPlaylistInterface >()->track();
}
return false;

View File

@ -0,0 +1,59 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2012 Leo Franchi <lfranchi@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SINGLE_TRACK_PLAYLIST_INTERFACE
#define SINGLE_TRACK_PLAYLIST_INTERFACE
#include "PlaylistInterface.h"
#include "DllMacro.h"
#include "Query.h"
#include "Typedefs.h"
#include "Result.h"
namespace Tomahawk
{
class DLLEXPORT SingleTrackPlaylistInterface : public PlaylistInterface
{
Q_OBJECT
public:
explicit SingleTrackPlaylistInterface( const query_ptr& query )
: PlaylistInterface()
, m_track( query )
{
}
query_ptr track() const { return m_track; }
void setQuery( const query_ptr& track ) { m_track = track; }
virtual result_ptr currentItem() const { return result_ptr(); }
virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; }
virtual void setRepeatMode( PlaylistModes::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual bool shuffled() const { return false; }
virtual result_ptr siblingItem( int itemsAway ) { return result_ptr(); }
virtual int trackCount() const { return 1; }
virtual QList< query_ptr > tracks() { return QList< query_ptr >(); }
private:
query_ptr m_track;
};
}
#endif