summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
authorsimon <simon>2002-12-09 18:33:53 (UTC)
committer simon <simon>2002-12-09 18:33:53 (UTC)
commit711d8c1af3ebdd6f88ff3e9ffa46624c9b63badd (patch) (unidiff)
tree20ad8855c3e9fcb0e0ec5a79b3d9e934236e1344 /noncore/multimedia/opieplayer2
parent29b5784bba7b19497b5984418bacee261075ccf7 (diff)
downloadopie-711d8c1af3ebdd6f88ff3e9ffa46624c9b63badd.zip
opie-711d8c1af3ebdd6f88ff3e9ffa46624c9b63badd.tar.gz
opie-711d8c1af3ebdd6f88ff3e9ffa46624c9b63badd.tar.bz2
- another small cleanup in the mouse handling
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
6 files changed, 13 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index dda039c..5986a72 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -324,34 +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
336void AudioWidget::mousePressEvent( QMouseEvent *event ) {
337 mouseMoveEvent( event );
338}
339
340
341void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
342 mouseMoveEvent( event );
343}
344
345
346void AudioWidget::showEvent( QShowEvent* ) { 336void AudioWidget::showEvent( QShowEvent* ) {
347 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 337 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
348 mouseMoveEvent( &event ); 338 mouseMoveEvent( &event );
349} 339}
350 340
351void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 341void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
352 switch ( e->key() ) { 342 switch ( e->key() ) {
353 ////////////////////////////// Zaurus keys 343 ////////////////////////////// Zaurus keys
354 case Key_Home: 344 case Key_Home:
355 break; 345 break;
356 case Key_F9: //activity 346 case Key_F9: //activity
357 hide(); 347 hide();
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 690d1b3..e2e2314 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -67,26 +67,24 @@ 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( Play, b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 70
71signals: 71signals:
72 void sliderMoved(long); 72 void sliderMoved(long);
73 73
74protected: 74protected:
75 void doBlank(); 75 void doBlank();
76 void doUnblank(); 76 void doUnblank();
77 void showEvent( QShowEvent *se ); 77 void showEvent( QShowEvent *se );
78 void resizeEvent( QResizeEvent *re ); 78 void resizeEvent( QResizeEvent *re );
79 void mousePressEvent( QMouseEvent *event );
80 void mouseReleaseEvent( QMouseEvent *event );
81 void timerEvent( QTimerEvent *event ); 79 void timerEvent( QTimerEvent *event );
82 void keyReleaseEvent( QKeyEvent *e); 80 void keyReleaseEvent( QKeyEvent *e);
83private slots: 81private slots:
84 void skipFor(); 82 void skipFor();
85 void skipBack(); 83 void skipBack();
86 void stopSkip(); 84 void stopSkip();
87private: 85private:
88 int skipDirection; 86 int skipDirection;
89 QString skin; 87 QString skin;
90 QImage imgUp; 88 QImage imgUp;
91 QImage imgDn; 89 QImage imgDn;
92 90
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 3533d74..439ba2e 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -104,24 +104,34 @@ void MediaWidget::mouseMoveEvent( QMouseEvent *event )
104 } else { 104 } else {
105 if ( button.isHeld ) { 105 if ( button.isHeld ) {
106 button.isHeld = FALSE; 106 button.isHeld = FALSE;
107 if ( button.type != ToggleButton ) { 107 if ( button.type != ToggleButton ) {
108 setToggleButton( button, FALSE ); 108 setToggleButton( button, FALSE );
109 } 109 }
110 handleCommand( command, button.isDown ); 110 handleCommand( command, button.isDown );
111 } 111 }
112 } 112 }
113 } 113 }
114} 114}
115 115
116void MediaWidget::mousePressEvent( QMouseEvent *event )
117{
118 mouseMoveEvent( event );
119}
120
121void MediaWidget::mouseReleaseEvent( QMouseEvent *event )
122{
123 mouseMoveEvent( event );
124}
125
116void MediaWidget::makeVisible() 126void MediaWidget::makeVisible()
117{ 127{
118} 128}
119 129
120void MediaWidget::handleCommand( Command command, bool buttonDown ) 130void MediaWidget::handleCommand( Command command, bool buttonDown )
121{ 131{
122 switch ( command ) { 132 switch ( command ) {
123 case Play: mediaPlayerState.togglePaused(); 133 case Play: mediaPlayerState.togglePaused();
124 case Stop: mediaPlayerState.setPlaying(FALSE); return; 134 case Stop: mediaPlayerState.setPlaying(FALSE); return;
125 case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 135 case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
126 case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 136 case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
127 case Loop: mediaPlayerState.setLooping( buttonDown ); return; 137 case Loop: mediaPlayerState.setLooping( buttonDown ); return;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index c261728..9042d5b 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -79,24 +79,26 @@ signals:
79 void backReleased(); 79 void backReleased();
80 void forwardClicked(); 80 void forwardClicked();
81 void backClicked(); 81 void backClicked();
82 void moreClicked(); 82 void moreClicked();
83 void lessClicked(); 83 void lessClicked();
84 84
85protected: 85protected:
86 virtual void closeEvent( QCloseEvent * ); 86 virtual void closeEvent( QCloseEvent * );
87 87
88 virtual void paintEvent( QPaintEvent *pe ); 88 virtual void paintEvent( QPaintEvent *pe );
89 89
90 virtual void mouseMoveEvent( QMouseEvent *event ); 90 virtual void mouseMoveEvent( QMouseEvent *event );
91 virtual void mousePressEvent( QMouseEvent *event );
92 virtual void mouseReleaseEvent( QMouseEvent *event );
91 93
92 virtual void makeVisible(); 94 virtual void makeVisible();
93 95
94 void handleCommand( Command command, bool buttonDown ); 96 void handleCommand( Command command, bool buttonDown );
95 97
96 bool isOverButton( const QPoint &position, int buttonId ) const; 98 bool isOverButton( const QPoint &position, int buttonId ) const;
97 99
98 void paintAllButtons( QPainter &p ); 100 void paintAllButtons( QPainter &p );
99 void paintButton( const Button &button ); 101 void paintButton( const Button &button );
100 void paintButton( QPainter &p, const Button &button ); 102 void paintButton( QPainter &p, const Button &button );
101 103
102 void setToggleButton( Button &button, bool down ); 104 void setToggleButton( Button &button, bool down );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 26777e6..04b09f9 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -232,34 +232,30 @@ void VideoWidget::updateSlider( long i, long max ) {
232 int width = slider->width(); 232 int width = slider->width();
233 int val = int((double)i * width / max); 233 int val = int((double)i * width / max);
234 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 234 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
235 if ( slider->value() != val ) { 235 if ( slider->value() != val ) {
236 slider->setValue( val ); 236 slider->setValue( val );
237 } 237 }
238 if ( slider->maxValue() != width ) { 238 if ( slider->maxValue() != width ) {
239 slider->setMaxValue( width ); 239 slider->setMaxValue( width );
240 } 240 }
241 } 241 }
242} 242}
243 243
244void VideoWidget::mousePressEvent( QMouseEvent *event ) {
245 mouseMoveEvent( event );
246}
247
248void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 244void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
249 if ( mediaPlayerState.isFullscreen() ) { 245 if ( mediaPlayerState.isFullscreen() ) {
250 mediaPlayerState.setFullscreen( FALSE ); 246 mediaPlayerState.setFullscreen( FALSE );
251 makeVisible(); 247 makeVisible();
252 } 248 }
253 mouseMoveEvent( event ); 249 MediaWidget::mouseReleaseEvent( event );
254} 250}
255 251
256void VideoWidget::showEvent( QShowEvent* ) { 252void VideoWidget::showEvent( QShowEvent* ) {
257 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 253 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
258 mouseMoveEvent( &event ); 254 mouseMoveEvent( &event );
259} 255}
260 256
261 257
262 void VideoWidget::backToNormal() { 258 void VideoWidget::backToNormal() {
263 mediaPlayerState.setFullscreen( FALSE ); 259 mediaPlayerState.setFullscreen( FALSE );
264 makeVisible(); 260 makeVisible();
265 } 261 }
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index bed2116..985c094 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 mousePressEvent( QMouseEvent *event );
80 void mouseReleaseEvent( QMouseEvent *event ); 79 void mouseReleaseEvent( QMouseEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 80 void keyReleaseEvent( QKeyEvent *e);
82 81
83private: 82private:
84// Ticker songInfo; 83// Ticker songInfo;
85 QImage imgUp; 84 QImage imgUp;
86 QImage imgDn; 85 QImage imgDn;
87 QString skin; 86 QString skin;
88 87
89 88
90 89
91 QString backgroundPix; 90 QString backgroundPix;