-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index b82171e..1fae689 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -248,86 +248,86 @@ void AudioWidget::sliderReleased() { | |||
248 | return; | 248 | return; |
249 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 249 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
250 | mediaPlayerState->setPosition( val ); | 250 | mediaPlayerState->setPosition( val ); |
251 | } | 251 | } |
252 | 252 | ||
253 | void AudioWidget::setPosition( long i ) { | 253 | void AudioWidget::setPosition( long i ) { |
254 | // qDebug("set position %d",i); | 254 | // qDebug("set position %d",i); |
255 | updateSlider( i, mediaPlayerState->length() ); | 255 | updateSlider( i, mediaPlayerState->length() ); |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | void AudioWidget::setLength( long max ) { | 259 | void AudioWidget::setLength( long max ) { |
260 | updateSlider( mediaPlayerState->position(), max ); | 260 | updateSlider( mediaPlayerState->position(), max ); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void AudioWidget::setView( char view ) { | 264 | void AudioWidget::setView( char view ) { |
265 | if (mediaPlayerState->streaming() ) { | 265 | if (mediaPlayerState->streaming() ) { |
266 | if( !slider.isHidden()) slider.hide(); | 266 | if( !slider.isHidden()) slider.hide(); |
267 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 267 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
268 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 268 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
269 | } else { | 269 | } else { |
270 | // this stops the slider from being moved, thus | 270 | // this stops the slider from being moved, thus |
271 | // does not stop stream when it reaches the end | 271 | // does not stop stream when it reaches the end |
272 | slider->show(); | 272 | slider.show(); |
273 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 273 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
274 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 274 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
275 | } | 275 | } |
276 | 276 | ||
277 | if ( view == 'a' ) { | 277 | if ( view == 'a' ) { |
278 | startTimer( 150 ); | 278 | startTimer( 150 ); |
279 | showMaximized(); | 279 | showMaximized(); |
280 | } else { | 280 | } else { |
281 | killTimers(); | 281 | killTimers(); |
282 | hide(); | 282 | hide(); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | 286 | ||
287 | static QString timeAsString( long length ) { | 287 | static QString timeAsString( long length ) { |
288 | length /= 44100; | 288 | length /= 44100; |
289 | int minutes = length / 60; | 289 | int minutes = length / 60; |
290 | int seconds = length % 60; | 290 | int seconds = length % 60; |
291 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 291 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
292 | } | 292 | } |
293 | 293 | ||
294 | void AudioWidget::updateSlider( long i, long max ) { | 294 | void AudioWidget::updateSlider( long i, long max ) { |
295 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 295 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
296 | if ( max == 0 ) { | 296 | if ( max == 0 ) { |
297 | return; | 297 | return; |
298 | } | 298 | } |
299 | // Will flicker too much if we don't do this | 299 | // Will flicker too much if we don't do this |
300 | // Scale to something reasonable | 300 | // Scale to something reasonable |
301 | int width = slider->width(); | 301 | int width = slider.width(); |
302 | int val = int((double)i * width / max); | 302 | int val = int((double)i * width / max); |
303 | if ( !audioSliderBeingMoved ) { | 303 | if ( !audioSliderBeingMoved ) { |
304 | if ( slider->value() != val ) { | 304 | if ( slider.value() != val ) { |
305 | slider->setValue( val ); | 305 | slider.setValue( val ); |
306 | } | 306 | } |
307 | 307 | ||
308 | if ( slider->maxValue() != width ) { | 308 | if ( slider.maxValue() != width ) { |
309 | slider->setMaxValue( width ); | 309 | slider.setMaxValue( width ); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | 314 | ||
315 | void AudioWidget::setToggleButton( int i, bool down ) { | 315 | void AudioWidget::setToggleButton( int i, bool down ) { |
316 | if ( down != audioButtons[i].isDown ) { | 316 | if ( down != audioButtons[i].isDown ) { |
317 | toggleButton( i ); | 317 | toggleButton( i ); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | void AudioWidget::toggleButton( int i ) { | 322 | void AudioWidget::toggleButton( int i ) { |
323 | audioButtons[i].isDown = !audioButtons[i].isDown; | 323 | audioButtons[i].isDown = !audioButtons[i].isDown; |
324 | QPainter p(this); | 324 | QPainter p(this); |
325 | paintButton ( &p, i ); | 325 | paintButton ( &p, i ); |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
329 | void AudioWidget::paintButton( QPainter *p, int i ) { | 329 | void AudioWidget::paintButton( QPainter *p, int i ) { |
330 | if ( audioButtons[i].isDown ) | 330 | if ( audioButtons[i].isDown ) |
331 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 331 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
332 | else | 332 | else |
333 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 333 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |