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