author | simon <simon> | 2002-12-09 15:10:48 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 15:10:48 (UTC) |
commit | 80902b6ade54252e05cf948040a11b2e975f6759 (patch) (unidiff) | |
tree | d251490e8e1e83af1cd8522736cc02a772463f0f /noncore/multimedia/opieplayer2/videowidget.cpp | |
parent | e487238141c57df63252e41a47b409cbb1f9ae83 (diff) | |
download | opie-80902b6ade54252e05cf948040a11b2e975f6759.zip opie-80902b6ade54252e05cf948040a11b2e975f6759.tar.gz opie-80902b6ade54252e05cf948040a11b2e975f6759.tar.bz2 |
- paintButton is no more a duplicated method but centralized in the
base class now :)
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
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 | |||
@@ -239,35 +239,24 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
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: |
@@ -394,32 +383,32 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
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 |