author | llornkcor <llornkcor> | 2002-08-11 02:22:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-11 02:22:34 (UTC) |
commit | c20e4302b915bcba07b468874e9795d37d2eaa03 (patch) (unidiff) | |
tree | 3db1dcad48072a4b39499b47d2ca17d6c16e5259 | |
parent | 534dcf3168c64c4d0ab5b0d04697a5f73ce4594c (diff) | |
download | opie-c20e4302b915bcba07b468874e9795d37d2eaa03.zip opie-c20e4302b915bcba07b468874e9795d37d2eaa03.tar.gz opie-c20e4302b915bcba07b468874e9795d37d2eaa03.tar.bz2 |
fix background image on video
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 419c3ae..a4e6b6e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -99,341 +99,344 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
99 | imgButtonMask->fill( 0 ); | 99 | imgButtonMask->fill( 0 ); |
100 | 100 | ||
101 | for ( int i = 0; i < 7; i++ ) { | 101 | for ( int i = 0; i < 7; i++ ) { |
102 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; | 102 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; |
103 | masks[i] = new QBitmap( filename ); | 103 | masks[i] = new QBitmap( filename ); |
104 | qDebug(filename); | 104 | qDebug(filename); |
105 | if ( !masks[i]->isNull() ) { | 105 | if ( !masks[i]->isNull() ) { |
106 | QImage imgMask = masks[i]->convertToImage(); | 106 | QImage imgMask = masks[i]->convertToImage(); |
107 | uchar **dest = imgButtonMask->jumpTable(); | 107 | uchar **dest = imgButtonMask->jumpTable(); |
108 | for ( int y = 0; y < imgUp->height(); y++ ) { | 108 | for ( int y = 0; y < imgUp->height(); y++ ) { |
109 | uchar *line = dest[y]; | 109 | uchar *line = dest[y]; |
110 | for ( int x = 0; x < imgUp->width(); x++ ) { | 110 | for ( int x = 0; x < imgUp->width(); x++ ) { |
111 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 111 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
112 | line[x] = i + 1; | 112 | line[x] = i + 1; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | for ( int i = 0; i < 7; i++ ) { | 119 | for ( int i = 0; i < 7; i++ ) { |
120 | buttonPixUp[i] = NULL; | 120 | buttonPixUp[i] = NULL; |
121 | buttonPixDown[i] = NULL; | 121 | buttonPixDown[i] = NULL; |
122 | } | 122 | } |
123 | 123 | ||
124 | setBackgroundPixmap( *pixBg ); | 124 | setBackgroundPixmap( *pixBg ); |
125 | 125 | ||
126 | slider = new QSlider( Qt::Horizontal, this ); | 126 | slider = new QSlider( Qt::Horizontal, this ); |
127 | slider->setMinValue( 0 ); | 127 | slider->setMinValue( 0 ); |
128 | slider->setMaxValue( 1 ); | 128 | slider->setMaxValue( 1 ); |
129 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 129 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
130 | slider->setFocusPolicy( QWidget::NoFocus ); | 130 | slider->setFocusPolicy( QWidget::NoFocus ); |
131 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 131 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
132 | 132 | ||
133 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 133 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
134 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 134 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
135 | 135 | ||
136 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 136 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
137 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 137 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
138 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 138 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
139 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 139 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
140 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 140 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
141 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 141 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
142 | 142 | ||
143 | setLength( mediaPlayerState->length() ); | 143 | setLength( mediaPlayerState->length() ); |
144 | setPosition( mediaPlayerState->position() ); | 144 | setPosition( mediaPlayerState->position() ); |
145 | 145 | ||
146 | ////////////////////////// FIXME | 146 | ////////////////////////// FIXME |
147 | // setFullscreen( mediaPlayerState->fullscreen() ); | 147 | // setFullscreen( mediaPlayerState->fullscreen() ); |
148 | setPaused( mediaPlayerState->paused() ); | 148 | setPaused( mediaPlayerState->paused() ); |
149 | setPlaying( mediaPlayerState->playing() ); | 149 | setPlaying( mediaPlayerState->playing() ); |
150 | qDebug("finished videowidget"); | 150 | qDebug("finished videowidget"); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | VideoWidget::~VideoWidget() { | 154 | VideoWidget::~VideoWidget() { |
155 | for ( int i = 0; i < 7; i++ ) { | 155 | for ( int i = 0; i < 7; i++ ) { |
156 | delete buttonPixUp[i]; | 156 | delete buttonPixUp[i]; |
157 | delete buttonPixDown[i]; | 157 | delete buttonPixDown[i]; |
158 | } | 158 | } |
159 | 159 | ||
160 | delete pixBg; | 160 | delete pixBg; |
161 | delete imgUp; | 161 | delete imgUp; |
162 | delete imgDn; | 162 | delete imgDn; |
163 | delete imgButtonMask; | 163 | delete imgButtonMask; |
164 | for ( int i = 0; i < 7; i++ ) { | 164 | for ( int i = 0; i < 7; i++ ) { |
165 | delete masks[i]; | 165 | delete masks[i]; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
170 | QPixmap pix( img.width(), img.height() ); | 170 | QPixmap pix( img.width(), img.height() ); |
171 | QPainter p( &pix ); | 171 | QPainter p( &pix ); |
172 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 172 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
173 | p.drawImage( 0, 0, img ); | 173 | p.drawImage( 0, 0, img ); |
174 | return new QPixmap( pix ); | 174 | return new QPixmap( pix ); |
175 | } | 175 | } |
176 | 176 | ||
177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
178 | QPixmap *pixmap = new QPixmap( pix ); | 178 | QPixmap *pixmap = new QPixmap( pix ); |
179 | pixmap->setMask( mask ); | 179 | pixmap->setMask( mask ); |
180 | return pixmap; | 180 | return pixmap; |
181 | } | 181 | } |
182 | 182 | ||
183 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 183 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
184 | int h = height(); | 184 | int h = height(); |
185 | int w = width(); | 185 | int w = width(); |
186 | int Vh = 160; | 186 | int Vh = 160; |
187 | //videoFrame->height(); | 187 | //videoFrame->height(); |
188 | int Vw = 220; | 188 | int Vw = 220; |
189 | //videoFrame->width(); | 189 | //videoFrame->width(); |
190 | // songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); | 190 | // songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); |
191 | 191 | ||
192 | slider->setFixedWidth( w - 110 ); | 192 | slider->setFixedWidth( w - 110 ); |
193 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 193 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
194 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 194 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
195 | slider->setFocusPolicy( QWidget::NoFocus ); | ||
196 | make slider->setBackgroundPixmap( *pixBg ); | ||
197 | |||
195 | // time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 198 | // time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
196 | xoff = 0;// ( imgUp->width() ) / 2; | 199 | xoff = 0;// ( imgUp->width() ) / 2; |
197 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; | 200 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; |
198 | QPoint p( xoff, yoff ); | 201 | QPoint p( xoff, yoff ); |
199 | 202 | ||
203 | |||
200 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
201 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
202 | 206 | ||
203 | for ( int i = 0; i < 7; i++ ) { | 207 | for ( int i = 0; i < 7; i++ ) { |
204 | if ( !masks[i]->isNull() ) { | 208 | if ( !masks[i]->isNull() ) { |
205 | delete buttonPixUp[i]; | 209 | delete buttonPixUp[i]; |
206 | delete buttonPixDown[i]; | 210 | delete buttonPixDown[i]; |
207 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
208 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
209 | } | 213 | } |
210 | } | 214 | } |
211 | 215 | ||
212 | delete pixUp; | 216 | delete pixUp; |
213 | delete pixDn; | 217 | delete pixDn; |
214 | } | 218 | } |
215 | 219 | ||
216 | static bool videoSliderBeingMoved = FALSE; | 220 | static bool videoSliderBeingMoved = FALSE; |
217 | 221 | ||
218 | void VideoWidget::sliderPressed() { | 222 | void VideoWidget::sliderPressed() { |
219 | videoSliderBeingMoved = TRUE; | 223 | videoSliderBeingMoved = TRUE; |
220 | } | 224 | } |
221 | 225 | ||
222 | void VideoWidget::sliderReleased() { | 226 | void VideoWidget::sliderReleased() { |
223 | videoSliderBeingMoved = FALSE; | 227 | videoSliderBeingMoved = FALSE; |
224 | if ( slider->width() == 0 ) { | 228 | if ( slider->width() == 0 ) { |
225 | return; | 229 | return; |
226 | } | 230 | } |
227 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 231 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
228 | mediaPlayerState->setPosition( val ); | 232 | mediaPlayerState->setPosition( val ); |
229 | } | 233 | } |
230 | 234 | ||
231 | void VideoWidget::setPosition( long i ) { | 235 | void VideoWidget::setPosition( long i ) { |
232 | updateSlider( i, mediaPlayerState->length() ); | 236 | updateSlider( i, mediaPlayerState->length() ); |
233 | } | 237 | } |
234 | 238 | ||
235 | 239 | ||
236 | void VideoWidget::setLength( long max ) { | 240 | void VideoWidget::setLength( long max ) { |
237 | updateSlider( mediaPlayerState->position(), max ); | 241 | updateSlider( mediaPlayerState->position(), max ); |
238 | } | 242 | } |
239 | 243 | ||
240 | void VideoWidget::setView( char view ) { | 244 | void VideoWidget::setView( char view ) { |
241 | if ( view == 'v' ) { | 245 | if ( view == 'v' ) { |
242 | makeVisible(); | 246 | makeVisible(); |
243 | } else { | 247 | } else { |
244 | // Effectively blank the view next time we show it so it looks nicer | 248 | // Effectively blank the view next time we show it so it looks nicer |
245 | scaledWidth = 0; | 249 | scaledWidth = 0; |
246 | scaledHeight = 0; | 250 | scaledHeight = 0; |
247 | hide(); | 251 | hide(); |
248 | } | 252 | } |
249 | } | 253 | } |
250 | 254 | ||
251 | void VideoWidget::updateSlider( long i, long max ) { | 255 | void VideoWidget::updateSlider( long i, long max ) { |
252 | // Will flicker too much if we don't do this | 256 | // Will flicker too much if we don't do this |
253 | if ( max == 0 ) { | 257 | if ( max == 0 ) { |
254 | return; | 258 | return; |
255 | } | 259 | } |
256 | int width = slider->width(); | 260 | int width = slider->width(); |
257 | int val = int((double)i * width / max); | 261 | int val = int((double)i * width / max); |
258 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { | 262 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { |
259 | if ( slider->value() != val ) { | 263 | if ( slider->value() != val ) { |
260 | slider->setValue( val ); | 264 | slider->setValue( val ); |
261 | } | 265 | } |
262 | if ( slider->maxValue() != width ) { | 266 | if ( slider->maxValue() != width ) { |
263 | slider->setMaxValue( width ); | 267 | slider->setMaxValue( width ); |
264 | } | 268 | } |
265 | } | 269 | } |
266 | } | 270 | } |
267 | 271 | ||
268 | void VideoWidget::setToggleButton( int i, bool down ) { | 272 | void VideoWidget::setToggleButton( int i, bool down ) { |
269 | if ( down != videoButtons[i].isDown ) { | 273 | if ( down != videoButtons[i].isDown ) { |
270 | toggleButton( i ); | 274 | toggleButton( i ); |
271 | } | 275 | } |
272 | } | 276 | } |
273 | 277 | ||
274 | void VideoWidget::toggleButton( int i ) { | 278 | void VideoWidget::toggleButton( int i ) { |
275 | videoButtons[i].isDown = !videoButtons[i].isDown; | 279 | videoButtons[i].isDown = !videoButtons[i].isDown; |
276 | QPainter p(this); | 280 | QPainter p(this); |
277 | paintButton ( &p, i ); | 281 | paintButton ( &p, i ); |
278 | } | 282 | } |
279 | 283 | ||
280 | void VideoWidget::paintButton( QPainter *p, int i ) { | 284 | void VideoWidget::paintButton( QPainter *p, int i ) { |
281 | 285 | ||
282 | if ( videoButtons[i].isDown ) | 286 | if ( videoButtons[i].isDown ) |
283 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 287 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
284 | else | 288 | else |
285 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 289 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
286 | } | 290 | } |
287 | 291 | ||
288 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 292 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
289 | for ( int i = 0; i < numButtons; i++ ) { | 293 | for ( int i = 0; i < numButtons; i++ ) { |
290 | if ( event->state() == QMouseEvent::LeftButton ) { | 294 | if ( event->state() == QMouseEvent::LeftButton ) { |
291 | // The test to see if the mouse click is inside the button or not | 295 | // The test to see if the mouse click is inside the button or not |
292 | int x = event->pos().x() - xoff; | 296 | int x = event->pos().x() - xoff; |
293 | int y = event->pos().y() - yoff; | 297 | int y = event->pos().y() - yoff; |
294 | 298 | ||
295 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 299 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
296 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 300 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
297 | if ( isOnButton != videoButtons[i].isHeld ) { | 301 | if ( isOnButton != videoButtons[i].isHeld ) { |
298 | videoButtons[i].isHeld = isOnButton; | 302 | videoButtons[i].isHeld = isOnButton; |
299 | toggleButton(i); | 303 | toggleButton(i); |
300 | } | 304 | } |
301 | } else { | 305 | } else { |
302 | if ( videoButtons[i].isHeld ) { | 306 | if ( videoButtons[i].isHeld ) { |
303 | videoButtons[i].isHeld = FALSE; | 307 | videoButtons[i].isHeld = FALSE; |
304 | if ( !videoButtons[i].isToggle ) | 308 | if ( !videoButtons[i].isToggle ) |
305 | setToggleButton( i, FALSE ); | 309 | setToggleButton( i, FALSE ); |
306 | } | 310 | } |
307 | } | 311 | } |
308 | switch (i) { | 312 | switch (i) { |
309 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 313 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; |
310 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 314 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
311 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 315 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
312 | case VideoNext: mediaPlayerState->setNext(); return; | 316 | case VideoNext: mediaPlayerState->setNext(); return; |
313 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 317 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
314 | case VideoPlayList: mediaPlayerState->setList(); return; | 318 | case VideoPlayList: mediaPlayerState->setList(); return; |
315 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 319 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
316 | } | 320 | } |
317 | 321 | ||
318 | } | 322 | } |
319 | } | 323 | } |
320 | 324 | ||
321 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 325 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
322 | mouseMoveEvent( event ); | 326 | mouseMoveEvent( event ); |
323 | } | 327 | } |
324 | 328 | ||
325 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 329 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
326 | if ( mediaPlayerState->fullscreen() ) { | 330 | if ( mediaPlayerState->fullscreen() ) { |
327 | mediaPlayerState->setFullscreen( FALSE ); | 331 | mediaPlayerState->setFullscreen( FALSE ); |
328 | makeVisible(); | 332 | makeVisible(); |
329 | 333 | ||
330 | mouseMoveEvent( event ); | 334 | mouseMoveEvent( event ); |
331 | } | 335 | } |
332 | } | 336 | } |
333 | 337 | ||
334 | 338 | ||
335 | void VideoWidget::makeVisible() { | 339 | void VideoWidget::makeVisible() { |
336 | if ( mediaPlayerState->fullscreen() ) { | 340 | if ( mediaPlayerState->fullscreen() ) { |
337 | setBackgroundMode( QWidget::NoBackground ); | 341 | setBackgroundMode( QWidget::NoBackground ); |
338 | showFullScreen(); | 342 | showFullScreen(); |
339 | resize( qApp->desktop()->size() ); | 343 | resize( qApp->desktop()->size() ); |
340 | slider->hide(); | 344 | slider->hide(); |
341 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 345 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
342 | } else { | 346 | } else { |
343 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | ||
344 | showNormal(); | 347 | showNormal(); |
345 | showMaximized(); | 348 | showMaximized(); |
346 | slider->show(); | 349 | slider->show(); |
347 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); | 350 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); |
348 | } | 351 | } |
349 | } | 352 | } |
350 | 353 | ||
351 | 354 | ||
352 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 355 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
353 | QPainter p( this ); | 356 | QPainter p( this ); |
354 | 357 | ||
355 | if ( mediaPlayerState->fullscreen() ) { | 358 | if ( mediaPlayerState->fullscreen() ) { |
356 | // Clear the background | 359 | // Clear the background |
357 | p.setBrush( QBrush( Qt::black ) ); | 360 | p.setBrush( QBrush( Qt::black ) ); |
358 | // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); | 361 | // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); |
359 | 362 | ||
360 | } else { | 363 | } else { |
361 | 364 | ||
362 | // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); | 365 | // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); |
363 | // draw the buttons | 366 | // draw the buttons |
364 | 367 | ||
365 | if ( !pe->erased() ) { | 368 | if ( !pe->erased() ) { |
366 | // Combine with background and double buffer | 369 | // Combine with background and double buffer |
367 | QPixmap pix( pe->rect().size() ); | 370 | QPixmap pix( pe->rect().size() ); |
368 | QPainter p( &pix ); | 371 | QPainter p( &pix ); |
369 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 372 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
370 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 373 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
371 | for ( int i = 0; i < numButtons; i++ ) | 374 | for ( int i = 0; i < numButtons; i++ ) |
372 | paintButton( &p, i ); | 375 | paintButton( &p, i ); |
373 | QPainter p2( this ); | 376 | QPainter p2( this ); |
374 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 377 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
375 | } else { | 378 | } else { |
376 | QPainter p( this ); | 379 | QPainter p( this ); |
377 | for ( int i = 0; i < numButtons; i++ ) | 380 | for ( int i = 0; i < numButtons; i++ ) |
378 | paintButton( &p, i ); | 381 | paintButton( &p, i ); |
379 | } | 382 | } |
380 | // for ( int i = 0; i < numButtons; i++ ) { | 383 | // for ( int i = 0; i < numButtons; i++ ) { |
381 | // paintButton( &p, i ); | 384 | // paintButton( &p, i ); |
382 | // } | 385 | // } |
383 | // // draw the slider | 386 | // // draw the slider |
384 | // slider->repaint( TRUE ); | 387 | // slider->repaint( TRUE ); |
385 | } | 388 | } |
386 | } | 389 | } |
387 | 390 | ||
388 | 391 | ||
389 | void VideoWidget::closeEvent( QCloseEvent* ) { | 392 | void VideoWidget::closeEvent( QCloseEvent* ) { |
390 | mediaPlayerState->setList(); | 393 | mediaPlayerState->setList(); |
391 | } | 394 | } |
392 | 395 | ||
393 | 396 | ||
394 | bool VideoWidget::playVideo() { | 397 | bool VideoWidget::playVideo() { |
395 | bool result = FALSE; | 398 | bool result = FALSE; |
396 | 399 | ||
397 | int stream = 0; | 400 | int stream = 0; |
398 | 401 | ||
399 | int sw = 240; | 402 | int sw = 240; |
400 | int sh = 320; | 403 | int sh = 320; |
401 | int dd = QPixmap::defaultDepth(); | 404 | int dd = QPixmap::defaultDepth(); |
402 | int w = height(); | 405 | int w = height(); |
403 | int h = width(); | 406 | int h = width(); |
404 | 407 | ||
405 | return true; | 408 | return true; |
406 | } | 409 | } |
407 | 410 | ||
408 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 411 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
409 | switch ( e->key() ) { | 412 | switch ( e->key() ) { |
410 | ////////////////////////////// Zaurus keys | 413 | ////////////////////////////// Zaurus keys |
411 | case Key_Home: | 414 | case Key_Home: |
412 | break; | 415 | break; |
413 | case Key_F9: //activity | 416 | case Key_F9: //activity |
414 | break; | 417 | break; |
415 | case Key_F10: //contacts | 418 | case Key_F10: //contacts |
416 | // hide(); | 419 | // hide(); |
417 | break; | 420 | break; |
418 | case Key_F11: //menu | 421 | case Key_F11: //menu |
419 | break; | 422 | break; |
420 | case Key_F12: //home | 423 | case Key_F12: //home |
421 | break; | 424 | break; |
422 | case Key_F13: //mail | 425 | case Key_F13: //mail |
423 | break; | 426 | break; |
424 | case Key_Space: { | 427 | case Key_Space: { |
425 | if(mediaPlayerState->playing()) { | 428 | if(mediaPlayerState->playing()) { |
426 | mediaPlayerState->setPlaying(FALSE); | 429 | mediaPlayerState->setPlaying(FALSE); |
427 | } else { | 430 | } else { |
428 | mediaPlayerState->setPlaying(TRUE); | 431 | mediaPlayerState->setPlaying(TRUE); |
429 | } | 432 | } |
430 | } | 433 | } |
431 | break; | 434 | break; |
432 | case Key_Down: | 435 | case Key_Down: |
433 | // toggleButton(6); | 436 | // toggleButton(6); |
434 | // emit lessClicked(); | 437 | // emit lessClicked(); |
435 | // emit lessReleased(); | 438 | // emit lessReleased(); |
436 | // toggleButton(6); | 439 | // toggleButton(6); |
437 | break; | 440 | break; |
438 | case Key_Up: | 441 | case Key_Up: |
439 | // toggleButton(5); | 442 | // toggleButton(5); |