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

* Check control states after a viewpage has been deleted.

This commit is contained in:
Christian Muehlhaeuser 2013-04-16 11:36:31 +02:00
parent c92ce9d8a5
commit 2db0c13821

View File

@ -64,7 +64,6 @@ AudioControls::AudioControls( QWidget* parent )
ui->artistTrackLabel->setFont( font );
ui->artistTrackLabel->setElideMode( Qt::ElideMiddle );
ui->artistTrackLabel->setType( QueryLabel::Track );
ui->artistTrackLabel->setJumpLinkVisible( true );
font.setPointSize( TomahawkUtils::defaultFontSize() );
ui->albumLabel->setFont( font );
@ -74,7 +73,7 @@ AudioControls::AudioControls( QWidget* parent )
queryLabelsPalette.setColor( QPalette::Foreground, Qt::black );
ui->artistTrackLabel->setPalette( queryLabelsPalette );
ui->albumLabel->setPalette( queryLabelsPalette );
font.setWeight( QFont::Normal );
ui->timeLabel->setFont( font );
ui->timeLeftLabel->setFont( font );
@ -136,7 +135,6 @@ AudioControls::AudioControls( QWidget* parent )
connect( ui->loveButton, SIGNAL( clicked( bool ) ), SLOT( onLoveButtonClicked( bool ) ) );
connect( ui->ownerButton, SIGNAL( clicked() ), SLOT( onOwnerButtonClicked() ) );
// <From AudioEngine>
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackLoading( Tomahawk::result_ptr ) ) );
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) );
connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( onPlaybackPaused() ) );
@ -149,6 +147,8 @@ AudioControls::AudioControls( QWidget* parent )
connect( AudioEngine::instance(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), SLOT( onRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
connect( AudioEngine::instance(), SIGNAL( shuffleModeChanged( bool ) ), SLOT( onShuffleModeChanged( bool ) ) );
connect( ViewManager::instance(), SIGNAL( viewPageDestroyed() ), SLOT( onControlStateChanged() ) );
ui->buttonAreaLayout->setSpacing( 0 );
ui->stackedLayout->setSpacing( 0 );
ui->stackedLayout->setContentsMargins( 0, 0, 0, 0 );
@ -216,6 +216,10 @@ AudioControls::onControlStateChanged()
ui->prevButton->setEnabled( AudioEngine::instance()->canGoPrevious() );
ui->nextButton->setEnabled( AudioEngine::instance()->canGoNext() );
// If the ViewManager doesn't know a page for the current interface, we can't offer the jump link
ui->artistTrackLabel->setJumpLinkVisible( AudioEngine::instance()->currentTrackPlaylist()
&& ViewManager::instance()->pageForInterface( AudioEngine::instance()->currentTrackPlaylist() ) );
}
@ -239,7 +243,7 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) );
ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( 0 ) );
m_sliderTimeLine.setDuration( duration );
m_sliderTimeLine.setFrameRange( 0, duration );
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
@ -299,9 +303,6 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
ui->seekSlider->setVisible( true );
m_sliderTimeLine.stop();
// If the ViewManager doesn't know a page for the current interface, we can't offer the jump link
ui->artistTrackLabel->setJumpLinkVisible( ( ViewManager::instance()->pageForInterface( AudioEngine::instance()->currentTrackPlaylist() ) ) );
onControlStateChanged();
QPixmap sourceIcon = result->sourceIcon( TomahawkUtils::RoundedCorners, ui->ownerButton->size() );