1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Refresh stations preview whenever controls are changed

This commit is contained in:
Leo Franchi 2011-10-20 17:23:58 -04:00
parent f796f1f133
commit be737a24f2
6 changed files with 16 additions and 9 deletions

View File

@ -120,7 +120,7 @@ CollapsibleControls::init()
m_layout->setCurrentWidget( m_summary );
connect( m_controls, SIGNAL( controlChanged( Tomahawk::dyncontrol_ptr ) ), SIGNAL( controlChanged( Tomahawk::dyncontrol_ptr ) ) );
connect( m_controls, SIGNAL( controlsChanged() ), SIGNAL( controlsChanged() ) );
connect( m_controls, SIGNAL( controlsChanged( bool ) ), SIGNAL( controlsChanged( bool ) ) );
setLayout( m_layout );

View File

@ -49,7 +49,7 @@ public:
virtual QSize sizeHint() const;
signals:
void controlsChanged();
void controlsChanged( bool added );
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
private slots:

View File

@ -156,7 +156,7 @@ DynamicControlList::addNewControl()
connect( m_controls.last(), SIGNAL( changed() ), this, SLOT( controlChanged() ) );
m_layout->addItem( m_collapseLayout, m_layout->rowCount(), 0, 1, 4, Qt::AlignCenter );
emit controlsChanged();
emit controlsChanged( true );
}
@ -170,7 +170,7 @@ DynamicControlList::removeControl()
m_generator->removeControl( w->control() );
delete w;
emit controlsChanged();
emit controlsChanged( false );
}

View File

@ -53,7 +53,7 @@ public:
QList< DynamicControlWrapper* > controls() const { return m_controls; }
signals:
void controlsChanged();
void controlsChanged( bool added );
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
void toggleCollapse();

View File

@ -95,7 +95,7 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
layoutFloatingWidgets();
connect( m_controls, SIGNAL( controlChanged( Tomahawk::dyncontrol_ptr ) ), this, SLOT( controlChanged( Tomahawk::dyncontrol_ptr ) ), Qt::QueuedConnection );
connect( m_controls, SIGNAL( controlsChanged() ), this, SLOT( controlsChanged() ), Qt::QueuedConnection );
connect( m_controls, SIGNAL( controlsChanged( bool ) ), this, SLOT( controlsChanged( bool ) ), Qt::QueuedConnection );
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) );
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
@ -361,7 +361,7 @@ DynamicWidget::tracksGenerated( const QList< query_ptr >& queries )
void
DynamicWidget::controlsChanged()
DynamicWidget::controlsChanged( bool added )
{
// controlsChanged() is emitted when a control is added or removed
// in the case of addition, it's blank by default... so to avoid an error
@ -373,6 +373,9 @@ DynamicWidget::controlsChanged()
m_playlist->createNewRevision();
m_seqRevLaunched++;
if ( !added )
showPreview();
emit descriptionChanged( m_playlist->generator()->sentenceSummary() );
}
@ -395,7 +398,11 @@ DynamicWidget::controlChanged( const Tomahawk::dyncontrol_ptr& control )
void
DynamicWidget::showPreview()
{
if( m_playlist->mode() == OnDemand && !m_runningOnDemand && m_model->rowCount( QModelIndex() ) == 0 ) { // if this is a not running station, preview matching tracks
if ( m_playlist->mode() == OnDemand &&
!m_runningOnDemand )
{
// if this is a not running station, preview matching tracks
m_model->clear();
generate( 20 ); // ask for more, we'll filter how many we actually want
}
}

View File

@ -101,7 +101,7 @@ private slots:
void tracksGenerated( const QList< Tomahawk::query_ptr>& queries );
void generatorError( const QString& title, const QString& content );
void controlsChanged();
void controlsChanged( bool added );
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
void showPreview();