Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 6e2e03e..7838229 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -73,20 +73,20 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
73 | Button defaultButton; | 73 | Button defaultButton; |
74 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | 74 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; |
75 | Button toggleButton; | 75 | Button toggleButton; |
76 | toggleButton.isToggle = true; | 76 | toggleButton.isToggle = true; |
77 | toggleButton.isHeld = toggleButton.isDown = false; | 77 | toggleButton.isHeld = toggleButton.isDown = false; |
78 | 78 | ||
79 | videoButtons.reserve( 7 ); | 79 | buttons.reserve( 7 ); |
80 | videoButtons.push_back( defaultButton ); // stop | 80 | buttons.push_back( defaultButton ); // stop |
81 | videoButtons.push_back( toggleButton ); // play | 81 | buttons.push_back( toggleButton ); // play |
82 | videoButtons.push_back( defaultButton ); // previous | 82 | buttons.push_back( defaultButton ); // previous |
83 | videoButtons.push_back( defaultButton ); // next | 83 | buttons.push_back( defaultButton ); // next |
84 | videoButtons.push_back( defaultButton ); // volUp | 84 | buttons.push_back( defaultButton ); // volUp |
85 | videoButtons.push_back( defaultButton ); // volDown | 85 | buttons.push_back( defaultButton ); // volDown |
86 | videoButtons.push_back( toggleButton ); //fullscreen | 86 | buttons.push_back( toggleButton ); //fullscreen |
87 | 87 | ||
88 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 88 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
89 | 89 | ||
90 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 90 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
91 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 91 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
92 | 92 | ||
@@ -255,64 +255,64 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
255 | slider->setMaxValue( width ); | 255 | slider->setMaxValue( width ); |
256 | } | 256 | } |
257 | } | 257 | } |
258 | } | 258 | } |
259 | 259 | ||
260 | void VideoWidget::setToggleButton( int i, bool down ) { | 260 | void VideoWidget::setToggleButton( int i, bool down ) { |
261 | if ( down != videoButtons[i].isDown ) { | 261 | if ( down != buttons[i].isDown ) { |
262 | toggleButton( i ); | 262 | toggleButton( i ); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | void VideoWidget::toggleButton( int i ) { | 266 | void VideoWidget::toggleButton( int i ) { |
267 | videoButtons[i].isDown = !videoButtons[i].isDown; | 267 | buttons[i].isDown = !buttons[i].isDown; |
268 | QPainter p(this); | 268 | QPainter p(this); |
269 | paintButton ( &p, i ); | 269 | paintButton ( &p, i ); |
270 | } | 270 | } |
271 | 271 | ||
272 | void VideoWidget::paintButton( QPainter *p, int i ) { | 272 | void VideoWidget::paintButton( QPainter *p, int i ) { |
273 | 273 | ||
274 | if ( videoButtons[i].isDown ) { | 274 | if ( buttons[i].isDown ) { |
275 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 275 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
276 | } else { | 276 | } else { |
277 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 277 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 281 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
282 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { | 282 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
283 | if ( event->state() == QMouseEvent::LeftButton ) { | 283 | if ( event->state() == QMouseEvent::LeftButton ) { |
284 | // The test to see if the mouse click is inside the button or not | 284 | // The test to see if the mouse click is inside the button or not |
285 | int x = event->pos().x() - xoff; | 285 | int x = event->pos().x() - xoff; |
286 | int y = event->pos().y() - yoff; | 286 | int y = event->pos().y() - yoff; |
287 | 287 | ||
288 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() | 288 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() |
289 | && y < imgButtonMask.height() | 289 | && y < imgButtonMask.height() |
290 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); | 290 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); |
291 | 291 | ||
292 | if ( isOnButton && !videoButtons[i].isHeld ) { | 292 | if ( isOnButton && !buttons[i].isHeld ) { |
293 | videoButtons[i].isHeld = TRUE; | 293 | buttons[i].isHeld = TRUE; |
294 | toggleButton(i); | 294 | toggleButton(i); |
295 | 295 | ||
296 | switch (i) { | 296 | switch (i) { |
297 | case VideoVolUp: | 297 | case VideoVolUp: |
298 | emit moreClicked(); | 298 | emit moreClicked(); |
299 | return; | 299 | return; |
300 | case VideoVolDown: | 300 | case VideoVolDown: |
301 | emit lessClicked(); | 301 | emit lessClicked(); |
302 | return; | 302 | return; |
303 | } | 303 | } |
304 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 304 | } else if ( !isOnButton && buttons[i].isHeld ) { |
305 | videoButtons[i].isHeld = FALSE; | 305 | buttons[i].isHeld = FALSE; |
306 | toggleButton(i); | 306 | toggleButton(i); |
307 | } | 307 | } |
308 | } else { | 308 | } else { |
309 | 309 | ||
310 | if ( videoButtons[i].isHeld ) { | 310 | if ( buttons[i].isHeld ) { |
311 | videoButtons[i].isHeld = FALSE; | 311 | buttons[i].isHeld = FALSE; |
312 | if ( !videoButtons[i].isToggle ) { | 312 | if ( !buttons[i].isToggle ) { |
313 | setToggleButton( i, FALSE ); | 313 | setToggleButton( i, FALSE ); |
314 | } | 314 | } |
315 | 315 | ||
316 | switch(i) { | 316 | switch(i) { |
317 | 317 | ||
318 | case VideoPlay: { | 318 | case VideoPlay: { |
@@ -423,20 +423,20 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
423 | if ( !pe->erased() ) { | 423 | if ( !pe->erased() ) { |
424 | // Combine with background and double buffer | 424 | // Combine with background and double buffer |
425 | QPixmap pix( pe->rect().size() ); | 425 | QPixmap pix( pe->rect().size() ); |
426 | QPainter p( &pix ); | 426 | QPainter p( &pix ); |
427 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 427 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
428 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 428 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
429 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { | 429 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
430 | paintButton( &p, i ); | 430 | paintButton( &p, i ); |
431 | } | 431 | } |
432 | QPainter p2( this ); | 432 | QPainter p2( this ); |
433 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 433 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
434 | } else { | 434 | } else { |
435 | QPainter p( this ); | 435 | QPainter p( this ); |
436 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) | 436 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
437 | paintButton( &p, i ); | 437 | paintButton( &p, i ); |
438 | } | 438 | } |
439 | //slider->repaint( TRUE ); | 439 | //slider->repaint( TRUE ); |
440 | } | 440 | } |
441 | } | 441 | } |
442 | 442 | ||