summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 6b656ee..dc90a62 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -280,67 +280,68 @@ void AudioWidget::sliderPressed() {
280 audioSliderBeingMoved = TRUE; 280 audioSliderBeingMoved = TRUE;
281} 281}
282 282
283 283
284void AudioWidget::sliderReleased() { 284void AudioWidget::sliderReleased() {
285 audioSliderBeingMoved = FALSE; 285 audioSliderBeingMoved = FALSE;
286 if ( slider.width() == 0 ) 286 if ( slider.width() == 0 )
287 return; 287 return;
288 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 288 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
289 mediaPlayerState->setPosition( val ); 289 mediaPlayerState->setPosition( val );
290} 290}
291 291
292void AudioWidget::setPosition( long i ) { 292void AudioWidget::setPosition( long i ) {
293// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 293// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
294 updateSlider( i, mediaPlayerState->length() ); 294 updateSlider( i, mediaPlayerState->length() );
295} 295}
296 296
297 297
298void AudioWidget::setLength( long max ) { 298void AudioWidget::setLength( long max ) {
299 updateSlider( mediaPlayerState->position(), max ); 299 updateSlider( mediaPlayerState->position(), max );
300} 300}
301 301
302 302
303void AudioWidget::setView( char view ) { 303void AudioWidget::setView( char view ) {
304 slider.show();
305 304
306// this isnt working for some reason 305// this isnt working for some reason
307 306
308// if ( mediaPlayerState->streaming() ) { 307 if ( mediaPlayerState->streaming() ) {
309// qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 308 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
310// if( !slider.isHidden()) slider.hide(); 309 if( !slider.isHidden()) {
311// disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 310 slider.hide();
312// disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 311 }
313// } else { 312 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
313 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
314 } else {
314 // this stops the slider from being moved, thus 315 // this stops the slider from being moved, thus
315 // does not stop stream when it reaches the end 316 // does not stop stream when it reaches the end
316 // slider.show(); 317 slider.show();
317 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 318 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
318 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 319 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
319// } 320 }
320 321
321 if ( view == 'a' ) { 322 if ( view == 'a' ) {
322 startTimer( 150 ); 323 // startTimer( 150 );
323 showMaximized(); 324 showMaximized();
324 } else { 325 } else {
325 killTimers(); 326 killTimers();
326 hide(); 327 hide();
327 } 328 }
328} 329}
329 330
330 331
331static QString timeAsString( long length ) { 332static QString timeAsString( long length ) {
332 int minutes = length / 60; 333 int minutes = length / 60;
333 int seconds = length % 60; 334 int seconds = length % 60;
334 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 335 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
335} 336}
336 337
337void AudioWidget::updateSlider( long i, long max ) { 338void AudioWidget::updateSlider( long i, long max ) {
338 339
339 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 340 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
340// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 341// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
341 342
342 if ( max == 0 ) { 343 if ( max == 0 ) {
343 return; 344 return;
344 } 345 }
345 // Will flicker too much if we don't do this 346 // Will flicker too much if we don't do this
346 // Scale to something reasonable 347 // Scale to something reasonable