-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 | |||
@@ -110,12 +110,14 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
110 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 110 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
111 | buttonMask.fill( 0 ); | 111 | buttonMask.fill( 0 ); |
112 | 112 | ||
113 | for ( int i = 0; i < 10; i++ ) { | 113 | masks.reserve( 10 ); |
114 | |||
115 | for ( uint i = 0; i < masks.capacity(); i++ ) { | ||
114 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); | 116 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); |
115 | masks[i] = new QBitmap( filename ); | 117 | masks.push_back( QBitmap( filename ) ); |
116 | 118 | ||
117 | if ( !masks[i]->isNull() ) { | 119 | if ( !masks[i].isNull() ) { |
118 | QImage imgMask = masks[i]->convertToImage(); | 120 | QImage imgMask = masks[i].convertToImage(); |
119 | uchar **dest = buttonMask.jumpTable(); | 121 | uchar **dest = buttonMask.jumpTable(); |
120 | for ( int y = 0; y < imgUp.height(); y++ ) { | 122 | for ( int y = 0; y < imgUp.height(); y++ ) { |
121 | uchar *line = dest[y]; | 123 | uchar *line = dest[y]; |
@@ -182,9 +184,6 @@ AudioWidget::~AudioWidget() { | |||
182 | delete buttonPixUp[i]; | 184 | delete buttonPixUp[i]; |
183 | delete buttonPixDown[i]; | 185 | delete buttonPixDown[i]; |
184 | } | 186 | } |
185 | for ( int i = 0; i < 10; i++ ) { | ||
186 | delete masks[i]; | ||
187 | } | ||
188 | // mediaPlayerState->setPlaying(false); | 187 | // mediaPlayerState->setPlaying(false); |
189 | } | 188 | } |
190 | 189 | ||
@@ -225,11 +224,11 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
225 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 224 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
226 | 225 | ||
227 | for ( int i = 0; i < 10; i++ ) { | 226 | for ( int i = 0; i < 10; i++ ) { |
228 | if ( !masks[i]->isNull() ) { | 227 | if ( !masks[i].isNull() ) { |
229 | delete buttonPixUp[i]; | 228 | delete buttonPixUp[i]; |
230 | delete buttonPixDown[i]; | 229 | delete buttonPixDown[i]; |
231 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); | 230 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); |
232 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); | 231 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); |
233 | } | 232 | } |
234 | } | 233 | } |
235 | } | 234 | } |
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: | |||
91 | void skipBack(); | 91 | void skipBack(); |
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | typedef std::vector<QBitmap> MaskVector; | ||
95 | |||
94 | void setToggleButton( int, bool ); | 96 | void setToggleButton( int, bool ); |
95 | virtual void paintButton( QPainter &p, int i ); | 97 | virtual void paintButton( QPainter &p, int i ); |
96 | int skipDirection; | 98 | int skipDirection; |
@@ -98,7 +100,7 @@ private: | |||
98 | QPixmap pixBg; | 100 | QPixmap pixBg; |
99 | QImage imgUp; | 101 | QImage imgUp; |
100 | QImage imgDn; | 102 | QImage imgDn; |
101 | QBitmap *masks[10]; | 103 | MaskVector masks; |
102 | QPixmap *buttonPixUp[10]; | 104 | QPixmap *buttonPixUp[10]; |
103 | QPixmap *buttonPixDown[10]; | 105 | QPixmap *buttonPixDown[10]; |
104 | 106 | ||