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
@@ -330,57 +330,12 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
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 ) {
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
@@ -66,24 +66,19 @@ public slots:
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();
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
@@ -66,12 +66,56 @@ void MediaWidget::paintEvent( QPaintEvent *pe )
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{
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
@@ -74,18 +74,24 @@ public slots:
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
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
@@ -240,52 +240,12 @@ void VideoWidget::updateSlider( long i, long max ) {
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() ) {
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
@@ -73,13 +73,12 @@ signals:
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;