author | sandman <sandman> | 2002-08-03 23:58:20 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-03 23:58:20 (UTC) |
commit | 0cecd08dba036f39e414e34a2b7c070008ee3884 (patch) (side-by-side diff) | |
tree | c187c9308f0553b1d5d9cd59093bcc3c11740665 /noncore/multimedia/opieplayer2/xinevideowidget.cpp | |
parent | 8fb605fdfbbcbc654f567efcb59f02ec0d26228a (diff) | |
download | opie-0cecd08dba036f39e414e34a2b7c070008ee3884.zip opie-0cecd08dba036f39e414e34a2b7c070008ee3884.tar.gz opie-0cecd08dba036f39e414e34a2b7c070008ee3884.tar.bz2 |
Added support for fullscreen playback
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 95 |
1 files changed, 66 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 4b69044..98446a0 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -40,2 +40,3 @@ #include <qsize.h> +#include <qapplication.h> @@ -45,2 +46,3 @@ + static inline void memcpy_rev ( void *dst, void *src, size_t len ) @@ -76,17 +78,15 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st -XineVideoWidget::XineVideoWidget( int width, - int height, - QWidget* parent, - const char* name ) +XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) { - m_image = new QImage ( width, height, qt_screen-> depth ( )); - m_buff = 0; setBackgroundMode ( NoBackground ); - /* QImage image = Resource::loadImage("SoundPlayer"); - image = image.smoothScale( width, height ); - - m_image = new QImage( image );*/ + + m_image = 0; + m_buff = 0; + m_bytes_per_line_fb = qt_screen-> linestep ( ); + m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; + m_rotation = 0; } + XineVideoWidget::~XineVideoWidget ( ) @@ -108,3 +108,4 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) p. fillRect ( rect ( ), black ); - p. drawImage ( 0, 0, *m_image ); + if ( m_image ) + p. drawImage ( 0, 0, *m_image ); //qWarning ( "logo\n" ); @@ -119,3 +120,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) - int rot = dp. transformOrientation ( ); + int rot = dp. transformOrientation ( ) + m_rotation; @@ -199,11 +200,2 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) -int XineVideoWidget::height ( ) const -{ - return m_image-> height ( ); -} - -int XineVideoWidget::width ( ) const -{ - return m_image-> width ( ); -} @@ -215,14 +207,19 @@ void XineVideoWidget::setImage ( QImage* image ) -void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, - int xoffsetXBytes, int width, - int height, int linestep, int bytes, int bpp ) +void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl ) { + bool rot90 = (( -m_rotation ) & 1 ); + + if ( rot90 ) { + int d = w; + w = h; + h = d; + } m_lastframe = m_thisframe; - m_thisframe. setRect ( xoffsetXBytes, yoffsetXLine, width, height ); + m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); - m_buff = image; - m_bytes_per_line_fb = linestep; - m_bytes_per_line_frame = bytes; - m_bytes_per_pixel = bpp; +// qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); + + m_buff = img; + m_bytes_per_line_frame = bpl; @@ -230 +227,41 @@ void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, } + +void XineVideoWidget::resizeEvent ( QResizeEvent * ) +{ + QSize s = size ( ); + bool fs = ( s == qApp-> desktop ( )-> size ( )); + + m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; + + if ( fs && qt_screen-> isTransformed ( )) { + s = qt_screen-> mapToDevice ( s ); + } + +// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); + + emit videoResized ( s ); +} + + +void XineVideoWidget::mousePressEvent ( QMouseEvent *me ) +{ + QWidget *p = parentWidget ( ); + + if ( p ) { + QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); + + QApplication::sendEvent ( p, &pme ); + } +} + +void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) +{ + QWidget *p = parentWidget ( ); + + if ( p ) { + QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); + + QApplication::sendEvent ( p, &pme ); + } +} + |