mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 17:43:59 +02:00
activate modeswitch button
This commit is contained in:
@@ -50,7 +50,9 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
|
||||
m_modeCombo = new QComboBox( this );
|
||||
m_modeCombo->addItem( tr( "On Demand" ), OnDemand );
|
||||
m_modeCombo->addItem( tr( "Static" ), Static );
|
||||
connect( m_modeCombo, SIGNAL( activated( int ) ), this, SLOT( modeChanged( int ) ) );
|
||||
m_headerLayout->addWidget( m_modeCombo );
|
||||
|
||||
m_generatorCombo = new QComboBox( this );
|
||||
foreach( const QString& type, GeneratorFactory::types() )
|
||||
m_generatorCombo->addItem( type );
|
||||
@@ -114,11 +116,7 @@ void DynamicWidget::loadDynamicPlaylist(const Tomahawk::dynplaylist_ptr& playlis
|
||||
m_controls->setControls( m_playlist->generator(), m_playlist->generator()->controls() );
|
||||
m_modeCombo->setCurrentIndex( static_cast<int>( playlist->mode() ) );
|
||||
|
||||
if( playlist->mode() == Static ) {
|
||||
m_generateButton->setText( tr( "Generate" ) );
|
||||
} else {
|
||||
m_generateButton->setText( tr( "Play" ) );
|
||||
}
|
||||
applyModeChange( m_playlist->mode() );
|
||||
connect( m_playlist->generator().data(), SIGNAL( generated( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksGenerated( QList<Tomahawk::query_ptr> ) ) );
|
||||
connect( m_playlist.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( onRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ) );
|
||||
|
||||
@@ -148,6 +146,28 @@ DynamicWidget::generateOrStart()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DynamicWidget::modeChanged( int mode )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
m_playlist->setMode( mode );
|
||||
applyModeChange( mode );
|
||||
m_playlist->createNewRevision();
|
||||
}
|
||||
|
||||
void DynamicWidget::applyModeChange( int mode )
|
||||
{
|
||||
if( mode == OnDemand )
|
||||
{
|
||||
m_generateButton->setText( tr( "Play" ) );
|
||||
} else if( mode == Static ) {
|
||||
m_generateButton->setText( tr( "Generate" ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicWidget::tracksGenerated( const QList< query_ptr >& queries )
|
||||
{
|
||||
|
@@ -57,12 +57,15 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void generateOrStart();
|
||||
void modeChanged(int);
|
||||
void tracksGenerated( const QList< Tomahawk::query_ptr>& queries );
|
||||
|
||||
void controlsChanged();
|
||||
void controlChanged( const Tomahawk::dyncontrol_ptr& control );
|
||||
|
||||
private:
|
||||
void applyModeChange( int mode );
|
||||
|
||||
dynplaylist_ptr m_playlist;
|
||||
QVBoxLayout* m_layout;
|
||||
|
||||
|
Reference in New Issue
Block a user