summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 15:49:37 (UTC)
committer simon <simon>2002-12-09 15:49:37 (UTC)
commit743155915f659d701ad468eadcc2b2173b6e2770 (patch) (unidiff)
treee95ff8ac9e8781865214e92e8a7e84bbdd04b645
parentaa766a6a0818ed0b756f8cd67fc4a1c85906f224 (diff)
downloadopie-743155915f659d701ad468eadcc2b2173b6e2770.zip
opie-743155915f659d701ad468eadcc2b2173b6e2770.tar.gz
opie-743155915f659d701ad468eadcc2b2173b6e2770.tar.bz2
- less indexing in the mouse event handler
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp27
2 files changed, 29 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index ef606ab..714509e 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -242,201 +242,204 @@ void AudioWidget::setLength( long max ) {
242 242
243void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 243void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
244 if ( mediaType == MediaPlayerState::Audio ) { 244 if ( mediaType == MediaPlayerState::Audio ) {
245 // startTimer( 150 ); 245 // startTimer( 150 );
246 showMaximized(); 246 showMaximized();
247 return; 247 return;
248 } 248 }
249 249
250 killTimers(); 250 killTimers();
251 hide(); 251 hide();
252} 252}
253 253
254 254
255void AudioWidget::setSeekable( bool isSeekable ) { 255void AudioWidget::setSeekable( bool isSeekable ) {
256 256
257 if ( !isSeekable ) { 257 if ( !isSeekable ) {
258 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 258 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
259 if( !slider.isHidden()) { 259 if( !slider.isHidden()) {
260 slider.hide(); 260 slider.hide();
261 } 261 }
262 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 262 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
263 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 263 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
264 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 264 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
265 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 265 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
266 } else { 266 } else {
267 // this stops the slider from being moved, thus 267 // this stops the slider from being moved, thus
268 // does not stop stream when it reaches the end 268 // does not stop stream when it reaches the end
269 slider.show(); 269 slider.show();
270 qDebug( " CONNECT SET POSTION " ); 270 qDebug( " CONNECT SET POSTION " );
271 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 271 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
272 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 272 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
273 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 273 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
274 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 274 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
275 } 275 }
276} 276}
277 277
278 278
279static QString timeAsString( long length ) { 279static QString timeAsString( long length ) {
280 int minutes = length / 60; 280 int minutes = length / 60;
281 int seconds = length % 60; 281 int seconds = length % 60;
282 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 282 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
283} 283}
284 284
285void AudioWidget::updateSlider( long i, long max ) { 285void AudioWidget::updateSlider( long i, long max ) {
286 286
287 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 287 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
288// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 288// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
289 289
290 if ( max == 0 ) { 290 if ( max == 0 ) {
291 return; 291 return;
292 } 292 }
293 // Will flicker too much if we don't do this 293 // Will flicker too much if we don't do this
294 // Scale to something reasonable 294 // Scale to something reasonable
295 int width = slider.width(); 295 int width = slider.width();
296 int val = int((double)i * width / max); 296 int val = int((double)i * width / max);
297 if ( !audioSliderBeingMoved ) { 297 if ( !audioSliderBeingMoved ) {
298 if ( slider.value() != val ) { 298 if ( slider.value() != val ) {
299 slider.setValue( val ); 299 slider.setValue( val );
300 } 300 }
301 301
302 if ( slider.maxValue() != width ) { 302 if ( slider.maxValue() != width ) {
303 slider.setMaxValue( width ); 303 slider.setMaxValue( width );
304 } 304 }
305 } 305 }
306} 306}
307 307
308void AudioWidget::skipFor() { 308void AudioWidget::skipFor() {
309 skipDirection = +1; 309 skipDirection = +1;
310 startTimer( 50 ); 310 startTimer( 50 );
311 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 311 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
312} 312}
313 313
314void AudioWidget::skipBack() { 314void AudioWidget::skipBack() {
315 skipDirection = -1; 315 skipDirection = -1;
316 startTimer( 50 ); 316 startTimer( 50 );
317 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 317 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
318} 318}
319 319
320 320
321 321
322void AudioWidget::stopSkip() { 322void AudioWidget::stopSkip() {
323 killTimers(); 323 killTimers();
324} 324}
325 325
326 326
327void AudioWidget::timerEvent( QTimerEvent * ) { 327void AudioWidget::timerEvent( QTimerEvent * ) {
328 if ( skipDirection == +1 ) { 328 if ( skipDirection == +1 ) {
329 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 329 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
330 } else if ( skipDirection == -1 ) { 330 } else if ( skipDirection == -1 ) {
331 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 331 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
332 } 332 }
333} 333}
334 334
335 335
336void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 336void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
337 for ( unsigned int i = 0; i < buttons.count(); i++ ) { 337 for ( unsigned int i = 0; i < buttons.count(); i++ ) {
338
339 Button &button = buttons[ i ];
340
338 if ( event->state() == QMouseEvent::LeftButton ) { 341 if ( event->state() == QMouseEvent::LeftButton ) {
339 // The test to see if the mouse click is inside the button or not 342 // The test to see if the mouse click is inside the button or not
340 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); 343 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
341 344
342 if ( isOnButton && !buttons[i].isHeld ) { 345 if ( isOnButton && !button.isHeld ) {
343 buttons[i].isHeld = TRUE; 346 button.isHeld = TRUE;
344 toggleButton( buttons[ i ] ); 347 toggleButton( button );
345 switch (i) { 348 switch (i) {
346 case VolumeUp: 349 case VolumeUp:
347 emit moreClicked(); 350 emit moreClicked();
348 return; 351 return;
349 case VolumeDown: 352 case VolumeDown:
350 emit lessClicked(); 353 emit lessClicked();
351 return; 354 return;
352 case Forward: 355 case Forward:
353 emit forwardClicked(); 356 emit forwardClicked();
354 return; 357 return;
355 case Back: 358 case Back:
356 emit backClicked(); 359 emit backClicked();
357 return; 360 return;
358 } 361 }
359 } else if ( !isOnButton && buttons[i].isHeld ) { 362 } else if ( !isOnButton && button.isHeld ) {
360 buttons[i].isHeld = FALSE; 363 button.isHeld = FALSE;
361 toggleButton( buttons[ i ] ); 364 toggleButton( button );
362 } 365 }
363 } else { 366 } else {
364 if ( buttons[i].isHeld ) { 367 if ( button.isHeld ) {
365 buttons[i].isHeld = FALSE; 368 button.isHeld = FALSE;
366 if ( buttons[i].type != ToggleButton ) { 369 if ( button.type != ToggleButton ) {
367 setToggleButton( buttons[ i ], FALSE ); 370 setToggleButton( button, FALSE );
368 } 371 }
369 qDebug("mouseEvent %d", i); 372 qDebug("mouseEvent %d", i);
370 handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); 373 handleCommand( static_cast<Command>( i ), button.isDown );
371 } 374 }
372 } 375 }
373 } 376 }
374} 377}
375 378
376 379
377void AudioWidget::mousePressEvent( QMouseEvent *event ) { 380void AudioWidget::mousePressEvent( QMouseEvent *event ) {
378 mouseMoveEvent( event ); 381 mouseMoveEvent( event );
379} 382}
380 383
381 384
382void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 385void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
383 mouseMoveEvent( event ); 386 mouseMoveEvent( event );
384} 387}
385 388
386 389
387void AudioWidget::showEvent( QShowEvent* ) { 390void AudioWidget::showEvent( QShowEvent* ) {
388 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 391 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
389 mouseMoveEvent( &event ); 392 mouseMoveEvent( &event );
390} 393}
391 394
392void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 395void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
393 switch ( e->key() ) { 396 switch ( e->key() ) {
394 ////////////////////////////// Zaurus keys 397 ////////////////////////////// Zaurus keys
395 case Key_Home: 398 case Key_Home:
396 break; 399 break;
397 case Key_F9: //activity 400 case Key_F9: //activity
398 hide(); 401 hide();
399 // qDebug("Audio F9"); 402 // qDebug("Audio F9");
400 break; 403 break;
401 case Key_F10: //contacts 404 case Key_F10: //contacts
402 break; 405 break;
403 case Key_F11: //menu 406 case Key_F11: //menu
404 mediaPlayerState.toggleBlank(); 407 mediaPlayerState.toggleBlank();
405 break; 408 break;
406 case Key_F12: //home 409 case Key_F12: //home
407 break; 410 break;
408 case Key_F13: //mail 411 case Key_F13: //mail
409 mediaPlayerState.toggleBlank(); 412 mediaPlayerState.toggleBlank();
410 break; 413 break;
411 case Key_Space: { 414 case Key_Space: {
412 mediaPlayerState.togglePaused(); 415 mediaPlayerState.togglePaused();
413 } 416 }
414 break; 417 break;
415 case Key_Down: 418 case Key_Down:
416 // toggleButton(6); 419 // toggleButton(6);
417 emit lessClicked(); 420 emit lessClicked();
418 emit lessReleased(); 421 emit lessReleased();
419 // toggleButton(6); 422 // toggleButton(6);
420 break; 423 break;
421 case Key_Up: 424 case Key_Up:
422 // toggleButton(5); 425 // toggleButton(5);
423 emit moreClicked(); 426 emit moreClicked();
424 emit moreReleased(); 427 emit moreReleased();
425 // toggleButton(5); 428 // toggleButton(5);
426 break; 429 break;
427 case Key_Right: 430 case Key_Right:
428 // toggleButton(3); 431 // toggleButton(3);
429 mediaPlayerState.setNext(); 432 mediaPlayerState.setNext();
430 // toggleButton(3); 433 // toggleButton(3);
431 break; 434 break;
432 case Key_Left: 435 case Key_Left:
433 // toggleButton(4); 436 // toggleButton(4);
434 mediaPlayerState.setPrev(); 437 mediaPlayerState.setPrev();
435 // toggleButton(4); 438 // toggleButton(4);
436 break; 439 break;
437 case Key_Escape: { 440 case Key_Escape: {
438 } 441 }
439 break; 442 break;
440 443
441 }; 444 };
442} 445}
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 673c9e8..9782b68 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -151,229 +151,232 @@ QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) {
151 QPixmap pixmap( pix ); 151 QPixmap pixmap( pix );
152 pixmap.setMask( mask ); 152 pixmap.setMask( mask );
153 return pixmap; 153 return pixmap;
154} 154}
155 155
156void VideoWidget::resizeEvent( QResizeEvent * ) { 156void VideoWidget::resizeEvent( QResizeEvent * ) {
157 int h = height(); 157 int h = height();
158 int w = width(); 158 int w = width();
159 //int Vh = 160; 159 //int Vh = 160;
160 //int Vw = 220; 160 //int Vw = 220;
161 161
162 slider->setFixedWidth( w - 20 ); 162 slider->setFixedWidth( w - 20 );
163 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 163 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
164 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 164 slider->setBackgroundOrigin( QWidget::ParentOrigin );
165 slider->setFocusPolicy( QWidget::NoFocus ); 165 slider->setFocusPolicy( QWidget::NoFocus );
166 slider->setBackgroundPixmap( backgroundPixmap ); 166 slider->setBackgroundPixmap( backgroundPixmap );
167 167
168 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 168 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
169 if(w>h) 169 if(w>h)
170 upperLeftOfButtonMask.ry() = 0; 170 upperLeftOfButtonMask.ry() = 0;
171 else 171 else
172 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 172 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
173 QPoint p = upperLeftOfButtonMask; 173 QPoint p = upperLeftOfButtonMask;
174 174
175 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); 175 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p );
176 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); 176 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p );
177 177
178 for ( int i = 0; i < 7; i++ ) { 178 for ( int i = 0; i < 7; i++ ) {
179 Button &button = buttons[ i ]; 179 Button &button = buttons[ i ];
180 180
181 if ( !button.mask.isNull() ) { 181 if ( !button.mask.isNull() ) {
182 button.pixUp = maskVPixToMask( *pixUp, button.mask ); 182 button.pixUp = maskVPixToMask( *pixUp, button.mask );
183 button.pixDown = maskVPixToMask( *pixDn, button.mask ); 183 button.pixDown = maskVPixToMask( *pixDn, button.mask );
184 } 184 }
185 } 185 }
186 186
187 delete pixUp; 187 delete pixUp;
188 delete pixDn; 188 delete pixDn;
189} 189}
190 190
191static bool videoSliderBeingMoved = FALSE; 191static bool videoSliderBeingMoved = FALSE;
192 192
193void VideoWidget::sliderPressed() { 193void VideoWidget::sliderPressed() {
194 videoSliderBeingMoved = TRUE; 194 videoSliderBeingMoved = TRUE;
195} 195}
196 196
197void VideoWidget::sliderReleased() { 197void VideoWidget::sliderReleased() {
198 videoSliderBeingMoved = FALSE; 198 videoSliderBeingMoved = FALSE;
199 if ( slider->width() == 0 ) { 199 if ( slider->width() == 0 ) {
200 return; 200 return;
201 } 201 }
202 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 202 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
203 mediaPlayerState.setPosition( val ); 203 mediaPlayerState.setPosition( val );
204} 204}
205 205
206void VideoWidget::setPosition( long i ) { 206void VideoWidget::setPosition( long i ) {
207 updateSlider( i, mediaPlayerState.length() ); 207 updateSlider( i, mediaPlayerState.length() );
208} 208}
209 209
210 210
211void VideoWidget::setLength( long max ) { 211void VideoWidget::setLength( long max ) {
212 updateSlider( mediaPlayerState.position(), max ); 212 updateSlider( mediaPlayerState.position(), max );
213} 213}
214 214
215void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 215void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
216{ 216{
217 if ( displayType == MediaPlayerState::Video ) { 217 if ( displayType == MediaPlayerState::Video ) {
218 makeVisible(); 218 makeVisible();
219 return; 219 return;
220 } 220 }
221 221
222 // Effectively blank the view next time we show it so it looks nicer 222 // Effectively blank the view next time we show it so it looks nicer
223 scaledWidth = 0; 223 scaledWidth = 0;
224 scaledHeight = 0; 224 scaledHeight = 0;
225 hide(); 225 hide();
226} 226}
227 227
228void VideoWidget::updateSlider( long i, long max ) { 228void VideoWidget::updateSlider( long i, long max ) {
229 // Will flicker too much if we don't do this 229 // Will flicker too much if we don't do this
230 if ( max == 0 ) { 230 if ( max == 0 ) {
231 return; 231 return;
232 } 232 }
233 int width = slider->width(); 233 int width = slider->width();
234 int val = int((double)i * width / max); 234 int val = int((double)i * width / max);
235 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 235 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
236 if ( slider->value() != val ) { 236 if ( slider->value() != val ) {
237 slider->setValue( val ); 237 slider->setValue( val );
238 } 238 }
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
245void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 245void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
246 for ( unsigned int i = 0; i < buttons.count(); i++ ) { 246 for ( unsigned int i = 0; i < buttons.count(); i++ ) {
247
248 Button &button = buttons[ i ];
249
247 if ( event->state() == QMouseEvent::LeftButton ) { 250 if ( event->state() == QMouseEvent::LeftButton ) {
248 // The test to see if the mouse click is inside the button or not 251 // The test to see if the mouse click is inside the button or not
249 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); 252 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
250 253
251 if ( isOnButton && !buttons[i].isHeld ) { 254 if ( isOnButton && !button.isHeld ) {
252 buttons[i].isHeld = TRUE; 255 button.isHeld = TRUE;
253 toggleButton( buttons[ i ] ); 256 toggleButton( button );
254 257
255 switch (i) { 258 switch (i) {
256 case VideoVolUp: 259 case VideoVolUp:
257 emit moreClicked(); 260 emit moreClicked();
258 return; 261 return;
259 case VideoVolDown: 262 case VideoVolDown:
260 emit lessClicked(); 263 emit lessClicked();
261 return; 264 return;
262 } 265 }
263 } else if ( !isOnButton && buttons[i].isHeld ) { 266 } else if ( !isOnButton && button.isHeld ) {
264 buttons[i].isHeld = FALSE; 267 button.isHeld = FALSE;
265 toggleButton( buttons[ i ] ); 268 toggleButton( button );
266 } 269 }
267 } else { 270 } else {
268 271
269 if ( buttons[i].isHeld ) { 272 if ( button.isHeld ) {
270 buttons[i].isHeld = FALSE; 273 button.isHeld = FALSE;
271 if ( buttons[i].type != ToggleButton ) { 274 if ( button.type != ToggleButton ) {
272 setToggleButton( buttons[ i ], FALSE ); 275 setToggleButton( button, FALSE );
273 } 276 }
274 277
275 switch(i) { 278 switch(i) {
276 279
277 case VideoPlay: { 280 case VideoPlay: {
278 if( mediaPlayerState.isPaused() ) { 281 if( mediaPlayerState.isPaused() ) {
279 setToggleButton( buttons[ i ], FALSE ); 282 setToggleButton( button, FALSE );
280 mediaPlayerState.setPaused( FALSE ); 283 mediaPlayerState.setPaused( FALSE );
281 return; 284 return;
282 } else if( !mediaPlayerState.isPaused() ) { 285 } else if( !mediaPlayerState.isPaused() ) {
283 setToggleButton( buttons[ i ], TRUE ); 286 setToggleButton( button, TRUE );
284 mediaPlayerState.setPaused( TRUE ); 287 mediaPlayerState.setPaused( TRUE );
285 return; 288 return;
286 } else { 289 } else {
287 return; 290 return;
288 } 291 }
289 } 292 }
290 293
291 case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; 294 case VideoStop: mediaPlayerState.setPlaying( FALSE ); return;
292 case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 295 case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
293 case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 296 case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
294 case VideoVolUp: emit moreReleased(); return; 297 case VideoVolUp: emit moreReleased(); return;
295 case VideoVolDown: emit lessReleased(); return; 298 case VideoVolDown: emit lessReleased(); return;
296 case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; 299 case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return;
297 } 300 }
298 } 301 }
299 } 302 }
300 } 303 }
301} 304}
302 305
303void VideoWidget::mousePressEvent( QMouseEvent *event ) { 306void VideoWidget::mousePressEvent( QMouseEvent *event ) {
304 mouseMoveEvent( event ); 307 mouseMoveEvent( event );
305} 308}
306 309
307void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 310void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
308 if ( mediaPlayerState.isFullscreen() ) { 311 if ( mediaPlayerState.isFullscreen() ) {
309 mediaPlayerState.setFullscreen( FALSE ); 312 mediaPlayerState.setFullscreen( FALSE );
310 makeVisible(); 313 makeVisible();
311 } 314 }
312 mouseMoveEvent( event ); 315 mouseMoveEvent( event );
313} 316}
314 317
315void VideoWidget::showEvent( QShowEvent* ) { 318void VideoWidget::showEvent( QShowEvent* ) {
316 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 319 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
317 mouseMoveEvent( &event ); 320 mouseMoveEvent( &event );
318} 321}
319 322
320 323
321 void VideoWidget::backToNormal() { 324 void VideoWidget::backToNormal() {
322 mediaPlayerState.setFullscreen( FALSE ); 325 mediaPlayerState.setFullscreen( FALSE );
323 makeVisible(); 326 makeVisible();
324 } 327 }
325 328
326void VideoWidget::makeVisible() { 329void VideoWidget::makeVisible() {
327 if ( mediaPlayerState.isFullscreen() ) { 330 if ( mediaPlayerState.isFullscreen() ) {
328 setBackgroundMode( QWidget::NoBackground ); 331 setBackgroundMode( QWidget::NoBackground );
329 showFullScreen(); 332 showFullScreen();
330 resize( qApp->desktop()->size() ); 333 resize( qApp->desktop()->size() );
331 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 334 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
332 335
333 slider->hide(); 336 slider->hide();
334 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 337 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
335 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 338 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
336 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 339 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
337 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 340 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
338 341
339 } else { 342 } else {
340 showNormal(); 343 showNormal();
341 showMaximized(); 344 showMaximized();
342 setBackgroundPixmap( backgroundPixmap ); 345 setBackgroundPixmap( backgroundPixmap );
343 QWidget *d = QApplication::desktop(); 346 QWidget *d = QApplication::desktop();
344 int w = d->width(); 347 int w = d->width();
345 int h = d->height(); 348 int h = d->height();
346 349
347 if(w>h) { 350 if(w>h) {
348 int newW=(w/2)-(246/2); //this will only work with 320x240 351 int newW=(w/2)-(246/2); //this will only work with 320x240
349 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 352 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
350 } else { 353 } else {
351 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 354 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
352 } 355 }
353 356
354 if ( !mediaPlayerState.isSeekable() ) { 357 if ( !mediaPlayerState.isSeekable() ) {
355 if( !slider->isHidden()) { 358 if( !slider->isHidden()) {
356 slider->hide(); 359 slider->hide();
357 } 360 }
358 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 361 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
359 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 362 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
360 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 363 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
361 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 364 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
362 } else { 365 } else {
363 slider->show(); 366 slider->show();
364 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 367 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
365 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 368 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
366 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 369 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
367 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 370 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
368 } 371 }
369 } 372 }
370} 373}
371 374
372void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 375void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
373 switch ( e->key() ) { 376 switch ( e->key() ) {
374////////////////////////////// Zaurus keys 377////////////////////////////// Zaurus keys
375 case Key_Home: 378 case Key_Home:
376 break; 379 break;
377 case Key_F9: //activity 380 case Key_F9: //activity
378 break; 381 break;
379 case Key_F10: //contacts 382 case Key_F10: //contacts