-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 4 |
2 files changed, 12 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index adef247..fe7ddc1 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -111,10 +111,12 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye buttonMask.fill( 0 ); - for ( int i = 0; i < 10; i++ ) { + masks.reserve( 10 ); + + for ( uint i = 0; i < masks.capacity(); i++ ) { QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); - masks[i] = new QBitmap( filename ); + masks.push_back( QBitmap( filename ) ); - if ( !masks[i]->isNull() ) { - QImage imgMask = masks[i]->convertToImage(); + if ( !masks[i].isNull() ) { + QImage imgMask = masks[i].convertToImage(); uchar **dest = buttonMask.jumpTable(); for ( int y = 0; y < imgUp.height(); y++ ) { @@ -183,7 +185,4 @@ AudioWidget::~AudioWidget() { delete buttonPixDown[i]; } - for ( int i = 0; i < 10; i++ ) { - delete masks[i]; - } // mediaPlayerState->setPlaying(false); } @@ -226,9 +225,9 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { for ( int i = 0; i < 10; i++ ) { - if ( !masks[i]->isNull() ) { + if ( !masks[i].isNull() ) { delete buttonPixUp[i]; delete buttonPixDown[i]; - buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); - buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); + buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); + buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); } } diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 8426490..bc7262c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -92,4 +92,6 @@ private slots: void stopSkip(); private: + typedef std::vector<QBitmap> MaskVector; + void setToggleButton( int, bool ); virtual void paintButton( QPainter &p, int i ); @@ -99,5 +101,5 @@ private: QImage imgUp; QImage imgDn; - QBitmap *masks[10]; + MaskVector masks; QPixmap *buttonPixUp[10]; QPixmap *buttonPixDown[10]; |