Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 45f301e..620c71f 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -287,97 +287,97 @@ void AudioWidget::sliderPressed() { | |||
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | void AudioWidget::sliderReleased() { | 290 | void AudioWidget::sliderReleased() { |
291 | audioSliderBeingMoved = FALSE; | 291 | audioSliderBeingMoved = FALSE; |
292 | if ( slider.width() == 0 ) | 292 | if ( slider.width() == 0 ) |
293 | return; | 293 | return; |
294 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 294 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
295 | mediaPlayerState->setPosition( val ); | 295 | mediaPlayerState->setPosition( val ); |
296 | } | 296 | } |
297 | 297 | ||
298 | void AudioWidget::setPosition( long i ) { | 298 | void AudioWidget::setPosition( long i ) { |
299 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 299 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
300 | updateSlider( i, mediaPlayerState->length() ); | 300 | updateSlider( i, mediaPlayerState->length() ); |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | void AudioWidget::setLength( long max ) { | 304 | void AudioWidget::setLength( long max ) { |
305 | updateSlider( mediaPlayerState->position(), max ); | 305 | updateSlider( mediaPlayerState->position(), max ); |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | void AudioWidget::setView( char view ) { | 309 | void AudioWidget::setView( char view ) { |
310 | 310 | ||
311 | // this isnt working for some reason | 311 | // this isnt working for some reason |
312 | 312 | ||
313 | if ( mediaPlayerState->streaming() ) { | 313 | if ( mediaPlayerState->streaming() ) { |
314 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 314 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
315 | if( !slider.isHidden()) { | 315 | if( !slider.isHidden()) { |
316 | slider.hide(); | 316 | slider.hide(); |
317 | } | 317 | } |
318 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 318 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
319 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 319 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
320 | } else { | 320 | } else { |
321 | // this stops the slider from being moved, thus | 321 | // this stops the slider from being moved, thus |
322 | // does not stop stream when it reaches the end | 322 | // does not stop stream when it reaches the end |
323 | slider.show(); | 323 | slider.show(); |
324 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 324 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
325 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 325 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
326 | } | 326 | } |
327 | 327 | ||
328 | if ( view == 'a' ) { | 328 | if ( view == 'a' ) { |
329 | // startTimer( 150 ); | 329 | // startTimer( 150 ); |
330 | showMaximized(); | 330 | showMaximized(); |
331 | } else { | 331 | } else { |
332 | killTimers(); | 332 | killTimers(); |
333 | hide(); | 333 | hide(); |
334 | } | 334 | } |
335 | qApp->processEvents(); | 335 | // qApp->processEvents(); |
336 | } | 336 | } |
337 | 337 | ||
338 | 338 | ||
339 | static QString timeAsString( long length ) { | 339 | static QString timeAsString( long length ) { |
340 | int minutes = length / 60; | 340 | int minutes = length / 60; |
341 | int seconds = length % 60; | 341 | int seconds = length % 60; |
342 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 342 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
343 | } | 343 | } |
344 | 344 | ||
345 | void AudioWidget::updateSlider( long i, long max ) { | 345 | void AudioWidget::updateSlider( long i, long max ) { |
346 | 346 | ||
347 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 347 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
348 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 348 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
349 | 349 | ||
350 | if ( max == 0 ) { | 350 | if ( max == 0 ) { |
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | // Will flicker too much if we don't do this | 353 | // Will flicker too much if we don't do this |
354 | // Scale to something reasonable | 354 | // Scale to something reasonable |
355 | int width = slider.width(); | 355 | int width = slider.width(); |
356 | int val = int((double)i * width / max); | 356 | int val = int((double)i * width / max); |
357 | if ( !audioSliderBeingMoved ) { | 357 | if ( !audioSliderBeingMoved ) { |
358 | if ( slider.value() != val ) { | 358 | if ( slider.value() != val ) { |
359 | slider.setValue( val ); | 359 | slider.setValue( val ); |
360 | } | 360 | } |
361 | 361 | ||
362 | if ( slider.maxValue() != width ) { | 362 | if ( slider.maxValue() != width ) { |
363 | slider.setMaxValue( width ); | 363 | slider.setMaxValue( width ); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | void AudioWidget::setToggleButton( int i, bool down ) { | 369 | void AudioWidget::setToggleButton( int i, bool down ) { |
370 | qDebug("setToggleButton %d", i); | 370 | qDebug("setToggleButton %d", i); |
371 | if ( down != audioButtons[i].isDown ) { | 371 | if ( down != audioButtons[i].isDown ) { |
372 | toggleButton( i ); | 372 | toggleButton( i ); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | void AudioWidget::toggleButton( int i ) { | 377 | void AudioWidget::toggleButton( int i ) { |
378 | audioButtons[i].isDown = !audioButtons[i].isDown; | 378 | audioButtons[i].isDown = !audioButtons[i].isDown; |
379 | QPainter p(this); | 379 | QPainter p(this); |
380 | paintButton ( &p, i ); | 380 | paintButton ( &p, i ); |
381 | } | 381 | } |
382 | 382 | ||
383 | 383 | ||