author | simon <simon> | 2002-12-08 22:26:34 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 22:26:34 (UTC) |
commit | 3b5f97272ded8a40da3853476371b4edc41d1a34 (patch) (unidiff) | |
tree | cc965571aa2f8ca62bf859e49acc91b440b96f1a | |
parent | 5d3f3d429bb6247741a30c00a344302a2c9a20c0 (diff) | |
download | opie-3b5f97272ded8a40da3853476371b4edc41d1a34.zip opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.gz opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.bz2 |
- share the imgButtonMask member variable in the base class
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
5 files changed, 14 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index a9d5a88..022aa82 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -104,18 +104,18 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
104 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 104 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
105 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 105 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
106 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 106 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
107 | 107 | ||
108 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 108 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
109 | imgButtonMask.fill( 0 ); | 109 | buttonMask.fill( 0 ); |
110 | 110 | ||
111 | for ( int i = 0; i < 10; i++ ) { | 111 | for ( int i = 0; i < 10; i++ ) { |
112 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); | 112 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); |
113 | masks[i] = new QBitmap( filename ); | 113 | masks[i] = new QBitmap( filename ); |
114 | 114 | ||
115 | if ( !masks[i]->isNull() ) { | 115 | if ( !masks[i]->isNull() ) { |
116 | QImage imgMask = masks[i]->convertToImage(); | 116 | QImage imgMask = masks[i]->convertToImage(); |
117 | uchar **dest = imgButtonMask.jumpTable(); | 117 | uchar **dest = buttonMask.jumpTable(); |
118 | for ( int y = 0; y < imgUp.height(); y++ ) { | 118 | for ( int y = 0; y < imgUp.height(); y++ ) { |
119 | uchar *line = dest[y]; | 119 | uchar *line = dest[y]; |
120 | for ( int x = 0; x < imgUp.width(); x++ ) | 120 | for ( int x = 0; x < imgUp.width(); x++ ) |
121 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 121 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
@@ -383,11 +383,11 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
383 | // The test to see if the mouse click is inside the button or not | 383 | // The test to see if the mouse click is inside the button or not |
384 | int x = event->pos().x() - xoff; | 384 | int x = event->pos().x() - xoff; |
385 | int y = event->pos().y() - yoff; | 385 | int y = event->pos().y() - yoff; |
386 | 386 | ||
387 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() | 387 | bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width() |
388 | && y < imgButtonMask.height() | 388 | && y < buttonMask.height() |
389 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); | 389 | && buttonMask.pixelIndex( x, y ) == i + 1 ); |
390 | 390 | ||
391 | if ( isOnButton && !buttons[i].isHeld ) { | 391 | if ( isOnButton && !buttons[i].isHeld ) { |
392 | buttons[i].isHeld = TRUE; | 392 | buttons[i].isHeld = TRUE; |
393 | toggleButton(i); | 393 | toggleButton(i); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 52a358c..da22946 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -98,9 +98,8 @@ private: | |||
98 | QString skin; | 98 | QString skin; |
99 | QPixmap pixBg; | 99 | QPixmap pixBg; |
100 | QImage imgUp; | 100 | QImage imgUp; |
101 | QImage imgDn; | 101 | QImage imgDn; |
102 | QImage imgButtonMask; | ||
103 | QBitmap *masks[10]; | 102 | QBitmap *masks[10]; |
104 | QPixmap *buttonPixUp[10]; | 103 | QPixmap *buttonPixUp[10]; |
105 | QPixmap *buttonPixDown[10]; | 104 | QPixmap *buttonPixDown[10]; |
106 | 105 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index b88d7e2..044ab6c 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -68,8 +68,10 @@ protected: | |||
68 | MediaPlayerState &mediaPlayerState; | 68 | MediaPlayerState &mediaPlayerState; |
69 | PlayListWidget &playList; | 69 | PlayListWidget &playList; |
70 | 70 | ||
71 | ButtonVector buttons; | 71 | ButtonVector buttons; |
72 | |||
73 | QImage buttonMask; | ||
72 | }; | 74 | }; |
73 | 75 | ||
74 | #endif // MEDIAWIDGET_H | 76 | #endif // MEDIAWIDGET_H |
75 | /* vim: et sw=4 ts=4 | 77 | /* vim: et sw=4 ts=4 |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7838229..459f592 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -98,18 +98,18 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
98 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 98 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
99 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 99 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
100 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 100 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
101 | 101 | ||
102 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 102 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
103 | imgButtonMask.fill( 0 ); | 103 | buttonMask.fill( 0 ); |
104 | 104 | ||
105 | for ( int i = 0; i < 7; i++ ) { | 105 | for ( int i = 0; i < 7; i++ ) { |
106 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 106 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
107 | masks[i] = new QBitmap( filename ); | 107 | masks[i] = new QBitmap( filename ); |
108 | 108 | ||
109 | if ( !masks[i]->isNull() ) { | 109 | if ( !masks[i]->isNull() ) { |
110 | QImage imgMask = masks[i]->convertToImage(); | 110 | QImage imgMask = masks[i]->convertToImage(); |
111 | uchar **dest = imgButtonMask.jumpTable(); | 111 | uchar **dest = buttonMask.jumpTable(); |
112 | for ( int y = 0; y < imgUp.height(); y++ ) { | 112 | for ( int y = 0; y < imgUp.height(); y++ ) { |
113 | uchar *line = dest[y]; | 113 | uchar *line = dest[y]; |
114 | for ( int x = 0; x < imgUp.width(); x++ ) { | 114 | for ( int x = 0; x < imgUp.width(); x++ ) { |
115 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 115 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
@@ -284,11 +284,11 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
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 < buttonMask.width() |
289 | && y < imgButtonMask.height() | 289 | && y < buttonMask.height() |
290 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); | 290 | && buttonMask.pixelIndex( x, y ) == i + 1 ); |
291 | 291 | ||
292 | if ( isOnButton && !buttons[i].isHeld ) { | 292 | if ( isOnButton && !buttons[i].isHeld ) { |
293 | buttons[i].isHeld = TRUE; | 293 | buttons[i].isHeld = TRUE; |
294 | toggleButton(i); | 294 | toggleButton(i); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index f996803..a5500d7 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -99,9 +99,8 @@ 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 | QImage imgButtonMask; | ||
104 | QBitmap *masks[7]; | 103 | QBitmap *masks[7]; |
105 | QPixmap *buttonPixUp[7]; | 104 | QPixmap *buttonPixUp[7]; |
106 | QPixmap *buttonPixDown[7]; | 105 | QPixmap *buttonPixDown[7]; |
107 | QString skin; | 106 | QString skin; |