summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
authorsimon <simon>2002-12-09 13:35:46 (UTC)
committer simon <simon>2002-12-09 13:35:46 (UTC)
commitd1324d850a3c8269bd6009de6fdf6c321954b371 (patch) (side-by-side diff)
treef9effa74f69b06b8e9e7b89c3317c871c2bd81d6 /noncore/multimedia/opieplayer2
parent235ef0e11bfd61c0debb530de8598ae38a396914 (diff)
downloadopie-d1324d850a3c8269bd6009de6fdf6c321954b371.zip
opie-d1324d850a3c8269bd6009de6fdf6c321954b371.tar.gz
opie-d1324d850a3c8269bd6009de6fdf6c321954b371.tar.bz2
- use a vector to store the masks
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h4
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
@@ -110,12 +110,14 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
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++ ) {
uchar *line = dest[y];
@@ -182,9 +184,6 @@ AudioWidget::~AudioWidget() {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
- for ( int i = 0; i < 10; i++ ) {
- delete masks[i];
- }
// mediaPlayerState->setPlaying(false);
}
@@ -225,11 +224,11 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
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
@@ -91,6 +91,8 @@ private slots:
void skipBack();
void stopSkip();
private:
+ typedef std::vector<QBitmap> MaskVector;
+
void setToggleButton( int, bool );
virtual void paintButton( QPainter &p, int i );
int skipDirection;
@@ -98,7 +100,7 @@ private:
QPixmap pixBg;
QImage imgUp;
QImage imgDn;
- QBitmap *masks[10];
+ MaskVector masks;
QPixmap *buttonPixUp[10];
QPixmap *buttonPixDown[10];