summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp45
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp44
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp40
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
6 files changed, 50 insertions, 91 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 37c565b..dda039c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -324,69 +324,24 @@ void AudioWidget::stopSkip() {
324 killTimers(); 324 killTimers();
325} 325}
326 326
327 327
328void AudioWidget::timerEvent( QTimerEvent * ) { 328void AudioWidget::timerEvent( QTimerEvent * ) {
329 if ( skipDirection == +1 ) { 329 if ( skipDirection == +1 ) {
330 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 330 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
331 } else if ( skipDirection == -1 ) { 331 } else if ( skipDirection == -1 ) {
332 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 332 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
333 } 333 }
334} 334}
335 335
336
337void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
338 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
339 Button &button = *it;
340 Command command = button.command;
341
342 if ( event->state() == QMouseEvent::LeftButton ) {
343 // The test to see if the mouse click is inside the button or not
344 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command );
345
346 if ( isOnButton && !button.isHeld ) {
347 button.isHeld = TRUE;
348 toggleButton( button );
349 switch ( command ) {
350 case VolumeUp:
351 emit moreClicked();
352 return;
353 case VolumeDown:
354 emit lessClicked();
355 return;
356 case Forward:
357 emit forwardClicked();
358 return;
359 case Back:
360 emit backClicked();
361 return;
362 default: break;
363 }
364 } else if ( !isOnButton && button.isHeld ) {
365 button.isHeld = FALSE;
366 toggleButton( button );
367 }
368 } else {
369 if ( button.isHeld ) {
370 button.isHeld = FALSE;
371 if ( button.type != ToggleButton ) {
372 setToggleButton( button, FALSE );
373 }
374 handleCommand( command, button.isDown );
375 }
376 }
377 }
378}
379
380
381void AudioWidget::mousePressEvent( QMouseEvent *event ) { 336void AudioWidget::mousePressEvent( QMouseEvent *event ) {
382 mouseMoveEvent( event ); 337 mouseMoveEvent( event );
383} 338}
384 339
385 340
386void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 341void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
387 mouseMoveEvent( event ); 342 mouseMoveEvent( event );
388} 343}
389 344
390 345
391void AudioWidget::showEvent( QShowEvent* ) { 346void AudioWidget::showEvent( QShowEvent* ) {
392 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 347 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 9b276b5..690d1b3 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -60,36 +60,31 @@ public slots:
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( Loop, b ); }
63 void setPosition( long ); 63 void setPosition( long );
64 void setSeekable( bool ); 64 void setSeekable( bool );
65 65
66public: 66public:
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( Play, b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 70
71signals: 71signals:
72 void moreClicked();
73 void lessClicked();
74 void forwardClicked();
75 void backClicked();
76 void sliderMoved(long); 72 void sliderMoved(long);
77 73
78protected: 74protected:
79 void doBlank(); 75 void doBlank();
80 void doUnblank(); 76 void doUnblank();
81 void showEvent( QShowEvent *se ); 77 void showEvent( QShowEvent *se );
82 void resizeEvent( QResizeEvent *re ); 78 void resizeEvent( QResizeEvent *re );
83 void mouseMoveEvent( QMouseEvent *event );
84 void mousePressEvent( QMouseEvent *event ); 79 void mousePressEvent( QMouseEvent *event );
85 void mouseReleaseEvent( QMouseEvent *event ); 80 void mouseReleaseEvent( QMouseEvent *event );
86 void timerEvent( QTimerEvent *event ); 81 void timerEvent( QTimerEvent *event );
87 void keyReleaseEvent( QKeyEvent *e); 82 void keyReleaseEvent( QKeyEvent *e);
88private slots: 83private slots:
89 void skipFor(); 84 void skipFor();
90 void skipBack(); 85 void skipBack();
91 void stopSkip(); 86 void stopSkip();
92private: 87private:
93 int skipDirection; 88 int skipDirection;
94 QString skin; 89 QString skin;
95 QImage imgUp; 90 QImage imgUp;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 7eb75e6..3533d74 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -60,24 +60,68 @@ void MediaWidget::paintEvent( QPaintEvent *pe )
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
72void MediaWidget::mouseMoveEvent( QMouseEvent *event )
73{
74 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
75 Button &button = *it;
76 Command command = button.command;
77
78 if ( event->state() == QMouseEvent::LeftButton ) {
79 // The test to see if the mouse click is inside the button or not
80 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command );
81
82 if ( isOnButton && !button.isHeld ) {
83 button.isHeld = TRUE;
84 toggleButton( button );
85 switch ( command ) {
86 case VolumeUp:
87 emit moreClicked();
88 return;
89 case VolumeDown:
90 emit lessClicked();
91 return;
92 case Forward:
93 emit forwardClicked();
94 return;
95 case Back:
96 emit backClicked();
97 return;
98 default: break;
99 }
100 } else if ( !isOnButton && button.isHeld ) {
101 button.isHeld = FALSE;
102 toggleButton( button );
103 }
104 } else {
105 if ( button.isHeld ) {
106 button.isHeld = FALSE;
107 if ( button.type != ToggleButton ) {
108 setToggleButton( button, FALSE );
109 }
110 handleCommand( command, button.isDown );
111 }
112 }
113 }
114}
115
72void MediaWidget::makeVisible() 116void MediaWidget::makeVisible()
73{ 117{
74} 118}
75 119
76void MediaWidget::handleCommand( Command command, bool buttonDown ) 120void MediaWidget::handleCommand( Command command, bool buttonDown )
77{ 121{
78 switch ( command ) { 122 switch ( command ) {
79 case Play: mediaPlayerState.togglePaused(); 123 case Play: mediaPlayerState.togglePaused();
80 case Stop: mediaPlayerState.setPlaying(FALSE); return; 124 case Stop: mediaPlayerState.setPlaying(FALSE); return;
81 case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 125 case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
82 case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 126 case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
83 case Loop: mediaPlayerState.setLooping( buttonDown ); return; 127 case Loop: mediaPlayerState.setLooping( buttonDown ); return;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 3f4c45d..c19fdbb 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -68,30 +68,36 @@ public:
68 virtual ~MediaWidget(); 68 virtual ~MediaWidget();
69 69
70public slots: 70public 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
75signals: 75signals:
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 void forwardClicked();
81 void backClicked();
82 void moreClicked();
83 void lessClicked();
80 84
81protected: 85protected:
82 virtual void closeEvent( QCloseEvent * ); 86 virtual void closeEvent( QCloseEvent * );
83 87
84 virtual void paintEvent( QPaintEvent *pe ); 88 virtual void paintEvent( QPaintEvent *pe );
85 89
90 virtual void mouseMoveEvent( QMouseEvent *event );
91
86 virtual void makeVisible(); 92 virtual void makeVisible();
87 93
88 void handleCommand( Command command, bool buttonDown ); 94 void handleCommand( Command command, bool buttonDown );
89 95
90 bool isOverButton( const QPoint &position, int buttonId ) const; 96 bool isOverButton( const QPoint &position, int buttonId ) const;
91 97
92 void paintAllButtons( QPainter &p ); 98 void paintAllButtons( QPainter &p );
93 void paintButton( const Button &button ); 99 void paintButton( const Button &button );
94 void paintButton( QPainter &p, const Button &button ); 100 void paintButton( QPainter &p, const Button &button );
95 101
96 void setToggleButton( Button &button, bool down ); 102 void setToggleButton( Button &button, bool down );
97 void setToggleButton( Command command, bool down ); 103 void setToggleButton( Command command, bool down );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index cc586cc..41844e1 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -234,64 +234,24 @@ void VideoWidget::updateSlider( long i, long max ) {
234 int width = slider->width(); 234 int width = slider->width();
235 int val = int((double)i * width / max); 235 int val = int((double)i * width / max);
236 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 236 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
237 if ( slider->value() != val ) { 237 if ( slider->value() != val ) {
238 slider->setValue( val ); 238 slider->setValue( val );
239 } 239 }
240 if ( slider->maxValue() != width ) { 240 if ( slider->maxValue() != width ) {
241 slider->setMaxValue( width ); 241 slider->setMaxValue( width );
242 } 242 }
243 } 243 }
244} 244}
245 245
246void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
247 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
248 Button &button = *it;
249 Command command = button.command;
250
251 if ( event->state() == QMouseEvent::LeftButton ) {
252 // The test to see if the mouse click is inside the button or not
253 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command );
254
255 if ( isOnButton && !button.isHeld ) {
256 button.isHeld = TRUE;
257 toggleButton( button );
258
259 switch ( command ) {
260 case VolumeUp:
261 emit moreClicked();
262 return;
263 case VolumeDown:
264 emit lessClicked();
265 return;
266 default: break;
267 }
268 } else if ( !isOnButton && button.isHeld ) {
269 button.isHeld = FALSE;
270 toggleButton( button );
271 }
272 } else {
273
274 if ( button.isHeld ) {
275 button.isHeld = FALSE;
276 if ( button.type != ToggleButton ) {
277 setToggleButton( button, FALSE );
278 }
279
280 handleCommand( command, button.isDown );
281 }
282 }
283 }
284}
285
286void VideoWidget::mousePressEvent( QMouseEvent *event ) { 246void VideoWidget::mousePressEvent( QMouseEvent *event ) {
287 mouseMoveEvent( event ); 247 mouseMoveEvent( event );
288} 248}
289 249
290void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 250void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
291 if ( mediaPlayerState.isFullscreen() ) { 251 if ( mediaPlayerState.isFullscreen() ) {
292 mediaPlayerState.setFullscreen( FALSE ); 252 mediaPlayerState.setFullscreen( FALSE );
293 makeVisible(); 253 makeVisible();
294 } 254 }
295 mouseMoveEvent( event ); 255 mouseMoveEvent( event );
296} 256}
297 257
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index ef88186..7d50ea0 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -67,25 +67,24 @@ public:
67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
68 68
69signals: 69signals:
70 void moreClicked(); 70 void moreClicked();
71 void lessClicked(); 71 void lessClicked();
72 void sliderMoved( long ); 72 void sliderMoved( long );
73 void videoResized ( const QSize &s ); 73 void videoResized ( const QSize &s );
74 74
75protected: 75protected:
76 76
77 void resizeEvent( QResizeEvent * ); 77 void resizeEvent( QResizeEvent * );
78 void showEvent( QShowEvent *se ); 78 void showEvent( QShowEvent *se );
79 void mouseMoveEvent( QMouseEvent *event );
80 void mousePressEvent( QMouseEvent *event ); 79 void mousePressEvent( QMouseEvent *event );
81 void mouseReleaseEvent( QMouseEvent *event ); 80 void mouseReleaseEvent( QMouseEvent *event );
82 void keyReleaseEvent( QKeyEvent *e); 81 void keyReleaseEvent( QKeyEvent *e);
83 82
84private: 83private:
85// Ticker songInfo; 84// Ticker songInfo;
86 QImage imgUp; 85 QImage imgUp;
87 QImage imgDn; 86 QImage imgDn;
88 QString skin; 87 QString skin;
89 88
90 89
91 90