-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 2081b4f..8659971 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -172,97 +172,97 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
172 | setPosition( mediaPlayerState.position() ); | 172 | setPosition( mediaPlayerState.position() ); |
173 | setLooping( mediaPlayerState.isFullscreen() ); | 173 | setLooping( mediaPlayerState.isFullscreen() ); |
174 | // setPaused( mediaPlayerState->paused() ); | 174 | // setPaused( mediaPlayerState->paused() ); |
175 | setPlaying( mediaPlayerState.isPlaying() ); | 175 | setPlaying( mediaPlayerState.isPlaying() ); |
176 | 176 | ||
177 | } | 177 | } |
178 | 178 | ||
179 | AudioWidget::~AudioWidget() { | 179 | AudioWidget::~AudioWidget() { |
180 | 180 | ||
181 | // mediaPlayerState->setPlaying(false); | 181 | // mediaPlayerState->setPlaying(false); |
182 | } | 182 | } |
183 | 183 | ||
184 | namespace { | 184 | namespace { |
185 | 185 | ||
186 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 186 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
187 | QPixmap pix( img.width(), img.height() ); | 187 | QPixmap pix( img.width(), img.height() ); |
188 | QPainter p( &pix ); | 188 | QPainter p( &pix ); |
189 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 189 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
190 | p.drawImage( 0, 0, img ); | 190 | p.drawImage( 0, 0, img ); |
191 | return pix; | 191 | return pix; |
192 | } | 192 | } |
193 | 193 | ||
194 | 194 | ||
195 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { | 195 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { |
196 | QPixmap pixmap( pix ); | 196 | QPixmap pixmap( pix ); |
197 | pixmap.setMask( mask ); | 197 | pixmap.setMask( mask ); |
198 | return pixmap; | 198 | return pixmap; |
199 | } | 199 | } |
200 | 200 | ||
201 | }; | 201 | }; |
202 | 202 | ||
203 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 203 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
204 | int h = height(); | 204 | int h = height(); |
205 | int w = width(); | 205 | int w = width(); |
206 | 206 | ||
207 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 207 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
208 | slider.setFixedWidth( w - 110 ); | 208 | slider.setFixedWidth( w - 110 ); |
209 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 209 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
210 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 210 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
211 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 211 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
212 | 212 | ||
213 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 213 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
214 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 214 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
215 | QPoint p = upperLeftOfButtonMask; | 215 | QPoint p = upperLeftOfButtonMask; |
216 | 216 | ||
217 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 217 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
218 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 218 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
219 | 219 | ||
220 | for ( int i = 0; i < 10; i++ ) { | 220 | for ( uint i = 0; i < masks.size(); i++ ) { |
221 | if ( !masks[i].isNull() ) { | 221 | if ( !masks[i].isNull() ) { |
222 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); | 222 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); |
223 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); | 223 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | void AudioWidget::sliderPressed() { | 228 | void AudioWidget::sliderPressed() { |
229 | audioSliderBeingMoved = TRUE; | 229 | audioSliderBeingMoved = TRUE; |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | void AudioWidget::sliderReleased() { | 233 | void AudioWidget::sliderReleased() { |
234 | audioSliderBeingMoved = FALSE; | 234 | audioSliderBeingMoved = FALSE; |
235 | if ( slider.width() == 0 ) | 235 | if ( slider.width() == 0 ) |
236 | return; | 236 | return; |
237 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 237 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
238 | mediaPlayerState.setPosition( val ); | 238 | mediaPlayerState.setPosition( val ); |
239 | } | 239 | } |
240 | 240 | ||
241 | void AudioWidget::setPosition( long i ) { | 241 | void AudioWidget::setPosition( long i ) { |
242 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 242 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
243 | updateSlider( i, mediaPlayerState.length() ); | 243 | updateSlider( i, mediaPlayerState.length() ); |
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | void AudioWidget::setLength( long max ) { | 247 | void AudioWidget::setLength( long max ) { |
248 | updateSlider( mediaPlayerState.position(), max ); | 248 | updateSlider( mediaPlayerState.position(), max ); |
249 | } | 249 | } |
250 | 250 | ||
251 | 251 | ||
252 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 252 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
253 | if ( mediaType == MediaPlayerState::Audio ) { | 253 | if ( mediaType == MediaPlayerState::Audio ) { |
254 | // startTimer( 150 ); | 254 | // startTimer( 150 ); |
255 | showMaximized(); | 255 | showMaximized(); |
256 | return; | 256 | return; |
257 | } | 257 | } |
258 | 258 | ||
259 | killTimers(); | 259 | killTimers(); |
260 | hide(); | 260 | hide(); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void AudioWidget::setSeekable( bool isSeekable ) { | 264 | void AudioWidget::setSeekable( bool isSeekable ) { |
265 | 265 | ||
266 | if ( !isSeekable ) { | 266 | if ( !isSeekable ) { |
267 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 267 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
268 | if( !slider.isHidden()) { | 268 | if( !slider.isHidden()) { |