1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 17:14:00 +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();
}
else {
m_working = false;
overlay()->hide();
}
}

View File

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

View File

@@ -91,7 +91,7 @@ public slots:
void trackStarted();
void stationFailed( const QString& );
void playlistStopped( PlaylistInterface* );
void playlistChanged( PlaylistInterface* );
void tracksAdded();
private slots:
@@ -110,6 +110,7 @@ private:
QVBoxLayout* m_layout;
bool m_resolveOnNextLoad;
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
LoadingSpinner* m_loading;