author | simon <simon> | 2002-12-09 16:28:55 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:28:55 (UTC) |
commit | 3b31b000db15e7618b3ef06a652bae41d87a1348 (patch) (unidiff) | |
tree | 25360f74f235f016d6ca50f2e4b8cc280a2e3a2e | |
parent | eeb797c68aca5cad9989b8438facebee13eede5e (diff) | |
download | opie-3b31b000db15e7618b3ef06a652bae41d87a1348.zip opie-3b31b000db15e7618b3ef06a652bae41d87a1348.tar.gz opie-3b31b000db15e7618b3ef06a652bae41d87a1348.tar.bz2 |
- transition to MediaWidget::Command completed
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 33 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 11 |
5 files changed, 30 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 092e5ce..9b276b5 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -56,19 +56,19 @@ public: | |||
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( buttons[ Loop ], b ); } | 62 | void setLooping( bool b) { setToggleButton( 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( buttons[ Play ], b ); } | 68 | virtual void setPlaying( bool b) { setToggleButton( 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(); |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 7891a7e..c0ebd63 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -112,12 +112,21 @@ void MediaWidget::paintButton( QPainter &p, const Button &button ) | |||
112 | if ( button.isDown ) | 112 | if ( button.isDown ) |
113 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); | 113 | p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); |
114 | else | 114 | else |
115 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); | 115 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); |
116 | } | 116 | } |
117 | 117 | ||
118 | void MediaWidget::setToggleButton( Command command, bool down ) | ||
119 | { | ||
120 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) | ||
121 | if ( it->command == command ) { | ||
122 | setToggleButton( *it, down ); | ||
123 | return; | ||
124 | } | ||
125 | } | ||
126 | |||
118 | void MediaWidget::setToggleButton( Button &button, bool down ) | 127 | void MediaWidget::setToggleButton( Button &button, bool down ) |
119 | { | 128 | { |
120 | if ( down != button.isDown ) | 129 | if ( down != button.isDown ) |
121 | toggleButton( button ); | 130 | toggleButton( button ); |
122 | } | 131 | } |
123 | 132 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 3bf01b6..caae0a7 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -89,12 +89,13 @@ protected: | |||
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( Button &button, bool down ); | 94 | void setToggleButton( Button &button, bool down ); |
95 | void setToggleButton( Command command, bool down ); | ||
95 | void toggleButton( Button &button ); | 96 | void toggleButton( Button &button ); |
96 | 97 | ||
97 | MediaPlayerState &mediaPlayerState; | 98 | MediaPlayerState &mediaPlayerState; |
98 | PlayListWidget &playList; | 99 | PlayListWidget &playList; |
99 | 100 | ||
100 | ButtonVector buttons; | 101 | ButtonVector buttons; |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 4867ef1..06f6cd2 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -109,13 +109,13 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
109 | QImage imgMask = button.mask.convertToImage(); | 109 | QImage imgMask = button.mask.convertToImage(); |
110 | uchar **dest = buttonMask.jumpTable(); | 110 | uchar **dest = buttonMask.jumpTable(); |
111 | for ( int y = 0; y < imgUp.height(); y++ ) { | 111 | for ( int y = 0; y < imgUp.height(); y++ ) { |
112 | uchar *line = dest[y]; | 112 | uchar *line = dest[y]; |
113 | for ( int x = 0; x < imgUp.width(); x++ ) | 113 | for ( int x = 0; x < imgUp.width(); x++ ) |
114 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 114 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
115 | line[x] = i + 1; | 115 | line[x] = button.command + 1; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | buttons.push_back( button ); | 119 | buttons.push_back( button ); |
120 | } | 120 | } |
121 | 121 | ||
@@ -244,28 +244,30 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
244 | } | 244 | } |
245 | 245 | ||
246 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 246 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
247 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 247 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
248 | 248 | ||
249 | Button &button = buttons[ i ]; | 249 | Button &button = buttons[ i ]; |
250 | Command command = button.command; | ||
250 | 251 | ||
251 | if ( event->state() == QMouseEvent::LeftButton ) { | 252 | if ( event->state() == QMouseEvent::LeftButton ) { |
252 | // The test to see if the mouse click is inside the button or not | 253 | // The test to see if the mouse click is inside the button or not |
253 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 254 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command ); |
254 | 255 | ||
255 | if ( isOnButton && !button.isHeld ) { | 256 | if ( isOnButton && !button.isHeld ) { |
256 | button.isHeld = TRUE; | 257 | button.isHeld = TRUE; |
257 | toggleButton( button ); | 258 | toggleButton( button ); |
258 | 259 | ||
259 | switch (i) { | 260 | switch ( command ) { |
260 | case VideoVolUp: | 261 | case VolumeUp: |
261 | emit moreClicked(); | 262 | emit moreClicked(); |
262 | return; | 263 | return; |
263 | case VideoVolDown: | 264 | case VolumeDown: |
264 | emit lessClicked(); | 265 | emit lessClicked(); |
265 | return; | 266 | return; |
267 | default: break; | ||
266 | } | 268 | } |
267 | } else if ( !isOnButton && button.isHeld ) { | 269 | } else if ( !isOnButton && button.isHeld ) { |
268 | button.isHeld = FALSE; | 270 | button.isHeld = FALSE; |
269 | toggleButton( button ); | 271 | toggleButton( button ); |
270 | } | 272 | } |
271 | } else { | 273 | } else { |
@@ -273,15 +275,15 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
273 | if ( button.isHeld ) { | 275 | if ( button.isHeld ) { |
274 | button.isHeld = FALSE; | 276 | button.isHeld = FALSE; |
275 | if ( button.type != ToggleButton ) { | 277 | if ( button.type != ToggleButton ) { |
276 | setToggleButton( button, FALSE ); | 278 | setToggleButton( button, FALSE ); |
277 | } | 279 | } |
278 | 280 | ||
279 | switch(i) { | 281 | switch( command ) { |
280 | 282 | ||
281 | case VideoPlay: { | 283 | case Play: { |
282 | if( mediaPlayerState.isPaused() ) { | 284 | if( mediaPlayerState.isPaused() ) { |
283 | setToggleButton( button, FALSE ); | 285 | setToggleButton( button, FALSE ); |
284 | mediaPlayerState.setPaused( FALSE ); | 286 | mediaPlayerState.setPaused( FALSE ); |
285 | return; | 287 | return; |
286 | } else if( !mediaPlayerState.isPaused() ) { | 288 | } else if( !mediaPlayerState.isPaused() ) { |
287 | setToggleButton( button, TRUE ); | 289 | setToggleButton( button, TRUE ); |
@@ -289,18 +291,19 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
289 | return; | 291 | return; |
290 | } else { | 292 | } else { |
291 | return; | 293 | return; |
292 | } | 294 | } |
293 | } | 295 | } |
294 | 296 | ||
295 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; | 297 | case Stop: mediaPlayerState.setPlaying( FALSE ); return; |
296 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 298 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
297 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 299 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
298 | case VideoVolUp: emit moreReleased(); return; | 300 | case VolumeUp: emit moreReleased(); return; |
299 | case VideoVolDown: emit lessReleased(); return; | 301 | case VolumeDown: emit lessReleased(); return; |
300 | case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; | 302 | case FullScreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; |
303 | default: break; | ||
301 | } | 304 | } |
302 | } | 305 | } |
303 | } | 306 | } |
304 | } | 307 | } |
305 | } | 308 | } |
306 | 309 | ||
@@ -424,14 +427,14 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
424 | XineVideoWidget* VideoWidget::vidWidget() { | 427 | XineVideoWidget* VideoWidget::vidWidget() { |
425 | return videoFrame; | 428 | return videoFrame; |
426 | } | 429 | } |
427 | 430 | ||
428 | 431 | ||
429 | void VideoWidget::setFullscreen ( bool b ) { | 432 | void VideoWidget::setFullscreen ( bool b ) { |
430 | setToggleButton( buttons[ VideoFullscreen ], b ); | 433 | setToggleButton( FullScreen, b ); |
431 | } | 434 | } |
432 | 435 | ||
433 | 436 | ||
434 | void VideoWidget::setPlaying( bool b) { | 437 | void VideoWidget::setPlaying( bool b) { |
435 | setToggleButton( buttons[ VideoPlay ], b ); | 438 | setToggleButton( Play, b ); |
436 | } | 439 | } |
437 | 440 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 915e9cc..c3bc131 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -41,23 +41,12 @@ | |||
41 | 41 | ||
42 | #include "mediawidget.h" | 42 | #include "mediawidget.h" |
43 | 43 | ||
44 | class QPixmap; | 44 | class QPixmap; |
45 | class QSlider; | 45 | class QSlider; |
46 | 46 | ||
47 | enum VideoButtons { | ||
48 | VideoPlay = 0, | ||
49 | VideoStop, | ||
50 | // VideoPause, | ||
51 | VideoNext, | ||
52 | VideoPrevious, | ||
53 | VideoVolUp, | ||
54 | VideoVolDown, | ||
55 | VideoFullscreen | ||
56 | }; | ||
57 | |||
58 | class VideoWidget : public MediaWidget { | 47 | class VideoWidget : public MediaWidget { |
59 | Q_OBJECT | 48 | Q_OBJECT |
60 | public: | 49 | public: |
61 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 50 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
62 | ~VideoWidget(); | 51 | ~VideoWidget(); |
63 | 52 | ||