summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 14:25:04 (UTC)
committer simon <simon>2002-12-02 14:25:04 (UTC)
commit11d12e26459315713b46dbe00a52eef0ce9e4d77 (patch) (unidiff)
tree4d761f1bb239261be545049a7a5e72a5dae011b5
parent6440dfbca27a1716456c081ff1b1756616afc518 (diff)
downloadopie-11d12e26459315713b46dbe00a52eef0ce9e4d77.zip
opie-11d12e26459315713b46dbe00a52eef0ce9e4d77.tar.gz
opie-11d12e26459315713b46dbe00a52eef0ce9e4d77.tar.bz2
- whichList() is deprecated
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index c435241..ff3f5f7 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -216,258 +216,258 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
216} 216}
217 217
218static bool videoSliderBeingMoved = FALSE; 218static bool videoSliderBeingMoved = FALSE;
219 219
220void VideoWidget::sliderPressed() { 220void VideoWidget::sliderPressed() {
221 videoSliderBeingMoved = TRUE; 221 videoSliderBeingMoved = TRUE;
222} 222}
223 223
224void VideoWidget::sliderReleased() { 224void VideoWidget::sliderReleased() {
225 videoSliderBeingMoved = FALSE; 225 videoSliderBeingMoved = FALSE;
226 if ( slider->width() == 0 ) { 226 if ( slider->width() == 0 ) {
227 return; 227 return;
228 } 228 }
229 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 229 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
230 mediaPlayerState->setPosition( val ); 230 mediaPlayerState->setPosition( val );
231} 231}
232 232
233void VideoWidget::setPosition( long i ) { 233void VideoWidget::setPosition( long i ) {
234 updateSlider( i, mediaPlayerState->length() ); 234 updateSlider( i, mediaPlayerState->length() );
235} 235}
236 236
237 237
238void VideoWidget::setLength( long max ) { 238void VideoWidget::setLength( long max ) {
239 updateSlider( mediaPlayerState->position(), max ); 239 updateSlider( mediaPlayerState->position(), max );
240} 240}
241 241
242void VideoWidget::setView( char view ) { 242void VideoWidget::setView( char view ) {
243 243
244 if ( view == 'v' ) { 244 if ( view == 'v' ) {
245 makeVisible(); 245 makeVisible();
246 } else { 246 } else {
247 // Effectively blank the view next time we show it so it looks nicer 247 // Effectively blank the view next time we show it so it looks nicer
248 scaledWidth = 0; 248 scaledWidth = 0;
249 scaledHeight = 0; 249 scaledHeight = 0;
250 hide(); 250 hide();
251 } 251 }
252} 252}
253 253
254void VideoWidget::updateSlider( long i, long max ) { 254void VideoWidget::updateSlider( long i, long max ) {
255 // Will flicker too much if we don't do this 255 // Will flicker too much if we don't do this
256 if ( max == 0 ) { 256 if ( max == 0 ) {
257 return; 257 return;
258 } 258 }
259 int width = slider->width(); 259 int width = slider->width();
260 int val = int((double)i * width / max); 260 int val = int((double)i * width / max);
261 if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { 261 if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) {
262 if ( slider->value() != val ) { 262 if ( slider->value() != val ) {
263 slider->setValue( val ); 263 slider->setValue( val );
264 } 264 }
265 if ( slider->maxValue() != width ) { 265 if ( slider->maxValue() != width ) {
266 slider->setMaxValue( width ); 266 slider->setMaxValue( width );
267 } 267 }
268 } 268 }
269} 269}
270 270
271void VideoWidget::setToggleButton( int i, bool down ) { 271void VideoWidget::setToggleButton( int i, bool down ) {
272 if ( down != videoButtons[i].isDown ) { 272 if ( down != videoButtons[i].isDown ) {
273 toggleButton( i ); 273 toggleButton( i );
274 } 274 }
275} 275}
276 276
277void VideoWidget::toggleButton( int i ) { 277void VideoWidget::toggleButton( int i ) {
278 videoButtons[i].isDown = !videoButtons[i].isDown; 278 videoButtons[i].isDown = !videoButtons[i].isDown;
279 QPainter p(this); 279 QPainter p(this);
280 paintButton ( &p, i ); 280 paintButton ( &p, i );
281} 281}
282 282
283void VideoWidget::paintButton( QPainter *p, int i ) { 283void VideoWidget::paintButton( QPainter *p, int i ) {
284 284
285 if ( videoButtons[i].isDown ) { 285 if ( videoButtons[i].isDown ) {
286 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 286 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
287 } else { 287 } else {
288 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 288 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
289 } 289 }
290} 290}
291 291
292void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 292void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
293 for ( int i = 0; i < numVButtons; i++ ) { 293 for ( int i = 0; i < numVButtons; i++ ) {
294 if ( event->state() == QMouseEvent::LeftButton ) { 294 if ( event->state() == QMouseEvent::LeftButton ) {
295 // The test to see if the mouse click is inside the button or not 295 // The test to see if the mouse click is inside the button or not
296 int x = event->pos().x() - xoff; 296 int x = event->pos().x() - xoff;
297 int y = event->pos().y() - yoff; 297 int y = event->pos().y() - yoff;
298 298
299 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 299 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
300 && y < imgButtonMask->height() 300 && y < imgButtonMask->height()
301 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 301 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
302 302
303 if ( isOnButton && !videoButtons[i].isHeld ) { 303 if ( isOnButton && !videoButtons[i].isHeld ) {
304 videoButtons[i].isHeld = TRUE; 304 videoButtons[i].isHeld = TRUE;
305 toggleButton(i); 305 toggleButton(i);
306 306
307 switch (i) { 307 switch (i) {
308 case VideoVolUp: 308 case VideoVolUp:
309 emit moreClicked(); 309 emit moreClicked();
310 return; 310 return;
311 case VideoVolDown: 311 case VideoVolDown:
312 emit lessClicked(); 312 emit lessClicked();
313 return; 313 return;
314 } 314 }
315 } else if ( !isOnButton && videoButtons[i].isHeld ) { 315 } else if ( !isOnButton && videoButtons[i].isHeld ) {
316 videoButtons[i].isHeld = FALSE; 316 videoButtons[i].isHeld = FALSE;
317 toggleButton(i); 317 toggleButton(i);
318 } 318 }
319 } else { 319 } else {
320 320
321 if ( videoButtons[i].isHeld ) { 321 if ( videoButtons[i].isHeld ) {
322 videoButtons[i].isHeld = FALSE; 322 videoButtons[i].isHeld = FALSE;
323 if ( !videoButtons[i].isToggle ) { 323 if ( !videoButtons[i].isToggle ) {
324 setToggleButton( i, FALSE ); 324 setToggleButton( i, FALSE );
325 } 325 }
326 326
327 switch(i) { 327 switch(i) {
328 328
329 case VideoPlay: { 329 case VideoPlay: {
330 if( mediaPlayerState->isPaused() ) { 330 if( mediaPlayerState->isPaused() ) {
331 setToggleButton( i, FALSE ); 331 setToggleButton( i, FALSE );
332 mediaPlayerState->setPaused( FALSE ); 332 mediaPlayerState->setPaused( FALSE );
333 return; 333 return;
334 } else if( !mediaPlayerState->isPaused() ) { 334 } else if( !mediaPlayerState->isPaused() ) {
335 setToggleButton( i, TRUE ); 335 setToggleButton( i, TRUE );
336 mediaPlayerState->setPaused( TRUE ); 336 mediaPlayerState->setPaused( TRUE );
337 return; 337 return;
338 } else { 338 } else {
339 return; 339 return;
340 } 340 }
341 } 341 }
342 342
343 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; 343 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
344 case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; 344 case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return;
345 case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; 345 case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return;
346 case VideoVolUp: emit moreReleased(); return; 346 case VideoVolUp: emit moreReleased(); return;
347 case VideoVolDown: emit lessReleased(); return; 347 case VideoVolDown: emit lessReleased(); return;
348 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 348 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
349 } 349 }
350 } 350 }
351 } 351 }
352 } 352 }
353} 353}
354 354
355void VideoWidget::mousePressEvent( QMouseEvent *event ) { 355void VideoWidget::mousePressEvent( QMouseEvent *event ) {
356 mouseMoveEvent( event ); 356 mouseMoveEvent( event );
357} 357}
358 358
359void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 359void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
360 if ( mediaPlayerState->isFullscreen() ) { 360 if ( mediaPlayerState->isFullscreen() ) {
361 mediaPlayerState->setFullscreen( FALSE ); 361 mediaPlayerState->setFullscreen( FALSE );
362 makeVisible(); 362 makeVisible();
363 } 363 }
364 mouseMoveEvent( event ); 364 mouseMoveEvent( event );
365} 365}
366 366
367void VideoWidget::showEvent( QShowEvent* ) { 367void VideoWidget::showEvent( QShowEvent* ) {
368 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 368 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
369 mouseMoveEvent( &event ); 369 mouseMoveEvent( &event );
370} 370}
371 371
372 372
373 void VideoWidget::backToNormal() { 373 void VideoWidget::backToNormal() {
374 mediaPlayerState->setFullscreen( FALSE ); 374 mediaPlayerState->setFullscreen( FALSE );
375 makeVisible(); 375 makeVisible();
376 } 376 }
377 377
378void VideoWidget::makeVisible() { 378void VideoWidget::makeVisible() {
379 if ( mediaPlayerState->isFullscreen() ) { 379 if ( mediaPlayerState->isFullscreen() ) {
380 setBackgroundMode( QWidget::NoBackground ); 380 setBackgroundMode( QWidget::NoBackground );
381 showFullScreen(); 381 showFullScreen();
382 resize( qApp->desktop()->size() ); 382 resize( qApp->desktop()->size() );
383 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 383 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
384 384
385 slider->hide(); 385 slider->hide();
386 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 386 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
387 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 387 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
388 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 388 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
389 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 389 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
390 390
391 } else { 391 } else {
392 showNormal(); 392 showNormal();
393 showMaximized(); 393 showMaximized();
394 setBackgroundPixmap( *pixBg ); 394 setBackgroundPixmap( *pixBg );
395 QWidget *d = QApplication::desktop(); 395 QWidget *d = QApplication::desktop();
396 int w = d->width(); 396 int w = d->width();
397 int h = d->height(); 397 int h = d->height();
398 398
399 if(w>h) { 399 if(w>h) {
400 int newW=(w/2)-(246/2); //this will only work with 320x240 400 int newW=(w/2)-(246/2); //this will only work with 320x240
401 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 401 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
402 } else { 402 } else {
403 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 403 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
404 } 404 }
405 405
406 if ( !mediaPlayerState->isSeekable() ) { 406 if ( !mediaPlayerState->isSeekable() ) {
407 if( !slider->isHidden()) { 407 if( !slider->isHidden()) {
408 slider->hide(); 408 slider->hide();
409 } 409 }
410 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 410 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
411 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 411 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
412 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 412 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
413 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 413 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
414 } else { 414 } else {
415 slider->show(); 415 slider->show();
416 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 416 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
417 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 417 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
418 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 418 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
419 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 419 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
420 } 420 }
421 } 421 }
422} 422}
423 423
424 424
425 425
426 426
427void VideoWidget::paintEvent( QPaintEvent * pe) { 427void VideoWidget::paintEvent( QPaintEvent * pe) {
428 QPainter p( this ); 428 QPainter p( this );
429 429
430 if ( mediaPlayerState->isFullscreen() ) { 430 if ( mediaPlayerState->isFullscreen() ) {
431 // Clear the background 431 // Clear the background
432 p.setBrush( QBrush( Qt::black ) ); 432 p.setBrush( QBrush( Qt::black ) );
433 } else { 433 } else {
434 if ( !pe->erased() ) { 434 if ( !pe->erased() ) {
435 // Combine with background and double buffer 435 // Combine with background and double buffer
436 QPixmap pix( pe->rect().size() ); 436 QPixmap pix( pe->rect().size() );
437 QPainter p( &pix ); 437 QPainter p( &pix );
438 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 438 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
439 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 439 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
440 for ( int i = 0; i < numVButtons; i++ ) { 440 for ( int i = 0; i < numVButtons; i++ ) {
441 paintButton( &p, i ); 441 paintButton( &p, i );
442 } 442 }
443 QPainter p2( this ); 443 QPainter p2( this );
444 p2.drawPixmap( pe->rect().topLeft(), pix ); 444 p2.drawPixmap( pe->rect().topLeft(), pix );
445 } else { 445 } else {
446 QPainter p( this ); 446 QPainter p( this );
447 for ( int i = 0; i < numVButtons; i++ ) 447 for ( int i = 0; i < numVButtons; i++ )
448 paintButton( &p, i ); 448 paintButton( &p, i );
449 } 449 }
450 //slider->repaint( TRUE ); 450 //slider->repaint( TRUE );
451 } 451 }
452} 452}
453 453
454 454
455void VideoWidget::closeEvent( QCloseEvent* ) { 455void VideoWidget::closeEvent( QCloseEvent* ) {
456 mediaPlayerState->setList(); 456 mediaPlayerState->setList();
457} 457}
458 458
459 459
460void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 460void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
461 switch ( e->key() ) { 461 switch ( e->key() ) {
462////////////////////////////// Zaurus keys 462////////////////////////////// Zaurus keys
463 case Key_Home: 463 case Key_Home:
464 break; 464 break;
465 case Key_F9: //activity 465 case Key_F9: //activity
466 break; 466 break;
467 case Key_F10: //contacts 467 case Key_F10: //contacts
468// hide(); 468// hide();
469 break; 469 break;
470 case Key_F11: //menu 470 case Key_F11: //menu
471 break; 471 break;
472 case Key_F12: //home 472 case Key_F12: //home
473 break; 473 break;