-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 1 |
5 files changed, 19 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 93819f2..22afe19 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -62,25 +62,25 @@ void MediaPlayer::pauseCheck( bool b ) { | |||
62 | if ( b && !mediaPlayerState->playing() ) { | 62 | if ( b && !mediaPlayerState->playing() ) { |
63 | mediaPlayerState->setPaused( FALSE ); | 63 | mediaPlayerState->setPaused( FALSE ); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | void MediaPlayer::play() { | 67 | void MediaPlayer::play() { |
68 | mediaPlayerState->setPlaying( FALSE ); | 68 | mediaPlayerState->setPlaying( FALSE ); |
69 | mediaPlayerState->setPlaying( TRUE ); | 69 | mediaPlayerState->setPlaying( TRUE ); |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaPlayer::setPlaying( bool play ) { | 72 | void MediaPlayer::setPlaying( bool play ) { |
73 | if ( !play ) { | 73 | if ( !play ) { |
74 | //mediaPlayerState->setPaused( TRUE ); | 74 | // mediaPlayerState->setPaused( FALSE ); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | 77 | ||
78 | if ( mediaPlayerState->paused() ) { | 78 | if ( mediaPlayerState->paused() ) { |
79 | mediaPlayerState->setPaused( FALSE ); | 79 | mediaPlayerState->setPaused( FALSE ); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | const DocLnk *playListCurrent = playList->current(); | 83 | const DocLnk *playListCurrent = playList->current(); |
84 | if ( playListCurrent != NULL ) { | 84 | if ( playListCurrent != NULL ) { |
85 | currentFile = playListCurrent; | 85 | currentFile = playListCurrent; |
86 | } | 86 | } |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 238770b..c2080e6 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -75,25 +75,27 @@ MediaButton videoButtons[] = { | |||
75 | const char *skinV_mask_file_names[7] = { | 75 | const char *skinV_mask_file_names[7] = { |
76 | "stop","play","back","fwd","up","down","full" | 76 | "stop","play","back","fwd","up","down","full" |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 79 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
80 | 80 | ||
81 | 81 | ||
82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
84 | setCaption( tr("OpiePlayer - Video") ); | 84 | setCaption( tr("OpiePlayer - Video") ); |
85 | 85 | ||
86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
87 | |||
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 88 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
89 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | ||
88 | 90 | ||
89 | Config cfg("OpiePlayer"); | 91 | Config cfg("OpiePlayer"); |
90 | cfg.setGroup("Options"); | 92 | cfg.setGroup("Options"); |
91 | skin = cfg.readEntry("Skin","default"); | 93 | skin = cfg.readEntry("Skin","default"); |
92 | 94 | ||
93 | QString skinPath = "opieplayer2/skins/" + skin; | 95 | QString skinPath = "opieplayer2/skins/" + skin; |
94 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 96 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
95 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 97 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
96 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 98 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
97 | 99 | ||
98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 100 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
99 | imgButtonMask->fill( 0 ); | 101 | imgButtonMask->fill( 0 ); |
@@ -334,26 +336,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
334 | switch(i) { | 336 | switch(i) { |
335 | 337 | ||
336 | case VideoPlay: { | 338 | case VideoPlay: { |
337 | if( mediaPlayerState->isPaused ) { | 339 | if( mediaPlayerState->isPaused ) { |
338 | setToggleButton( i, FALSE ); | 340 | setToggleButton( i, FALSE ); |
339 | mediaPlayerState->setPaused( FALSE ); | 341 | mediaPlayerState->setPaused( FALSE ); |
340 | return; | 342 | return; |
341 | } else if( !mediaPlayerState->isPaused ) { | 343 | } else if( !mediaPlayerState->isPaused ) { |
342 | setToggleButton( i, TRUE ); | 344 | setToggleButton( i, TRUE ); |
343 | mediaPlayerState->setPaused( TRUE ); | 345 | mediaPlayerState->setPaused( TRUE ); |
344 | return; | 346 | return; |
345 | } else { | 347 | } else { |
346 | // setToggleButton( i, TRUE ); | 348 | return; |
347 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); | ||
348 | } | 349 | } |
349 | } | 350 | } |
350 | 351 | ||
351 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 352 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
352 | case VideoNext: mediaPlayerState->setNext(); return; | 353 | case VideoNext: mediaPlayerState->setNext(); return; |
353 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 354 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
354 | case VideoVolUp: emit moreReleased(); return; | 355 | case VideoVolUp: emit moreReleased(); return; |
355 | case VideoVolDown: emit lessReleased(); return; | 356 | case VideoVolDown: emit lessReleased(); return; |
356 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 357 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
357 | } | 358 | } |
358 | } | 359 | } |
359 | } | 360 | } |
@@ -369,36 +370,42 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
369 | mediaPlayerState->setFullscreen( FALSE ); | 370 | mediaPlayerState->setFullscreen( FALSE ); |
370 | makeVisible(); | 371 | makeVisible(); |
371 | } | 372 | } |
372 | mouseMoveEvent( event ); | 373 | mouseMoveEvent( event ); |
373 | } | 374 | } |
374 | 375 | ||
375 | void VideoWidget::showEvent( QShowEvent* ) { | 376 | void VideoWidget::showEvent( QShowEvent* ) { |
376 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 377 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
377 | mouseMoveEvent( &event ); | 378 | mouseMoveEvent( &event ); |
378 | } | 379 | } |
379 | 380 | ||
380 | 381 | ||
382 | void VideoWidget::backToNormal() { | ||
383 | mediaPlayerState->setFullscreen( FALSE ); | ||
384 | makeVisible(); | ||
385 | } | ||
386 | |||
381 | void VideoWidget::makeVisible() { | 387 | void VideoWidget::makeVisible() { |
382 | if ( mediaPlayerState->fullscreen() ) { | 388 | if ( mediaPlayerState->fullscreen() ) { |
383 | setBackgroundMode( QWidget::NoBackground ); | 389 | setBackgroundMode( QWidget::NoBackground ); |
384 | showFullScreen(); | 390 | showFullScreen(); |
385 | resize( qApp->desktop()->size() ); | 391 | resize( qApp->desktop()->size() ); |
386 | slider->hide(); | 392 | slider->hide(); |
387 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 393 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
394 | |||
388 | } else { | 395 | } else { |
389 | showNormal(); | 396 | showNormal(); |
390 | showMaximized(); | 397 | showMaximized(); |
391 | slider->show(); | 398 | slider->show(); |
392 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); | 399 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
393 | qApp->processEvents(); | 400 | qApp->processEvents(); |
394 | } | 401 | } |
395 | } | 402 | } |
396 | 403 | ||
397 | 404 | ||
398 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 405 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
399 | QPainter p( this ); | 406 | QPainter p( this ); |
400 | 407 | ||
401 | if ( mediaPlayerState->fullscreen() ) { | 408 | if ( mediaPlayerState->fullscreen() ) { |
402 | // Clear the background | 409 | // Clear the background |
403 | p.setBrush( QBrush( Qt::black ) ); | 410 | p.setBrush( QBrush( Qt::black ) ); |
404 | } else { | 411 | } else { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index b35558b..990fa5f 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -57,24 +57,25 @@ public: | |||
57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
58 | ~VideoWidget(); | 58 | ~VideoWidget(); |
59 | 59 | ||
60 | 60 | ||
61 | XineVideoWidget* vidWidget(); | 61 | XineVideoWidget* vidWidget(); |
62 | public slots: | 62 | public slots: |
63 | void updateSlider( long, long ); | 63 | void updateSlider( long, long ); |
64 | void sliderPressed( ); | 64 | void sliderPressed( ); |
65 | void sliderReleased( ); | 65 | void sliderReleased( ); |
66 | void setPlaying( bool b); | 66 | void setPlaying( bool b); |
67 | void setFullscreen( bool b ); | 67 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 68 | void makeVisible(); |
69 | void backToNormal(); | ||
69 | void setPosition( long ); | 70 | void setPosition( long ); |
70 | void setLength( long ); | 71 | void setLength( long ); |
71 | void setView( char ); | 72 | void setView( char ); |
72 | 73 | ||
73 | signals: | 74 | signals: |
74 | void moreClicked(); | 75 | void moreClicked(); |
75 | void lessClicked(); | 76 | void lessClicked(); |
76 | void moreReleased(); | 77 | void moreReleased(); |
77 | void lessReleased(); | 78 | void lessReleased(); |
78 | void sliderMoved( long ); | 79 | void sliderMoved( long ); |
79 | void videoResized ( const QSize &s ); | 80 | void videoResized ( const QSize &s ); |
80 | 81 | ||
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index d65006b..3e28e54 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -240,29 +240,31 @@ void XineVideoWidget::resizeEvent ( QResizeEvent * ) | |||
240 | 240 | ||
241 | // qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); | 241 | // qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); |
242 | 242 | ||
243 | emit videoResized ( s ); | 243 | emit videoResized ( s ); |
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | void XineVideoWidget::mousePressEvent ( QMouseEvent *me ) | 247 | void XineVideoWidget::mousePressEvent ( QMouseEvent *me ) |
248 | { | 248 | { |
249 | QWidget *p = parentWidget ( ); | 249 | QWidget *p = parentWidget ( ); |
250 | 250 | ||
251 | if ( p ) { | 251 | if ( p ) { |
252 | QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); | 252 | // QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); |
253 | 253 | ||
254 | QApplication::sendEvent ( p, &pme ); | 254 | // QApplication::sendEvent ( p, &pme ); |
255 | // emit clicked(); | ||
255 | } | 256 | } |
256 | } | 257 | } |
257 | 258 | ||
258 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) | 259 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) |
259 | { | 260 | { |
260 | QWidget *p = parentWidget ( ); | 261 | QWidget *p = parentWidget ( ); |
261 | 262 | ||
262 | if ( p ) { | 263 | if ( p ) { |
263 | QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); | 264 | // QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); |
264 | 265 | ||
265 | QApplication::sendEvent ( p, &pme ); | 266 | // QApplication::sendEvent ( p, &pme ); |
267 | emit clicked(); | ||
266 | } | 268 | } |
267 | } | 269 | } |
268 | 270 | ||
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h index 2fc627d..c5101da 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.h +++ b/noncore/multimedia/opieplayer2/xinevideowidget.h | |||
@@ -47,24 +47,25 @@ public: | |||
47 | void setImage( QImage* image ); | 47 | void setImage( QImage* image ); |
48 | void setImage( uchar* image, int width, int height, int linestep); | 48 | void setImage( uchar* image, int width, int height, int linestep); |
49 | void clear() ; | 49 | void clear() ; |
50 | 50 | ||
51 | protected: | 51 | protected: |
52 | void paintEvent( QPaintEvent* p ); | 52 | void paintEvent( QPaintEvent* p ); |
53 | void resizeEvent ( QResizeEvent *r ); | 53 | void resizeEvent ( QResizeEvent *r ); |
54 | 54 | ||
55 | void mousePressEvent ( QMouseEvent *e ); | 55 | void mousePressEvent ( QMouseEvent *e ); |
56 | void mouseReleaseEvent ( QMouseEvent *e ); | 56 | void mouseReleaseEvent ( QMouseEvent *e ); |
57 | 57 | ||
58 | signals: | 58 | signals: |
59 | void clicked(); | ||
59 | void videoResized ( const QSize &s ); | 60 | void videoResized ( const QSize &s ); |
60 | 61 | ||
61 | private: | 62 | private: |
62 | QRect m_lastframe; | 63 | QRect m_lastframe; |
63 | QRect m_thisframe; | 64 | QRect m_thisframe; |
64 | 65 | ||
65 | uchar* m_buff; | 66 | uchar* m_buff; |
66 | int m_bytes_per_line_fb; | 67 | int m_bytes_per_line_fb; |
67 | int m_bytes_per_line_frame; | 68 | int m_bytes_per_line_frame; |
68 | int m_bytes_per_pixel; | 69 | int m_bytes_per_pixel; |
69 | QImage* m_image; | 70 | QImage* m_image; |
70 | int m_rotation; | 71 | int m_rotation; |