mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
* QueueProxyModel removes unplayable tracks once finished resolving.
This commit is contained in:
parent
301b8b8850
commit
af79919485
@ -32,6 +32,8 @@ using namespace Tomahawk;
|
||||
QueueProxyModel::QueueProxyModel( TrackView* parent )
|
||||
: PlayableProxyModel( parent )
|
||||
{
|
||||
connect( this, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onIndexChanged( QModelIndex ) ) );
|
||||
connect( this, SIGNAL( indexResolved( QModelIndex ) ), SLOT( onIndexChanged( QModelIndex ) ) );
|
||||
connect( parent, SIGNAL( itemActivated( QModelIndex ) ), SLOT( onIndexActivated( QModelIndex ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) );
|
||||
}
|
||||
@ -42,6 +44,21 @@ QueueProxyModel::~QueueProxyModel()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QueueProxyModel::onIndexChanged( const QModelIndex& index )
|
||||
{
|
||||
PlayableItem* item = itemFromIndex( mapToSource( index ) );
|
||||
if ( item && item->query() )
|
||||
{
|
||||
tDebug() << item->query()->toString() << item->query()->resolvingFinished() << item->query()->playable();
|
||||
}
|
||||
if ( !item || !item->query() || ( item->query()->resolvingFinished() && !item->query()->playable() ) )
|
||||
{
|
||||
removeIndex( index );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QueueProxyModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
virtual ~QueueProxyModel();
|
||||
|
||||
private slots:
|
||||
void onIndexChanged( const QModelIndex& index );
|
||||
void onIndexActivated( const QModelIndex& index );
|
||||
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user