mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-08 18:12:41 +02:00
Merge branch 'master' of github.com:tomahawk-player/tomahawk
This commit is contained in:
commit
59cf992dfb
@ -227,15 +227,12 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||
ui->seekSlider->setValue( 0 );
|
||||
ui->seekSlider->setEnabled( AudioEngine::instance()->canSeek() );
|
||||
|
||||
m_sliderTimeLine.stop();
|
||||
m_sliderTimeLine.setDuration( duration );
|
||||
m_sliderTimeLine.setFrameRange( 0, duration );
|
||||
m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve );
|
||||
m_sliderTimeLine.setCurrentTime( 0 );
|
||||
m_seeked = false;
|
||||
|
||||
ui->seekSlider->setVisible( true );
|
||||
|
||||
int updateRate = (double)1000 / ( (double)ui->seekSlider->contentsRect().width() / (double)( duration / 1000 ) );
|
||||
m_sliderTimeLine.setUpdateInterval( qBound( 40, updateRate, 500 ) );
|
||||
|
||||
@ -284,6 +281,11 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
||||
ui->loveButton->setToolTip( tr( "Love" ) );
|
||||
ui->ownerButton->setToolTip( QString( tr( "Playing from %1" ) ).arg( result->friendlySource() ) );
|
||||
|
||||
ui->seekSlider->setRange( 0, 0 );
|
||||
ui->seekSlider->setValue( 0 );
|
||||
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() ) ) );
|
||||
|
||||
|
@ -451,6 +451,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
if ( !err )
|
||||
{
|
||||
tLog() << "Starting new song:" << m_currentTrack->url();
|
||||
m_state = Loading;
|
||||
emit loading( m_currentTrack );
|
||||
|
||||
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
|
||||
@ -736,8 +737,17 @@ AudioEngine::onAboutToFinish()
|
||||
void
|
||||
AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << oldState << newState << m_expectStop;
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << oldState << newState << m_expectStop << state();
|
||||
|
||||
if ( newState == Phonon::LoadingState )
|
||||
{
|
||||
// We don't emit this state to listeners - yet.
|
||||
m_state = Loading;
|
||||
}
|
||||
if ( newState == Phonon::StoppedState )
|
||||
{
|
||||
m_state = Stopped;
|
||||
}
|
||||
if ( newState == Phonon::ErrorState )
|
||||
{
|
||||
stop( UnknownError );
|
||||
@ -749,7 +759,9 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||
}
|
||||
if ( newState == Phonon::PlayingState )
|
||||
{
|
||||
emit started( m_currentTrack );
|
||||
if ( state() != Paused && state() != Playing )
|
||||
emit started( m_currentTrack );
|
||||
|
||||
setState( Playing );
|
||||
}
|
||||
|
||||
@ -982,17 +994,12 @@ AudioEngine::checkStateQueue()
|
||||
{
|
||||
case Playing:
|
||||
{
|
||||
bool paused = isPaused();
|
||||
m_mediaObject->play();
|
||||
if ( paused )
|
||||
setVolume( m_volume );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Paused:
|
||||
{
|
||||
m_volume = volume();
|
||||
m_mediaObject->pause();
|
||||
break;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ Q_OBJECT
|
||||
|
||||
public:
|
||||
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError, NoError };
|
||||
enum AudioState { Stopped, Playing, Paused, Error };
|
||||
enum AudioState { Stopped, Playing, Paused, Error, Loading };
|
||||
|
||||
static AudioEngine* instance();
|
||||
|
||||
@ -171,7 +171,6 @@ private:
|
||||
bool m_waitingOnNewTrack;
|
||||
|
||||
mutable QStringList m_supportedMimeTypes;
|
||||
unsigned int m_volume;
|
||||
|
||||
AudioState m_state;
|
||||
QQueue< AudioState > m_stateQueue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user