Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index a6fd334..00d516c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -186,34 +186,32 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
186 | time.setAlignment( Qt::AlignCenter ); | 186 | time.setAlignment( Qt::AlignCenter ); |
187 | time.setFrame(FALSE); | 187 | time.setFrame(FALSE); |
188 | changeTextColor( &time ); | 188 | changeTextColor( &time ); |
189 | 189 | ||
190 | resizeEvent( NULL ); | 190 | resizeEvent( NULL ); |
191 | 191 | ||
192 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 192 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
193 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 193 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
194 | 194 | ||
195 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 195 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
196 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 196 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
197 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 197 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
198 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | ||
199 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 198 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
199 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | ||
200 | 200 | ||
201 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 201 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
202 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 202 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
203 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 203 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
204 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 204 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
205 | 205 | ||
206 | |||
207 | |||
208 | // Intialise state | 206 | // Intialise state |
209 | setLength( mediaPlayerState->length() ); | 207 | setLength( mediaPlayerState->length() ); |
210 | setPosition( mediaPlayerState->position() ); | 208 | setPosition( mediaPlayerState->position() ); |
211 | setLooping( mediaPlayerState->fullscreen() ); | 209 | setLooping( mediaPlayerState->fullscreen() ); |
212 | // setPaused( mediaPlayerState->paused() ); | 210 | // setPaused( mediaPlayerState->paused() ); |
213 | setPlaying( mediaPlayerState->playing() ); | 211 | setPlaying( mediaPlayerState->playing() ); |
214 | 212 | ||
215 | } | 213 | } |
216 | 214 | ||
217 | AudioWidget::~AudioWidget() { | 215 | AudioWidget::~AudioWidget() { |
218 | 216 | ||
219 | for ( int i = 0; i < 10; i++ ) { | 217 | for ( int i = 0; i < 10; i++ ) { |
@@ -299,49 +297,52 @@ void AudioWidget::setPosition( long i ) { | |||
299 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 297 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
300 | updateSlider( i, mediaPlayerState->length() ); | 298 | updateSlider( i, mediaPlayerState->length() ); |
301 | } | 299 | } |
302 | 300 | ||
303 | 301 | ||
304 | void AudioWidget::setLength( long max ) { | 302 | void AudioWidget::setLength( long max ) { |
305 | updateSlider( mediaPlayerState->position(), max ); | 303 | updateSlider( mediaPlayerState->position(), max ); |
306 | } | 304 | } |
307 | 305 | ||
308 | 306 | ||
309 | void AudioWidget::setView( char view ) { | 307 | void AudioWidget::setView( char view ) { |
310 | 308 | ||
311 | // this isnt working for some reason | 309 | if ( view == 'a' ) { |
310 | // startTimer( 150 ); | ||
311 | showMaximized(); | ||
312 | } else { | ||
313 | killTimers(); | ||
314 | hide(); | ||
315 | } | ||
316 | // qApp->processEvents(); | ||
317 | } | ||
318 | |||
319 | |||
320 | void AudioWidget::setSeekable( bool isSeekable ) { | ||
312 | 321 | ||
313 | if ( mediaPlayerState->streaming() ) { | 322 | if ( isSeekable ) { |
314 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 323 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
315 | if( !slider.isHidden()) { | 324 | if( !slider.isHidden()) { |
316 | slider.hide(); | 325 | slider.hide(); |
317 | } | 326 | } |
318 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 327 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
319 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 328 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
320 | } else { | 329 | } else { |
321 | // this stops the slider from being moved, thus | 330 | // this stops the slider from being moved, thus |
322 | // does not stop stream when it reaches the end | 331 | // does not stop stream when it reaches the end |
323 | slider.show(); | 332 | slider.show(); |
333 | qDebug( " CONNECT SET POSTION " ); | ||
324 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 334 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
325 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 335 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
326 | } | 336 | } |
327 | |||
328 | if ( view == 'a' ) { | ||
329 | // startTimer( 150 ); | ||
330 | showMaximized(); | ||
331 | } else { | ||
332 | killTimers(); | ||
333 | hide(); | ||
334 | } | ||
335 | // qApp->processEvents(); | ||
336 | } | 337 | } |
337 | 338 | ||
338 | 339 | ||
339 | static QString timeAsString( long length ) { | 340 | static QString timeAsString( long length ) { |
340 | int minutes = length / 60; | 341 | int minutes = length / 60; |
341 | int seconds = length % 60; | 342 | int seconds = length % 60; |
342 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 343 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
343 | } | 344 | } |
344 | 345 | ||
345 | void AudioWidget::updateSlider( long i, long max ) { | 346 | void AudioWidget::updateSlider( long i, long max ) { |
346 | 347 | ||
347 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 348 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |