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