author | harlekin <harlekin> | 2002-08-15 16:43:50 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-15 16:43:50 (UTC) |
commit | 09b410db4f8f0104ada5f76d611b39e49e327670 (patch) (unidiff) | |
tree | cdeaf715c48fa93c8e370d85ffdbf5f794e6a815 | |
parent | 71520dfe386a04f8bce5d6f5d9d86dcbeda000d2 (diff) | |
download | opie-09b410db4f8f0104ada5f76d611b39e49e327670.zip opie-09b410db4f8f0104ada5f76d611b39e49e327670.tar.gz opie-09b410db4f8f0104ada5f76d611b39e49e327670.tar.bz2 |
update
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index f5780aa..5a23d84 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -73,129 +73,128 @@ MediaButton videoButtons[] = { | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | const char *skinV_mask_file_names[7] = { | 75 | const char *skinV_mask_file_names[7] = { |
76 | "stop","play","back","fwd","up","down","full" | 76 | "stop","play","back","fwd","up","down","full" |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 79 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
80 | 80 | ||
81 | 81 | ||
82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
84 | setCaption( tr("OpiePlayer - Video") ); | 84 | setCaption( tr("OpiePlayer - Video") ); |
85 | 85 | ||
86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
88 | 88 | ||
89 | Config cfg("OpiePlayer"); | 89 | Config cfg("OpiePlayer"); |
90 | cfg.setGroup("Options"); | 90 | cfg.setGroup("Options"); |
91 | skin = cfg.readEntry("Skin","default"); | 91 | skin = cfg.readEntry("Skin","default"); |
92 | 92 | ||
93 | QString skinPath = "opieplayer2/skins/" + skin; | 93 | QString skinPath = "opieplayer2/skins/" + skin; |
94 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 94 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
95 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 95 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
96 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 96 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
97 | 97 | ||
98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
99 | imgButtonMask->fill( 0 ); | 99 | imgButtonMask->fill( 0 ); |
100 | 100 | ||
101 | for ( int i = 0; i < 7; i++ ) { | 101 | for ( int i = 0; i < 7; i++ ) { |
102 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; | 102 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; |
103 | masks[i] = new QBitmap( filename ); | 103 | masks[i] = new QBitmap( filename ); |
104 | qDebug(filename); | 104 | qDebug(filename); |
105 | if ( !masks[i]->isNull() ) { | 105 | if ( !masks[i]->isNull() ) { |
106 | QImage imgMask = masks[i]->convertToImage(); | 106 | QImage imgMask = masks[i]->convertToImage(); |
107 | uchar **dest = imgButtonMask->jumpTable(); | 107 | uchar **dest = imgButtonMask->jumpTable(); |
108 | for ( int y = 0; y < imgUp->height(); y++ ) { | 108 | for ( int y = 0; y < imgUp->height(); y++ ) { |
109 | uchar *line = dest[y]; | 109 | uchar *line = dest[y]; |
110 | for ( int x = 0; x < imgUp->width(); x++ ) { | 110 | for ( int x = 0; x < imgUp->width(); x++ ) { |
111 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 111 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
112 | line[x] = i + 1; | 112 | line[x] = i + 1; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | for ( int i = 0; i < 7; i++ ) { | 118 | for ( int i = 0; i < 7; i++ ) { |
119 | buttonPixUp[i] = NULL; | 119 | buttonPixUp[i] = NULL; |
120 | buttonPixDown[i] = NULL; | 120 | buttonPixDown[i] = NULL; |
121 | } | 121 | } |
122 | 122 | ||
123 | setBackgroundPixmap( *pixBg ); | 123 | setBackgroundPixmap( *pixBg ); |
124 | 124 | ||
125 | slider = new QSlider( Qt::Horizontal, this ); | 125 | slider = new QSlider( Qt::Horizontal, this ); |
126 | slider->setMinValue( 0 ); | 126 | slider->setMinValue( 0 ); |
127 | slider->setMaxValue( 1 ); | 127 | slider->setMaxValue( 1 ); |
128 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 128 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
129 | slider->setFocusPolicy( QWidget::NoFocus ); | 129 | slider->setFocusPolicy( QWidget::NoFocus ); |
130 | 130 | ||
131 | resizeEvent( NULL ); | 131 | resizeEvent( NULL ); |
132 | 132 | ||
133 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 133 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
134 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 134 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
135 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 135 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
136 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 136 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
137 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | ||
138 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 137 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
139 | 138 | ||
140 | setLength( mediaPlayerState->length() ); | 139 | setLength( mediaPlayerState->length() ); |
141 | setPosition( mediaPlayerState->position() ); | 140 | setPosition( mediaPlayerState->position() ); |
142 | setFullscreen( mediaPlayerState->fullscreen() ); | 141 | setFullscreen( mediaPlayerState->fullscreen() ); |
143 | setPaused( mediaPlayerState->paused() ); | 142 | setPaused( mediaPlayerState->paused() ); |
144 | setPlaying( mediaPlayerState->playing() ); | 143 | setPlaying( mediaPlayerState->playing() ); |
145 | } | 144 | } |
146 | 145 | ||
147 | 146 | ||
148 | VideoWidget::~VideoWidget() { | 147 | VideoWidget::~VideoWidget() { |
149 | 148 | ||
150 | for ( int i = 0; i < 7; i++ ) { | 149 | for ( int i = 0; i < 7; i++ ) { |
151 | delete buttonPixUp[i]; | 150 | delete buttonPixUp[i]; |
152 | delete buttonPixDown[i]; | 151 | delete buttonPixDown[i]; |
153 | } | 152 | } |
154 | 153 | ||
155 | delete pixBg; | 154 | delete pixBg; |
156 | delete imgUp; | 155 | delete imgUp; |
157 | delete imgDn; | 156 | delete imgDn; |
158 | delete imgButtonMask; | 157 | delete imgButtonMask; |
159 | for ( int i = 0; i < 7; i++ ) { | 158 | for ( int i = 0; i < 7; i++ ) { |
160 | delete masks[i]; | 159 | delete masks[i]; |
161 | } | 160 | } |
162 | 161 | ||
163 | } | 162 | } |
164 | 163 | ||
165 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 164 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
166 | QPixmap pix( img.width(), img.height() ); | 165 | QPixmap pix( img.width(), img.height() ); |
167 | QPainter p( &pix ); | 166 | QPainter p( &pix ); |
168 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 167 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
169 | p.drawImage( 0, 0, img ); | 168 | p.drawImage( 0, 0, img ); |
170 | return new QPixmap( pix ); | 169 | return new QPixmap( pix ); |
171 | } | 170 | } |
172 | 171 | ||
173 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 172 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
174 | QPixmap *pixmap = new QPixmap( pix ); | 173 | QPixmap *pixmap = new QPixmap( pix ); |
175 | pixmap->setMask( mask ); | 174 | pixmap->setMask( mask ); |
176 | return pixmap; | 175 | return pixmap; |
177 | } | 176 | } |
178 | 177 | ||
179 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 178 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
180 | int h = height(); | 179 | int h = height(); |
181 | int w = width(); | 180 | int w = width(); |
182 | int Vh = 160; | 181 | int Vh = 160; |
183 | //videoFrame->height(); | 182 | //videoFrame->height(); |
184 | int Vw = 220; | 183 | int Vw = 220; |
185 | //videoFrame->width(); | 184 | //videoFrame->width(); |
186 | 185 | ||
187 | 186 | ||
188 | slider->setFixedWidth( w - 20 ); | 187 | slider->setFixedWidth( w - 20 ); |
189 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 188 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
190 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 189 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
191 | slider->setFocusPolicy( QWidget::NoFocus ); | 190 | slider->setFocusPolicy( QWidget::NoFocus ); |
192 | slider->setBackgroundPixmap( *pixBg ); | 191 | slider->setBackgroundPixmap( *pixBg ); |
193 | 192 | ||
194 | xoff = 0;// ( imgUp->width() ) / 2; | 193 | xoff = 0;// ( imgUp->width() ) / 2; |
195 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; | 194 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; |
196 | QPoint p( xoff, yoff ); | 195 | QPoint p( xoff, yoff ); |
197 | 196 | ||
198 | 197 | ||
199 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 198 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
200 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 199 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
201 | 200 | ||
@@ -293,220 +292,206 @@ void VideoWidget::toggleButton( int i ) { | |||
293 | } | 292 | } |
294 | 293 | ||
295 | void VideoWidget::paintButton( QPainter *p, int i ) { | 294 | void VideoWidget::paintButton( QPainter *p, int i ) { |
296 | 295 | ||
297 | if ( videoButtons[i].isDown ) { | 296 | if ( videoButtons[i].isDown ) { |
298 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 297 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
299 | } else { | 298 | } else { |
300 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 299 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
301 | } | 300 | } |
302 | } | 301 | } |
303 | 302 | ||
304 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 303 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
305 | for ( int i = 0; i < numVButtons; i++ ) { | 304 | for ( int i = 0; i < numVButtons; i++ ) { |
306 | if ( event->state() == QMouseEvent::LeftButton ) { | 305 | if ( event->state() == QMouseEvent::LeftButton ) { |
307 | // The test to see if the mouse click is inside the button or not | 306 | // The test to see if the mouse click is inside the button or not |
308 | int x = event->pos().x() - xoff; | 307 | int x = event->pos().x() - xoff; |
309 | int y = event->pos().y() - yoff; | 308 | int y = event->pos().y() - yoff; |
310 | 309 | ||
311 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 310 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
312 | && y < imgButtonMask->height() | 311 | && y < imgButtonMask->height() |
313 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 312 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
314 | 313 | ||
315 | if ( isOnButton && !videoButtons[i].isHeld ) { | 314 | if ( isOnButton && !videoButtons[i].isHeld ) { |
316 | videoButtons[i].isHeld = TRUE; | 315 | videoButtons[i].isHeld = TRUE; |
317 | toggleButton(i); | 316 | toggleButton(i); |
318 | 317 | ||
319 | switch (i) { | 318 | switch (i) { |
320 | case VideoVolUp: | 319 | case VideoVolUp: |
321 | emit moreClicked(); | 320 | emit moreClicked(); |
322 | return; | 321 | return; |
323 | case VideoVolDown: | 322 | case VideoVolDown: |
324 | emit lessClicked(); | 323 | emit lessClicked(); |
325 | return; | 324 | return; |
326 | } | 325 | } |
327 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 326 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
328 | videoButtons[i].isHeld = FALSE; | 327 | videoButtons[i].isHeld = FALSE; |
329 | toggleButton(i); | 328 | toggleButton(i); |
330 | } | 329 | } |
331 | } else { | 330 | } else { |
332 | 331 | ||
333 | if ( videoButtons[i].isHeld ) { | 332 | if ( videoButtons[i].isHeld ) { |
334 | videoButtons[i].isHeld = FALSE; | 333 | videoButtons[i].isHeld = FALSE; |
335 | if ( !videoButtons[i].isToggle ) { | 334 | if ( !videoButtons[i].isToggle ) { |
336 | setToggleButton( i, FALSE ); | 335 | setToggleButton( i, FALSE ); |
337 | } | 336 | } |
338 | 337 | ||
339 | switch(i) { | 338 | switch(i) { |
340 | 339 | ||
341 | case VideoPlay: { | 340 | case VideoPlay: { |
342 | if( mediaPlayerState->isPaused ) { | 341 | if( mediaPlayerState->isPaused ) { |
343 | setToggleButton( i, FALSE ); | 342 | setToggleButton( i, FALSE ); |
344 | mediaPlayerState->setPaused( FALSE ); | 343 | mediaPlayerState->setPaused( FALSE ); |
345 | return; | 344 | return; |
346 | } else if( !mediaPlayerState->isPaused ) { | 345 | } else if( !mediaPlayerState->isPaused ) { |
347 | setToggleButton( i, TRUE ); | 346 | setToggleButton( i, TRUE ); |
348 | mediaPlayerState->setPaused( TRUE ); | 347 | mediaPlayerState->setPaused( TRUE ); |
349 | return; | 348 | return; |
350 | } else { | 349 | } else { |
351 | // setToggleButton( i, TRUE ); | 350 | // setToggleButton( i, TRUE ); |
352 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); | 351 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); |
353 | } | 352 | } |
354 | } | 353 | } |
355 | 354 | ||
356 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 355 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
357 | // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
358 | case VideoNext: mediaPlayerState->setNext(); return; | 356 | case VideoNext: mediaPlayerState->setNext(); return; |
359 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 357 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
360 | case VideoVolUp: emit moreReleased(); return; | 358 | case VideoVolUp: emit moreReleased(); return; |
361 | case VideoVolDown: emit lessReleased(); return; | 359 | case VideoVolDown: emit lessReleased(); return; |
362 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 360 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
363 | } | 361 | } |
364 | } | 362 | } |
365 | } | 363 | } |
366 | } | 364 | } |
367 | } | 365 | } |
368 | 366 | ||
369 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 367 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
370 | mouseMoveEvent( event ); | 368 | mouseMoveEvent( event ); |
371 | } | 369 | } |
372 | 370 | ||
373 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 371 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
374 | if ( mediaPlayerState->fullscreen() ) { | 372 | if ( mediaPlayerState->fullscreen() ) { |
375 | mediaPlayerState->setFullscreen( FALSE ); | 373 | mediaPlayerState->setFullscreen( FALSE ); |
376 | makeVisible(); | 374 | makeVisible(); |
377 | } | 375 | } |
378 | mouseMoveEvent( event ); | 376 | mouseMoveEvent( event ); |
379 | } | 377 | } |
380 | 378 | ||
381 | void VideoWidget::showEvent( QShowEvent* ) { | 379 | void VideoWidget::showEvent( QShowEvent* ) { |
382 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 380 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
383 | mouseMoveEvent( &event ); | 381 | mouseMoveEvent( &event ); |
384 | } | 382 | } |
385 | 383 | ||
386 | 384 | ||
387 | void VideoWidget::makeVisible() { | 385 | void VideoWidget::makeVisible() { |
388 | if ( mediaPlayerState->fullscreen() ) { | 386 | if ( mediaPlayerState->fullscreen() ) { |
389 | setBackgroundMode( QWidget::NoBackground ); | 387 | setBackgroundMode( QWidget::NoBackground ); |
390 | showFullScreen(); | 388 | showFullScreen(); |
391 | resize( qApp->desktop()->size() ); | 389 | resize( qApp->desktop()->size() ); |
392 | slider->hide(); | 390 | slider->hide(); |
393 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 391 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
394 | } else { | 392 | } else { |
395 | showNormal(); | 393 | showNormal(); |
396 | showMaximized(); | 394 | showMaximized(); |
397 | slider->show(); | 395 | slider->show(); |
398 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); | 396 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); |
399 | qApp->processEvents(); | 397 | qApp->processEvents(); |
400 | } | 398 | } |
401 | } | 399 | } |
402 | 400 | ||
403 | 401 | ||
404 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 402 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
405 | QPainter p( this ); | 403 | QPainter p( this ); |
406 | 404 | ||
407 | if ( mediaPlayerState->fullscreen() ) { | 405 | if ( mediaPlayerState->fullscreen() ) { |
408 | // Clear the background | 406 | // Clear the background |
409 | p.setBrush( QBrush( Qt::black ) ); | 407 | p.setBrush( QBrush( Qt::black ) ); |
410 | // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); | ||
411 | |||
412 | } else { | 408 | } else { |
413 | |||
414 | // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); | ||
415 | // draw the buttons | ||
416 | |||
417 | if ( !pe->erased() ) { | 409 | if ( !pe->erased() ) { |
418 | // Combine with background and double buffer | 410 | // Combine with background and double buffer |
419 | QPixmap pix( pe->rect().size() ); | 411 | QPixmap pix( pe->rect().size() ); |
420 | QPainter p( &pix ); | 412 | QPainter p( &pix ); |
421 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 413 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
422 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 414 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
423 | for ( int i = 0; i < numVButtons; i++ ) { | 415 | for ( int i = 0; i < numVButtons; i++ ) { |
424 | paintButton( &p, i ); | 416 | paintButton( &p, i ); |
425 | } | 417 | } |
426 | QPainter p2( this ); | 418 | QPainter p2( this ); |
427 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 419 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
428 | } else { | 420 | } else { |
429 | QPainter p( this ); | 421 | QPainter p( this ); |
430 | for ( int i = 0; i < numVButtons; i++ ) | 422 | for ( int i = 0; i < numVButtons; i++ ) |
431 | paintButton( &p, i ); | 423 | paintButton( &p, i ); |
432 | } | 424 | } |
433 | // for ( int i = 0; i < numButtons; i++ ) { | ||
434 | // paintButton( &p, i ); | ||
435 | // } | ||
436 | // draw the slider | ||
437 | slider->repaint( TRUE ); | 425 | slider->repaint( TRUE ); |
438 | } | 426 | } |
439 | } | 427 | } |
440 | 428 | ||
441 | 429 | ||
442 | void VideoWidget::closeEvent( QCloseEvent* ) { | 430 | void VideoWidget::closeEvent( QCloseEvent* ) { |
443 | mediaPlayerState->setList(); | 431 | mediaPlayerState->setList(); |
444 | } | 432 | } |
445 | 433 | ||
446 | 434 | ||
447 | 435 | ||
448 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 436 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
449 | switch ( e->key() ) { | 437 | switch ( e->key() ) { |
450 | ////////////////////////////// Zaurus keys | 438 | ////////////////////////////// Zaurus keys |
451 | case Key_Home: | 439 | case Key_Home: |
452 | break; | 440 | break; |
453 | case Key_F9: //activity | 441 | case Key_F9: //activity |
454 | break; | 442 | break; |
455 | case Key_F10: //contacts | 443 | case Key_F10: //contacts |
456 | // hide(); | 444 | // hide(); |
457 | break; | 445 | break; |
458 | case Key_F11: //menu | 446 | case Key_F11: //menu |
459 | break; | 447 | break; |
460 | case Key_F12: //home | 448 | case Key_F12: //home |
461 | break; | 449 | break; |
462 | case Key_F13: //mail | 450 | case Key_F13: //mail |
463 | break; | 451 | break; |
464 | case Key_Space: { | 452 | case Key_Space: { |
465 | if(mediaPlayerState->playing()) { | 453 | if(mediaPlayerState->playing()) { |
466 | mediaPlayerState->setPlaying(FALSE); | 454 | mediaPlayerState->setPlaying(FALSE); |
467 | } else { | 455 | } else { |
468 | mediaPlayerState->setPlaying(TRUE); | 456 | mediaPlayerState->setPlaying(TRUE); |
469 | } | 457 | } |
470 | } | 458 | } |
471 | break; | 459 | break; |
472 | case Key_Down: | 460 | case Key_Down: |
473 | // toggleButton(6); | 461 | // toggleButton(6); |
474 | // emit lessClicked(); | 462 | // emit lessClicked(); |
475 | // emit lessReleased(); | 463 | // emit lessReleased(); |
476 | // toggleButton(6); | 464 | // toggleButton(6); |
477 | break; | 465 | break; |
478 | case Key_Up: | 466 | case Key_Up: |
479 | // toggleButton(5); | 467 | // toggleButton(5); |
480 | // emit moreClicked(); | 468 | // emit moreClicked(); |
481 | // emit moreReleased(); | 469 | // emit moreReleased(); |
482 | // toggleButton(5); | 470 | // toggleButton(5); |
483 | break; | 471 | break; |
484 | case Key_Right: | 472 | case Key_Right: |
485 | mediaPlayerState->setNext(); | 473 | mediaPlayerState->setNext(); |
486 | break; | 474 | break; |
487 | case Key_Left: | 475 | case Key_Left: |
488 | mediaPlayerState->setPrev(); | 476 | mediaPlayerState->setPrev(); |
489 | break; | 477 | break; |
490 | case Key_Escape: | 478 | case Key_Escape: |
491 | break; | 479 | break; |
492 | 480 | ||
493 | }; | 481 | }; |
494 | } | 482 | } |
495 | 483 | ||
496 | XineVideoWidget* VideoWidget::vidWidget() { | 484 | XineVideoWidget* VideoWidget::vidWidget() { |
497 | return videoFrame; | 485 | return videoFrame; |
498 | } | 486 | } |
499 | 487 | ||
500 | 488 | ||
501 | void VideoWidget::setFullscreen ( bool b ) { | 489 | void VideoWidget::setFullscreen ( bool b ) { |
502 | setToggleButton( VideoFullscreen, b ); | 490 | setToggleButton( VideoFullscreen, b ); |
503 | } | 491 | } |
504 | 492 | ||
505 | void VideoWidget::setPaused( bool b) { | ||
506 | // setToggleButton( VideoPause, b ); | ||
507 | } | ||
508 | 493 | ||
509 | void VideoWidget::setPlaying( bool b) { | 494 | void VideoWidget::setPlaying( bool b) { |
510 | setToggleButton( VideoPlay, b ); | 495 | setToggleButton( VideoPlay, b ); |
511 | } | 496 | } |
512 | 497 | ||