mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
* Added some queueState safety mechanism. Phonon's error signal fails to fire sometimes. Sigh.
This commit is contained in:
parent
4b059293d1
commit
c574dfeff3
@ -80,6 +80,10 @@ AudioEngine::AudioEngine()
|
||||
|
||||
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
|
||||
|
||||
m_stateQueueTimer.setInterval( 5000 );
|
||||
m_stateQueueTimer.setSingleShot( true );
|
||||
connect( &m_stateQueueTimer, SIGNAL( timeout() ), SLOT( queueStateSafety() ) );
|
||||
|
||||
onVolumeChanged( m_audioOutput->volume() );
|
||||
|
||||
#ifndef Q_WS_X11
|
||||
@ -867,17 +871,29 @@ AudioEngine::checkStateQueue()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::queueStateSafety()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
m_stateQueue.clear();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::queueState( AudioState state )
|
||||
{
|
||||
tDebug() << "Enqueuing state command:" << state << m_stateQueue.count();
|
||||
if ( m_stateQueueTimer.isActive() )
|
||||
m_stateQueueTimer.stop();
|
||||
|
||||
tDebug() << "Enqueuing state command:" << state << m_stateQueue.count();
|
||||
m_stateQueue.enqueue( state );
|
||||
|
||||
if ( m_stateQueue.count() == 1 )
|
||||
{
|
||||
checkStateQueue();
|
||||
}
|
||||
|
||||
m_stateQueueTimer.start();
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,6 +137,8 @@ private slots:
|
||||
void onPlaylistNextTrackReady();
|
||||
|
||||
void sendWaitingNotification() const;
|
||||
|
||||
void queueStateSafety();
|
||||
|
||||
private:
|
||||
void checkStateQueue();
|
||||
@ -169,6 +171,7 @@ private:
|
||||
|
||||
AudioState m_state;
|
||||
QQueue< AudioState > m_stateQueue;
|
||||
QTimer m_stateQueueTimer;
|
||||
|
||||
static AudioEngine* s_instance;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user