summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h8
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/skin.h2
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()
void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
- const QString &imagePrefix, const QSize &buttonAreaSize )
+ const Skin &skin, const QSize &buttonAreaSize )
{
@@ -55,3 +55,3 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount
for ( uint i = 0; i < buttonCount; ++i ) {
- Button button = setupButton( skinInfo[ i ], imagePrefix );
+ Button button = setupButton( skinInfo[ i ], skin );
buttons.push_back( button );
@@ -60,3 +60,3 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount
-MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix )
+MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
{
@@ -66,5 +66,3 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo,
- QString fileName = imagePrefix + buttonInfo.fileName + ".png";
-
- button.mask = setupButtonMask( button.command, fileName );
+ button.mask = setupButtonMask( button.command, skin.buttonMaskImage( buttonInfo.fileName ) );
@@ -73,6 +71,5 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo,
-QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName )
+QBitmap MediaWidget::setupButtonMask( const Command &command, const QImage &maskImage )
{
- QImage imgMask( Resource::findPixmap( fileName ) );
- if ( imgMask.isNull() )
+ if ( maskImage.isNull() )
return QBitmap();
@@ -83,3 +80,3 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil
for ( int x = 0; x < buttonMask.width(); x++ )
- if ( !qRed( imgMask.pixel( x, y ) ) )
+ if ( !qRed( maskImage.pixel( x, y ) ) )
line[x] = command + 1;
@@ -88,3 +85,3 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil
// ### grmbl qt2. use constructor when switching to qt3.
- QBitmap bm; bm = imgMask;
+ QBitmap bm; bm = maskImage;
return bm;
@@ -110,4 +107,3 @@ void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, co
- setupButtons( skinInfo, buttonCount,
- skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() );
+ setupButtons( skinInfo, buttonCount, skin, buttonUpImage.size() );
}
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
+class Skin;
+
class MediaWidget : public QWidget
@@ -102,5 +104,5 @@ 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 );
+ const Skin &skin, const QSize &buttonAreaSize );
+ Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin );
+ QBitmap setupButtonMask( const Command &command, const QImage &maskImage );
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
+QImage Skin::buttonMaskImage( const QString &fileName ) const
+{
+ QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix );
+ QString path = prefix + fileName + ".png";
+ return QImage( Resource::findPixmap( path ) );
+}
+
/* 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:
+ QImage buttonMaskImage( const QString &fileName ) const;
+
private: