author | harlekin <harlekin> | 2002-08-15 20:51:11 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-15 20:51:11 (UTC) |
commit | be99f951c39d19a6e9923103434afdb293741d35 (patch) (side-by-side diff) | |
tree | 4fe4d6cc51eee0bbdd53c9b353624d104929f08b | |
parent | 157b5b1209b656960fc0b27fc077eb36a77b2c3f (diff) | |
download | opie-be99f951c39d19a6e9923103434afdb293741d35.zip opie-be99f951c39d19a6e9923103434afdb293741d35.tar.gz opie-be99f951c39d19a6e9923103434afdb293741d35.tar.bz2 |
click in fullscreen leeds to going back to the normal videowidget now
-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 @@ -50,49 +50,49 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); volControl = new VolumeControl; } MediaPlayer::~MediaPlayer() { delete xineControl; delete volControl; } void MediaPlayer::pauseCheck( bool b ) { if ( b && !mediaPlayerState->playing() ) { mediaPlayerState->setPaused( FALSE ); } } void MediaPlayer::play() { mediaPlayerState->setPlaying( FALSE ); mediaPlayerState->setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { - //mediaPlayerState->setPaused( TRUE ); + // mediaPlayerState->setPaused( FALSE ); return; } if ( mediaPlayerState->paused() ) { mediaPlayerState->setPaused( FALSE ); return; } const DocLnk *playListCurrent = playList->current(); if ( playListCurrent != NULL ) { currentFile = playListCurrent; } xineControl->play( currentFile->file() ); xineControl->length(); long seconds = mediaPlayerState->length();// QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); qDebug(time); QString tickerText; if( currentFile->file().left(4) == "http" ) tickerText= tr( " File: " ) + currentFile->name(); else 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 @@ -63,49 +63,51 @@ struct MediaButton { }; MediaButton videoButtons[] = { { FALSE, FALSE, FALSE }, // stop { TRUE, FALSE, FALSE }, // play { FALSE, FALSE, FALSE }, // previous { FALSE, FALSE, FALSE }, // next { FALSE, FALSE, FALSE }, // volUp { FALSE, FALSE, FALSE }, // volDown { TRUE, FALSE, FALSE } // fullscreen }; const char *skinV_mask_file_names[7] = { "stop","play","back","fwd","up","down","full" }; static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { setCaption( tr("OpiePlayer - Video") ); videoFrame = new XineVideoWidget ( this, "Video frame" ); + connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); + connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); Config cfg("OpiePlayer"); cfg.setGroup("Options"); skin = cfg.readEntry("Skin","default"); QString skinPath = "opieplayer2/skins/" + skin; pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); imgButtonMask->fill( 0 ); for ( int i = 0; i < 7; i++ ) { QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; masks[i] = new QBitmap( filename ); if ( !masks[i]->isNull() ) { QImage imgMask = masks[i]->convertToImage(); uchar **dest = imgButtonMask->jumpTable(); for ( int y = 0; y < imgUp->height(); y++ ) { uchar *line = dest[y]; for ( int x = 0; x < imgUp->width(); x++ ) { if ( !qRed( imgMask.pixel( x, y ) ) ) @@ -322,95 +324,100 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { } else if ( !isOnButton && videoButtons[i].isHeld ) { videoButtons[i].isHeld = FALSE; toggleButton(i); } } else { if ( videoButtons[i].isHeld ) { videoButtons[i].isHeld = FALSE; if ( !videoButtons[i].isToggle ) { setToggleButton( i, FALSE ); } switch(i) { case VideoPlay: { if( mediaPlayerState->isPaused ) { setToggleButton( i, FALSE ); mediaPlayerState->setPaused( FALSE ); return; } else if( !mediaPlayerState->isPaused ) { setToggleButton( i, TRUE ); mediaPlayerState->setPaused( TRUE ); return; } else { - // setToggleButton( i, TRUE ); - // mediaPlayerState->setPlaying( videoButtons[i].isDown ); + return; } } case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; case VideoNext: mediaPlayerState->setNext(); return; case VideoPrevious: mediaPlayerState->setPrev(); return; case VideoVolUp: emit moreReleased(); return; case VideoVolDown: emit lessReleased(); return; case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; } } } } } void VideoWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { if ( mediaPlayerState->fullscreen() ) { mediaPlayerState->setFullscreen( FALSE ); makeVisible(); } mouseMoveEvent( event ); } void VideoWidget::showEvent( QShowEvent* ) { QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); mouseMoveEvent( &event ); } + void VideoWidget::backToNormal() { + mediaPlayerState->setFullscreen( FALSE ); + makeVisible(); + } + void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); + } else { showNormal(); showMaximized(); slider->show(); - videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); + videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); qApp->processEvents(); } } void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); if ( mediaPlayerState->fullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); } else { if ( !pe->erased() ) { // Combine with background and double buffer QPixmap pix( pe->rect().size() ); QPainter p( &pix ); p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); for ( int i = 0; i < numVButtons; i++ ) { paintButton( &p, i ); } QPainter p2( this ); p2.drawPixmap( pe->rect().topLeft(), pix ); } 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 @@ -45,48 +45,49 @@ enum VideoButtons { VideoPlay, // VideoPause, VideoPrevious, VideoNext, VideoVolUp, VideoVolDown, VideoFullscreen }; class VideoWidget : public QWidget { Q_OBJECT public: VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); ~VideoWidget(); XineVideoWidget* vidWidget(); public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setPlaying( bool b); void setFullscreen( bool b ); void makeVisible(); + void backToNormal(); void setPosition( long ); void setLength( long ); void setView( char ); signals: void moreClicked(); void lessClicked(); void moreReleased(); void lessReleased(); void sliderMoved( long ); void videoResized ( const QSize &s ); protected: void resizeEvent( QResizeEvent * ); void paintEvent( QPaintEvent *pe ); void showEvent( QShowEvent *se ); void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); private: 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 @@ -228,41 +228,43 @@ void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl ) } 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 ( )); + // QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); - QApplication::sendEvent ( p, &pme ); + // QApplication::sendEvent ( p, &pme ); + // emit clicked(); } } void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) { QWidget *p = parentWidget ( ); if ( p ) { - QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); + // QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); - QApplication::sendEvent ( p, &pme ); + // QApplication::sendEvent ( p, &pme ); + emit clicked(); } } 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 @@ -35,38 +35,39 @@ #include <qwidget.h> #include "lib.h" class QImage; class XineVideoWidget : public QWidget { Q_OBJECT public: XineVideoWidget( QWidget* parent, const char* name ); ~XineVideoWidget(); QImage *image() { return m_image; }; void setImage( QImage* image ); void setImage( uchar* image, int width, int height, int linestep); void clear() ; protected: void paintEvent( QPaintEvent* p ); void resizeEvent ( QResizeEvent *r ); void mousePressEvent ( QMouseEvent *e ); void mouseReleaseEvent ( QMouseEvent *e ); signals: + void clicked(); void videoResized ( const QSize &s ); private: QRect m_lastframe; QRect m_thisframe; uchar* m_buff; int m_bytes_per_line_fb; int m_bytes_per_line_frame; int m_bytes_per_pixel; QImage* m_image; int m_rotation; }; |