1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 11:04:01 +02:00

Fixed AudioControls' slider timeline.

This commit is contained in:
Christian Muehlhaeuser
2015-04-18 08:42:27 +02:00
parent dfc07598a1
commit 8c7036b0da

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org> * Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org> * Copyright 2013, Teo Mrnjavac <teo@kde.org>
* *
@@ -344,6 +344,7 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr result )
// ui->loveButton->setToolTip( tr( "Love" ) ); // ui->loveButton->setToolTip( tr( "Love" ) );
ui->ownerButton->setToolTip( QString( tr( "Playing from %1" ) ).arg( result->friendlySource() ) ); ui->ownerButton->setToolTip( QString( tr( "Playing from %1" ) ).arg( result->friendlySource() ) );
// stop the seek slider while we're still loading the track
ui->seekSlider->setRange( 0, 0 ); ui->seekSlider->setRange( 0, 0 );
ui->seekSlider->setValue( 0 ); ui->seekSlider->setValue( 0 );
ui->seekSlider->setVisible( true ); ui->seekSlider->setVisible( true );
@@ -531,7 +532,6 @@ AudioControls::onTrackPosition( float position )
ui->seekSlider->blockSignals( true ); ui->seekSlider->blockSignals( true );
ui->seekSlider->setSliderPosition( position * duration ); ui->seekSlider->setSliderPosition( position * duration );
ui->seekSlider->blockSignals( false ); ui->seekSlider->blockSignals( false );
m_sliderTimeLine.stop();
} }
} }
@@ -562,9 +562,12 @@ AudioControls::onPlaybackTimer( qint64 msElapsed )
if ( msElapsed == 0 ) if ( msElapsed == 0 )
{ {
m_haveTiming = false; m_haveTiming = false;
m_sliderTimeLine.stop();
return; return;
} }
m_haveTiming = true; m_haveTiming = true;
if ( m_sliderTimeLine.state() != QTimeLine::Running )
m_sliderTimeLine.resume();
int currentTime = m_sliderTimeLine.currentTime(); int currentTime = m_sliderTimeLine.currentTime();
//tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << currentTime << "and audio engine state is" << (int)AudioEngine::instance()->state(); //tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << currentTime << "and audio engine state is" << (int)AudioEngine::instance()->state();
@@ -619,10 +622,7 @@ AudioControls::onPlaybackTimer( qint64 msElapsed )
m_sliderTimeLine.setCurrentTime( msElapsed ); m_sliderTimeLine.setCurrentTime( msElapsed );
} }
} }
else
{
tDebug() << Q_FUNC_INFO << "What to do? How could we even get here?";
}
m_lastSliderCheck = msElapsed; m_lastSliderCheck = msElapsed;
ui->seekSlider->blockSignals( false ); ui->seekSlider->blockSignals( false );
} }