summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayer.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp65
1 files changed, 30 insertions, 35 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
@@ -50,4 +50,4 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
50 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 50 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
51 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 51 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
52 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 52 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
53 53
@@ -67,3 +67,3 @@ 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}
@@ -78,7 +78,6 @@ void MediaPlayer::play() {
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 }
@@ -86,4 +85,4 @@ void MediaPlayer::setPlaying( bool play ) {
86 if ( mediaPlayerState->paused() ) { 85 if ( mediaPlayerState->paused() ) {
87 mediaPlayerState->setPaused( FALSE ); 86 mediaPlayerState->setPaused( FALSE );
88 return; 87 return;
89 } 88 }
@@ -91,18 +90,15 @@ void MediaPlayer::setPlaying( bool play ) {
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 }
@@ -110,5 +106,5 @@ void MediaPlayer::setPlaying( bool play ) {
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 }
@@ -116,7 +112,6 @@ void MediaPlayer::setPlaying( bool play ) {
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();
@@ -126,3 +121,3 @@ void MediaPlayer::setPlaying( bool play ) {
126 if ( !fileInfo.isEmpty() ) 121 if ( !fileInfo.isEmpty() )
127 tickerText += ", " + fileInfo; 122 tickerText += ", " + fileInfo;
128 audioUI->setTickerText( tickerText + "." ); 123 audioUI->setTickerText( tickerText + "." );
@@ -137,8 +132,8 @@ void MediaPlayer::prev() {
137 if ( playList->prev() ) 132 if ( playList->prev() )
138 play(); 133 play();
139 else if ( mediaPlayerState->looping() ) { 134 else if ( mediaPlayerState->looping() ) {
140 if ( playList->last() ) 135 if ( playList->last() )
141 play(); 136 play();
142 } else 137 } else
143 mediaPlayerState->setList(); 138 mediaPlayerState->setList();
144} 139}
@@ -148,8 +143,8 @@ void MediaPlayer::next() {
148 if ( playList->next() ) 143 if ( playList->next() )
149 play(); 144 play();
150 else if ( mediaPlayerState->looping() ) { 145 else if ( mediaPlayerState->looping() ) {
151 if ( playList->first() ) 146 if ( playList->first() )
152 play(); 147 play();
153 } else 148 } else
154 mediaPlayerState->setList(); 149 mediaPlayerState->setList();
155} 150}
@@ -178,3 +173,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
178 if ( volumeDirection == +1 ) 173 if ( volumeDirection == +1 )
179 AudioDevice::increaseVolume(); 174 AudioDevice::increaseVolume();
180 else if ( volumeDirection == -1 ) 175 else if ( volumeDirection == -1 )