author | harlekin <harlekin> | 2002-11-10 16:43:22 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-10 16:43:22 (UTC) |
commit | 5a8660a4089fa2160da47e2a4d63baea431b48b1 (patch) (side-by-side diff) | |
tree | 4d4e7edb3c8fe6dc741fb19c6f5587093f7d4a57 | |
parent | cb4821802897bbf6e06be3b2608656e05db68b96 (diff) | |
download | opie-5a8660a4089fa2160da47e2a4d63baea431b48b1.zip opie-5a8660a4089fa2160da47e2a4d63baea431b48b1.tar.gz opie-5a8660a4089fa2160da47e2a4d63baea431b48b1.tar.bz2 |
update
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 21 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
2 files changed, 11 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index a847605..c643273 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -96,97 +96,96 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 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( QPEApplication::qpeDir() + "/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 ) ) ) line[x] = i + 1; } } } } for ( int i = 0; i < 7; i++ ) { buttonPixUp[i] = NULL; buttonPixDown[i] = NULL; } setBackgroundPixmap( *pixBg ); slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); //slider->setFocusPolicy( QWidget::NoFocus ); resizeEvent( NULL ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); - connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); setLength( mediaPlayerState->length() ); setPosition( mediaPlayerState->position() ); setFullscreen( mediaPlayerState->fullscreen() ); setPlaying( mediaPlayerState->playing() ); } VideoWidget::~VideoWidget() { for ( int i = 0; i < 7; i++ ) { delete buttonPixUp[i]; delete buttonPixDown[i]; } delete pixBg; delete imgUp; delete imgDn; delete imgButtonMask; for ( int i = 0; i < 7; i++ ) { delete masks[i]; } } QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { QPixmap pix( img.width(), img.height() ); QPainter p( &pix ); p.drawTiledPixmap( pix.rect(), bg, offset ); p.drawImage( 0, 0, img ); return new QPixmap( pix ); } QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { QPixmap *pixmap = new QPixmap( pix ); pixmap->setMask( mask ); return pixmap; } void VideoWidget::resizeEvent( QResizeEvent * ) { int h = height(); int w = width(); //int Vh = 160; //int Vw = 220; slider->setFixedWidth( w - 20 ); slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider->setBackgroundOrigin( QWidget::ParentOrigin ); @@ -336,171 +335,173 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { setToggleButton( i, TRUE ); mediaPlayerState->setPaused( TRUE ); return; } else { return; } } case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; case VideoPrevious: if(playList->whichList() ==0) 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 ( )); + + slider->hide(); + disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); + disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); + } else { showNormal(); showMaximized(); setBackgroundPixmap( *pixBg ); QWidget *d = QApplication::desktop(); int w = d->width(); int h = d->height(); if(w>h) { int newW=(w/2)-(246/2); //this will only work with 320x240 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); } else { videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); } - } -} - - -void VideoWidget::setSeekable( bool isSeekable ) { - if ( !isSeekable || mediaPlayerState->fullscreen() ) { - qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); + if ( !mediaPlayerState->seekable() ) { if( !slider->isHidden()) { slider->hide(); } disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } else { slider->show(); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } } +} + + 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 { QPainter p( this ); for ( int i = 0; i < numVButtons; i++ ) paintButton( &p, i ); } //slider->repaint( TRUE ); } } void VideoWidget::closeEvent( QCloseEvent* ) { mediaPlayerState->setList(); } - void VideoWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts // hide(); break; case Key_F11: //menu break; case Key_F12: //home break; case Key_F13: //mail break; case Key_Space: { if(mediaPlayerState->playing()) { mediaPlayerState->setPlaying(FALSE); } else { mediaPlayerState->setPlaying(TRUE); } } break; case Key_Down: // toggleButton(6); emit lessClicked(); emit lessReleased(); // toggleButton(6); break; case Key_Up: // toggleButton(5); emit moreClicked(); emit moreReleased(); // toggleButton(5); break; case Key_Right: mediaPlayerState->setNext(); break; case Key_Left: mediaPlayerState->setPrev(); break; case Key_Escape: break; }; } diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index fd02805..990fa5f 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -24,97 +24,96 @@ : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef VIDEO_WIDGET_H #define VIDEO_WIDGET_H #include <qwidget.h> #include "xinevideowidget.h" class QPixmap; class QSlider; enum VideoButtons { VideoStop = 0, 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 setSeekable( bool ); 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: // Ticker songInfo; QPixmap *pixBg; QImage *imgUp; QImage *imgDn; QImage *imgButtonMask; QBitmap *masks[7]; QPixmap *buttonPixUp[7]; QPixmap *buttonPixDown[7]; QString skin; // QPixmap *pixmaps[4]; int xoff, yoff; void paintButton( QPainter *p, int i ); void toggleButton( int ); void setToggleButton( int, bool ); QString backgroundPix; QSlider *slider; QPixmap *pixmaps[3]; QImage *currentFrame; int scaledWidth; int scaledHeight; XineVideoWidget* videoFrame; }; |