Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 6e9c14a..87e06ee 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -105,34 +105,29 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); buttonMask.fill( 0 ); - masks.reserve( buttonCount ); - - for ( uint i = 0; i < masks.capacity(); i++ ) { + for ( uint i = 0; i < buttons.size(); i++ ) { QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); - masks.push_back( QBitmap( filename ) ); + buttons[ i ].mask =QBitmap( filename ); - if ( !masks[i].isNull() ) { - QImage imgMask = masks[i].convertToImage(); + if ( !buttons[i].mask.isNull() ) { + QImage imgMask = buttons[i].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] = i + 1; } } } - buttonPixUp.resize( masks.size(), QPixmap() ); - buttonPixDown.resize( masks.size(), QPixmap() ); - setBackgroundPixmap( pixBg ); songInfo.setFocusPolicy( QWidget::NoFocus ); // changeTextColor( &songInfo ); // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); // songInfo.setFrameStyle( QFrame::NoFrame); @@ -212,16 +207,16 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; QPoint p = upperLeftOfButtonMask; QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); - for ( uint i = 0; i < masks.size(); i++ ) { - if ( !masks[i].isNull() ) { - buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); - buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); + for ( uint i = 0; i < buttons.size(); i++ ) { + if ( !buttons[i].mask.isNull() ) { + buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); + buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); } } } void AudioWidget::sliderPressed() { audioSliderBeingMoved = TRUE; @@ -319,15 +314,15 @@ void AudioWidget::setToggleButton( int i, bool down ) { toggleButton( i ); } } void AudioWidget::paintButton( QPainter &p, int i ) { if ( buttons[i].isDown ) { - p.drawPixmap( upperLeftOfButtonMask, buttonPixDown[i] ); + p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixDown ); } else { - p.drawPixmap( upperLeftOfButtonMask, buttonPixUp[i] ); + p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixUp ); } } void AudioWidget::skipFor() { skipDirection = +1; |