mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* QueueProxyModel removes unplayable tracks once finished resolving.
This commit is contained in:
@@ -32,6 +32,8 @@ using namespace Tomahawk;
|
|||||||
QueueProxyModel::QueueProxyModel( TrackView* parent )
|
QueueProxyModel::QueueProxyModel( TrackView* parent )
|
||||||
: PlayableProxyModel( 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( parent, SIGNAL( itemActivated( QModelIndex ) ), SLOT( onIndexActivated( QModelIndex ) ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) );
|
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
|
void
|
||||||
QueueProxyModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
QueueProxyModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
|
@@ -36,6 +36,7 @@ public:
|
|||||||
virtual ~QueueProxyModel();
|
virtual ~QueueProxyModel();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onIndexChanged( const QModelIndex& index );
|
||||||
void onIndexActivated( const QModelIndex& index );
|
void onIndexActivated( const QModelIndex& index );
|
||||||
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user