-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 8 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 2 |
4 files changed, 23 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 2031b4d..4de7ea9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -46,3 +46,3 @@ MediaWidget::~MediaWidget() | |||
46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
47 | const QString &imagePrefix, const QSize &buttonAreaSize ) | 47 | const Skin &skin, const QSize &buttonAreaSize ) |
48 | { | 48 | { |
@@ -55,3 +55,3 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount | |||
55 | for ( uint i = 0; i < buttonCount; ++i ) { | 55 | for ( uint i = 0; i < buttonCount; ++i ) { |
56 | Button button = setupButton( skinInfo[ i ], imagePrefix ); | 56 | Button button = setupButton( skinInfo[ i ], skin ); |
57 | buttons.push_back( button ); | 57 | buttons.push_back( button ); |
@@ -60,3 +60,3 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount | |||
60 | 60 | ||
61 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ) | 61 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
62 | { | 62 | { |
@@ -66,5 +66,3 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, | |||
66 | 66 | ||
67 | QString fileName = imagePrefix + buttonInfo.fileName + ".png"; | 67 | button.mask = setupButtonMask( button.command, skin.buttonMaskImage( buttonInfo.fileName ) ); |
68 | |||
69 | button.mask = setupButtonMask( button.command, fileName ); | ||
70 | 68 | ||
@@ -73,6 +71,5 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, | |||
73 | 71 | ||
74 | QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName ) | 72 | QBitmap MediaWidget::setupButtonMask( const Command &command, const QImage &maskImage ) |
75 | { | 73 | { |
76 | QImage imgMask( Resource::findPixmap( fileName ) ); | 74 | if ( maskImage.isNull() ) |
77 | if ( imgMask.isNull() ) | ||
78 | return QBitmap(); | 75 | return QBitmap(); |
@@ -83,3 +80,3 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil | |||
83 | for ( int x = 0; x < buttonMask.width(); x++ ) | 80 | for ( int x = 0; x < buttonMask.width(); x++ ) |
84 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 81 | if ( !qRed( maskImage.pixel( x, y ) ) ) |
85 | line[x] = command + 1; | 82 | line[x] = command + 1; |
@@ -88,3 +85,3 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil | |||
88 | // ### grmbl qt2. use constructor when switching to qt3. | 85 | // ### grmbl qt2. use constructor when switching to qt3. |
89 | QBitmap bm; bm = imgMask; | 86 | QBitmap bm; bm = maskImage; |
90 | return bm; | 87 | return bm; |
@@ -110,4 +107,3 @@ void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, co | |||
110 | 107 | ||
111 | setupButtons( skinInfo, buttonCount, | 108 | setupButtons( skinInfo, buttonCount, skin, buttonUpImage.size() ); |
112 | skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() ); | ||
113 | } | 109 | } |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 52b9fcb..0d635aa 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -45,2 +45,4 @@ namespace | |||
45 | 45 | ||
46 | class Skin; | ||
47 | |||
46 | class MediaWidget : public QWidget | 48 | class MediaWidget : public QWidget |
@@ -102,5 +104,5 @@ protected: | |||
102 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 104 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
103 | const QString &imagePrefix, const QSize &buttonAreaSize ); | 105 | const Skin &skin, const QSize &buttonAreaSize ); |
104 | Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ); | 106 | Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); |
105 | QBitmap setupButtonMask( const Command &command, const QString &fileName ); | 107 | QBitmap setupButtonMask( const Command &command, const QImage &maskImage ); |
106 | 108 | ||
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index 352368f..fb1c9c4 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -26,2 +26,9 @@ QImage Skin::buttonDownImage() const | |||
26 | 26 | ||
27 | QImage Skin::buttonMaskImage( const QString &fileName ) const | ||
28 | { | ||
29 | QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix ); | ||
30 | QString path = prefix + fileName + ".png"; | ||
31 | return QImage( Resource::findPixmap( path ) ); | ||
32 | } | ||
33 | |||
27 | /* vim: et sw=4 ts=4 | 34 | /* vim: et sw=4 ts=4 |
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h index 85f9e57..f160b3c 100644 --- a/noncore/multimedia/opieplayer2/skin.h +++ b/noncore/multimedia/opieplayer2/skin.h | |||
@@ -15,2 +15,4 @@ public: | |||
15 | 15 | ||
16 | QImage buttonMaskImage( const QString &fileName ) const; | ||
17 | |||
16 | private: | 18 | private: |