1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

only add tracks to a station if it is active

try harder to not overlay spinner over text
This commit is contained in:
Leo Franchi
2011-03-24 10:55:55 -04:00
parent c35d77891b
commit f0db24aa07
3 changed files with 15 additions and 12 deletions

View File

@@ -144,7 +144,6 @@ DynamicView::onTrackCountChanged( unsigned int tracks )
overlay()->show(); overlay()->show();
} }
else { else {
m_working = false;
overlay()->hide(); overlay()->hide();
} }
} }

View File

@@ -50,6 +50,7 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
, m_layout( new QVBoxLayout ) , m_layout( new QVBoxLayout )
, m_resolveOnNextLoad( false ) , m_resolveOnNextLoad( false )
, m_seqRevLaunched( 0 ) , m_seqRevLaunched( 0 )
, m_activePlaylist( false )
, m_setup( 0 ) , m_setup( 0 )
, m_runningOnDemand( false ) , m_runningOnDemand( false )
, m_controlsChanged( false ) , m_controlsChanged( false )
@@ -95,7 +96,7 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
connect( m_controls, SIGNAL( controlsChanged() ), this, SLOT( controlsChanged() ), Qt::QueuedConnection ); connect( m_controls, SIGNAL( controlsChanged() ), this, SLOT( controlsChanged() ), Qt::QueuedConnection );
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) );
connect( AudioEngine::instance(), SIGNAL( playlistChanged( PlaylistInterface* ) ), this, SLOT( playlistStopped( PlaylistInterface* ) ) ); connect( AudioEngine::instance(), SIGNAL( playlistChanged( PlaylistInterface* ) ), this, SLOT( playlistChanged( PlaylistInterface* ) ) );
} }
DynamicWidget::~DynamicWidget() DynamicWidget::~DynamicWidget()
@@ -214,15 +215,17 @@ DynamicWidget::layoutFloatingWidgets()
} }
void void
DynamicWidget::playlistStopped( PlaylistInterface* pl ) DynamicWidget::playlistChanged( PlaylistInterface* pl )
{ {
if( pl == static_cast< PlaylistInterface* >( m_view->proxyModel() ) ) // same playlist, so don't stop if( pl == static_cast< PlaylistInterface* >( m_view->proxyModel() ) ) { // same playlist
return; m_activePlaylist = true;
} else {
// user started playing something somewhere else, so give it a rest m_activePlaylist = false;
if( m_runningOnDemand ) {
stopStation( false ); // user started playing something somewhere else, so give it a rest
m_model->clear(); if( m_runningOnDemand ) {
stopStation( false );
}
} }
} }
@@ -257,7 +260,7 @@ DynamicWidget::stationFailed( const QString& msg )
void void
DynamicWidget::trackStarted() DynamicWidget::trackStarted()
{ {
if( isVisible() && !m_playlist.isNull() && if( m_activePlaylist && !m_playlist.isNull() &&
m_playlist->mode() == OnDemand && !m_runningOnDemand ) { m_playlist->mode() == OnDemand && !m_runningOnDemand ) {
startStation(); startStation();

View File

@@ -91,7 +91,7 @@ public slots:
void trackStarted(); void trackStarted();
void stationFailed( const QString& ); void stationFailed( const QString& );
void playlistStopped( PlaylistInterface* ); void playlistChanged( PlaylistInterface* );
void tracksAdded(); void tracksAdded();
private slots: private slots:
@@ -110,6 +110,7 @@ private:
QVBoxLayout* m_layout; QVBoxLayout* m_layout;
bool m_resolveOnNextLoad; bool m_resolveOnNextLoad;
int m_seqRevLaunched; // if we shoot off multiple createRevision calls, we don'y want to set one of the middle ones int m_seqRevLaunched; // if we shoot off multiple createRevision calls, we don'y want to set one of the middle ones
bool m_activePlaylist;
// loading animation // loading animation
LoadingSpinner* m_loading; LoadingSpinner* m_loading;