author | simon <simon> | 2002-12-09 15:04:10 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 15:04:10 (UTC) |
commit | dcc1922ecb8c6816e4ae9ba7973f8653e482b2aa (patch) (unidiff) | |
tree | 5ff73aaf1ac1c59cde2e9ddafe8cebcddb162158 /noncore | |
parent | d3451a94e3a4425f9f1b1dcc3999259270780631 (diff) | |
download | opie-dcc1922ecb8c6816e4ae9ba7973f8653e482b2aa.zip opie-dcc1922ecb8c6816e4ae9ba7973f8653e482b2aa.tar.gz opie-dcc1922ecb8c6816e4ae9ba7973f8653e482b2aa.tar.bz2 |
- getting rid of the buttonPixUp/Down arrays, reuse the Button structure
instead
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 32 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
2 files changed, 12 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 089ef6a..3baa087 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -118,11 +118,6 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | for ( int i = 0; i < 7; i++ ) { | ||
122 | buttonPixUp[i] = NULL; | ||
123 | buttonPixDown[i] = NULL; | ||
124 | } | ||
125 | |||
126 | setBackgroundPixmap( pixBg ); | 121 | setBackgroundPixmap( pixBg ); |
127 | 122 | ||
128 | slider = new QSlider( Qt::Horizontal, this ); | 123 | slider = new QSlider( Qt::Horizontal, this ); |
@@ -140,11 +135,8 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
140 | } | 135 | } |
141 | 136 | ||
142 | 137 | ||
143 | VideoWidget::~VideoWidget() { | 138 | VideoWidget::~VideoWidget() |
144 | for ( int i = 0; i < 7; i++ ) { | 139 | { |
145 | delete buttonPixUp[i]; | ||
146 | delete buttonPixDown[i]; | ||
147 | } | ||
148 | } | 140 | } |
149 | 141 | ||
150 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 142 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
@@ -155,9 +147,9 @@ QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | |||
155 | return new QPixmap( pix ); | 147 | return new QPixmap( pix ); |
156 | } | 148 | } |
157 | 149 | ||
158 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 150 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { |
159 | QPixmap *pixmap = new QPixmap( pix ); | 151 | QPixmap pixmap( pix ); |
160 | pixmap->setMask( mask ); | 152 | pixmap.setMask( mask ); |
161 | return pixmap; | 153 | return pixmap; |
162 | } | 154 | } |
163 | 155 | ||
@@ -187,10 +179,8 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { | |||
187 | Button &button = buttons[ i ]; | 179 | Button &button = buttons[ i ]; |
188 | 180 | ||
189 | if ( !button.mask.isNull() ) { | 181 | if ( !button.mask.isNull() ) { |
190 | delete buttonPixUp[i]; | 182 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); |
191 | delete buttonPixDown[i]; | 183 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); |
192 | buttonPixUp[i] = maskVPixToMask( *pixUp, button.mask ); | ||
193 | buttonPixDown[i] = maskVPixToMask( *pixDn, button.mask ); | ||
194 | } | 184 | } |
195 | } | 185 | } |
196 | 186 | ||
@@ -260,10 +250,12 @@ void VideoWidget::setToggleButton( int i, bool down ) { | |||
260 | 250 | ||
261 | void VideoWidget::paintButton( QPainter &p, int i ) { | 251 | void VideoWidget::paintButton( QPainter &p, int i ) { |
262 | 252 | ||
263 | if ( buttons[i].isDown ) { | 253 | Button &button = buttons[ i ]; |
264 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); | 254 | |
255 | if ( button.isDown ) { | ||
256 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); | ||
265 | } else { | 257 | } else { |
266 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); | 258 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); |
267 | } | 259 | } |
268 | } | 260 | } |
269 | 261 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index fd301f9..aeb6429 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -100,8 +100,6 @@ private: | |||
100 | QPixmap pixBg; | 100 | QPixmap pixBg; |
101 | QImage imgUp; | 101 | QImage imgUp; |
102 | QImage imgDn; | 102 | QImage imgDn; |
103 | QPixmap *buttonPixUp[7]; | ||
104 | QPixmap *buttonPixDown[7]; | ||
105 | QString skin; | 103 | QString skin; |
106 | 104 | ||
107 | 105 | ||