mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 08:19:42 +01:00
make stations behave when multiple result signals are emitted by the pipeline
This commit is contained in:
parent
8c3745896c
commit
8b2ade25de
@ -84,6 +84,7 @@ DynamicModel::newTrackGenerated( const Tomahawk::query_ptr& query )
|
||||
if( m_onDemandRunning ) {
|
||||
connect( query.data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( trackResolveFinished( bool ) ) );
|
||||
|
||||
m_waitingFor << query.data();
|
||||
append( query );
|
||||
}
|
||||
}
|
||||
@ -112,7 +113,10 @@ DynamicModel::trackResolveFinished( bool success )
|
||||
{
|
||||
Q_UNUSED( success );
|
||||
|
||||
Query* q = qobject_cast<Query*>(sender());
|
||||
Query* q = qobject_cast<Query*>( sender() );
|
||||
|
||||
if( !m_waitingFor.contains( q ) )
|
||||
return;
|
||||
|
||||
if( !q->playable() ) {
|
||||
qDebug() << "Got not resolved track:" << q->track() << q->artist() << m_lastResolvedRow << m_currentAttempts;
|
||||
@ -139,6 +143,7 @@ DynamicModel::trackResolveFinished( bool success )
|
||||
|
||||
emit checkForOverflow();
|
||||
}
|
||||
m_waitingFor.removeAll( q );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@ -27,7 +27,7 @@ namespace Tomahawk
|
||||
|
||||
class StationModelItem;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Extends PlaylistModel with support for handling stations
|
||||
*/
|
||||
@ -37,22 +37,22 @@ class DynamicModel : public PlaylistModel
|
||||
public:
|
||||
DynamicModel( QObject* parent = 0 );
|
||||
virtual ~DynamicModel();
|
||||
|
||||
|
||||
void startOnDemand();
|
||||
void stopOnDemand( bool stopPlaying = true );
|
||||
void changeStation();
|
||||
|
||||
|
||||
virtual QString description() const;
|
||||
|
||||
|
||||
void loadPlaylist( const dynplaylist_ptr& playlist, bool loadEntries = true );
|
||||
|
||||
|
||||
virtual void removeIndex( const QModelIndex& index, bool moreToCome = false );
|
||||
|
||||
|
||||
bool searchingForNext() const { return m_searchingForNext; }
|
||||
|
||||
|
||||
void setFilterUnresolvable( bool filter ) { m_filterUnresolvable = filter; }
|
||||
bool filterUnresolvable() const { return m_filterUnresolvable; }
|
||||
|
||||
|
||||
// a batchof static tracks wre generated
|
||||
void tracksGenerated( const QList< query_ptr > entries, int limitResolvedTo = -1 );
|
||||
signals:
|
||||
@ -60,25 +60,29 @@ signals:
|
||||
void checkForOverflow();
|
||||
|
||||
void trackGenerationFailure( const QString& msg );
|
||||
|
||||
|
||||
void tracksAdded();
|
||||
private slots:
|
||||
private slots:
|
||||
void newTrackGenerated( const Tomahawk::query_ptr& query );
|
||||
|
||||
|
||||
void trackResolveFinished( bool );
|
||||
void newTrackLoading();
|
||||
|
||||
|
||||
void filteringTrackResolved( bool successful );
|
||||
private:
|
||||
void filterUnresolved( const QList< query_ptr >& entries );
|
||||
void addToPlaylist( const QList< query_ptr >& entries, bool clearFirst );
|
||||
|
||||
|
||||
dynplaylist_ptr m_playlist;
|
||||
|
||||
// for filtering unresolvable
|
||||
int m_limitResolvedTo;
|
||||
QList< query_ptr > m_toResolveList;
|
||||
QList< query_ptr > m_resolvedList;
|
||||
|
||||
|
||||
// for managing upcoming queue
|
||||
QList< Query* > m_waitingFor;
|
||||
|
||||
bool m_onDemandRunning;
|
||||
bool m_changeOnNext;
|
||||
bool m_searchingForNext;
|
||||
@ -88,7 +92,7 @@ private:
|
||||
int m_currentAttempts;
|
||||
int m_lastResolvedRow;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user