mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
* Show an error dialog when a playback problem occurred.
This commit is contained in:
parent
793babcd12
commit
324f8a9515
@ -160,6 +160,8 @@ void
|
||||
AudioEngine::stop()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
|
||||
|
||||
emit stopped();
|
||||
if ( isStopped() )
|
||||
return;
|
||||
|
||||
@ -171,7 +173,6 @@ AudioEngine::stop()
|
||||
if ( !m_currentTrack.isNull() )
|
||||
emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 );
|
||||
|
||||
emit stopped();
|
||||
setCurrentTrack( Tomahawk::result_ptr() );
|
||||
|
||||
Tomahawk::InfoSystem::InfoTypeMap map;
|
||||
@ -603,6 +604,9 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||
if ( newState == Phonon::ErrorState )
|
||||
{
|
||||
tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType();
|
||||
emit error( UnknownError );
|
||||
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
if ( newState == Phonon::PlayingState )
|
||||
|
@ -45,7 +45,7 @@ class DLLEXPORT AudioEngine : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError };
|
||||
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError };
|
||||
enum AudioState { Stopped, Playing, Paused };
|
||||
|
||||
static AudioEngine* instance();
|
||||
@ -121,7 +121,7 @@ signals:
|
||||
|
||||
void playlistChanged( Tomahawk::PlaylistInterface* playlist );
|
||||
|
||||
void error( AudioErrorCode errorCode );
|
||||
void error( AudioEngine::AudioErrorCode errorCode );
|
||||
|
||||
private slots:
|
||||
bool loadTrack( const Tomahawk::result_ptr& result );
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "playlist.h"
|
||||
#include "query.h"
|
||||
#include "artist.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "viewmanager.h"
|
||||
#include "sip/SipHandler.h"
|
||||
#include "sourcetree/sourcetreeview.h"
|
||||
@ -297,8 +296,8 @@ TomahawkWindow::setupSignals()
|
||||
m_audioControls, SLOT( onShuffleModeChanged( bool ) ) );
|
||||
|
||||
// <From AudioEngine>
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( const Tomahawk::result_ptr& ) ),
|
||||
SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( error( AudioEngine::AudioErrorCode ) ), SLOT( onAudioEngineError( AudioEngine::AudioErrorCode ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( const Tomahawk::result_ptr& ) ), SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( audioStarted() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( resumed()), SLOT( audioStarted() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( audioStopped() ) );
|
||||
@ -487,6 +486,7 @@ TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::showOfflineSources()
|
||||
{
|
||||
@ -519,6 +519,7 @@ TomahawkWindow::loadSpiff()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::loadXspfFinished( int ret )
|
||||
{
|
||||
@ -537,6 +538,7 @@ TomahawkWindow::loadXspfFinished( int ret )
|
||||
d->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::onXSPFOk( const Tomahawk::playlist_ptr& pl )
|
||||
{
|
||||
@ -563,6 +565,17 @@ TomahawkWindow::onXSPFError( XSPFLoader::XSPFErrorCode error )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QMessageBox::warning( this, tr( "Playback Error" ), tr( "Sorry, there is a problem accessing your audio device. Make sure you have a suitable Phonon backend and required plugins installed." ), QMessageBox::Ok );
|
||||
#else
|
||||
QMessageBox::warning( this, tr( "Playback Error" ), tr( "Sorry, there is a problem accessing your audio device." ), QMessageBox::Ok );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::createAutomaticPlaylist( QString playlistName )
|
||||
{
|
||||
@ -613,7 +626,9 @@ TomahawkWindow::createPlaylist()
|
||||
playlistSelectorDlg->show();
|
||||
}
|
||||
|
||||
void TomahawkWindow::playlistCreateDialogFinished( int ret )
|
||||
|
||||
void
|
||||
TomahawkWindow::playlistCreateDialogFinished( int ret )
|
||||
{
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = qobject_cast< PlaylistTypeSelectorDlg* >( sender() );
|
||||
Q_ASSERT( playlistSelectorDlg );
|
||||
@ -633,6 +648,7 @@ void TomahawkWindow::playlistCreateDialogFinished( int ret )
|
||||
playlistSelectorDlg->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::audioStarted()
|
||||
{
|
||||
@ -655,6 +671,7 @@ TomahawkWindow::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
||||
setWindowTitle( m_windowTitle );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::onSipConnected()
|
||||
{
|
||||
@ -672,8 +689,8 @@ TomahawkWindow::onSipDisconnected()
|
||||
void
|
||||
TomahawkWindow::onSipPluginAdded( SipPlugin* p )
|
||||
{
|
||||
connect( p, SIGNAL( addMenu( QMenu* ) ), this, SLOT( pluginMenuAdded( QMenu* ) ) );
|
||||
connect( p, SIGNAL( removeMenu( QMenu* ) ), this, SLOT( pluginMenuRemoved( QMenu* ) ) );
|
||||
connect( p, SIGNAL( addMenu( QMenu* ) ), SLOT( pluginMenuAdded( QMenu* ) ) );
|
||||
connect( p, SIGNAL( removeMenu( QMenu* ) ), SLOT( pluginMenuRemoved( QMenu* ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QStackedWidget>
|
||||
|
||||
#include "result.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/xspfloader.h"
|
||||
|
||||
class JobStatusModel;
|
||||
@ -84,6 +85,8 @@ private slots:
|
||||
void onSipDisconnected();
|
||||
void onSipError();
|
||||
|
||||
void onAudioEngineError( AudioEngine::AudioErrorCode error );
|
||||
|
||||
void onXSPFError( XSPFLoader::XSPFErrorCode error );
|
||||
void onXSPFOk( const Tomahawk::playlist_ptr& );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user