author | simon <simon> | 2002-12-11 11:40:20 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 11:40:20 (UTC) |
commit | 03ac4af4d6014bbd46b12d5fe89ee2cc73941080 (patch) (side-by-side diff) | |
tree | f88296c20f73e7e46d03daff3000ef34acd31bb0 | |
parent | 9431b69a1efab055c28c77e780df012b0a476a57 (diff) | |
download | opie-03ac4af4d6014bbd46b12d5fe89ee2cc73941080.zip opie-03ac4af4d6014bbd46b12d5fe89ee2cc73941080.tar.gz opie-03ac4af4d6014bbd46b12d5fe89ee2cc73941080.tar.bz2 |
- slight simplification of XineControl constructor
- fixed a race between the video resizing and the xine initialization
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 27 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 4 |
5 files changed, 37 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 0d9a5b8..c230d6f 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -366,3 +366,3 @@ void MediaPlayer::recreateAudioAndVideoWidgets() - xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); + xineControl = new XineControl( videoUI->vidWidget(), mediaPlayerState ); connect( xineControl, SIGNAL( initialized() ), diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 14e71d9..e791c3b 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -40,7 +40,8 @@ #include "mediaplayerstate.h" +#include "xinevideowidget.h" -XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget, +XineControl::XineControl( XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) - : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) + : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { @@ -49,3 +50,2 @@ XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWi - connect ( videoContainerWidget, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); @@ -57,3 +57,3 @@ XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWi connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); - connect( libXine, SIGNAL( initialized() ), this, SIGNAL( initialized() ) ); + connect( libXine, SIGNAL( initialized() ), this, SLOT( xineInitialized() ) ); @@ -128,2 +128,10 @@ void XineControl::setGamma( int value ) { +void XineControl::xineInitialized() +{ + connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); + libXine->resize( xineVideoWidget->videoSize() ); + + emit initialized(); +} + void XineControl::stop( bool isSet ) { diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 000529c..085de3f 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -44,3 +44,3 @@ class XineControl : public QObject { public: - XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget, + XineControl( XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, @@ -103,2 +103,5 @@ public slots: +private slots: + void xineInitialized(); + private: @@ -113,2 +116,3 @@ private: MediaPlayerState &mediaPlayerState; + XineVideoWidget *xineVideoWidget; diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 1d88cea..791818e 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -110,2 +110,17 @@ void XineVideoWidget::clear ( ) +QSize XineVideoWidget::videoSize() const +{ + QSize s = size(); + bool fs = ( s == qApp->desktop()->size() ); + + // if we are in fullscreen mode, do not rotate the video + // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) + m_rotation = fs ? - qt_screen->transformOrientation() : 0; + + if ( fs && qt_screen->isTransformed() ) + s = qt_screen->mapToDevice( s ); + + return s; +} + void XineVideoWidget::paintEvent ( QPaintEvent * ) @@ -253,13 +268,3 @@ void XineVideoWidget::resizeEvent ( QResizeEvent * ) { - QSize s = size ( ); - bool fs = ( s == qApp-> desktop ( )-> size ( )); - - // if we are in fullscreen mode, do not rotate the video - // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) - m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; - - if ( fs && qt_screen-> isTransformed ( )) - s = qt_screen-> mapToDevice ( s ); - - emit videoResized ( s ); + emit videoResized( videoSize() ); } diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h index 33f1470..8b3a3ea 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.h +++ b/noncore/multimedia/opieplayer2/xinevideowidget.h @@ -52,2 +52,4 @@ public: + QSize videoSize() const; + protected: @@ -71,3 +73,3 @@ private: QImage *m_logo; - int m_rotation; + mutable int m_rotation; }; |