summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 11:52:24 (UTC)
committer simon <simon>2002-12-11 11:52:24 (UTC)
commit9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a (patch) (side-by-side diff)
tree08bfee61215df1af5c0a9a7e2068ea3f4fb8045c
parent03ac4af4d6014bbd46b12d5fe89ee2cc73941080 (diff)
downloadopie-9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a.zip
opie-9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a.tar.gz
opie-9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a.tar.bz2
- less qimage<>qpixmap conversions
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 865ff91..70ef8d9 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -51,62 +51,63 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount
buttons.clear();
buttons.reserve( buttonCount );
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( Resource::findPixmap( fileName ) );
- if ( mask.isNull() )
- return mask;
+ QImage imgMask( Resource::findPixmap( fileName ) );
+ if ( imgMask.isNull() )
+ return QBitmap();
- 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;
+ // ### grmbl qt2. use constructor when switching to qt3.
+ QBitmap bm; bm = imgMask;
+ return bm;
}
void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix )
{
Config cfg( "OpiePlayer" );
cfg.setGroup( "Options" );
QString skin = cfg.readEntry( "Skin","default" );
loadSkin( skinInfo, buttonCount, skin, fileNameInfix );
}
void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix )
{
QString skinPath = "opieplayer2/skins/" + name;
backgroundPixmap = QPixmap( Resource::loadPixmap( QString( "%1/background" ).arg( skinPath ) ) );
buttonUpImage = QImage( Resource::loadImage( QString( "%1/skin%2_up" ).arg( skinPath ).arg( fileNameInfix ) ) );
buttonDownImage = QImage( Resource::loadImage( QString( "%1/skin%2_down" ).arg( skinPath ).arg( fileNameInfix ) ) );
setupButtons( skinInfo, buttonCount,
skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() );
}
void MediaWidget::closeEvent( QCloseEvent * )
{