-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index a4e6b6e..9b88299 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -148,97 +148,97 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
148 | setPaused( mediaPlayerState->paused() ); | 148 | setPaused( mediaPlayerState->paused() ); |
149 | setPlaying( mediaPlayerState->playing() ); | 149 | setPlaying( mediaPlayerState->playing() ); |
150 | qDebug("finished videowidget"); | 150 | qDebug("finished videowidget"); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | VideoWidget::~VideoWidget() { | 154 | VideoWidget::~VideoWidget() { |
155 | for ( int i = 0; i < 7; i++ ) { | 155 | for ( int i = 0; i < 7; i++ ) { |
156 | delete buttonPixUp[i]; | 156 | delete buttonPixUp[i]; |
157 | delete buttonPixDown[i]; | 157 | delete buttonPixDown[i]; |
158 | } | 158 | } |
159 | 159 | ||
160 | delete pixBg; | 160 | delete pixBg; |
161 | delete imgUp; | 161 | delete imgUp; |
162 | delete imgDn; | 162 | delete imgDn; |
163 | delete imgButtonMask; | 163 | delete imgButtonMask; |
164 | for ( int i = 0; i < 7; i++ ) { | 164 | for ( int i = 0; i < 7; i++ ) { |
165 | delete masks[i]; | 165 | delete masks[i]; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
170 | QPixmap pix( img.width(), img.height() ); | 170 | QPixmap pix( img.width(), img.height() ); |
171 | QPainter p( &pix ); | 171 | QPainter p( &pix ); |
172 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 172 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
173 | p.drawImage( 0, 0, img ); | 173 | p.drawImage( 0, 0, img ); |
174 | return new QPixmap( pix ); | 174 | return new QPixmap( pix ); |
175 | } | 175 | } |
176 | 176 | ||
177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
178 | QPixmap *pixmap = new QPixmap( pix ); | 178 | QPixmap *pixmap = new QPixmap( pix ); |
179 | pixmap->setMask( mask ); | 179 | pixmap->setMask( mask ); |
180 | return pixmap; | 180 | return pixmap; |
181 | } | 181 | } |
182 | 182 | ||
183 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 183 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
184 | int h = height(); | 184 | int h = height(); |
185 | int w = width(); | 185 | int w = width(); |
186 | int Vh = 160; | 186 | int Vh = 160; |
187 | //videoFrame->height(); | 187 | //videoFrame->height(); |
188 | int Vw = 220; | 188 | int Vw = 220; |
189 | //videoFrame->width(); | 189 | //videoFrame->width(); |
190 | // songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); | 190 | // songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); |
191 | 191 | ||
192 | slider->setFixedWidth( w - 110 ); | 192 | slider->setFixedWidth( w - 110 ); |
193 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 193 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
194 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 194 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
195 | slider->setFocusPolicy( QWidget::NoFocus ); | 195 | slider->setFocusPolicy( QWidget::NoFocus ); |
196 | make slider->setBackgroundPixmap( *pixBg ); | 196 | slider->setBackgroundPixmap( *pixBg ); |
197 | 197 | ||
198 | // time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 198 | // time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
199 | xoff = 0;// ( imgUp->width() ) / 2; | 199 | xoff = 0;// ( imgUp->width() ) / 2; |
200 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; | 200 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; |
201 | QPoint p( xoff, yoff ); | 201 | QPoint p( xoff, yoff ); |
202 | 202 | ||
203 | 203 | ||
204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
206 | 206 | ||
207 | for ( int i = 0; i < 7; i++ ) { | 207 | for ( int i = 0; i < 7; i++ ) { |
208 | if ( !masks[i]->isNull() ) { | 208 | if ( !masks[i]->isNull() ) { |
209 | delete buttonPixUp[i]; | 209 | delete buttonPixUp[i]; |
210 | delete buttonPixDown[i]; | 210 | delete buttonPixDown[i]; |
211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | delete pixUp; | 216 | delete pixUp; |
217 | delete pixDn; | 217 | delete pixDn; |
218 | } | 218 | } |
219 | 219 | ||
220 | static bool videoSliderBeingMoved = FALSE; | 220 | static bool videoSliderBeingMoved = FALSE; |
221 | 221 | ||
222 | void VideoWidget::sliderPressed() { | 222 | void VideoWidget::sliderPressed() { |
223 | videoSliderBeingMoved = TRUE; | 223 | videoSliderBeingMoved = TRUE; |
224 | } | 224 | } |
225 | 225 | ||
226 | void VideoWidget::sliderReleased() { | 226 | void VideoWidget::sliderReleased() { |
227 | videoSliderBeingMoved = FALSE; | 227 | videoSliderBeingMoved = FALSE; |
228 | if ( slider->width() == 0 ) { | 228 | if ( slider->width() == 0 ) { |
229 | return; | 229 | return; |
230 | } | 230 | } |
231 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 231 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
232 | mediaPlayerState->setPosition( val ); | 232 | mediaPlayerState->setPosition( val ); |
233 | } | 233 | } |
234 | 234 | ||
235 | void VideoWidget::setPosition( long i ) { | 235 | void VideoWidget::setPosition( long i ) { |
236 | updateSlider( i, mediaPlayerState->length() ); | 236 | updateSlider( i, mediaPlayerState->length() ); |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | void VideoWidget::setLength( long max ) { | 240 | void VideoWidget::setLength( long max ) { |
241 | updateSlider( mediaPlayerState->position(), max ); | 241 | updateSlider( mediaPlayerState->position(), max ); |
242 | } | 242 | } |
243 | 243 | ||
244 | void VideoWidget::setView( char view ) { | 244 | void VideoWidget::setView( char view ) { |
@@ -416,51 +416,51 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
416 | case Key_F9: //activity | 416 | case Key_F9: //activity |
417 | break; | 417 | break; |
418 | case Key_F10: //contacts | 418 | case Key_F10: //contacts |
419 | // hide(); | 419 | // hide(); |
420 | break; | 420 | break; |
421 | case Key_F11: //menu | 421 | case Key_F11: //menu |
422 | break; | 422 | break; |
423 | case Key_F12: //home | 423 | case Key_F12: //home |
424 | break; | 424 | break; |
425 | case Key_F13: //mail | 425 | case Key_F13: //mail |
426 | break; | 426 | break; |
427 | case Key_Space: { | 427 | case Key_Space: { |
428 | if(mediaPlayerState->playing()) { | 428 | if(mediaPlayerState->playing()) { |
429 | mediaPlayerState->setPlaying(FALSE); | 429 | mediaPlayerState->setPlaying(FALSE); |
430 | } else { | 430 | } else { |
431 | mediaPlayerState->setPlaying(TRUE); | 431 | mediaPlayerState->setPlaying(TRUE); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | break; | 434 | break; |
435 | case Key_Down: | 435 | case Key_Down: |
436 | // toggleButton(6); | 436 | // toggleButton(6); |
437 | // emit lessClicked(); | 437 | // emit lessClicked(); |
438 | // emit lessReleased(); | 438 | // emit lessReleased(); |
439 | // toggleButton(6); | 439 | // toggleButton(6); |
440 | break; | 440 | break; |
441 | case Key_Up: | 441 | case Key_Up: |
442 | // toggleButton(5); | 442 | // toggleButton(5); |
443 | // emit moreClicked(); | 443 | // emit moreClicked(); |
444 | // emit moreReleased(); | 444 | // emit moreReleased(); |
445 | // toggleButton(5); | 445 | // toggleButton(5); |
446 | break; | 446 | break; |
447 | case Key_Right: | 447 | case Key_Right: |
448 | mediaPlayerState->setNext(); | 448 | mediaPlayerState->setNext(); |
449 | break; | 449 | break; |
450 | case Key_Left: | 450 | case Key_Left: |
451 | mediaPlayerState->setPrev(); | 451 | mediaPlayerState->setPrev(); |
452 | break; | 452 | break; |
453 | case Key_Escape: | 453 | case Key_Escape: |
454 | break; | 454 | break; |
455 | 455 | ||
456 | }; | 456 | }; |
457 | } | 457 | } |
458 | 458 | ||
459 | XineVideoWidget* VideoWidget::vidWidget() { | 459 | XineVideoWidget* VideoWidget::vidWidget() { |
460 | return videoFrame; | 460 | return videoFrame; |
461 | } | 461 | } |
462 | 462 | ||
463 | 463 | ||
464 | void VideoWidget::setFullscreen ( bool b ) { | 464 | void VideoWidget::setFullscreen ( bool b ) { |
465 | setToggleButton( VideoFullscreen, b ); | 465 | setToggleButton( VideoFullscreen, b ); |
466 | } | 466 | } |