Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 110 |
1 files changed, 79 insertions, 31 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index be838c4..bb5f9e8 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -181,42 +181,42 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
181 | p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); | 181 | p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 185 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
186 | for ( int i = 0; i < numButtons; i++ ) { | 186 | for ( int i = 0; i < numButtons; i++ ) { |
187 | int x = videoButtons[i].xPos; | 187 | int x = videoButtons[i].xPos; |
188 | int y = videoButtons[i].yPos; | 188 | int y = videoButtons[i].yPos; |
189 | if ( event->state() == QMouseEvent::LeftButton ) { | 189 | if ( event->state() == QMouseEvent::LeftButton ) { |
190 | // The test to see if the mouse click is inside the circular button or not | 190 | // The test to see if the mouse click is inside the circular button or not |
191 | // (compared with the radius squared to avoid a square-root of our distance) | 191 | // (compared with the radius squared to avoid a square-root of our distance) |
192 | int radius = 16; | 192 | int radius = 16; |
193 | QPoint center = QPoint( x + radius, y + radius ); | 193 | QPoint center = QPoint( x + radius, y + radius ); |
194 | QPoint dXY = center - event->pos(); | 194 | QPoint dXY = center - event->pos(); |
195 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 195 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
196 | bool isOnButton = dist <= (radius * radius); | 196 | bool isOnButton = dist <= (radius * radius); |
197 | if ( isOnButton != videoButtons[i].isHeld ) { | 197 | if ( isOnButton != videoButtons[i].isHeld ) { |
198 | videoButtons[i].isHeld = isOnButton; | 198 | videoButtons[i].isHeld = isOnButton; |
199 | toggleButton(i); | 199 | toggleButton(i); |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | if ( videoButtons[i].isHeld ) { | 202 | if ( videoButtons[i].isHeld ) { |
203 | videoButtons[i].isHeld = FALSE; | 203 | videoButtons[i].isHeld = FALSE; |
204 | if ( !videoButtons[i].isToggle ) | 204 | if ( !videoButtons[i].isToggle ) |
205 | setToggleButton( i, FALSE ); | 205 | setToggleButton( i, FALSE ); |
206 | switch (i) { | 206 | switch (i) { |
207 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 207 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; |
208 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 208 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
209 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 209 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
210 | case VideoNext: mediaPlayerState->setNext(); return; | 210 | case VideoNext: mediaPlayerState->setNext(); return; |
211 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 211 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
212 | case VideoPlayList: mediaPlayerState->setList(); return; | 212 | case VideoPlayList: mediaPlayerState->setList(); return; |
213 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 213 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 221 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
222 | mouseMoveEvent( event ); | 222 | mouseMoveEvent( event ); |
@@ -224,13 +224,13 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { | |||
224 | 224 | ||
225 | 225 | ||
226 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 226 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
227 | if ( mediaPlayerState->fullscreen() ) { | 227 | if ( mediaPlayerState->fullscreen() ) { |
228 | mediaPlayerState->setFullscreen( FALSE ); | 228 | mediaPlayerState->setFullscreen( FALSE ); |
229 | makeVisible(); | 229 | makeVisible(); |
230 | } else { | 230 | |
231 | mouseMoveEvent( event ); | 231 | mouseMoveEvent( event ); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | void VideoWidget::makeVisible() { | 236 | void VideoWidget::makeVisible() { |
@@ -418,6 +418,54 @@ bool VideoWidget::playVideo() { | |||
418 | } | 418 | } |
419 | 419 | ||
420 | return result; | 420 | return result; |
421 | } | 421 | } |
422 | 422 | ||
423 | 423 | ||
424 | |||
425 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) | ||
426 | { | ||
427 | switch ( e->key() ) { | ||
428 | ////////////////////////////// Zaurus keys | ||
429 | case Key_Home: | ||
430 | break; | ||
431 | case Key_F9: //activity | ||
432 | break; | ||
433 | case Key_F10: //contacts | ||
434 | break; | ||
435 | case Key_F11: //menu | ||
436 | break; | ||
437 | case Key_F12: //home | ||
438 | break; | ||
439 | case Key_F13: //mail | ||
440 | break; | ||
441 | case Key_Space: { | ||
442 | if(mediaPlayerState->playing()) { | ||
443 | mediaPlayerState->setPlaying(FALSE); | ||
444 | } else { | ||
445 | mediaPlayerState->setPlaying(TRUE); | ||
446 | } | ||
447 | } | ||
448 | break; | ||
449 | case Key_Down: | ||
450 | // toggleButton(6); | ||
451 | // emit lessClicked(); | ||
452 | // emit lessReleased(); | ||
453 | // toggleButton(6); | ||
454 | break; | ||
455 | case Key_Up: | ||
456 | // toggleButton(5); | ||
457 | // emit moreClicked(); | ||
458 | // emit moreReleased(); | ||
459 | // toggleButton(5); | ||
460 | break; | ||
461 | case Key_Right: | ||
462 | mediaPlayerState->setNext(); | ||
463 | break; | ||
464 | case Key_Left: | ||
465 | mediaPlayerState->setPrev(); | ||
466 | break; | ||
467 | case Key_Escape: | ||
468 | break; | ||
469 | |||
470 | }; | ||
471 | } | ||