summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 01:09:30 (UTC)
committer simon <simon>2002-12-11 01:09:30 (UTC)
commit7e71955ef58a502d6a6dd2384c3f55bd852d649a (patch) (side-by-side diff)
tree99096f2de6d579ddfa461495cddd07f40859e4d4
parent212b7605f9e86d2161e11f65498c37acd1863300 (diff)
downloadopie-7e71955ef58a502d6a6dd2384c3f55bd852d649a.zip
opie-7e71955ef58a502d6a6dd2384c3f55bd852d649a.tar.gz
opie-7e71955ef58a502d6a6dd2384c3f55bd852d649a.tar.bz2
- centralize more of the skin loading code, so it can be factored out later
more easily
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp11
4 files changed, 28 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 0b7cc45..bb686f1 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -187,28 +187,17 @@ 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) ) );
- buttonUpImage = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
- buttonDownImage = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
-
- setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", buttonUpImage.size() );
+ loadDefaultSkin( skinInfo, buttonCount );
setBackgroundPixmap( backgroundPixmap );
songInfo.setFocusPolicy( QWidget::NoFocus );
// changeTextColor( &songInfo );
// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
// songInfo.setFrameStyle( QFrame::NoFrame);
songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index d60dc0d..c9d7db8 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -19,16 +19,19 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "mediawidget.h"
#include "playlistwidget.h"
+#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
+
MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
: QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
{
connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
this, SLOT( setLength( long ) ) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
@@ -80,16 +83,36 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil
for ( int x = 0; x < buttonMask.width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = command + 1;
}
return mask;
}
+void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix )
+{
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup( "Options" );
+ QString skin = cfg.readEntry( "Skin","default" );
+
+ loadSkin( skinInfo, buttonCount, skin, fileNameInfix );
+}
+
+void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix )
+{
+ QString skinPath = "opieplayer2/skins/" + name;
+ backgroundPixmap = QPixmap( Resource::loadPixmap( QString( "%1/background" ).arg( skinPath ) ) );
+ buttonUpImage = QImage( Resource::loadImage( QString( "%1/skin%2_up" ).arg( skinPath ).arg( fileNameInfix ) ) );
+ buttonDownImage = QImage( Resource::loadImage( QString( "%1/skin%2_down" ).arg( skinPath ).arg( fileNameInfix ) ) );
+
+ setupButtons( skinInfo, buttonCount,
+ QPEApplication::qpeDir() + "/pics/" + skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() );
+}
+
void MediaWidget::closeEvent( QCloseEvent * )
{
mediaPlayerState.setList();
}
void MediaWidget::paintEvent( QPaintEvent *pe )
{
QPainter p( this );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 754228e..52b9fcb 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -99,16 +99,19 @@ signals:
void lessClicked();
protected:
void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
const QString &imagePrefix, const QSize &buttonAreaSize );
Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix );
QBitmap setupButtonMask( const Command &command, const QString &fileName );
+ void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null );
+ void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix );
+
virtual void closeEvent( QCloseEvent * );
virtual void paintEvent( QPaintEvent *pe );
Button *buttonAt( const QPoint &position );
virtual void mousePressEvent( QMouseEvent *event );
virtual void mouseReleaseEvent( QMouseEvent *event );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 0047ac0..bc47717 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -180,26 +180,17 @@ 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");
- QString skin = cfg.readEntry("Skin","default");
-
- QString skinPath = "opieplayer2/skins/" + skin;
- backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
- buttonUpImage = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
- buttonDownImage = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
-
- setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", buttonUpImage.size() );
+ loadDefaultSkin( skinInfo, buttonCount, "V" );
setBackgroundPixmap( backgroundPixmap );
delete slider;
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( backgroundPixmap );