-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 15 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
6 files changed, 14 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 12f91a9..5cc2814 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -268,205 +268,196 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
268 | // does not stop stream when it reaches the end | 268 | // does not stop stream when it reaches the end |
269 | slider.show(); | 269 | slider.show(); |
270 | qDebug( " CONNECT SET POSTION " ); | 270 | qDebug( " CONNECT SET POSTION " ); |
271 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 271 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
272 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 272 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
273 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 273 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
274 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 274 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | 278 | ||
279 | static QString timeAsString( long length ) { | 279 | static QString timeAsString( long length ) { |
280 | int minutes = length / 60; | 280 | int minutes = length / 60; |
281 | int seconds = length % 60; | 281 | int seconds = length % 60; |
282 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 282 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
283 | } | 283 | } |
284 | 284 | ||
285 | void AudioWidget::updateSlider( long i, long max ) { | 285 | void AudioWidget::updateSlider( long i, long max ) { |
286 | 286 | ||
287 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 287 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
288 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 288 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
289 | 289 | ||
290 | if ( max == 0 ) { | 290 | if ( max == 0 ) { |
291 | return; | 291 | return; |
292 | } | 292 | } |
293 | // Will flicker too much if we don't do this | 293 | // Will flicker too much if we don't do this |
294 | // Scale to something reasonable | 294 | // Scale to something reasonable |
295 | int width = slider.width(); | 295 | int width = slider.width(); |
296 | int val = int((double)i * width / max); | 296 | int val = int((double)i * width / max); |
297 | if ( !audioSliderBeingMoved ) { | 297 | if ( !audioSliderBeingMoved ) { |
298 | if ( slider.value() != val ) { | 298 | if ( slider.value() != val ) { |
299 | slider.setValue( val ); | 299 | slider.setValue( val ); |
300 | } | 300 | } |
301 | 301 | ||
302 | if ( slider.maxValue() != width ) { | 302 | if ( slider.maxValue() != width ) { |
303 | slider.setMaxValue( width ); | 303 | slider.setMaxValue( width ); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | void AudioWidget::setToggleButton( int i, bool down ) { | 309 | void AudioWidget::setToggleButton( int i, bool down ) { |
310 | qDebug("setToggleButton %d", i); | 310 | qDebug("setToggleButton %d", i); |
311 | if ( down != buttons[i].isDown ) { | 311 | if ( down != buttons[i].isDown ) { |
312 | toggleButton( i ); | 312 | toggleButton( i ); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | void AudioWidget::paintButton( QPainter &p, int i ) { | ||
317 | if ( buttons[i].isDown ) { | ||
318 | p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixDown ); | ||
319 | } else { | ||
320 | p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixUp ); | ||
321 | } | ||
322 | } | ||
323 | |||
324 | |||
325 | void AudioWidget::skipFor() { | 316 | void AudioWidget::skipFor() { |
326 | skipDirection = +1; | 317 | skipDirection = +1; |
327 | startTimer( 50 ); | 318 | startTimer( 50 ); |
328 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 319 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
329 | } | 320 | } |
330 | 321 | ||
331 | void AudioWidget::skipBack() { | 322 | void AudioWidget::skipBack() { |
332 | skipDirection = -1; | 323 | skipDirection = -1; |
333 | startTimer( 50 ); | 324 | startTimer( 50 ); |
334 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 325 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
335 | } | 326 | } |
336 | 327 | ||
337 | 328 | ||
338 | 329 | ||
339 | void AudioWidget::stopSkip() { | 330 | void AudioWidget::stopSkip() { |
340 | killTimers(); | 331 | killTimers(); |
341 | } | 332 | } |
342 | 333 | ||
343 | 334 | ||
344 | void AudioWidget::timerEvent( QTimerEvent * ) { | 335 | void AudioWidget::timerEvent( QTimerEvent * ) { |
345 | if ( skipDirection == +1 ) { | 336 | if ( skipDirection == +1 ) { |
346 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 337 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
347 | } else if ( skipDirection == -1 ) { | 338 | } else if ( skipDirection == -1 ) { |
348 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 339 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
349 | } | 340 | } |
350 | } | 341 | } |
351 | 342 | ||
352 | 343 | ||
353 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 344 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
354 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 345 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
355 | if ( event->state() == QMouseEvent::LeftButton ) { | 346 | if ( event->state() == QMouseEvent::LeftButton ) { |
356 | // The test to see if the mouse click is inside the button or not | 347 | // The test to see if the mouse click is inside the button or not |
357 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 348 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
358 | 349 | ||
359 | if ( isOnButton && !buttons[i].isHeld ) { | 350 | if ( isOnButton && !buttons[i].isHeld ) { |
360 | buttons[i].isHeld = TRUE; | 351 | buttons[i].isHeld = TRUE; |
361 | toggleButton(i); | 352 | toggleButton(i); |
362 | switch (i) { | 353 | switch (i) { |
363 | case VolumeUp: | 354 | case VolumeUp: |
364 | emit moreClicked(); | 355 | emit moreClicked(); |
365 | return; | 356 | return; |
366 | case VolumeDown: | 357 | case VolumeDown: |
367 | emit lessClicked(); | 358 | emit lessClicked(); |
368 | return; | 359 | return; |
369 | case Forward: | 360 | case Forward: |
370 | emit forwardClicked(); | 361 | emit forwardClicked(); |
371 | return; | 362 | return; |
372 | case Back: | 363 | case Back: |
373 | emit backClicked(); | 364 | emit backClicked(); |
374 | return; | 365 | return; |
375 | } | 366 | } |
376 | } else if ( !isOnButton && buttons[i].isHeld ) { | 367 | } else if ( !isOnButton && buttons[i].isHeld ) { |
377 | buttons[i].isHeld = FALSE; | 368 | buttons[i].isHeld = FALSE; |
378 | toggleButton(i); | 369 | toggleButton(i); |
379 | } | 370 | } |
380 | } else { | 371 | } else { |
381 | if ( buttons[i].isHeld ) { | 372 | if ( buttons[i].isHeld ) { |
382 | buttons[i].isHeld = FALSE; | 373 | buttons[i].isHeld = FALSE; |
383 | if ( buttons[i].type != ToggleButton ) { | 374 | if ( buttons[i].type != ToggleButton ) { |
384 | setToggleButton( i, FALSE ); | 375 | setToggleButton( i, FALSE ); |
385 | } | 376 | } |
386 | qDebug("mouseEvent %d", i); | 377 | qDebug("mouseEvent %d", i); |
387 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); | 378 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
388 | } | 379 | } |
389 | } | 380 | } |
390 | } | 381 | } |
391 | } | 382 | } |
392 | 383 | ||
393 | 384 | ||
394 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 385 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
395 | mouseMoveEvent( event ); | 386 | mouseMoveEvent( event ); |
396 | } | 387 | } |
397 | 388 | ||
398 | 389 | ||
399 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 390 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
400 | mouseMoveEvent( event ); | 391 | mouseMoveEvent( event ); |
401 | } | 392 | } |
402 | 393 | ||
403 | 394 | ||
404 | void AudioWidget::showEvent( QShowEvent* ) { | 395 | void AudioWidget::showEvent( QShowEvent* ) { |
405 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 396 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
406 | mouseMoveEvent( &event ); | 397 | mouseMoveEvent( &event ); |
407 | } | 398 | } |
408 | 399 | ||
409 | 400 | ||
410 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 401 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
411 | if ( !pe->erased() ) { | 402 | if ( !pe->erased() ) { |
412 | // Combine with background and double buffer | 403 | // Combine with background and double buffer |
413 | QPixmap pix( pe->rect().size() ); | 404 | QPixmap pix( pe->rect().size() ); |
414 | QPainter p( &pix ); | 405 | QPainter p( &pix ); |
415 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 406 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
416 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 407 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
417 | for ( unsigned int i = 0; i < buttons.count(); i++ ) | 408 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
418 | paintButton( p, i ); | 409 | paintButton( p, buttons[ i ] ); |
419 | QPainter p2( this ); | 410 | QPainter p2( this ); |
420 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 411 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
421 | } else { | 412 | } else { |
422 | QPainter p( this ); | 413 | QPainter p( this ); |
423 | for ( unsigned int i = 0; i < buttons.count(); i++ ) | 414 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
424 | paintButton( p, i ); | 415 | paintButton( p, buttons[ i ] ); |
425 | } | 416 | } |
426 | } | 417 | } |
427 | 418 | ||
428 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 419 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
429 | switch ( e->key() ) { | 420 | switch ( e->key() ) { |
430 | ////////////////////////////// Zaurus keys | 421 | ////////////////////////////// Zaurus keys |
431 | case Key_Home: | 422 | case Key_Home: |
432 | break; | 423 | break; |
433 | case Key_F9: //activity | 424 | case Key_F9: //activity |
434 | hide(); | 425 | hide(); |
435 | // qDebug("Audio F9"); | 426 | // qDebug("Audio F9"); |
436 | break; | 427 | break; |
437 | case Key_F10: //contacts | 428 | case Key_F10: //contacts |
438 | break; | 429 | break; |
439 | case Key_F11: //menu | 430 | case Key_F11: //menu |
440 | mediaPlayerState.toggleBlank(); | 431 | mediaPlayerState.toggleBlank(); |
441 | break; | 432 | break; |
442 | case Key_F12: //home | 433 | case Key_F12: //home |
443 | break; | 434 | break; |
444 | case Key_F13: //mail | 435 | case Key_F13: //mail |
445 | mediaPlayerState.toggleBlank(); | 436 | mediaPlayerState.toggleBlank(); |
446 | break; | 437 | break; |
447 | case Key_Space: { | 438 | case Key_Space: { |
448 | mediaPlayerState.togglePaused(); | 439 | mediaPlayerState.togglePaused(); |
449 | } | 440 | } |
450 | break; | 441 | break; |
451 | case Key_Down: | 442 | case Key_Down: |
452 | // toggleButton(6); | 443 | // toggleButton(6); |
453 | emit lessClicked(); | 444 | emit lessClicked(); |
454 | emit lessReleased(); | 445 | emit lessReleased(); |
455 | // toggleButton(6); | 446 | // toggleButton(6); |
456 | break; | 447 | break; |
457 | case Key_Up: | 448 | case Key_Up: |
458 | // toggleButton(5); | 449 | // toggleButton(5); |
459 | emit moreClicked(); | 450 | emit moreClicked(); |
460 | emit moreReleased(); | 451 | emit moreReleased(); |
461 | // toggleButton(5); | 452 | // toggleButton(5); |
462 | break; | 453 | break; |
463 | case Key_Right: | 454 | case Key_Right: |
464 | // toggleButton(3); | 455 | // toggleButton(3); |
465 | mediaPlayerState.setNext(); | 456 | mediaPlayerState.setNext(); |
466 | // toggleButton(3); | 457 | // toggleButton(3); |
467 | break; | 458 | break; |
468 | case Key_Left: | 459 | case Key_Left: |
469 | // toggleButton(4); | 460 | // toggleButton(4); |
470 | mediaPlayerState.setPrev(); | 461 | mediaPlayerState.setPrev(); |
471 | // toggleButton(4); | 462 | // toggleButton(4); |
472 | break; | 463 | break; |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 332fb4b..7a775cd 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -47,65 +47,64 @@ | |||
47 | 47 | ||
48 | #include "mediawidget.h" | 48 | #include "mediawidget.h" |
49 | 49 | ||
50 | class QPixmap; | 50 | class QPixmap; |
51 | 51 | ||
52 | class AudioWidget : public MediaWidget { | 52 | class AudioWidget : public MediaWidget { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
56 | ~AudioWidget(); | 56 | ~AudioWidget(); |
57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
58 | public slots: | 58 | public slots: |
59 | void updateSlider( long, long ); | 59 | void updateSlider( long, long ); |
60 | void sliderPressed( ); | 60 | void sliderPressed( ); |
61 | void sliderReleased( ); | 61 | void sliderReleased( ); |
62 | void setLooping( bool b) { setToggleButton( Loop, b ); } | 62 | void setLooping( bool b) { setToggleButton( Loop, b ); } |
63 | void setPosition( long ); | 63 | void setPosition( long ); |
64 | void setSeekable( bool ); | 64 | void setSeekable( bool ); |
65 | 65 | ||
66 | public: | 66 | public: |
67 | virtual void setLength( long ); | 67 | virtual void setLength( long ); |
68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } | 68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } |
69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
70 | 70 | ||
71 | signals: | 71 | signals: |
72 | void moreClicked(); | 72 | void moreClicked(); |
73 | void lessClicked(); | 73 | void lessClicked(); |
74 | void forwardClicked(); | 74 | void forwardClicked(); |
75 | void backClicked(); | 75 | void backClicked(); |
76 | void sliderMoved(long); | 76 | void sliderMoved(long); |
77 | 77 | ||
78 | protected: | 78 | protected: |
79 | void doBlank(); | 79 | void doBlank(); |
80 | void doUnblank(); | 80 | void doUnblank(); |
81 | void paintEvent( QPaintEvent *pe ); | 81 | void paintEvent( QPaintEvent *pe ); |
82 | void showEvent( QShowEvent *se ); | 82 | void showEvent( QShowEvent *se ); |
83 | void resizeEvent( QResizeEvent *re ); | 83 | void resizeEvent( QResizeEvent *re ); |
84 | void mouseMoveEvent( QMouseEvent *event ); | 84 | void mouseMoveEvent( QMouseEvent *event ); |
85 | void mousePressEvent( QMouseEvent *event ); | 85 | void mousePressEvent( QMouseEvent *event ); |
86 | void mouseReleaseEvent( QMouseEvent *event ); | 86 | void mouseReleaseEvent( QMouseEvent *event ); |
87 | void timerEvent( QTimerEvent *event ); | 87 | void timerEvent( QTimerEvent *event ); |
88 | void keyReleaseEvent( QKeyEvent *e); | 88 | void keyReleaseEvent( QKeyEvent *e); |
89 | private slots: | 89 | private slots: |
90 | void skipFor(); | 90 | void skipFor(); |
91 | void skipBack(); | 91 | void skipBack(); |
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | void setToggleButton( int, bool ); | 94 | void setToggleButton( int, bool ); |
95 | virtual void paintButton( QPainter &p, int i ); | ||
96 | int skipDirection; | 95 | int skipDirection; |
97 | QString skin; | 96 | QString skin; |
98 | QPixmap pixBg; | 97 | QPixmap pixBg; |
99 | QImage imgUp; | 98 | QImage imgUp; |
100 | QImage imgDn; | 99 | QImage imgDn; |
101 | 100 | ||
102 | OTicker songInfo; | 101 | OTicker songInfo; |
103 | QSlider slider; | 102 | QSlider slider; |
104 | QLineEdit time; | 103 | QLineEdit time; |
105 | bool isStreaming : 1; | 104 | bool isStreaming : 1; |
106 | bool audioSliderBeingMoved : 1; | 105 | bool audioSliderBeingMoved : 1; |
107 | }; | 106 | }; |
108 | 107 | ||
109 | 108 | ||
110 | #endif // AUDIO_WIDGET_H | 109 | #endif // AUDIO_WIDGET_H |
111 | 110 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 62266ad..f977b61 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -26,59 +26,67 @@ | |||
26 | 26 | ||
27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
29 | { | 29 | { |
30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
33 | this, SLOT( setLength( long ) ) ); | 33 | this, SLOT( setLength( long ) ) ); |
34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
35 | this, SLOT( setPlaying( bool ) ) ); | 35 | this, SLOT( setPlaying( bool ) ) ); |
36 | } | 36 | } |
37 | 37 | ||
38 | MediaWidget::~MediaWidget() | 38 | MediaWidget::~MediaWidget() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | void MediaWidget::closeEvent( QCloseEvent * ) | 42 | void MediaWidget::closeEvent( QCloseEvent * ) |
43 | { | 43 | { |
44 | mediaPlayerState.setList(); | 44 | mediaPlayerState.setList(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void MediaWidget::handleCommand( Command command, bool buttonDown ) | 47 | void MediaWidget::handleCommand( Command command, bool buttonDown ) |
48 | { | 48 | { |
49 | switch ( command ) { | 49 | switch ( command ) { |
50 | case Play: mediaPlayerState.togglePaused(); | 50 | case Play: mediaPlayerState.togglePaused(); |
51 | case Stop: mediaPlayerState.setPlaying(FALSE); return; | 51 | case Stop: mediaPlayerState.setPlaying(FALSE); return; |
52 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 52 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
53 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 53 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
54 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; | 54 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; |
55 | case VolumeUp: emit moreReleased(); return; | 55 | case VolumeUp: emit moreReleased(); return; |
56 | case VolumeDown: emit lessReleased(); return; | 56 | case VolumeDown: emit lessReleased(); return; |
57 | case PlayList: mediaPlayerState.setList(); return; | 57 | case PlayList: mediaPlayerState.setList(); return; |
58 | case Forward: emit forwardReleased(); return; | 58 | case Forward: emit forwardReleased(); return; |
59 | case Back: emit backReleased(); return; | 59 | case Back: emit backReleased(); return; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const | 63 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const |
64 | { | 64 | { |
65 | return ( position.x() > 0 && position.y() > 0 && | 65 | return ( position.x() > 0 && position.y() > 0 && |
66 | position.x() < buttonMask.width() && | 66 | position.x() < buttonMask.width() && |
67 | position.y() < buttonMask.height() && | 67 | position.y() < buttonMask.height() && |
68 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); | 68 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); |
69 | } | 69 | } |
70 | 70 | ||
71 | void MediaWidget::paintButton( int buttonId ) | 71 | void MediaWidget::paintButton( int buttonId ) |
72 | { | 72 | { |
73 | QPainter p( this ); | 73 | QPainter p( this ); |
74 | paintButton( p, buttonId ); | 74 | paintButton( p, buttons[ buttonId ] ); |
75 | } | ||
76 | |||
77 | void MediaWidget::paintButton( QPainter &p, const Button &button ) | ||
78 | { | ||
79 | if ( button.isDown ) | ||
80 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); | ||
81 | else | ||
82 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); | ||
75 | } | 83 | } |
76 | 84 | ||
77 | void MediaWidget::toggleButton( int buttonId ) | 85 | void MediaWidget::toggleButton( int buttonId ) |
78 | { | 86 | { |
79 | buttons[ buttonId ].isDown = !buttons[ buttonId ].isDown; | 87 | buttons[ buttonId ].isDown = !buttons[ buttonId ].isDown; |
80 | paintButton( buttonId ); | 88 | paintButton( buttonId ); |
81 | } | 89 | } |
82 | 90 | ||
83 | /* vim: et sw=4 ts=4 | 91 | /* vim: et sw=4 ts=4 |
84 | */ | 92 | */ |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 49bf024..163f449 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -41,65 +41,65 @@ public: | |||
41 | struct Button | 41 | struct Button |
42 | { | 42 | { |
43 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} | 43 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} |
44 | 44 | ||
45 | ButtonType type : 1; | 45 | ButtonType type : 1; |
46 | bool isHeld : 1; | 46 | bool isHeld : 1; |
47 | bool isDown : 1; | 47 | bool isDown : 1; |
48 | 48 | ||
49 | QBitmap mask; | 49 | QBitmap mask; |
50 | QPixmap pixUp; | 50 | QPixmap pixUp; |
51 | QPixmap pixDown; | 51 | QPixmap pixDown; |
52 | }; | 52 | }; |
53 | typedef std::vector<Button> ButtonVector; | 53 | typedef std::vector<Button> ButtonVector; |
54 | // when the transition is done this should be Command -> Button | 54 | // when the transition is done this should be Command -> Button |
55 | typedef QMap<int, Button> ButtonMap; | 55 | typedef QMap<int, Button> ButtonMap; |
56 | 56 | ||
57 | struct SkinButtonInfo | 57 | struct SkinButtonInfo |
58 | { | 58 | { |
59 | Command command; | 59 | Command command; |
60 | const char *fileName; | 60 | const char *fileName; |
61 | ButtonType type; | 61 | ButtonType type; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | typedef std::vector<QBitmap> MaskVector; | 64 | typedef std::vector<QBitmap> MaskVector; |
65 | typedef std::vector<QPixmap> PixmapVector; | 65 | typedef std::vector<QPixmap> PixmapVector; |
66 | 66 | ||
67 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 67 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
68 | virtual ~MediaWidget(); | 68 | virtual ~MediaWidget(); |
69 | 69 | ||
70 | public slots: | 70 | public slots: |
71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
72 | virtual void setLength( long length ) = 0; | 72 | virtual void setLength( long length ) = 0; |
73 | virtual void setPlaying( bool playing ) = 0; | 73 | virtual void setPlaying( bool playing ) = 0; |
74 | 74 | ||
75 | signals: | 75 | signals: |
76 | void moreReleased(); | 76 | void moreReleased(); |
77 | void lessReleased(); | 77 | void lessReleased(); |
78 | void forwardReleased(); | 78 | void forwardReleased(); |
79 | void backReleased(); | 79 | void backReleased(); |
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | virtual void closeEvent( QCloseEvent * ); | 82 | virtual void closeEvent( QCloseEvent * ); |
83 | 83 | ||
84 | void handleCommand( Command command, bool buttonDown ); | 84 | void handleCommand( Command command, bool buttonDown ); |
85 | 85 | ||
86 | bool isOverButton( const QPoint &position, int buttonId ) const; | 86 | bool isOverButton( const QPoint &position, int buttonId ) const; |
87 | 87 | ||
88 | void paintButton( int buttonId ); | 88 | void paintButton( int buttonId ); |
89 | virtual void paintButton( QPainter &p, int i ) = 0; | 89 | void paintButton( QPainter &p, const Button &button ); |
90 | 90 | ||
91 | void toggleButton( int buttonId ); | 91 | void toggleButton( int buttonId ); |
92 | 92 | ||
93 | MediaPlayerState &mediaPlayerState; | 93 | MediaPlayerState &mediaPlayerState; |
94 | PlayListWidget &playList; | 94 | PlayListWidget &playList; |
95 | 95 | ||
96 | ButtonMap buttons; | 96 | ButtonMap buttons; |
97 | 97 | ||
98 | QImage buttonMask; | 98 | QImage buttonMask; |
99 | 99 | ||
100 | QPoint upperLeftOfButtonMask; | 100 | QPoint upperLeftOfButtonMask; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #endif // MEDIAWIDGET_H | 103 | #endif // MEDIAWIDGET_H |
104 | /* vim: et sw=4 ts=4 | 104 | /* vim: et sw=4 ts=4 |
105 | */ | 105 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 3baa087..a483434 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -203,107 +203,96 @@ void VideoWidget::sliderReleased() { | |||
203 | mediaPlayerState.setPosition( val ); | 203 | mediaPlayerState.setPosition( val ); |
204 | } | 204 | } |
205 | 205 | ||
206 | void VideoWidget::setPosition( long i ) { | 206 | void VideoWidget::setPosition( long i ) { |
207 | updateSlider( i, mediaPlayerState.length() ); | 207 | updateSlider( i, mediaPlayerState.length() ); |
208 | } | 208 | } |
209 | 209 | ||
210 | 210 | ||
211 | void VideoWidget::setLength( long max ) { | 211 | void VideoWidget::setLength( long max ) { |
212 | updateSlider( mediaPlayerState.position(), max ); | 212 | updateSlider( mediaPlayerState.position(), max ); |
213 | } | 213 | } |
214 | 214 | ||
215 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 215 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
216 | { | 216 | { |
217 | if ( displayType == MediaPlayerState::Video ) { | 217 | if ( displayType == MediaPlayerState::Video ) { |
218 | makeVisible(); | 218 | makeVisible(); |
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | 221 | ||
222 | // Effectively blank the view next time we show it so it looks nicer | 222 | // Effectively blank the view next time we show it so it looks nicer |
223 | scaledWidth = 0; | 223 | scaledWidth = 0; |
224 | scaledHeight = 0; | 224 | scaledHeight = 0; |
225 | hide(); | 225 | hide(); |
226 | } | 226 | } |
227 | 227 | ||
228 | void VideoWidget::updateSlider( long i, long max ) { | 228 | void VideoWidget::updateSlider( long i, long max ) { |
229 | // Will flicker too much if we don't do this | 229 | // Will flicker too much if we don't do this |
230 | if ( max == 0 ) { | 230 | if ( max == 0 ) { |
231 | return; | 231 | return; |
232 | } | 232 | } |
233 | int width = slider->width(); | 233 | int width = slider->width(); |
234 | int val = int((double)i * width / max); | 234 | int val = int((double)i * width / max); |
235 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 235 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
236 | if ( slider->value() != val ) { | 236 | if ( slider->value() != val ) { |
237 | slider->setValue( val ); | 237 | slider->setValue( val ); |
238 | } | 238 | } |
239 | if ( slider->maxValue() != width ) { | 239 | if ( slider->maxValue() != width ) { |
240 | slider->setMaxValue( width ); | 240 | slider->setMaxValue( width ); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void VideoWidget::setToggleButton( int i, bool down ) { | 245 | void VideoWidget::setToggleButton( int i, bool down ) { |
246 | if ( down != buttons[i].isDown ) { | 246 | if ( down != buttons[i].isDown ) { |
247 | toggleButton( i ); | 247 | toggleButton( i ); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | void VideoWidget::paintButton( QPainter &p, int i ) { | ||
252 | |||
253 | Button &button = buttons[ i ]; | ||
254 | |||
255 | if ( button.isDown ) { | ||
256 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); | ||
257 | } else { | ||
258 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 251 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
263 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 252 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
264 | if ( event->state() == QMouseEvent::LeftButton ) { | 253 | if ( event->state() == QMouseEvent::LeftButton ) { |
265 | // The test to see if the mouse click is inside the button or not | 254 | // The test to see if the mouse click is inside the button or not |
266 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 255 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
267 | 256 | ||
268 | if ( isOnButton && !buttons[i].isHeld ) { | 257 | if ( isOnButton && !buttons[i].isHeld ) { |
269 | buttons[i].isHeld = TRUE; | 258 | buttons[i].isHeld = TRUE; |
270 | toggleButton(i); | 259 | toggleButton(i); |
271 | 260 | ||
272 | switch (i) { | 261 | switch (i) { |
273 | case VideoVolUp: | 262 | case VideoVolUp: |
274 | emit moreClicked(); | 263 | emit moreClicked(); |
275 | return; | 264 | return; |
276 | case VideoVolDown: | 265 | case VideoVolDown: |
277 | emit lessClicked(); | 266 | emit lessClicked(); |
278 | return; | 267 | return; |
279 | } | 268 | } |
280 | } else if ( !isOnButton && buttons[i].isHeld ) { | 269 | } else if ( !isOnButton && buttons[i].isHeld ) { |
281 | buttons[i].isHeld = FALSE; | 270 | buttons[i].isHeld = FALSE; |
282 | toggleButton(i); | 271 | toggleButton(i); |
283 | } | 272 | } |
284 | } else { | 273 | } else { |
285 | 274 | ||
286 | if ( buttons[i].isHeld ) { | 275 | if ( buttons[i].isHeld ) { |
287 | buttons[i].isHeld = FALSE; | 276 | buttons[i].isHeld = FALSE; |
288 | if ( buttons[i].type != ToggleButton ) { | 277 | if ( buttons[i].type != ToggleButton ) { |
289 | setToggleButton( i, FALSE ); | 278 | setToggleButton( i, FALSE ); |
290 | } | 279 | } |
291 | 280 | ||
292 | switch(i) { | 281 | switch(i) { |
293 | 282 | ||
294 | case VideoPlay: { | 283 | case VideoPlay: { |
295 | if( mediaPlayerState.isPaused() ) { | 284 | if( mediaPlayerState.isPaused() ) { |
296 | setToggleButton( i, FALSE ); | 285 | setToggleButton( i, FALSE ); |
297 | mediaPlayerState.setPaused( FALSE ); | 286 | mediaPlayerState.setPaused( FALSE ); |
298 | return; | 287 | return; |
299 | } else if( !mediaPlayerState.isPaused() ) { | 288 | } else if( !mediaPlayerState.isPaused() ) { |
300 | setToggleButton( i, TRUE ); | 289 | setToggleButton( i, TRUE ); |
301 | mediaPlayerState.setPaused( TRUE ); | 290 | mediaPlayerState.setPaused( TRUE ); |
302 | return; | 291 | return; |
303 | } else { | 292 | } else { |
304 | return; | 293 | return; |
305 | } | 294 | } |
306 | } | 295 | } |
307 | 296 | ||
308 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; | 297 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; |
309 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 298 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
@@ -358,104 +347,104 @@ void VideoWidget::makeVisible() { | |||
358 | showMaximized(); | 347 | showMaximized(); |
359 | setBackgroundPixmap( pixBg ); | 348 | setBackgroundPixmap( pixBg ); |
360 | QWidget *d = QApplication::desktop(); | 349 | QWidget *d = QApplication::desktop(); |
361 | int w = d->width(); | 350 | int w = d->width(); |
362 | int h = d->height(); | 351 | int h = d->height(); |
363 | 352 | ||
364 | if(w>h) { | 353 | if(w>h) { |
365 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 354 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
366 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 355 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
367 | } else { | 356 | } else { |
368 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 357 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
369 | } | 358 | } |
370 | 359 | ||
371 | if ( !mediaPlayerState.isSeekable() ) { | 360 | if ( !mediaPlayerState.isSeekable() ) { |
372 | if( !slider->isHidden()) { | 361 | if( !slider->isHidden()) { |
373 | slider->hide(); | 362 | slider->hide(); |
374 | } | 363 | } |
375 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 364 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
376 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 365 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
377 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 366 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
378 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 367 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
379 | } else { | 368 | } else { |
380 | slider->show(); | 369 | slider->show(); |
381 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 370 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
382 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 371 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
383 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 372 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
384 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 373 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
385 | } | 374 | } |
386 | } | 375 | } |
387 | } | 376 | } |
388 | 377 | ||
389 | 378 | ||
390 | 379 | ||
391 | 380 | ||
392 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 381 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
393 | QPainter p( this ); | 382 | QPainter p( this ); |
394 | 383 | ||
395 | if ( mediaPlayerState.isFullscreen() ) { | 384 | if ( mediaPlayerState.isFullscreen() ) { |
396 | // Clear the background | 385 | // Clear the background |
397 | p.setBrush( QBrush( Qt::black ) ); | 386 | p.setBrush( QBrush( Qt::black ) ); |
398 | } else { | 387 | } else { |
399 | if ( !pe->erased() ) { | 388 | if ( !pe->erased() ) { |
400 | // Combine with background and double buffer | 389 | // Combine with background and double buffer |
401 | QPixmap pix( pe->rect().size() ); | 390 | QPixmap pix( pe->rect().size() ); |
402 | QPainter p( &pix ); | 391 | QPainter p( &pix ); |
403 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 392 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
404 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 393 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
405 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 394 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
406 | paintButton( p, i ); | 395 | paintButton( p, buttons[ i ] ); |
407 | } | 396 | } |
408 | QPainter p2( this ); | 397 | QPainter p2( this ); |
409 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 398 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
410 | } else { | 399 | } else { |
411 | QPainter p( this ); | 400 | QPainter p( this ); |
412 | for ( unsigned int i = 0; i < buttons.count(); i++ ) | 401 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
413 | paintButton( p, i ); | 402 | paintButton( p, buttons[ i ] ); |
414 | } | 403 | } |
415 | //slider->repaint( TRUE ); | 404 | //slider->repaint( TRUE ); |
416 | } | 405 | } |
417 | } | 406 | } |
418 | 407 | ||
419 | 408 | ||
420 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 409 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
421 | switch ( e->key() ) { | 410 | switch ( e->key() ) { |
422 | ////////////////////////////// Zaurus keys | 411 | ////////////////////////////// Zaurus keys |
423 | case Key_Home: | 412 | case Key_Home: |
424 | break; | 413 | break; |
425 | case Key_F9: //activity | 414 | case Key_F9: //activity |
426 | break; | 415 | break; |
427 | case Key_F10: //contacts | 416 | case Key_F10: //contacts |
428 | // hide(); | 417 | // hide(); |
429 | break; | 418 | break; |
430 | case Key_F11: //menu | 419 | case Key_F11: //menu |
431 | break; | 420 | break; |
432 | case Key_F12: //home | 421 | case Key_F12: //home |
433 | break; | 422 | break; |
434 | case Key_F13: //mail | 423 | case Key_F13: //mail |
435 | break; | 424 | break; |
436 | case Key_Space: { | 425 | case Key_Space: { |
437 | if(mediaPlayerState.isPlaying()) { | 426 | if(mediaPlayerState.isPlaying()) { |
438 | mediaPlayerState.setPlaying(FALSE); | 427 | mediaPlayerState.setPlaying(FALSE); |
439 | } else { | 428 | } else { |
440 | mediaPlayerState.setPlaying(TRUE); | 429 | mediaPlayerState.setPlaying(TRUE); |
441 | } | 430 | } |
442 | } | 431 | } |
443 | break; | 432 | break; |
444 | case Key_Down: | 433 | case Key_Down: |
445 | // toggleButton(6); | 434 | // toggleButton(6); |
446 | emit lessClicked(); | 435 | emit lessClicked(); |
447 | emit lessReleased(); | 436 | emit lessReleased(); |
448 | // toggleButton(6); | 437 | // toggleButton(6); |
449 | break; | 438 | break; |
450 | case Key_Up: | 439 | case Key_Up: |
451 | // toggleButton(5); | 440 | // toggleButton(5); |
452 | emit moreClicked(); | 441 | emit moreClicked(); |
453 | emit moreReleased(); | 442 | emit moreReleased(); |
454 | // toggleButton(5); | 443 | // toggleButton(5); |
455 | break; | 444 | break; |
456 | case Key_Right: | 445 | case Key_Right: |
457 | mediaPlayerState.setNext(); | 446 | mediaPlayerState.setNext(); |
458 | break; | 447 | break; |
459 | case Key_Left: | 448 | case Key_Left: |
460 | mediaPlayerState.setPrev(); | 449 | mediaPlayerState.setPrev(); |
461 | break; | 450 | break; |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 937feac..a271120 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -58,63 +58,62 @@ enum VideoButtons { | |||
58 | class VideoWidget : public MediaWidget { | 58 | class VideoWidget : public MediaWidget { |
59 | Q_OBJECT | 59 | Q_OBJECT |
60 | public: | 60 | public: |
61 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 61 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
62 | ~VideoWidget(); | 62 | ~VideoWidget(); |
63 | 63 | ||
64 | 64 | ||
65 | XineVideoWidget* vidWidget(); | 65 | XineVideoWidget* vidWidget(); |
66 | public slots: | 66 | public slots: |
67 | void updateSlider( long, long ); | 67 | void updateSlider( long, long ); |
68 | void sliderPressed( ); | 68 | void sliderPressed( ); |
69 | void sliderReleased( ); | 69 | void sliderReleased( ); |
70 | void setFullscreen( bool b ); | 70 | void setFullscreen( bool b ); |
71 | void makeVisible(); | 71 | void makeVisible(); |
72 | void backToNormal(); | 72 | void backToNormal(); |
73 | void setPosition( long ); | 73 | void setPosition( long ); |
74 | 74 | ||
75 | public: | 75 | public: |
76 | virtual void setPlaying( bool b); | 76 | virtual void setPlaying( bool b); |
77 | virtual void setLength( long ); | 77 | virtual void setLength( long ); |
78 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 78 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void moreClicked(); | 81 | void moreClicked(); |
82 | void lessClicked(); | 82 | void lessClicked(); |
83 | void moreReleased(); | 83 | void moreReleased(); |
84 | void lessReleased(); | 84 | void lessReleased(); |
85 | void sliderMoved( long ); | 85 | void sliderMoved( long ); |
86 | void videoResized ( const QSize &s ); | 86 | void videoResized ( const QSize &s ); |
87 | 87 | ||
88 | protected: | 88 | protected: |
89 | 89 | ||
90 | void resizeEvent( QResizeEvent * ); | 90 | void resizeEvent( QResizeEvent * ); |
91 | void paintEvent( QPaintEvent *pe ); | 91 | void paintEvent( QPaintEvent *pe ); |
92 | void showEvent( QShowEvent *se ); | 92 | void showEvent( QShowEvent *se ); |
93 | void mouseMoveEvent( QMouseEvent *event ); | 93 | void mouseMoveEvent( QMouseEvent *event ); |
94 | void mousePressEvent( QMouseEvent *event ); | 94 | void mousePressEvent( QMouseEvent *event ); |
95 | void mouseReleaseEvent( QMouseEvent *event ); | 95 | void mouseReleaseEvent( QMouseEvent *event ); |
96 | void keyReleaseEvent( QKeyEvent *e); | 96 | void keyReleaseEvent( QKeyEvent *e); |
97 | 97 | ||
98 | private: | 98 | private: |
99 | // Ticker songInfo; | 99 | // Ticker songInfo; |
100 | QPixmap pixBg; | 100 | QPixmap pixBg; |
101 | QImage imgUp; | 101 | QImage imgUp; |
102 | QImage imgDn; | 102 | QImage imgDn; |
103 | QString skin; | 103 | QString skin; |
104 | 104 | ||
105 | 105 | ||
106 | virtual void paintButton( QPainter &p, int i ); | ||
107 | void setToggleButton( int, bool ); | 106 | void setToggleButton( int, bool ); |
108 | 107 | ||
109 | QString backgroundPix; | 108 | QString backgroundPix; |
110 | QSlider *slider; | 109 | QSlider *slider; |
111 | QImage *currentFrame; | 110 | QImage *currentFrame; |
112 | int scaledWidth; | 111 | int scaledWidth; |
113 | int scaledHeight; | 112 | int scaledHeight; |
114 | XineVideoWidget* videoFrame; | 113 | XineVideoWidget* videoFrame; |
115 | }; | 114 | }; |
116 | 115 | ||
117 | #endif // VIDEO_WIDGET_H | 116 | #endif // VIDEO_WIDGET_H |
118 | 117 | ||
119 | 118 | ||
120 | 119 | ||