author | harlekin <harlekin> | 2002-08-02 11:38:17 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-02 11:38:17 (UTC) |
commit | d3a54af5288cd30fc1a4f2dafc9f848b245046d6 (patch) (side-by-side diff) | |
tree | 7390858ac62708bfc81078493e580a57297c61fa | |
parent | 471dc69956af37e7c5f481c10482f280db853491 (diff) | |
download | opie-d3a54af5288cd30fc1a4f2dafc9f848b245046d6.zip opie-d3a54af5288cd30fc1a4f2dafc9f848b245046d6.tar.gz opie-d3a54af5288cd30fc1a4f2dafc9f848b245046d6.tar.bz2 |
theme work
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 38 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 1 |
4 files changed, 26 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 689366e..300a5c8 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -140,49 +140,49 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : songInfo.setFocusPolicy( QWidget::NoFocus ); changeTextColor( &songInfo ); slider.setFixedHeight( 20 ); slider.setMinValue( 0 ); slider.setMaxValue( 1 ); slider.setFocusPolicy( QWidget::NoFocus ); slider.setBackgroundPixmap( *pixBg ); time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); time.setFrame(FALSE); changeTextColor( &time ); resizeEvent( NULL ); connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); - + // Intialise state setLength( mediaPlayerState->length() ); setPosition( mediaPlayerState->position() ); setLooping( mediaPlayerState->fullscreen() ); setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState->playing() ); } AudioWidget::~AudioWidget() { for ( int i = 0; i < 11; i++ ) { delete buttonPixUp[i]; delete buttonPixDown[i]; } delete pixBg; delete imgUp; delete imgDn; delete imgButtonMask; for ( int i = 0; i < 11; i++ ) { delete masks[i]; } } diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index bce6b89..48caf00 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -65,86 +65,91 @@ struct MediaButton { }; // Layout information for the videoButtons (and if it is a toggle button or not) MediaButton videoButtons[] = { { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen }; static const int numButtons = (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") ); Config cfg("OpiePlayer"); cfg.setGroup("VideoWidget"); - QString backgroundPix, Button0aPix, Button0bPix, controlsPix; - backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); + QString Button0aPix, Button0bPix, controlsPix; + //backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); + cfg.setGroup("AudioWidget"); + QString skin = cfg.readEntry("Skin","default"); + QString skinPath = "opieplayer/skins/" + skin; + backgroundPix = QString("%1/background").arg(skinPath) ; + setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setGeometry( QRect( 7, 250, 220, 20 ) ); connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); // Intialise state setLength( mediaPlayerState->length() ); setPosition( mediaPlayerState->position() ); setFullscreen( mediaPlayerState->fullscreen() ); setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState->playing() ); videoFrame = new XineVideoWidget( 240, 155 ,this, "Video frame" ); - videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); + } VideoWidget::~VideoWidget() { for ( int i = 0; i < 3; i++ ) { delete pixmaps[i]; } delete currentFrame; } static bool videoSliderBeingMoved = FALSE; void VideoWidget::sliderPressed() { videoSliderBeingMoved = TRUE; } void VideoWidget::sliderReleased() { videoSliderBeingMoved = FALSE; if ( slider->width() == 0 ) { return; } @@ -248,72 +253,75 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoPlayList: mediaPlayerState->setList(); 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::makeVisible() { - if ( mediaPlayerState->fullscreen() ) { - setBackgroundMode( QWidget::NoBackground ); - showFullScreen(); - resize( qApp->desktop()->size() ); - slider->hide(); - } else { - setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); - showNormal(); - showMaximized(); - slider->show(); - } + if ( mediaPlayerState->fullscreen() ) { + setBackgroundMode( QWidget::NoBackground ); + showFullScreen(); + resize( qApp->desktop()->size() ); + slider->hide(); + } else { + setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); + showNormal(); + showMaximized(); + slider->show(); + } } void VideoWidget::paintEvent( QPaintEvent * ) { QPainter p( this ); if ( mediaPlayerState->fullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); videoFrame->setGeometry( QRect( 0, 0 , 240 ,340 ) ); - + } else { + + videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); // draw the buttons + for ( int i = 0; i < numButtons; i++ ) { paintButton( &p, i ); } // draw the slider slider->repaint( TRUE ); } } void VideoWidget::closeEvent( QCloseEvent* ) { mediaPlayerState->setList(); } bool VideoWidget::playVideo() { bool result = FALSE; int stream = 0; int sw = 240; int sh = 320; int dd = QPixmap::defaultDepth(); int w = height(); int h = width(); diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 8f98889..0122d5d 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -65,36 +65,37 @@ public slots: void setPaused( bool b) { setToggleButton( VideoPause, b ); } void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); } void makeVisible(); void setPosition( long ); void setLength( long ); void setView( char ); signals: void sliderMoved( long ); protected: void paintEvent( QPaintEvent *pe ); void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); private: 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; }; #endif // VIDEO_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 3be9fa4..3faeab1 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -24,48 +24,49 @@ : = ...= . :.=- -. .:....=;==+<; 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. */ #include <qtimer.h> #include "xinecontrol.h" #include "mediaplayerstate.h" #include "videowidget.h" extern MediaPlayerState *mediaPlayerState; extern VideoWidget *videoUI; XineControl::XineControl( QObject *parent, const char *name ) : QObject( parent, name ) { libXine = new XINE::Lib(videoUI->vidWidget() ); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) ); + connect(this, SIGNAL( postitionChanged(int position) ), mediaPlayerState, SLOT( setPosition( long p ) ) ); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); } XineControl::~XineControl() { delete libXine; } void XineControl::play( const QString& fileName ) { libXine->play( fileName ); mediaPlayerState->setPlaying( true ); // default to audio view until we know how to handle video // MediaDetect mdetect; char whichGui = mdetect.videoOrAudio( fileName ); if (whichGui == 'f') { qDebug("Nicht erkannter Dateityp"); return; } if (whichGui == 'a') { libXine->setShowVideo( false ); } else { |