author | simon <simon> | 2002-12-09 15:46:08 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 15:46:08 (UTC) |
commit | aa766a6a0818ed0b756f8cd67fc4a1c85906f224 (patch) (unidiff) | |
tree | fe6af32c30e0355f839a8a574d1ec7d8a7561fd5 | |
parent | 21738c78103c42605625f85abf7bfd0d6beaad3f (diff) | |
download | opie-aa766a6a0818ed0b756f8cd67fc4a1c85906f224.zip opie-aa766a6a0818ed0b756f8cd67fc4a1c85906f224.tar.gz opie-aa766a6a0818ed0b756f8cd67fc4a1c85906f224.tar.bz2 |
- toggleButton and setToggleButton now operate on a Button object instead
of an index
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 14 |
5 files changed, 17 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 8c7e614..ef606ab 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -216,227 +216,227 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | void AudioWidget::sliderPressed() { | 219 | void AudioWidget::sliderPressed() { |
220 | audioSliderBeingMoved = TRUE; | 220 | audioSliderBeingMoved = TRUE; |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||
224 | void AudioWidget::sliderReleased() { | 224 | void AudioWidget::sliderReleased() { |
225 | audioSliderBeingMoved = FALSE; | 225 | audioSliderBeingMoved = FALSE; |
226 | if ( slider.width() == 0 ) | 226 | if ( slider.width() == 0 ) |
227 | return; | 227 | return; |
228 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 228 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
229 | mediaPlayerState.setPosition( val ); | 229 | mediaPlayerState.setPosition( val ); |
230 | } | 230 | } |
231 | 231 | ||
232 | void AudioWidget::setPosition( long i ) { | 232 | void AudioWidget::setPosition( long i ) { |
233 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 233 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
234 | updateSlider( i, mediaPlayerState.length() ); | 234 | updateSlider( i, mediaPlayerState.length() ); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | void AudioWidget::setLength( long max ) { | 238 | void AudioWidget::setLength( long max ) { |
239 | updateSlider( mediaPlayerState.position(), max ); | 239 | updateSlider( mediaPlayerState.position(), max ); |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 243 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
244 | if ( mediaType == MediaPlayerState::Audio ) { | 244 | if ( mediaType == MediaPlayerState::Audio ) { |
245 | // startTimer( 150 ); | 245 | // startTimer( 150 ); |
246 | showMaximized(); | 246 | showMaximized(); |
247 | return; | 247 | return; |
248 | } | 248 | } |
249 | 249 | ||
250 | killTimers(); | 250 | killTimers(); |
251 | hide(); | 251 | hide(); |
252 | } | 252 | } |
253 | 253 | ||
254 | 254 | ||
255 | void AudioWidget::setSeekable( bool isSeekable ) { | 255 | void AudioWidget::setSeekable( bool isSeekable ) { |
256 | 256 | ||
257 | if ( !isSeekable ) { | 257 | if ( !isSeekable ) { |
258 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 258 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
259 | if( !slider.isHidden()) { | 259 | if( !slider.isHidden()) { |
260 | slider.hide(); | 260 | slider.hide(); |
261 | } | 261 | } |
262 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 262 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
263 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 263 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
264 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 264 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
265 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 265 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
266 | } else { | 266 | } else { |
267 | // this stops the slider from being moved, thus | 267 | // this stops the slider from being moved, thus |
268 | // does not stop stream when it reaches the end | 268 | // does not stop stream when it reaches the end |
269 | slider.show(); | 269 | slider.show(); |
270 | qDebug( " CONNECT SET POSTION " ); | 270 | qDebug( " CONNECT SET POSTION " ); |
271 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 271 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
272 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 272 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
273 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 273 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
274 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 274 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | 278 | ||
279 | static QString timeAsString( long length ) { | 279 | static QString timeAsString( long length ) { |
280 | int minutes = length / 60; | 280 | int minutes = length / 60; |
281 | int seconds = length % 60; | 281 | int seconds = length % 60; |
282 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 282 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
283 | } | 283 | } |
284 | 284 | ||
285 | void AudioWidget::updateSlider( long i, long max ) { | 285 | void AudioWidget::updateSlider( long i, long max ) { |
286 | 286 | ||
287 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 287 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
288 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 288 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
289 | 289 | ||
290 | if ( max == 0 ) { | 290 | if ( max == 0 ) { |
291 | return; | 291 | return; |
292 | } | 292 | } |
293 | // Will flicker too much if we don't do this | 293 | // Will flicker too much if we don't do this |
294 | // Scale to something reasonable | 294 | // Scale to something reasonable |
295 | int width = slider.width(); | 295 | int width = slider.width(); |
296 | int val = int((double)i * width / max); | 296 | int val = int((double)i * width / max); |
297 | if ( !audioSliderBeingMoved ) { | 297 | if ( !audioSliderBeingMoved ) { |
298 | if ( slider.value() != val ) { | 298 | if ( slider.value() != val ) { |
299 | slider.setValue( val ); | 299 | slider.setValue( val ); |
300 | } | 300 | } |
301 | 301 | ||
302 | if ( slider.maxValue() != width ) { | 302 | if ( slider.maxValue() != width ) { |
303 | slider.setMaxValue( width ); | 303 | slider.setMaxValue( width ); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | void AudioWidget::skipFor() { | 308 | void AudioWidget::skipFor() { |
309 | skipDirection = +1; | 309 | skipDirection = +1; |
310 | startTimer( 50 ); | 310 | startTimer( 50 ); |
311 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 311 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
312 | } | 312 | } |
313 | 313 | ||
314 | void AudioWidget::skipBack() { | 314 | void AudioWidget::skipBack() { |
315 | skipDirection = -1; | 315 | skipDirection = -1; |
316 | startTimer( 50 ); | 316 | startTimer( 50 ); |
317 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 317 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
318 | } | 318 | } |
319 | 319 | ||
320 | 320 | ||
321 | 321 | ||
322 | void AudioWidget::stopSkip() { | 322 | void AudioWidget::stopSkip() { |
323 | killTimers(); | 323 | killTimers(); |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | void AudioWidget::timerEvent( QTimerEvent * ) { | 327 | void AudioWidget::timerEvent( QTimerEvent * ) { |
328 | if ( skipDirection == +1 ) { | 328 | if ( skipDirection == +1 ) { |
329 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 329 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
330 | } else if ( skipDirection == -1 ) { | 330 | } else if ( skipDirection == -1 ) { |
331 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 331 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 336 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
337 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 337 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
338 | if ( event->state() == QMouseEvent::LeftButton ) { | 338 | if ( event->state() == QMouseEvent::LeftButton ) { |
339 | // The test to see if the mouse click is inside the button or not | 339 | // The test to see if the mouse click is inside the button or not |
340 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 340 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
341 | 341 | ||
342 | if ( isOnButton && !buttons[i].isHeld ) { | 342 | if ( isOnButton && !buttons[i].isHeld ) { |
343 | buttons[i].isHeld = TRUE; | 343 | buttons[i].isHeld = TRUE; |
344 | toggleButton(i); | 344 | toggleButton( buttons[ i ] ); |
345 | switch (i) { | 345 | switch (i) { |
346 | case VolumeUp: | 346 | case VolumeUp: |
347 | emit moreClicked(); | 347 | emit moreClicked(); |
348 | return; | 348 | return; |
349 | case VolumeDown: | 349 | case VolumeDown: |
350 | emit lessClicked(); | 350 | emit lessClicked(); |
351 | return; | 351 | return; |
352 | case Forward: | 352 | case Forward: |
353 | emit forwardClicked(); | 353 | emit forwardClicked(); |
354 | return; | 354 | return; |
355 | case Back: | 355 | case Back: |
356 | emit backClicked(); | 356 | emit backClicked(); |
357 | return; | 357 | return; |
358 | } | 358 | } |
359 | } else if ( !isOnButton && buttons[i].isHeld ) { | 359 | } else if ( !isOnButton && buttons[i].isHeld ) { |
360 | buttons[i].isHeld = FALSE; | 360 | buttons[i].isHeld = FALSE; |
361 | toggleButton(i); | 361 | toggleButton( buttons[ i ] ); |
362 | } | 362 | } |
363 | } else { | 363 | } else { |
364 | if ( buttons[i].isHeld ) { | 364 | if ( buttons[i].isHeld ) { |
365 | buttons[i].isHeld = FALSE; | 365 | buttons[i].isHeld = FALSE; |
366 | if ( buttons[i].type != ToggleButton ) { | 366 | if ( buttons[i].type != ToggleButton ) { |
367 | setToggleButton( i, FALSE ); | 367 | setToggleButton( buttons[ i ], FALSE ); |
368 | } | 368 | } |
369 | qDebug("mouseEvent %d", i); | 369 | qDebug("mouseEvent %d", i); |
370 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); | 370 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 377 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
378 | mouseMoveEvent( event ); | 378 | mouseMoveEvent( event ); |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 382 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
383 | mouseMoveEvent( event ); | 383 | mouseMoveEvent( event ); |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | void AudioWidget::showEvent( QShowEvent* ) { | 387 | void AudioWidget::showEvent( QShowEvent* ) { |
388 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 388 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
389 | mouseMoveEvent( &event ); | 389 | mouseMoveEvent( &event ); |
390 | } | 390 | } |
391 | 391 | ||
392 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 392 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
393 | switch ( e->key() ) { | 393 | switch ( e->key() ) { |
394 | ////////////////////////////// Zaurus keys | 394 | ////////////////////////////// Zaurus keys |
395 | case Key_Home: | 395 | case Key_Home: |
396 | break; | 396 | break; |
397 | case Key_F9: //activity | 397 | case Key_F9: //activity |
398 | hide(); | 398 | hide(); |
399 | // qDebug("Audio F9"); | 399 | // qDebug("Audio F9"); |
400 | break; | 400 | break; |
401 | case Key_F10: //contacts | 401 | case Key_F10: //contacts |
402 | break; | 402 | break; |
403 | case Key_F11: //menu | 403 | case Key_F11: //menu |
404 | mediaPlayerState.toggleBlank(); | 404 | mediaPlayerState.toggleBlank(); |
405 | break; | 405 | break; |
406 | case Key_F12: //home | 406 | case Key_F12: //home |
407 | break; | 407 | break; |
408 | case Key_F13: //mail | 408 | case Key_F13: //mail |
409 | mediaPlayerState.toggleBlank(); | 409 | mediaPlayerState.toggleBlank(); |
410 | break; | 410 | break; |
411 | case Key_Space: { | 411 | case Key_Space: { |
412 | mediaPlayerState.togglePaused(); | 412 | mediaPlayerState.togglePaused(); |
413 | } | 413 | } |
414 | break; | 414 | break; |
415 | case Key_Down: | 415 | case Key_Down: |
416 | // toggleButton(6); | 416 | // toggleButton(6); |
417 | emit lessClicked(); | 417 | emit lessClicked(); |
418 | emit lessReleased(); | 418 | emit lessReleased(); |
419 | // toggleButton(6); | 419 | // toggleButton(6); |
420 | break; | 420 | break; |
421 | case Key_Up: | 421 | case Key_Up: |
422 | // toggleButton(5); | 422 | // toggleButton(5); |
423 | emit moreClicked(); | 423 | emit moreClicked(); |
424 | emit moreReleased(); | 424 | emit moreReleased(); |
425 | // toggleButton(5); | 425 | // toggleButton(5); |
426 | break; | 426 | break; |
427 | case Key_Right: | 427 | case Key_Right: |
428 | // toggleButton(3); | 428 | // toggleButton(3); |
429 | mediaPlayerState.setNext(); | 429 | mediaPlayerState.setNext(); |
430 | // toggleButton(3); | 430 | // toggleButton(3); |
431 | break; | 431 | break; |
432 | case Key_Left: | 432 | case Key_Left: |
433 | // toggleButton(4); | 433 | // toggleButton(4); |
434 | mediaPlayerState.setPrev(); | 434 | mediaPlayerState.setPrev(); |
435 | // toggleButton(4); | 435 | // toggleButton(4); |
436 | break; | 436 | break; |
437 | case Key_Escape: { | 437 | case Key_Escape: { |
438 | } | 438 | } |
439 | break; | 439 | break; |
440 | 440 | ||
441 | }; | 441 | }; |
442 | } | 442 | } |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 9b276b5..092e5ce 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -1,107 +1,107 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef AUDIO_WIDGET_H | 34 | #ifndef AUDIO_WIDGET_H |
35 | #define AUDIO_WIDGET_H | 35 | #define AUDIO_WIDGET_H |
36 | 36 | ||
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qdrawutil.h> | 38 | #include <qdrawutil.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qslider.h> | 41 | #include <qslider.h> |
42 | #include <qframe.h> | 42 | #include <qframe.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qimage.h> | 44 | #include <qimage.h> |
45 | 45 | ||
46 | #include <opie/oticker.h> | 46 | #include <opie/oticker.h> |
47 | 47 | ||
48 | #include "mediawidget.h" | 48 | #include "mediawidget.h" |
49 | 49 | ||
50 | class QPixmap; | 50 | class QPixmap; |
51 | 51 | ||
52 | class AudioWidget : public MediaWidget { | 52 | class AudioWidget : public MediaWidget { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
56 | ~AudioWidget(); | 56 | ~AudioWidget(); |
57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
58 | public slots: | 58 | public slots: |
59 | void updateSlider( long, long ); | 59 | void updateSlider( long, long ); |
60 | void sliderPressed( ); | 60 | void sliderPressed( ); |
61 | void sliderReleased( ); | 61 | void sliderReleased( ); |
62 | void setLooping( bool b) { setToggleButton( Loop, b ); } | 62 | void setLooping( bool b) { setToggleButton( buttons[ Loop ], b ); } |
63 | void setPosition( long ); | 63 | void setPosition( long ); |
64 | void setSeekable( bool ); | 64 | void setSeekable( bool ); |
65 | 65 | ||
66 | public: | 66 | public: |
67 | virtual void setLength( long ); | 67 | virtual void setLength( long ); |
68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } | 68 | virtual void setPlaying( bool b) { setToggleButton( buttons[ Play ], b ); } |
69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
70 | 70 | ||
71 | signals: | 71 | signals: |
72 | void moreClicked(); | 72 | void moreClicked(); |
73 | void lessClicked(); | 73 | void lessClicked(); |
74 | void forwardClicked(); | 74 | void forwardClicked(); |
75 | void backClicked(); | 75 | void backClicked(); |
76 | void sliderMoved(long); | 76 | void sliderMoved(long); |
77 | 77 | ||
78 | protected: | 78 | protected: |
79 | void doBlank(); | 79 | void doBlank(); |
80 | void doUnblank(); | 80 | void doUnblank(); |
81 | void showEvent( QShowEvent *se ); | 81 | void showEvent( QShowEvent *se ); |
82 | void resizeEvent( QResizeEvent *re ); | 82 | void resizeEvent( QResizeEvent *re ); |
83 | void mouseMoveEvent( QMouseEvent *event ); | 83 | void mouseMoveEvent( QMouseEvent *event ); |
84 | void mousePressEvent( QMouseEvent *event ); | 84 | void mousePressEvent( QMouseEvent *event ); |
85 | void mouseReleaseEvent( QMouseEvent *event ); | 85 | void mouseReleaseEvent( QMouseEvent *event ); |
86 | void timerEvent( QTimerEvent *event ); | 86 | void timerEvent( QTimerEvent *event ); |
87 | void keyReleaseEvent( QKeyEvent *e); | 87 | void keyReleaseEvent( QKeyEvent *e); |
88 | private slots: | 88 | private slots: |
89 | void skipFor(); | 89 | void skipFor(); |
90 | void skipBack(); | 90 | void skipBack(); |
91 | void stopSkip(); | 91 | void stopSkip(); |
92 | private: | 92 | private: |
93 | int skipDirection; | 93 | int skipDirection; |
94 | QString skin; | 94 | QString skin; |
95 | QImage imgUp; | 95 | QImage imgUp; |
96 | QImage imgDn; | 96 | QImage imgDn; |
97 | 97 | ||
98 | OTicker songInfo; | 98 | OTicker songInfo; |
99 | QSlider slider; | 99 | QSlider slider; |
100 | QLineEdit time; | 100 | QLineEdit time; |
101 | bool isStreaming : 1; | 101 | bool isStreaming : 1; |
102 | bool audioSliderBeingMoved : 1; | 102 | bool audioSliderBeingMoved : 1; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | 105 | ||
106 | #endif // AUDIO_WIDGET_H | 106 | #endif // AUDIO_WIDGET_H |
107 | 107 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 9c5291b..66129c9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -1,137 +1,131 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | (C) 2002 Max Reiss <harlekin@handhelds.org> | 3 | (C) 2002 Max Reiss <harlekin@handhelds.org> |
4 | (C) 2002 L. Potter <ljp@llornkcor.com> | 4 | (C) 2002 L. Potter <ljp@llornkcor.com> |
5 | (C) 2002 Holger Freyther <zecke@handhelds.org> | 5 | (C) 2002 Holger Freyther <zecke@handhelds.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include "mediawidget.h" | 24 | #include "mediawidget.h" |
25 | #include "playlistwidget.h" | 25 | #include "playlistwidget.h" |
26 | 26 | ||
27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
29 | { | 29 | { |
30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
33 | this, SLOT( setLength( long ) ) ); | 33 | this, SLOT( setLength( long ) ) ); |
34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
35 | this, SLOT( setPlaying( bool ) ) ); | 35 | this, SLOT( setPlaying( bool ) ) ); |
36 | } | 36 | } |
37 | 37 | ||
38 | MediaWidget::~MediaWidget() | 38 | MediaWidget::~MediaWidget() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | void MediaWidget::closeEvent( QCloseEvent * ) | 42 | void MediaWidget::closeEvent( QCloseEvent * ) |
43 | { | 43 | { |
44 | mediaPlayerState.setList(); | 44 | mediaPlayerState.setList(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 47 | void MediaWidget::paintEvent( QPaintEvent *pe ) |
48 | { | 48 | { |
49 | QPainter p( this ); | 49 | QPainter p( this ); |
50 | 50 | ||
51 | if ( mediaPlayerState.isFullscreen() ) { | 51 | if ( mediaPlayerState.isFullscreen() ) { |
52 | // Clear the background | 52 | // Clear the background |
53 | p.setBrush( QBrush( Qt::black ) ); | 53 | p.setBrush( QBrush( Qt::black ) ); |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | 56 | ||
57 | if ( !pe->erased() ) { | 57 | if ( !pe->erased() ) { |
58 | // Combine with background and double buffer | 58 | // Combine with background and double buffer |
59 | QPixmap pix( pe->rect().size() ); | 59 | QPixmap pix( pe->rect().size() ); |
60 | QPainter p( &pix ); | 60 | QPainter p( &pix ); |
61 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 61 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
62 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); | 62 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); |
63 | paintAllButtons( p ); | 63 | paintAllButtons( p ); |
64 | QPainter p2( this ); | 64 | QPainter p2( this ); |
65 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 65 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
66 | } else { | 66 | } else { |
67 | QPainter p( this ); | 67 | QPainter p( this ); |
68 | paintAllButtons( p ); | 68 | paintAllButtons( p ); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaWidget::handleCommand( Command command, bool buttonDown ) | 72 | void MediaWidget::handleCommand( Command command, bool buttonDown ) |
73 | { | 73 | { |
74 | switch ( command ) { | 74 | switch ( command ) { |
75 | case Play: mediaPlayerState.togglePaused(); | 75 | case Play: mediaPlayerState.togglePaused(); |
76 | case Stop: mediaPlayerState.setPlaying(FALSE); return; | 76 | case Stop: mediaPlayerState.setPlaying(FALSE); return; |
77 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 77 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
78 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 78 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
79 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; | 79 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; |
80 | case VolumeUp: emit moreReleased(); return; | 80 | case VolumeUp: emit moreReleased(); return; |
81 | case VolumeDown: emit lessReleased(); return; | 81 | case VolumeDown: emit lessReleased(); return; |
82 | case PlayList: mediaPlayerState.setList(); return; | 82 | case PlayList: mediaPlayerState.setList(); return; |
83 | case Forward: emit forwardReleased(); return; | 83 | case Forward: emit forwardReleased(); return; |
84 | case Back: emit backReleased(); return; | 84 | case Back: emit backReleased(); return; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const | 88 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const |
89 | { | 89 | { |
90 | return ( position.x() > 0 && position.y() > 0 && | 90 | return ( position.x() > 0 && position.y() > 0 && |
91 | position.x() < buttonMask.width() && | 91 | position.x() < buttonMask.width() && |
92 | position.y() < buttonMask.height() && | 92 | position.y() < buttonMask.height() && |
93 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); | 93 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); |
94 | } | 94 | } |
95 | 95 | ||
96 | void MediaWidget::paintAllButtons( QPainter &p ) | 96 | void MediaWidget::paintAllButtons( QPainter &p ) |
97 | { | 97 | { |
98 | for ( ButtonMap::ConstIterator it = buttons.begin(); | 98 | for ( ButtonMap::ConstIterator it = buttons.begin(); |
99 | it != buttons.end(); ++it ) | 99 | it != buttons.end(); ++it ) |
100 | paintButton( p, *it ); | 100 | paintButton( p, *it ); |
101 | } | 101 | } |
102 | 102 | ||
103 | void MediaWidget::paintButton( const Button &button ) | 103 | void MediaWidget::paintButton( const Button &button ) |
104 | { | 104 | { |
105 | QPainter p( this ); | 105 | QPainter p( this ); |
106 | paintButton( p, button ); | 106 | paintButton( p, button ); |
107 | } | 107 | } |
108 | 108 | ||
109 | void MediaWidget::paintButton( QPainter &p, const Button &button ) | 109 | void MediaWidget::paintButton( QPainter &p, const Button &button ) |
110 | { | 110 | { |
111 | if ( button.isDown ) | 111 | if ( button.isDown ) |
112 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); | 112 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); |
113 | else | 113 | else |
114 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); | 114 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); |
115 | } | 115 | } |
116 | 116 | ||
117 | void MediaWidget::setToggleButton( int buttonId, bool down ) | 117 | void MediaWidget::setToggleButton( Button &button, bool down ) |
118 | { | 118 | { |
119 | qDebug("setToggleButton %d", buttonId ); | ||
120 | |||
121 | Button &button = buttons[ buttonId ]; | ||
122 | |||
123 | if ( down != button.isDown ) | 119 | if ( down != button.isDown ) |
124 | toggleButton( buttonId ); | 120 | toggleButton( button ); |
125 | } | 121 | } |
126 | 122 | ||
127 | void MediaWidget::toggleButton( int buttonId ) | 123 | void MediaWidget::toggleButton( Button &button ) |
128 | { | 124 | { |
129 | Button &button = buttons[ buttonId ]; | ||
130 | |||
131 | button.isDown = !button.isDown; | 125 | button.isDown = !button.isDown; |
132 | 126 | ||
133 | paintButton( button ); | 127 | paintButton( button ); |
134 | } | 128 | } |
135 | 129 | ||
136 | /* vim: et sw=4 ts=4 | 130 | /* vim: et sw=4 ts=4 |
137 | */ | 131 | */ |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index b7860dc..05b7b71 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -1,111 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | (C) 2002 Max Reiss <harlekin@handhelds.org> | 3 | (C) 2002 Max Reiss <harlekin@handhelds.org> |
4 | (C) 2002 L. Potter <ljp@llornkcor.com> | 4 | (C) 2002 L. Potter <ljp@llornkcor.com> |
5 | (C) 2002 Holger Freyther <zecke@handhelds.org> | 5 | (C) 2002 Holger Freyther <zecke@handhelds.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef MEDIAWIDGET_H | 23 | #ifndef MEDIAWIDGET_H |
24 | #define MEDIAWIDGET_H | 24 | #define MEDIAWIDGET_H |
25 | 25 | ||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qmap.h> | 27 | #include <qmap.h> |
28 | 28 | ||
29 | #include "mediaplayerstate.h" | 29 | #include "mediaplayerstate.h" |
30 | #include "playlistwidget.h" | 30 | #include "playlistwidget.h" |
31 | 31 | ||
32 | #include <vector> | 32 | #include <vector> |
33 | 33 | ||
34 | class MediaWidget : public QWidget | 34 | class MediaWidget : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
39 | enum ButtonType { NormalButton, ToggleButton }; | 39 | enum ButtonType { NormalButton, ToggleButton }; |
40 | 40 | ||
41 | struct Button | 41 | struct Button |
42 | { | 42 | { |
43 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} | 43 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} |
44 | 44 | ||
45 | ButtonType type : 1; | 45 | ButtonType type : 1; |
46 | bool isHeld : 1; | 46 | bool isHeld : 1; |
47 | bool isDown : 1; | 47 | bool isDown : 1; |
48 | 48 | ||
49 | QBitmap mask; | 49 | QBitmap mask; |
50 | QPixmap pixUp; | 50 | QPixmap pixUp; |
51 | QPixmap pixDown; | 51 | QPixmap pixDown; |
52 | }; | 52 | }; |
53 | typedef std::vector<Button> ButtonVector; | 53 | typedef std::vector<Button> ButtonVector; |
54 | // when the transition is done this should be Command -> Button | 54 | // when the transition is done this should be Command -> Button |
55 | typedef QMap<int, Button> ButtonMap; | 55 | typedef QMap<int, Button> ButtonMap; |
56 | 56 | ||
57 | struct SkinButtonInfo | 57 | struct SkinButtonInfo |
58 | { | 58 | { |
59 | Command command; | 59 | Command command; |
60 | const char *fileName; | 60 | const char *fileName; |
61 | ButtonType type; | 61 | ButtonType type; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | typedef std::vector<QBitmap> MaskVector; | 64 | typedef std::vector<QBitmap> MaskVector; |
65 | typedef std::vector<QPixmap> PixmapVector; | 65 | typedef std::vector<QPixmap> PixmapVector; |
66 | 66 | ||
67 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 67 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
68 | virtual ~MediaWidget(); | 68 | virtual ~MediaWidget(); |
69 | 69 | ||
70 | public slots: | 70 | public slots: |
71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
72 | virtual void setLength( long length ) = 0; | 72 | virtual void setLength( long length ) = 0; |
73 | virtual void setPlaying( bool playing ) = 0; | 73 | virtual void setPlaying( bool playing ) = 0; |
74 | 74 | ||
75 | signals: | 75 | signals: |
76 | void moreReleased(); | 76 | void moreReleased(); |
77 | void lessReleased(); | 77 | void lessReleased(); |
78 | void forwardReleased(); | 78 | void forwardReleased(); |
79 | void backReleased(); | 79 | void backReleased(); |
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | virtual void closeEvent( QCloseEvent * ); | 82 | virtual void closeEvent( QCloseEvent * ); |
83 | 83 | ||
84 | virtual void paintEvent( QPaintEvent *pe ); | 84 | virtual void paintEvent( QPaintEvent *pe ); |
85 | 85 | ||
86 | void handleCommand( Command command, bool buttonDown ); | 86 | void handleCommand( Command command, bool buttonDown ); |
87 | 87 | ||
88 | bool isOverButton( const QPoint &position, int buttonId ) const; | 88 | bool isOverButton( const QPoint &position, int buttonId ) const; |
89 | 89 | ||
90 | void paintAllButtons( QPainter &p ); | 90 | void paintAllButtons( QPainter &p ); |
91 | void paintButton( const Button &button ); | 91 | void paintButton( const Button &button ); |
92 | void paintButton( QPainter &p, const Button &button ); | 92 | void paintButton( QPainter &p, const Button &button ); |
93 | 93 | ||
94 | void setToggleButton( int buttonId, bool down ); | 94 | void setToggleButton( Button &button, bool down ); |
95 | void toggleButton( int buttonId ); | 95 | void toggleButton( Button &button ); |
96 | 96 | ||
97 | MediaPlayerState &mediaPlayerState; | 97 | MediaPlayerState &mediaPlayerState; |
98 | PlayListWidget &playList; | 98 | PlayListWidget &playList; |
99 | 99 | ||
100 | ButtonMap buttons; | 100 | ButtonMap buttons; |
101 | 101 | ||
102 | QImage buttonMask; | 102 | QImage buttonMask; |
103 | 103 | ||
104 | QPoint upperLeftOfButtonMask; | 104 | QPoint upperLeftOfButtonMask; |
105 | 105 | ||
106 | QPixmap backgroundPixmap; | 106 | QPixmap backgroundPixmap; |
107 | }; | 107 | }; |
108 | 108 | ||
109 | #endif // MEDIAWIDGET_H | 109 | #endif // MEDIAWIDGET_H |
110 | /* vim: et sw=4 ts=4 | 110 | /* vim: et sw=4 ts=4 |
111 | */ | 111 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index db4a396..673c9e8 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -125,309 +125,309 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
125 | slider->setMaxValue( 1 ); | 125 | slider->setMaxValue( 1 ); |
126 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 126 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
127 | //slider->setFocusPolicy( QWidget::NoFocus ); | 127 | //slider->setFocusPolicy( QWidget::NoFocus ); |
128 | 128 | ||
129 | resizeEvent( NULL ); | 129 | resizeEvent( NULL ); |
130 | 130 | ||
131 | setLength( mediaPlayerState.length() ); | 131 | setLength( mediaPlayerState.length() ); |
132 | setPosition( mediaPlayerState.position() ); | 132 | setPosition( mediaPlayerState.position() ); |
133 | setFullscreen( mediaPlayerState.isFullscreen() ); | 133 | setFullscreen( mediaPlayerState.isFullscreen() ); |
134 | setPlaying( mediaPlayerState.isPlaying() ); | 134 | setPlaying( mediaPlayerState.isPlaying() ); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | VideoWidget::~VideoWidget() | 138 | VideoWidget::~VideoWidget() |
139 | { | 139 | { |
140 | } | 140 | } |
141 | 141 | ||
142 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 142 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
143 | QPixmap pix( img.width(), img.height() ); | 143 | QPixmap pix( img.width(), img.height() ); |
144 | QPainter p( &pix ); | 144 | QPainter p( &pix ); |
145 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 145 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
146 | p.drawImage( 0, 0, img ); | 146 | p.drawImage( 0, 0, img ); |
147 | return new QPixmap( pix ); | 147 | return new QPixmap( pix ); |
148 | } | 148 | } |
149 | 149 | ||
150 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { | 150 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { |
151 | QPixmap pixmap( pix ); | 151 | QPixmap pixmap( pix ); |
152 | pixmap.setMask( mask ); | 152 | pixmap.setMask( mask ); |
153 | return pixmap; | 153 | return pixmap; |
154 | } | 154 | } |
155 | 155 | ||
156 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 156 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
157 | int h = height(); | 157 | int h = height(); |
158 | int w = width(); | 158 | int w = width(); |
159 | //int Vh = 160; | 159 | //int Vh = 160; |
160 | //int Vw = 220; | 160 | //int Vw = 220; |
161 | 161 | ||
162 | slider->setFixedWidth( w - 20 ); | 162 | slider->setFixedWidth( w - 20 ); |
163 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 163 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
164 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 164 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
165 | slider->setFocusPolicy( QWidget::NoFocus ); | 165 | slider->setFocusPolicy( QWidget::NoFocus ); |
166 | slider->setBackgroundPixmap( backgroundPixmap ); | 166 | slider->setBackgroundPixmap( backgroundPixmap ); |
167 | 167 | ||
168 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; | 168 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; |
169 | if(w>h) | 169 | if(w>h) |
170 | upperLeftOfButtonMask.ry() = 0; | 170 | upperLeftOfButtonMask.ry() = 0; |
171 | else | 171 | else |
172 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 172 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
173 | QPoint p = upperLeftOfButtonMask; | 173 | QPoint p = upperLeftOfButtonMask; |
174 | 174 | ||
175 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); | 175 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); |
176 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); | 176 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); |
177 | 177 | ||
178 | for ( int i = 0; i < 7; i++ ) { | 178 | for ( int i = 0; i < 7; i++ ) { |
179 | Button &button = buttons[ i ]; | 179 | Button &button = buttons[ i ]; |
180 | 180 | ||
181 | if ( !button.mask.isNull() ) { | 181 | if ( !button.mask.isNull() ) { |
182 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); | 182 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); |
183 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); | 183 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | delete pixUp; | 187 | delete pixUp; |
188 | delete pixDn; | 188 | delete pixDn; |
189 | } | 189 | } |
190 | 190 | ||
191 | static bool videoSliderBeingMoved = FALSE; | 191 | static bool videoSliderBeingMoved = FALSE; |
192 | 192 | ||
193 | void VideoWidget::sliderPressed() { | 193 | void VideoWidget::sliderPressed() { |
194 | videoSliderBeingMoved = TRUE; | 194 | videoSliderBeingMoved = TRUE; |
195 | } | 195 | } |
196 | 196 | ||
197 | void VideoWidget::sliderReleased() { | 197 | void VideoWidget::sliderReleased() { |
198 | videoSliderBeingMoved = FALSE; | 198 | videoSliderBeingMoved = FALSE; |
199 | if ( slider->width() == 0 ) { | 199 | if ( slider->width() == 0 ) { |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); | 202 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); |
203 | mediaPlayerState.setPosition( val ); | 203 | mediaPlayerState.setPosition( val ); |
204 | } | 204 | } |
205 | 205 | ||
206 | void VideoWidget::setPosition( long i ) { | 206 | void VideoWidget::setPosition( long i ) { |
207 | updateSlider( i, mediaPlayerState.length() ); | 207 | updateSlider( i, mediaPlayerState.length() ); |
208 | } | 208 | } |
209 | 209 | ||
210 | 210 | ||
211 | void VideoWidget::setLength( long max ) { | 211 | void VideoWidget::setLength( long max ) { |
212 | updateSlider( mediaPlayerState.position(), max ); | 212 | updateSlider( mediaPlayerState.position(), max ); |
213 | } | 213 | } |
214 | 214 | ||
215 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 215 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
216 | { | 216 | { |
217 | if ( displayType == MediaPlayerState::Video ) { | 217 | if ( displayType == MediaPlayerState::Video ) { |
218 | makeVisible(); | 218 | makeVisible(); |
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | 221 | ||
222 | // Effectively blank the view next time we show it so it looks nicer | 222 | // Effectively blank the view next time we show it so it looks nicer |
223 | scaledWidth = 0; | 223 | scaledWidth = 0; |
224 | scaledHeight = 0; | 224 | scaledHeight = 0; |
225 | hide(); | 225 | hide(); |
226 | } | 226 | } |
227 | 227 | ||
228 | void VideoWidget::updateSlider( long i, long max ) { | 228 | void VideoWidget::updateSlider( long i, long max ) { |
229 | // Will flicker too much if we don't do this | 229 | // Will flicker too much if we don't do this |
230 | if ( max == 0 ) { | 230 | if ( max == 0 ) { |
231 | return; | 231 | return; |
232 | } | 232 | } |
233 | int width = slider->width(); | 233 | int width = slider->width(); |
234 | int val = int((double)i * width / max); | 234 | int val = int((double)i * width / max); |
235 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 235 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
236 | if ( slider->value() != val ) { | 236 | if ( slider->value() != val ) { |
237 | slider->setValue( val ); | 237 | slider->setValue( val ); |
238 | } | 238 | } |
239 | if ( slider->maxValue() != width ) { | 239 | if ( slider->maxValue() != width ) { |
240 | slider->setMaxValue( width ); | 240 | slider->setMaxValue( width ); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 245 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
246 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 246 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
247 | if ( event->state() == QMouseEvent::LeftButton ) { | 247 | if ( event->state() == QMouseEvent::LeftButton ) { |
248 | // The test to see if the mouse click is inside the button or not | 248 | // The test to see if the mouse click is inside the button or not |
249 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 249 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
250 | 250 | ||
251 | if ( isOnButton && !buttons[i].isHeld ) { | 251 | if ( isOnButton && !buttons[i].isHeld ) { |
252 | buttons[i].isHeld = TRUE; | 252 | buttons[i].isHeld = TRUE; |
253 | toggleButton(i); | 253 | toggleButton( buttons[ i ] ); |
254 | 254 | ||
255 | switch (i) { | 255 | switch (i) { |
256 | case VideoVolUp: | 256 | case VideoVolUp: |
257 | emit moreClicked(); | 257 | emit moreClicked(); |
258 | return; | 258 | return; |
259 | case VideoVolDown: | 259 | case VideoVolDown: |
260 | emit lessClicked(); | 260 | emit lessClicked(); |
261 | return; | 261 | return; |
262 | } | 262 | } |
263 | } else if ( !isOnButton && buttons[i].isHeld ) { | 263 | } else if ( !isOnButton && buttons[i].isHeld ) { |
264 | buttons[i].isHeld = FALSE; | 264 | buttons[i].isHeld = FALSE; |
265 | toggleButton(i); | 265 | toggleButton( buttons[ i ] ); |
266 | } | 266 | } |
267 | } else { | 267 | } else { |
268 | 268 | ||
269 | if ( buttons[i].isHeld ) { | 269 | if ( buttons[i].isHeld ) { |
270 | buttons[i].isHeld = FALSE; | 270 | buttons[i].isHeld = FALSE; |
271 | if ( buttons[i].type != ToggleButton ) { | 271 | if ( buttons[i].type != ToggleButton ) { |
272 | setToggleButton( i, FALSE ); | 272 | setToggleButton( buttons[ i ], FALSE ); |
273 | } | 273 | } |
274 | 274 | ||
275 | switch(i) { | 275 | switch(i) { |
276 | 276 | ||
277 | case VideoPlay: { | 277 | case VideoPlay: { |
278 | if( mediaPlayerState.isPaused() ) { | 278 | if( mediaPlayerState.isPaused() ) { |
279 | setToggleButton( i, FALSE ); | 279 | setToggleButton( buttons[ i ], FALSE ); |
280 | mediaPlayerState.setPaused( FALSE ); | 280 | mediaPlayerState.setPaused( FALSE ); |
281 | return; | 281 | return; |
282 | } else if( !mediaPlayerState.isPaused() ) { | 282 | } else if( !mediaPlayerState.isPaused() ) { |
283 | setToggleButton( i, TRUE ); | 283 | setToggleButton( buttons[ i ], TRUE ); |
284 | mediaPlayerState.setPaused( TRUE ); | 284 | mediaPlayerState.setPaused( TRUE ); |
285 | return; | 285 | return; |
286 | } else { | 286 | } else { |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; | 291 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; |
292 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 292 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
293 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 293 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
294 | case VideoVolUp: emit moreReleased(); return; | 294 | case VideoVolUp: emit moreReleased(); return; |
295 | case VideoVolDown: emit lessReleased(); return; | 295 | case VideoVolDown: emit lessReleased(); return; |
296 | case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; | 296 | case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; |
297 | } | 297 | } |
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 303 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
304 | mouseMoveEvent( event ); | 304 | mouseMoveEvent( event ); |
305 | } | 305 | } |
306 | 306 | ||
307 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 307 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
308 | if ( mediaPlayerState.isFullscreen() ) { | 308 | if ( mediaPlayerState.isFullscreen() ) { |
309 | mediaPlayerState.setFullscreen( FALSE ); | 309 | mediaPlayerState.setFullscreen( FALSE ); |
310 | makeVisible(); | 310 | makeVisible(); |
311 | } | 311 | } |
312 | mouseMoveEvent( event ); | 312 | mouseMoveEvent( event ); |
313 | } | 313 | } |
314 | 314 | ||
315 | void VideoWidget::showEvent( QShowEvent* ) { | 315 | void VideoWidget::showEvent( QShowEvent* ) { |
316 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 316 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
317 | mouseMoveEvent( &event ); | 317 | mouseMoveEvent( &event ); |
318 | } | 318 | } |
319 | 319 | ||
320 | 320 | ||
321 | void VideoWidget::backToNormal() { | 321 | void VideoWidget::backToNormal() { |
322 | mediaPlayerState.setFullscreen( FALSE ); | 322 | mediaPlayerState.setFullscreen( FALSE ); |
323 | makeVisible(); | 323 | makeVisible(); |
324 | } | 324 | } |
325 | 325 | ||
326 | void VideoWidget::makeVisible() { | 326 | void VideoWidget::makeVisible() { |
327 | if ( mediaPlayerState.isFullscreen() ) { | 327 | if ( mediaPlayerState.isFullscreen() ) { |
328 | setBackgroundMode( QWidget::NoBackground ); | 328 | setBackgroundMode( QWidget::NoBackground ); |
329 | showFullScreen(); | 329 | showFullScreen(); |
330 | resize( qApp->desktop()->size() ); | 330 | resize( qApp->desktop()->size() ); |
331 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 331 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
332 | 332 | ||
333 | slider->hide(); | 333 | slider->hide(); |
334 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 334 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
335 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 335 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
336 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 336 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
337 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 337 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
338 | 338 | ||
339 | } else { | 339 | } else { |
340 | showNormal(); | 340 | showNormal(); |
341 | showMaximized(); | 341 | showMaximized(); |
342 | setBackgroundPixmap( backgroundPixmap ); | 342 | setBackgroundPixmap( backgroundPixmap ); |
343 | QWidget *d = QApplication::desktop(); | 343 | QWidget *d = QApplication::desktop(); |
344 | int w = d->width(); | 344 | int w = d->width(); |
345 | int h = d->height(); | 345 | int h = d->height(); |
346 | 346 | ||
347 | if(w>h) { | 347 | if(w>h) { |
348 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 348 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
349 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 349 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
350 | } else { | 350 | } else { |
351 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 351 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
352 | } | 352 | } |
353 | 353 | ||
354 | if ( !mediaPlayerState.isSeekable() ) { | 354 | if ( !mediaPlayerState.isSeekable() ) { |
355 | if( !slider->isHidden()) { | 355 | if( !slider->isHidden()) { |
356 | slider->hide(); | 356 | slider->hide(); |
357 | } | 357 | } |
358 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 358 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
359 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 359 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
360 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 360 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
361 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 361 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
362 | } else { | 362 | } else { |
363 | slider->show(); | 363 | slider->show(); |
364 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 364 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
365 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 365 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
366 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 366 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
367 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 367 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 372 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
373 | switch ( e->key() ) { | 373 | switch ( e->key() ) { |
374 | ////////////////////////////// Zaurus keys | 374 | ////////////////////////////// Zaurus keys |
375 | case Key_Home: | 375 | case Key_Home: |
376 | break; | 376 | break; |
377 | case Key_F9: //activity | 377 | case Key_F9: //activity |
378 | break; | 378 | break; |
379 | case Key_F10: //contacts | 379 | case Key_F10: //contacts |
380 | // hide(); | 380 | // hide(); |
381 | break; | 381 | break; |
382 | case Key_F11: //menu | 382 | case Key_F11: //menu |
383 | break; | 383 | break; |
384 | case Key_F12: //home | 384 | case Key_F12: //home |
385 | break; | 385 | break; |
386 | case Key_F13: //mail | 386 | case Key_F13: //mail |
387 | break; | 387 | break; |
388 | case Key_Space: { | 388 | case Key_Space: { |
389 | if(mediaPlayerState.isPlaying()) { | 389 | if(mediaPlayerState.isPlaying()) { |
390 | mediaPlayerState.setPlaying(FALSE); | 390 | mediaPlayerState.setPlaying(FALSE); |
391 | } else { | 391 | } else { |
392 | mediaPlayerState.setPlaying(TRUE); | 392 | mediaPlayerState.setPlaying(TRUE); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | break; | 395 | break; |
396 | case Key_Down: | 396 | case Key_Down: |
397 | // toggleButton(6); | 397 | // toggleButton(6); |
398 | emit lessClicked(); | 398 | emit lessClicked(); |
399 | emit lessReleased(); | 399 | emit lessReleased(); |
400 | // toggleButton(6); | 400 | // toggleButton(6); |
401 | break; | 401 | break; |
402 | case Key_Up: | 402 | case Key_Up: |
403 | // toggleButton(5); | 403 | // toggleButton(5); |
404 | emit moreClicked(); | 404 | emit moreClicked(); |
405 | emit moreReleased(); | 405 | emit moreReleased(); |
406 | // toggleButton(5); | 406 | // toggleButton(5); |
407 | break; | 407 | break; |
408 | case Key_Right: | 408 | case Key_Right: |
409 | mediaPlayerState.setNext(); | 409 | mediaPlayerState.setNext(); |
410 | break; | 410 | break; |
411 | case Key_Left: | 411 | case Key_Left: |
412 | mediaPlayerState.setPrev(); | 412 | mediaPlayerState.setPrev(); |
413 | break; | 413 | break; |
414 | case Key_Escape: | 414 | case Key_Escape: |
415 | break; | 415 | break; |
416 | 416 | ||
417 | }; | 417 | }; |
418 | } | 418 | } |
419 | 419 | ||
420 | XineVideoWidget* VideoWidget::vidWidget() { | 420 | XineVideoWidget* VideoWidget::vidWidget() { |
421 | return videoFrame; | 421 | return videoFrame; |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | void VideoWidget::setFullscreen ( bool b ) { | 425 | void VideoWidget::setFullscreen ( bool b ) { |
426 | setToggleButton( VideoFullscreen, b ); | 426 | setToggleButton( buttons[ VideoFullscreen ], b ); |
427 | } | 427 | } |
428 | 428 | ||
429 | 429 | ||
430 | void VideoWidget::setPlaying( bool b) { | 430 | void VideoWidget::setPlaying( bool b) { |
431 | setToggleButton( VideoPlay, b ); | 431 | setToggleButton( buttons[ VideoPlay ], b ); |
432 | } | 432 | } |
433 | 433 | ||