summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-24 15:15:51 (UTC)
committer zecke <zecke>2004-09-24 15:15:51 (UTC)
commit4c53e68c3ac96baaaf39cc049c89d8ccf022ff59 (patch) (unidiff)
tree8273ae338f0d611c28438a4f8a6a6fc8329e90e8
parenta214128c01e38ffd50edc4ed5b5c72593796eab2 (diff)
downloadopie-4c53e68c3ac96baaaf39cc049c89d8ccf022ff59.zip
opie-4c53e68c3ac96baaaf39cc049c89d8ccf022ff59.tar.gz
opie-4c53e68c3ac96baaaf39cc049c89d8ccf022ff59.tar.bz2
Handling of Errors is a bit problematic with the current design.
We can start playing from multiple contexts. This are the PlayList context and single file context. Now the problem is that MediapPlayerState::setPlaying emits a signal. If started from the the PlayList setPlaying(false) would trigger an infite loop together with the Play ToggleButton, in single file context setPlaying(false) is the right choiche. The intermediate solution is to show an Error MessageBox and to raise the Audio Widget and leave it to the user to close it or go to the next file.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp48
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h4
3 files changed, 30 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index d73f0cd..37b998f 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -55,4 +55,5 @@ PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
55 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) 55 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
56{ 56{
57 Global::statusMessage( tr( "Loading of Skin started" ) );
57 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); 58 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
58 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); 59 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index e1816c8..c47a773 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -45,14 +45,4 @@ using namespace Opie::Core;
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46 46
47XineControl::XineControl( XineVideoWidget *xineWidget,
48 MediaPlayerState &_mediaPlayerState,
49 QObject *parent, const char *name )
50 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
51{
52 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
53
54 init();
55}
56
57XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 47XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
58 MediaPlayerState &_mediaPlayerState, 48 MediaPlayerState &_mediaPlayerState,
@@ -60,4 +50,6 @@ XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
60 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 50 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
61{ 51{
52 m_wasError = false;
53
62 xine->ensureInitialized(); 54 xine->ensureInitialized();
63 55
@@ -97,12 +89,15 @@ void XineControl::play( const QString& fileName ) {
97 hasAudioChannel = FALSE; 89 hasAudioChannel = FALSE;
98 m_fileName = fileName; 90 m_fileName = fileName;
91 m_wasError = false;
99 92
100 odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
101 93
94 /*
95 * If Playing Fails we will fire up an MessgaeBox
96 * but present the AudioWidget so the User can
97 * either Quit and change the Playlist or Continue
98 */
102 if ( !libXine->play( fileName, 0, 0 ) ) { 99 if ( !libXine->play( fileName, 0, 0 ) ) {
103 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
104 // toggle stop so the the play button is reset 101 m_wasError = true;
105 mediaPlayerState.setPlaying( false );
106 return;
107 } 102 }
108 mediaPlayerState.setPlaying( true ); 103 mediaPlayerState.setPlaying( true );
@@ -215,4 +210,17 @@ QString XineControl::getMetaInfo() {
215 QString returnString; 210 QString returnString;
216 211
212 /*
213 * If there was an error let us
214 * change the Meta Info to contain the Error Message
215 */
216 if ( m_wasError ) {
217 returnString = tr("Error on file '%1' with reason: ",
218 "Error when playing a file" ).arg( m_fileName );
219 returnString += getErrorCode();
220 returnString.replace( QRegExp("<qt>", false), "" );
221 returnString.replace( QRegExp("</qt>", false), "" );
222 return returnString;
223 }
224
217 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 225 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
218 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 226 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
@@ -248,15 +256,15 @@ QString XineControl::getErrorCode() {
248 256
249 if ( errorCode == 1 ) { 257 if ( errorCode == 1 ) {
250 return tr( "No input plugin found for this media type" ); 258 return tr( "<qt>No input plugin found for this media type</qt>" );
251 } else if ( errorCode == 2 ) { 259 } else if ( errorCode == 2 ) {
252 return tr( "No demux plugin found for this media type" ); 260 return tr( "<qt>No demux plugin found for this media type</qt>" );
253 } else if ( errorCode == 3 ) { 261 } else if ( errorCode == 3 ) {
254 return tr( "Demuxing failed for this media type" ); 262 return tr( "<qt>Demuxing failed for this media type</qt>" );
255 } else if ( errorCode == 4 ) { 263 } else if ( errorCode == 4 ) {
256 return tr( "Malformed MRL" ); 264 return tr( "<qt>Malformed MRL</qt>" );
257 } else if ( errorCode == 5 ) { 265 } else if ( errorCode == 5 ) {
258 return tr( "Input failed" ); 266 return tr( "<qt>Input failed</qt>" );
259 } else { 267 } else {
260 return tr( "Some other error" ); 268 return tr( "<qt>Some other error</qt>" );
261 } 269 }
262} 270}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 3f44f2e..848bd05 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -42,7 +42,4 @@ class XineControl : public QObject {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 XineControl( XineVideoWidget *xineWidget,
45 MediaPlayerState &_mediaPlayerState,
46 QObject *parent = 0, const char *name =0 );
47 // note that this constructor takes over ownership of the passed 44 // note that this constructor takes over ownership of the passed
48 // XINE::Lib object. 45 // XINE::Lib object.
@@ -118,4 +115,5 @@ private:
118 MediaPlayerState &mediaPlayerState; 115 MediaPlayerState &mediaPlayerState;
119 XineVideoWidget *xineVideoWidget; 116 XineVideoWidget *xineVideoWidget;
117 bool m_wasError : 1; // used for chaeting on the metainfo
120 118
121signals: 119signals: