summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayer.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index ce42c2c..c971a3c 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -67,67 +67,62 @@ void MediaPlayer::pauseCheck( bool b ) {
67 if ( b && !mediaPlayerState->playing() ) 67 if ( b && !mediaPlayerState->playing() )
68 mediaPlayerState->setPaused( FALSE ); 68 mediaPlayerState->setPaused( FALSE );
69} 69}
70 70
71 71
72void MediaPlayer::play() { 72void MediaPlayer::play() {
73 mediaPlayerState->setPlaying( FALSE ); 73 mediaPlayerState->setPlaying( FALSE );
74 mediaPlayerState->setPlaying( TRUE ); 74 mediaPlayerState->setPlaying( TRUE );
75} 75}
76 76
77 77
78void MediaPlayer::setPlaying( bool play ) { 78void MediaPlayer::setPlaying( bool play ) {
79
80 if ( !play ) { 79 if ( !play ) {
81 mediaPlayerState->setPaused( FALSE ); 80 mediaPlayerState->setPaused( FALSE );
82 loopControl->stop( FALSE ); 81 loopControl->stop( FALSE );
83 return; 82 return;
84 } 83 }
85 84
86 if ( mediaPlayerState->paused() ) { 85 if ( mediaPlayerState->paused() ) {
87 mediaPlayerState->setPaused( FALSE ); 86 mediaPlayerState->setPaused( FALSE );
88 return; 87 return;
89 } 88 }
90 89
91 const DocLnk *playListCurrent = playList->current(); 90 const DocLnk *playListCurrent = playList->current();
92
93 if ( playListCurrent != NULL ) { 91 if ( playListCurrent != NULL ) {
94 loopControl->stop( TRUE ); 92 loopControl->stop( TRUE );
95 currentFile = playListCurrent; 93 currentFile = playListCurrent;
96 } 94 }
97
98 if ( currentFile == NULL ) { 95 if ( currentFile == NULL ) {
99 QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); 96 QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) );
100 mediaPlayerState->setPlaying( FALSE ); 97 mediaPlayerState->setPlaying( FALSE );
101 return; 98 return;
102 } 99 }
103
104 if ( !QFile::exists( currentFile->file() ) ) { 100 if ( !QFile::exists( currentFile->file() ) ) {
105 QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); 101 QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" );
106 mediaPlayerState->setPlaying( FALSE ); 102 mediaPlayerState->setPlaying( FALSE );
107 return; 103 return;
108 } 104 }
109 105
110 if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { 106 if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) {
111 QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); 107 QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" );
112 mediaPlayerState->setPlaying( FALSE ); 108 mediaPlayerState->setPlaying( FALSE );
113 return; 109 return;
114 } 110 }
115 111
116 if ( !loopControl->init( currentFile->file() ) ) { 112 if ( !loopControl->init( currentFile->file() ) ) {
117 QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); 113 QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" );
118 mediaPlayerState->setPlaying( FALSE ); 114 mediaPlayerState->setPlaying( FALSE );
119 return; 115 return;
120 } 116 }
121
122 long seconds = loopControl->totalPlaytime(); 117 long seconds = loopControl->totalPlaytime();
123 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 118 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
124 QString tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 119 QString tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
125 QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); 120 QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
126 if ( !fileInfo.isEmpty() ) 121 if ( !fileInfo.isEmpty() )
127 tickerText += ", " + fileInfo; 122 tickerText += ", " + fileInfo;
128 audioUI->setTickerText( tickerText + "." ); 123 audioUI->setTickerText( tickerText + "." );
129 124
130 loopControl->play(); 125 loopControl->play();
131 126
132 mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' ); 127 mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' );
133} 128}