summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp43
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp25
4 files changed, 50 insertions, 48 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 23d12ec..fd18dbb 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -101,26 +101,3 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
- buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
- buttonMask.fill( 0 );
-
- for ( uint i = 0; i < buttonCount; i++ ) {
- Button button;
- button.command = skinInfo[ i ].command;
- button.type = skinInfo[ i ].type;
-
- QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" );
- button.mask =QBitmap( filename );
-
- if ( !button.mask.isNull() ) {
- QImage imgMask = button.mask.convertToImage();
- uchar **dest = buttonMask.jumpTable();
- for ( int y = 0; y < imgUp.height(); y++ ) {
- uchar *line = dest[y];
- for ( int x = 0; x < imgUp.width(); x++ )
- if ( !qRed( imgMask.pixel( x, y ) ) )
- line[x] = button.command + 1;
- }
- }
-
- buttons.push_back( button );
- }
+ setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 4c4cead..db16b44 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -41,2 +41,45 @@ MediaWidget::~MediaWidget()
+void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
+ const QString &imagePrefix, const QSize &buttonAreaSize )
+{
+ buttonMask = QImage( buttonAreaSize, 8, 255 );
+ buttonMask.fill( 0 );
+
+ for ( uint i = 0; i < buttonCount; ++i ) {
+ Button button = setupButton( skinInfo[ i ], imagePrefix );
+ buttons.push_back( button );
+ }
+}
+
+MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix )
+{
+ Button button;
+ button.command = buttonInfo.command;
+ button.type = buttonInfo.type;
+
+ QString fileName = imagePrefix + buttonInfo.fileName + ".png";
+
+ button.mask = setupButtonMask( button.command, fileName );
+
+ return button;
+}
+
+QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName )
+{
+ QBitmap mask( fileName );
+ if ( mask.isNull() )
+ return mask;
+
+ QImage imgMask = mask.convertToImage();
+ uchar **dest = buttonMask.jumpTable();
+ for ( int y = 0; y < buttonMask.height(); y++ ) {
+ uchar *line = dest[y];
+ for ( int x = 0; x < buttonMask.width(); x++ )
+ if ( !qRed( imgMask.pixel( x, y ) ) )
+ line[x] = command + 1;
+ }
+
+ return mask;
+}
+
void MediaWidget::closeEvent( QCloseEvent * )
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 8031371..148948a 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -85,2 +85,7 @@ signals:
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 );
+
virtual void closeEvent( QCloseEvent * );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 4901e47..d1efaad 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -96,26 +96,3 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
- buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
- buttonMask.fill( 0 );
-
- for ( uint i = 0; i < buttonCount; i++ ) {
- Button button;
- button.command = skinInfo[ i ].command;
- button.type = skinInfo[ i ].type;
-
- QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinInfo[i].fileName + ".png" );
- button.mask =QBitmap( filename );
-
- if ( !button.mask.isNull() ) {
- QImage imgMask = button.mask.convertToImage();
- uchar **dest = buttonMask.jumpTable();
- for ( int y = 0; y < imgUp.height(); y++ ) {
- uchar *line = dest[y];
- for ( int x = 0; x < imgUp.width(); x++ )
- if ( !qRed( imgMask.pixel( x, y ) ) )
- line[x] = button.command + 1;
- }
- }
-
- buttons.push_back( button );
- }
+ setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() );