-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 83 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 47 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
9 files changed, 87 insertions, 61 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index fd18dbb..0516089 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -85,51 +85,13 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), audioSliderBeingMoved( false ) { setCaption( tr("OpiePlayer") ); - Config cfg("OpiePlayer"); - cfg.setGroup("Options"); - skin = cfg.readEntry("Skin","default"); - //skin = "scaleTest"; - // color of background, frame, degree of transparency - - QString skinPath = "opieplayer2/skins/" + skin; - backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); - imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); - imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); - - setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); - - setBackgroundPixmap( backgroundPixmap ); - - songInfo.setFocusPolicy( QWidget::NoFocus ); -// changeTextColor( &songInfo ); -// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); -// songInfo.setFrameStyle( QFrame::NoFrame); - songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); -// songInfo.setForegroundColor(Qt::white); - - slider.setFixedHeight( 20 ); - slider.setMinValue( 0 ); - slider.setMaxValue( 1 ); - slider.setFocusPolicy( QWidget::NoFocus ); - slider.setBackgroundPixmap( backgroundPixmap ); - -// Config cofg("qpe"); -// cofg.setGroup("Appearance"); -// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); - - time.setFocusPolicy( QWidget::NoFocus ); - time.setAlignment( Qt::AlignCenter ); - -// time.setFrame(FALSE); -// changeTextColor( &time ); - - resizeEvent( NULL ); + loadSkin(); connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); @@ -139,13 +101,12 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye // Intialise state setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setLooping( mediaPlayerState.isFullscreen() ); // setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState.isPlaying() ); - } AudioWidget::~AudioWidget() { // mediaPlayerState->setPlaying(false); } @@ -226,12 +187,54 @@ void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { } killTimers(); hide(); } +void AudioWidget::loadSkin() +{ + Config cfg("OpiePlayer"); + cfg.setGroup("Options"); + skin = cfg.readEntry("Skin","default"); + //skin = "scaleTest"; + // color of background, frame, degree of transparency + + QString skinPath = "opieplayer2/skins/" + skin; + backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); + imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); + imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); + + setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); + + setBackgroundPixmap( backgroundPixmap ); + + songInfo.setFocusPolicy( QWidget::NoFocus ); +// changeTextColor( &songInfo ); +// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); +// songInfo.setFrameStyle( QFrame::NoFrame); + songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); +// songInfo.setForegroundColor(Qt::white); + + slider.setFixedHeight( 20 ); + slider.setMinValue( 0 ); + slider.setMaxValue( 1 ); + slider.setFocusPolicy( QWidget::NoFocus ); + slider.setBackgroundPixmap( backgroundPixmap ); + +// Config cofg("qpe"); +// cofg.setGroup("Appearance"); +// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); + + time.setFocusPolicy( QWidget::NoFocus ); + time.setAlignment( Qt::AlignCenter ); + +// time.setFrame(FALSE); +// changeTextColor( &time ); + + resizeEvent( 0 ); +} void AudioWidget::setSeekable( bool isSeekable ) { if ( !isSeekable ) { qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); if( !slider.isHidden()) { diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 53982a1..61556c6 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -65,12 +65,14 @@ public slots: public: virtual void setLength( long ); virtual void setPlaying( bool b) { setToggleButton( Play, b ); } virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); + virtual void loadSkin(); + signals: void sliderMoved(long); protected: void doBlank(); void doUnblank(); diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index ffc7cb6..f87cee8 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp @@ -9,13 +9,13 @@ int main(int argc, char **argv) { MediaPlayerState st( 0, "mediaPlayerState" ); PlayListWidget pl( st, 0, "playList" ); pl.showMaximized(); MediaPlayer mp( pl, st, 0, "mediaPlayer" ); QObject::connect( &pl, SIGNAL( skinSelected() ), - &mp, SLOT( recreateAudioAndVideoWidgets() ) ); + &mp, SLOT( reloadSkins() ) ); a.showMainDocumentWidget(&pl); return a.exec(); } diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index e1bfc2d..8a3d3e0 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -364,6 +364,12 @@ void MediaPlayer::recreateAudioAndVideoWidgets() connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); } +void MediaPlayer::reloadSkins() +{ + audioUI->loadSkin(); + videoUI->loadSkin(); +} + diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index dc306c4..6b316f6 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -52,12 +52,13 @@ class MediaPlayer : public QObject { public: MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); ~MediaPlayer(); public slots: void recreateAudioAndVideoWidgets(); + void reloadSkins(); private slots: void setPlaying( bool ); void pauseCheck( bool ); void play(); void next(); diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index db16b44..d60dc0d 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -42,12 +42,15 @@ MediaWidget::~MediaWidget() void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &imagePrefix, const QSize &buttonAreaSize ) { buttonMask = QImage( buttonAreaSize, 8, 255 ); buttonMask.fill( 0 ); + buttons.clear(); + buttons.reserve( buttonCount ); + for ( uint i = 0; i < buttonCount; ++i ) { Button button = setupButton( skinInfo[ i ], imagePrefix ); buttons.push_back( button ); } } diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 148948a..8c781e9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -69,12 +69,14 @@ public: public slots: virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; virtual void setLength( long length ) = 0; virtual void setPlaying( bool playing ) = 0; + virtual void loadSkin() = 0; + signals: void moreReleased(); void lessReleased(); void forwardReleased(); void backReleased(); void forwardClicked(); diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index d1efaad..a03d43e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -76,38 +76,20 @@ const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) { 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"); + slider = 0; - QString skinPath = "opieplayer2/skins/" + skin; - backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); - imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); - imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); - - setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() ); - - setBackgroundPixmap( backgroundPixmap ); - - slider = new QSlider( Qt::Horizontal, this ); - slider->setMinValue( 0 ); - slider->setMaxValue( 1 ); - slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); - //slider->setFocusPolicy( QWidget::NoFocus ); - - resizeEvent( NULL ); + loadSkin(); setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setFullscreen( mediaPlayerState.isFullscreen() ); setPlaying( mediaPlayerState.isPlaying() ); } @@ -198,12 +180,37 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) // Effectively blank the view next time we show it so it looks nicer scaledWidth = 0; scaledHeight = 0; hide(); } +void VideoWidget::loadSkin() +{ + Config cfg("OpiePlayer"); + cfg.setGroup("Options"); + skin = cfg.readEntry("Skin","default"); + + QString skinPath = "opieplayer2/skins/" + skin; + backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); + imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); + imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); + + setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() ); + + setBackgroundPixmap( backgroundPixmap ); + + delete slider; + slider = new QSlider( Qt::Horizontal, this ); + slider->setMinValue( 0 ); + slider->setMaxValue( 1 ); + slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); + //slider->setFocusPolicy( QWidget::NoFocus ); + + resizeEvent( 0 ); +} + void VideoWidget::updateSlider( long i, long max ) { // Will flicker too much if we don't do this if ( max == 0 ) { return; } int width = slider->width(); diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 21a4e9e..87be371 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -63,12 +63,14 @@ public slots: public: virtual void setPlaying( bool b); virtual void setLength( long ); virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); + virtual void loadSkin(); + signals: void moreClicked(); void lessClicked(); void sliderMoved( long ); void videoResized ( const QSize &s ); |