mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-14 04:51:53 +02:00
re-resolve tracks when a resolver is added or removed.
The pipeline emits a signal to queries when a resolver is added/removed. The queries take action based on their solved() status and if not solved() inform the pipeline to re-resolve them.
This commit is contained in:
parent
7742e3091a
commit
5ec7e3340b
src/libtomahawk
@ -82,8 +82,9 @@ void
|
||||
Pipeline::removeResolver( Resolver* r )
|
||||
{
|
||||
QMutexLocker lock( &m_mut );
|
||||
|
||||
|
||||
m_resolvers.removeAll( r );
|
||||
emit resolverRemoved( r );
|
||||
}
|
||||
|
||||
|
||||
@ -100,6 +101,7 @@ Pipeline::addResolver( Resolver* r, bool sort )
|
||||
Pipeline::resolverSorter );
|
||||
}
|
||||
qDebug() << "Adding resolver" << r->name();
|
||||
emit resolverAdded( r );
|
||||
|
||||
/* qDebug() << "Current pipeline:";
|
||||
foreach( Resolver * r, m_resolvers )
|
||||
|
@ -79,6 +79,9 @@ public slots:
|
||||
signals:
|
||||
void idle();
|
||||
void resolving( const Tomahawk::query_ptr& query );
|
||||
|
||||
void resolverAdded( Resolver* );
|
||||
void resolverRemoved( Resolver* );
|
||||
|
||||
private slots:
|
||||
void timeoutShunt( const query_ptr& q );
|
||||
|
@ -67,6 +67,11 @@ Query::Query( const QString& artist, const QString& track, const QString& album,
|
||||
{
|
||||
connect( Database::instance(), SIGNAL( indexReady() ), SLOT( refreshResults() ), Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
connect( Pipeline::instance(), SIGNAL( resolverAdded( Resolver* ) ),
|
||||
SLOT( onResolverAdded() ), Qt::QueuedConnection );
|
||||
connect( Pipeline::instance(), SIGNAL( resolverRemoved( Resolver* ) ),
|
||||
SLOT( onResolverRemoved() ), Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
|
||||
@ -148,6 +153,26 @@ Query::onResolvingFinished()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Query::onResolverAdded( )
|
||||
{
|
||||
if ( !solved() )
|
||||
{
|
||||
refreshResults();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Query::onResolverRemoved( )
|
||||
{
|
||||
if ( !solved() )
|
||||
{
|
||||
refreshResults();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
QList< result_ptr >
|
||||
Query::results() const
|
||||
{
|
||||
|
@ -105,6 +105,10 @@ public slots:
|
||||
|
||||
void onResolvingFinished();
|
||||
|
||||
// resolve if not solved()
|
||||
void onResolverAdded( );
|
||||
void onResolverRemoved( );
|
||||
|
||||
private slots:
|
||||
void onResultStatusChanged();
|
||||
void refreshResults();
|
||||
|
Loading…
x
Reference in New Issue
Block a user