-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 | |||
@@ -332,48 +332,48 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
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 | } |
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 | |||
@@ -50,31 +50,31 @@ | |||
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(); |
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 | |||
@@ -105,33 +105,27 @@ void MediaWidget::paintButton( const Button &button ) | |||
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 | |||
@@ -82,26 +82,26 @@ 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 | }; |
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 | |||
@@ -241,55 +241,55 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
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; |
@@ -414,20 +414,20 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
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 | ||