-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 21 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 6 |
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 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include "mediawidget.h" | 24 | #include "mediawidget.h" |
25 | #include "playlistwidget.h" | 25 | #include "playlistwidget.h" |
26 | #include "skin.h" | 26 | #include "skin.h" |
27 | 27 | ||
28 | #include <qpe/config.h> | ||
29 | #include <qpe/qpeapplication.h> | ||
30 | |||
31 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 28 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
32 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 29 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
33 | { | 30 | { |
34 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 31 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
35 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 32 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
36 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 33 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
@@ -66,17 +63,13 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, | |||
66 | 63 | ||
67 | return button; | 64 | return button; |
68 | } | 65 | } |
69 | 66 | ||
70 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) | 67 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) |
71 | { | 68 | { |
72 | Config cfg( "OpiePlayer" ); | 69 | Skin skin( fileNameInfix ); |
73 | cfg.setGroup( "Options" ); | ||
74 | QString name = cfg.readEntry( "Skin","default" ); | ||
75 | |||
76 | Skin skin( name, fileNameInfix ); | ||
77 | loadSkin( skinInfo, buttonCount, skin ); | 70 | loadSkin( skinInfo, buttonCount, skin ); |
78 | } | 71 | } |
79 | 72 | ||
80 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) | 73 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) |
81 | { | 74 | { |
82 | backgroundPixmap = skin.backgroundImage(); | 75 | 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 @@ | |||
1 | 1 | ||
2 | #include "skin.h" | 2 | #include "skin.h" |
3 | 3 | ||
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | #include <qpe/config.h> | ||
5 | 6 | ||
6 | Skin::Skin( const QString &name, const QString &fileNameInfix ) | 7 | Skin::Skin( const QString &name, const QString &fileNameInfix ) |
7 | : m_name( name ), m_fileNameInfix( fileNameInfix ) | 8 | : m_fileNameInfix( fileNameInfix ) |
9 | { | ||
10 | init( name ); | ||
11 | } | ||
12 | |||
13 | Skin::Skin( const QString &fileNameInfix ) | ||
14 | : m_fileNameInfix( fileNameInfix ) | ||
15 | { | ||
16 | init( defaultSkinName() ); | ||
17 | } | ||
18 | |||
19 | void Skin::init( const QString &name ) | ||
8 | { | 20 | { |
9 | m_skinPath = "opieplayer2/skins/" + name; | 21 | m_skinPath = "opieplayer2/skins/" + name; |
10 | } | 22 | } |
11 | 23 | ||
12 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) | 24 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) |
13 | { | 25 | { |
@@ -76,8 +88,15 @@ QImage Skin::buttonMaskImage( const QString &fileName ) const | |||
76 | QString path = prefix + fileName + ".png"; | 88 | QString path = prefix + fileName + ".png"; |
77 | it = m_buttonMasks.insert( fileName, QImage( Resource::findPixmap( path ) ) ); | 89 | it = m_buttonMasks.insert( fileName, QImage( Resource::findPixmap( path ) ) ); |
78 | } | 90 | } |
79 | return *it; | 91 | return *it; |
80 | } | 92 | } |
81 | 93 | ||
94 | QString Skin::defaultSkinName() | ||
95 | { | ||
96 | Config cfg( "OpiePlayer" ); | ||
97 | cfg.setGroup( "Options" ); | ||
98 | return cfg.readEntry( "Skin", "default" ); | ||
99 | } | ||
100 | |||
82 | /* vim: et sw=4 ts=4 | 101 | /* vim: et sw=4 ts=4 |
83 | */ | 102 | */ |
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 @@ | |||
8 | #include "mediawidget.h" | 8 | #include "mediawidget.h" |
9 | 9 | ||
10 | class Skin | 10 | class Skin |
11 | { | 11 | { |
12 | public: | 12 | public: |
13 | Skin( const QString &name, const QString &fileNameInfix ); | 13 | Skin( const QString &name, const QString &fileNameInfix ); |
14 | Skin( const QString &fileNameInfix ); | ||
14 | 15 | ||
15 | void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); | 16 | void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); |
16 | 17 | ||
17 | QImage backgroundImage() const; | 18 | QImage backgroundImage() const; |
18 | QImage buttonUpImage() const; | 19 | QImage buttonUpImage() const; |
19 | QImage buttonDownImage() const; | 20 | QImage buttonDownImage() const; |
20 | 21 | ||
21 | QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; | 22 | QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; |
22 | 23 | ||
23 | QImage buttonMaskImage( const QString &fileName ) const; | 24 | QImage buttonMaskImage( const QString &fileName ) const; |
24 | 25 | ||
26 | static QString defaultSkinName(); | ||
27 | |||
25 | private: | 28 | private: |
29 | void init( const QString &name ); | ||
30 | |||
26 | void addButtonToMask( int tag, const QImage &maskImage ) const; | 31 | void addButtonToMask( int tag, const QImage &maskImage ) const; |
27 | 32 | ||
28 | QString m_name; | ||
29 | QString m_fileNameInfix; | 33 | QString m_fileNameInfix; |
30 | QString m_skinPath; | 34 | QString m_skinPath; |
31 | 35 | ||
32 | typedef QMap<QString, QImage> ButtonMaskImageMap; | 36 | typedef QMap<QString, QImage> ButtonMaskImageMap; |
33 | 37 | ||
34 | mutable QImage m_backgroundImage; | 38 | mutable QImage m_backgroundImage; |