mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Show error message if phonon spits an error, but don't block with modal dialog/audio stop
This commit is contained in:
@@ -590,10 +590,10 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
|||||||
|
|
||||||
if ( newState == Phonon::ErrorState )
|
if ( newState == Phonon::ErrorState )
|
||||||
{
|
{
|
||||||
|
stop();
|
||||||
|
|
||||||
tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType();
|
tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType();
|
||||||
emit error( UnknownError );
|
emit error( UnknownError );
|
||||||
|
|
||||||
stop();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( newState == Phonon::PlayingState )
|
if ( newState == Phonon::PlayingState )
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -58,6 +58,8 @@
|
|||||||
#include "tomahawksettings.h"
|
#include "tomahawksettings.h"
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
#include "jobview/JobStatusView.h"
|
#include "jobview/JobStatusView.h"
|
||||||
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
#include "tomahawktrayicon.h"
|
#include "tomahawktrayicon.h"
|
||||||
#include "scanmanager.h"
|
#include "scanmanager.h"
|
||||||
#include "tomahawkapp.h"
|
#include "tomahawkapp.h"
|
||||||
@@ -80,6 +82,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
, m_searchWidget( 0 )
|
, m_searchWidget( 0 )
|
||||||
, m_audioControls( new AudioControls( this ) )
|
, m_audioControls( new AudioControls( this ) )
|
||||||
, m_trayIcon( new TomahawkTrayIcon( this ) )
|
, m_trayIcon( new TomahawkTrayIcon( this ) )
|
||||||
|
, m_audioRetryCounter( 0 )
|
||||||
{
|
{
|
||||||
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||||
|
|
||||||
@@ -568,11 +571,17 @@ TomahawkWindow::onXSPFError( XSPFLoader::XSPFErrorCode error )
|
|||||||
void
|
void
|
||||||
TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
|
TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
|
||||||
{
|
{
|
||||||
|
QString msg;
|
||||||
#ifdef Q_WS_X11
|
#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 );
|
msg = tr( "Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped. Make sure you have a suitable Phonon backend and required plugins installed." );
|
||||||
#else
|
#else
|
||||||
QMessageBox::warning( this, tr( "Playback Error" ), tr( "Sorry, there is a problem accessing your audio device." ), QMessageBox::Ok );
|
msg = tr( "Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped." );
|
||||||
#endif
|
#endif
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) );
|
||||||
|
|
||||||
|
if ( m_audioRetryCounter < 3 )
|
||||||
|
AudioEngine::instance()->play();
|
||||||
|
m_audioRetryCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -652,6 +661,7 @@ TomahawkWindow::playlistCreateDialogFinished( int ret )
|
|||||||
void
|
void
|
||||||
TomahawkWindow::audioStarted()
|
TomahawkWindow::audioStarted()
|
||||||
{
|
{
|
||||||
|
m_audioRetryCounter = 0;
|
||||||
ui->actionPlay->setText( tr( "Pause" ) );
|
ui->actionPlay->setText( tr( "Pause" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -141,6 +142,7 @@ private:
|
|||||||
|
|
||||||
Tomahawk::result_ptr m_currentTrack;
|
Tomahawk::result_ptr m_currentTrack;
|
||||||
QString m_windowTitle;
|
QString m_windowTitle;
|
||||||
|
int m_audioRetryCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOMAHAWKWINDOW_H
|
#endif // TOMAHAWKWINDOW_H
|
||||||
|
Reference in New Issue
Block a user