summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp9
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp21
-rw-r--r--noncore/multimedia/opieplayer2/skin.h6
3 files changed, 26 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 0d1c8b6..ab23aa8 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -22,15 +22,12 @@
#include "mediawidget.h"
#include "playlistwidget.h"
#include "skin.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 ) ),
@@ -66,17 +63,13 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo,
return button;
}
void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix )
{
- Config cfg( "OpiePlayer" );
- cfg.setGroup( "Options" );
- QString name = cfg.readEntry( "Skin","default" );
-
- Skin skin( name, fileNameInfix );
+ Skin skin( fileNameInfix );
loadSkin( skinInfo, buttonCount, skin );
}
void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
{
backgroundPixmap = skin.backgroundImage();
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index d3918d1..8281b20 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -1,13 +1,25 @@
#include "skin.h"
#include <qpe/resource.h>
+#include <qpe/config.h>
Skin::Skin( const QString &name, const QString &fileNameInfix )
- : m_name( name ), m_fileNameInfix( fileNameInfix )
+ : m_fileNameInfix( fileNameInfix )
+{
+ init( name );
+}
+
+Skin::Skin( const QString &fileNameInfix )
+ : m_fileNameInfix( fileNameInfix )
+{
+ init( defaultSkinName() );
+}
+
+void Skin::init( const QString &name )
{
m_skinPath = "opieplayer2/skins/" + name;
}
void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount )
{
@@ -76,8 +88,15 @@ QImage Skin::buttonMaskImage( const QString &fileName ) const
QString path = prefix + fileName + ".png";
it = m_buttonMasks.insert( fileName, QImage( Resource::findPixmap( path ) ) );
}
return *it;
}
+QString Skin::defaultSkinName()
+{
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup( "Options" );
+ return cfg.readEntry( "Skin", "default" );
+}
+
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h
index ee19f4b..58f1849 100644
--- a/noncore/multimedia/opieplayer2/skin.h
+++ b/noncore/multimedia/opieplayer2/skin.h
@@ -8,27 +8,31 @@
#include "mediawidget.h"
class Skin
{
public:
Skin( const QString &name, const QString &fileNameInfix );
+ Skin( const QString &fileNameInfix );
void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount );
QImage backgroundImage() const;
QImage buttonUpImage() const;
QImage buttonDownImage() const;
QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const;
QImage buttonMaskImage( const QString &fileName ) const;
+ static QString defaultSkinName();
+
private:
+ void init( const QString &name );
+
void addButtonToMask( int tag, const QImage &maskImage ) const;
- QString m_name;
QString m_fileNameInfix;
QString m_skinPath;
typedef QMap<QString, QImage> ButtonMaskImageMap;
mutable QImage m_backgroundImage;