-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 @@ -89,43 +89,5 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye 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) ) ); @@ -143,5 +105,4 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye // setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState.isPlaying() ); - } @@ -230,4 +191,46 @@ void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { } +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 ) { 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 @@ -69,4 +69,6 @@ public: virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); + virtual void loadSkin(); + signals: void sliderMoved(long); 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 @@ -13,5 +13,5 @@ int main(int argc, char **argv) { MediaPlayer mp( pl, st, 0, "mediaPlayer" ); QObject::connect( &pl, SIGNAL( skinSelected() ), - &mp, SLOT( recreateAudioAndVideoWidgets() ) ); + &mp, SLOT( reloadSkins() ) ); a.showMainDocumentWidget(&pl); 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 @@ -368,2 +368,8 @@ void MediaPlayer::recreateAudioAndVideoWidgets() } +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 @@ -56,4 +56,5 @@ public: public slots: void recreateAudioAndVideoWidgets(); + void reloadSkins(); private slots: 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 @@ -46,4 +46,7 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount buttonMask.fill( 0 ); + buttons.clear(); + buttons.reserve( buttonCount ); + for ( uint i = 0; i < buttonCount; ++i ) { Button button = setupButton( skinInfo[ i ], imagePrefix ); 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 @@ -73,4 +73,6 @@ public slots: virtual void setPlaying( bool playing ) = 0; + virtual void loadSkin() = 0; + signals: void moreReleased(); 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 @@ -80,5 +80,4 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye setCaption( tr("OpiePlayer - Video") ); - videoFrame = new XineVideoWidget ( this, "Video frame" ); @@ -86,24 +85,7 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye 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() ); @@ -202,4 +184,29 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) } +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 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 @@ -67,4 +67,6 @@ public: virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); + virtual void loadSkin(); + signals: void moreClicked(); |