summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/videowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 380c703..7d85d63 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -65,32 +65,31 @@ const char * const skinV_mask_file_names[7] = {
65 65
66} 66}
67 67
68VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 68VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
69 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) 69 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
70{ 70{
71 setCaption( tr("OpiePlayer - Video") ); 71 setCaption( tr("OpiePlayer - Video") );
72 72
73 Button defaultButton; 73 Button defaultButton;
74 Button toggleButton = defaultButton; 74 Button toggleButton = defaultButton;
75 toggleButton.type = ToggleButton; 75 toggleButton.type = ToggleButton;
76 76
77 buttons.reserve( 7 ); 77 buttons.insert( 0, toggleButton ); // play
78 buttons.push_back( toggleButton ); // play 78 buttons.insert( 1, toggleButton ); // stop
79 buttons.push_back( defaultButton ); // stop 79 buttons.insert( 2, toggleButton ); // next
80 buttons.push_back( defaultButton ); // next 80 buttons.insert( 3, toggleButton ); // previous
81 buttons.push_back( defaultButton ); // previous 81 buttons.insert( 4, toggleButton ); // volUp
82 buttons.push_back( defaultButton ); // volUp 82 buttons.insert( 5, toggleButton ); // volDown
83 buttons.push_back( defaultButton ); // volDown 83 buttons.insert( 6, toggleButton ); // fullscreen
84 buttons.push_back( toggleButton ); //fullscreen
85 84
86 videoFrame = new XineVideoWidget ( this, "Video frame" ); 85 videoFrame = new XineVideoWidget ( this, "Video frame" );
87 86
88 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 87 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
89 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 88 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
90 89
91 Config cfg("OpiePlayer"); 90 Config cfg("OpiePlayer");
92 cfg.setGroup("Options"); 91 cfg.setGroup("Options");
93 skin = cfg.readEntry("Skin","default"); 92 skin = cfg.readEntry("Skin","default");
94 93
95 QString skinPath = "opieplayer2/skins/" + skin; 94 QString skinPath = "opieplayer2/skins/" + skin;
96 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 95 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
@@ -262,25 +261,25 @@ void VideoWidget::setToggleButton( int i, bool down ) {
262} 261}
263 262
264void VideoWidget::paintButton( QPainter &p, int i ) { 263void VideoWidget::paintButton( QPainter &p, int i ) {
265 264
266 if ( buttons[i].isDown ) { 265 if ( buttons[i].isDown ) {
267 p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); 266 p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
268 } else { 267 } else {
269 p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); 268 p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
270 } 269 }
271} 270}
272 271
273void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 272void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
274 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 273 for ( unsigned int i = 0; i < buttons.count(); i++ ) {
275 if ( event->state() == QMouseEvent::LeftButton ) { 274 if ( event->state() == QMouseEvent::LeftButton ) {
276 // The test to see if the mouse click is inside the button or not 275 // The test to see if the mouse click is inside the button or not
277 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); 276 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
278 277
279 if ( isOnButton && !buttons[i].isHeld ) { 278 if ( isOnButton && !buttons[i].isHeld ) {
280 buttons[i].isHeld = TRUE; 279 buttons[i].isHeld = TRUE;
281 toggleButton(i); 280 toggleButton(i);
282 281
283 switch (i) { 282 switch (i) {
284 case VideoVolUp: 283 case VideoVolUp:
285 emit moreClicked(); 284 emit moreClicked();
286 return; 285 return;
@@ -404,32 +403,32 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
404 QPainter p( this ); 403 QPainter p( this );
405 404
406 if ( mediaPlayerState.isFullscreen() ) { 405 if ( mediaPlayerState.isFullscreen() ) {
407 // Clear the background 406 // Clear the background
408 p.setBrush( QBrush( Qt::black ) ); 407 p.setBrush( QBrush( Qt::black ) );
409 } else { 408 } else {
410 if ( !pe->erased() ) { 409 if ( !pe->erased() ) {
411 // Combine with background and double buffer 410 // Combine with background and double buffer
412 QPixmap pix( pe->rect().size() ); 411 QPixmap pix( pe->rect().size() );
413 QPainter p( &pix ); 412 QPainter p( &pix );
414 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 413 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
415 p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); 414 p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() );
416 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 415 for ( unsigned int i = 0; i < buttons.count(); i++ ) {
417 paintButton( p, i ); 416 paintButton( p, i );
418 } 417 }
419 QPainter p2( this ); 418 QPainter p2( this );
420 p2.drawPixmap( pe->rect().topLeft(), pix ); 419 p2.drawPixmap( pe->rect().topLeft(), pix );
421 } else { 420 } else {
422 QPainter p( this ); 421 QPainter p( this );
423 for ( unsigned int i = 0; i < buttons.size(); i++ ) 422 for ( unsigned int i = 0; i < buttons.count(); i++ )
424 paintButton( p, i ); 423 paintButton( p, i );
425 } 424 }
426 //slider->repaint( TRUE ); 425 //slider->repaint( TRUE );
427 } 426 }
428} 427}
429 428
430 429
431void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 430void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
432 switch ( e->key() ) { 431 switch ( e->key() ) {
433////////////////////////////// Zaurus keys 432////////////////////////////// Zaurus keys
434 case Key_Home: 433 case Key_Home:
435 break; 434 break;