summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
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
@@ -308,25 +308,16 @@ void AudioWidget::updateSlider( long i, long max ) {
308 308
309void AudioWidget::setToggleButton( int i, bool down ) { 309void 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
316void 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
325void AudioWidget::skipFor() { 316void 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
331void AudioWidget::skipBack() { 322void AudioWidget::skipBack() {
332 skipDirection = -1; 323 skipDirection = -1;
@@ -410,23 +401,23 @@ void AudioWidget::showEvent( QShowEvent* ) {
410void AudioWidget::paintEvent( QPaintEvent * pe ) { 401void 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
428void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 419void 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;
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
@@ -87,17 +87,16 @@ protected:
87 void timerEvent( QTimerEvent *event ); 87 void timerEvent( QTimerEvent *event );
88 void keyReleaseEvent( QKeyEvent *e); 88 void keyReleaseEvent( QKeyEvent *e);
89private slots: 89private slots:
90 void skipFor(); 90 void skipFor();
91 void skipBack(); 91 void skipBack();
92 void stopSkip(); 92 void stopSkip();
93private: 93private:
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;
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
@@ -66,17 +66,25 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
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
71void MediaWidget::paintButton( int buttonId ) 71void 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
77void 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
77void MediaWidget::toggleButton( int buttonId ) 85void 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
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
@@ -81,17 +81,17 @@ signals:
81protected: 81protected:
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
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
@@ -243,27 +243,16 @@ void VideoWidget::updateSlider( long i, long max ) {
243} 243}
244 244
245void VideoWidget::setToggleButton( int i, bool down ) { 245void 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
251void 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
262void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 251void 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;
@@ -398,24 +387,24 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
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
420void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 409void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
421 switch ( e->key() ) { 410 switch ( e->key() ) {
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
@@ -98,17 +98,16 @@ protected:
98private: 98private:
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;