author | llornkcor <llornkcor> | 2002-08-13 23:42:50 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-13 23:42:50 (UTC) |
commit | 6baf582094b418ec1defa2415210a7d7583628ff (patch) (unidiff) | |
tree | e7ee4a196eeb23a1b9276ab09f01aaf39ced83e3 | |
parent | 8abcf5a17d4ec31ad01557b69b8b0e7d97dc0c8f (diff) | |
download | opie-6baf582094b418ec1defa2415210a7d7583628ff.zip opie-6baf582094b418ec1defa2415210a7d7583628ff.tar.gz opie-6baf582094b418ec1defa2415210a7d7583628ff.tar.bz2 |
fix video button actions.. still needs work
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 87 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 11 |
6 files changed, 84 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8d8e4e5..a3238f0 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -33,3 +33,5 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
33 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 33 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
34 | |||
34 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 35 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
36 | |||
35 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 37 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
@@ -52,3 +54,2 @@ MediaPlayer::~MediaPlayer() { | |||
52 | void MediaPlayer::pauseCheck( bool b ) { | 54 | void MediaPlayer::pauseCheck( bool b ) { |
53 | // Only pause if playing | ||
54 | if ( b && !mediaPlayerState->playing() ) { | 55 | if ( b && !mediaPlayerState->playing() ) { |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 57b1c81..bb8d905 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -55,4 +55,2 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
55 | 55 | ||
56 | |||
57 | |||
58 | // public stuff | 56 | // public stuff |
@@ -161,6 +159,5 @@ void MediaPlayerState::setPlaylist( bool b ) { | |||
161 | void MediaPlayerState::setPaused( bool b ) { | 159 | void MediaPlayerState::setPaused( bool b ) { |
162 | if(b) qDebug("setPaused true"); | ||
163 | else qDebug("setPaused false"); | ||
164 | |||
165 | if ( isPaused == b ) { | 160 | if ( isPaused == b ) { |
161 | isPaused = FALSE; | ||
162 | emit pausedToggled(FALSE); | ||
166 | return; | 163 | return; |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 65458e7..27db464 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -166,3 +166,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
166 | 166 | ||
167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), this, SLOT( toggleFull() ) ); | 167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); |
168 | 168 | ||
@@ -173,3 +173,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
173 | 173 | ||
174 | pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), this, SLOT(toggleScaled() ) ); | 174 | pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); |
175 | 175 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index fdfa666..dd49892 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -64,3 +64,2 @@ private: | |||
64 | 64 | ||
65 | |||
66 | void initializeStates(); | 65 | void initializeStates(); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 9b88299..33153d4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -65,8 +65,8 @@ struct MediaButton { | |||
65 | MediaButton videoButtons[] = { | 65 | MediaButton videoButtons[] = { |
66 | { FALSE, FALSE, FALSE }, // previous | ||
67 | { FALSE, FALSE, FALSE }, // stop | 66 | { FALSE, FALSE, FALSE }, // stop |
68 | { TRUE, FALSE, FALSE }, // play | 67 | { TRUE, FALSE, FALSE }, // play |
69 | { TRUE, FALSE, FALSE }, // pause | 68 | { FALSE, FALSE, FALSE }, // previous |
70 | { FALSE, FALSE, FALSE }, // next | 69 | { FALSE, FALSE, FALSE }, // next |
71 | { FALSE, FALSE, FALSE }, // playlist | 70 | { FALSE, FALSE, FALSE }, // volUp |
71 | { FALSE, FALSE, FALSE }, // volDown | ||
72 | { TRUE, FALSE, FALSE } // fullscreen | 72 | { TRUE, FALSE, FALSE } // fullscreen |
@@ -78,3 +78,3 @@ const char *skinV_mask_file_names[7] = { | |||
78 | 78 | ||
79 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 79 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
80 | 80 | ||
@@ -139,2 +139,3 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
139 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 139 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
140 | |||
140 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 141 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
@@ -154,2 +155,3 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
154 | VideoWidget::~VideoWidget() { | 155 | VideoWidget::~VideoWidget() { |
156 | mediaPlayerState->setPlaying( FALSE ); | ||
155 | for ( int i = 0; i < 7; i++ ) { | 157 | for ( int i = 0; i < 7; i++ ) { |
@@ -166,2 +168,3 @@ VideoWidget::~VideoWidget() { | |||
166 | } | 168 | } |
169 | |||
167 | } | 170 | } |
@@ -292,3 +295,3 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
292 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 295 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
293 | for ( int i = 0; i < numButtons; i++ ) { | 296 | for ( int i = 0; i < numVButtons; i++ ) { |
294 | if ( event->state() == QMouseEvent::LeftButton ) { | 297 | if ( event->state() == QMouseEvent::LeftButton ) { |
@@ -304,2 +307,38 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
304 | } | 307 | } |
308 | |||
309 | // qDebug("mouseMove event switch1 %d", i); | ||
310 | if( isOnButton) | ||
311 | switch (i) { | ||
312 | case VideoStop:{ | ||
313 | setToggleButton( i, FALSE ); | ||
314 | mediaPlayerState->setStop(TRUE); | ||
315 | mediaPlayerState->setPlaying(FALSE); | ||
316 | return; | ||
317 | } | ||
318 | case VideoPlay: { | ||
319 | |||
320 | if( mediaPlayerState->isPaused) { | ||
321 | setToggleButton( i, FALSE ); | ||
322 | mediaPlayerState->setPaused( FALSE); | ||
323 | return; | ||
324 | } | ||
325 | else if( mediaPlayerState->isPlaying) { | ||
326 | setToggleButton( i, TRUE ); | ||
327 | mediaPlayerState->setPaused( TRUE); | ||
328 | return; | ||
329 | } | ||
330 | else { | ||
331 | setToggleButton( i, FALSE ); | ||
332 | mediaPlayerState->setPlaying( videoButtons[i].isDown ); | ||
333 | return; | ||
334 | } | ||
335 | } | ||
336 | case VideoNext: qDebug("next"); mediaPlayerState->setNext(); return; | ||
337 | case VideoPrevious: qDebug("previous"); mediaPlayerState->setPrev(); return; | ||
338 | case VideoVolUp: return; | ||
339 | case VideoVolDown: return; | ||
340 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
341 | |||
342 | }; | ||
343 | |||
305 | } else { | 344 | } else { |
@@ -307,16 +346,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
307 | videoButtons[i].isHeld = FALSE; | 346 | videoButtons[i].isHeld = FALSE; |
308 | if ( !videoButtons[i].isToggle ) | 347 | if ( !videoButtons[i].isToggle ) { |
309 | setToggleButton( i, FALSE ); | 348 | setToggleButton( i, FALSE ); |
310 | } | 349 | } |
311 | } | 350 | // qDebug("mouseMove event switch2 %d %d", i, VideoPlay); |
312 | switch (i) { | 351 | switch (i) { |
313 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 352 | case VideoPlay: { |
353 | if( mediaPlayerState->isPaused) { | ||
354 | mediaPlayerState->setPaused( FALSE); return; } | ||
355 | else if( mediaPlayerState->isPlaying) { | ||
356 | mediaPlayerState->setPaused( TRUE); return; } | ||
357 | else | ||
358 | mediaPlayerState->setPlaying( TRUE /*videoButtons[i].isDown*/ ); return; | ||
359 | } | ||
314 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 360 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
315 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 361 | // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
316 | case VideoNext: mediaPlayerState->setNext(); return; | 362 | case VideoNext: mediaPlayerState->setNext(); return; |
317 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 363 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
318 | case VideoPlayList: mediaPlayerState->setList(); return; | 364 | case VideoVolUp: return; |
365 | case VideoVolDown: return; | ||
319 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 366 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
320 | } | 367 | } |
321 | 368 | } | |
369 | } | ||
322 | } | 370 | } |
@@ -373,3 +421,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
373 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 421 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
374 | for ( int i = 0; i < numButtons; i++ ) | 422 | for ( int i = 0; i < numVButtons; i++ ) |
375 | paintButton( &p, i ); | 423 | paintButton( &p, i ); |
@@ -379,3 +427,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
379 | QPainter p( this ); | 427 | QPainter p( this ); |
380 | for ( int i = 0; i < numButtons; i++ ) | 428 | for ( int i = 0; i < numVButtons; i++ ) |
381 | paintButton( &p, i ); | 429 | paintButton( &p, i ); |
@@ -385,4 +433,4 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
385 | // } | 433 | // } |
386 | // // draw the slider | 434 | // draw the slider |
387 | // slider->repaint( TRUE ); | 435 | slider->repaint( TRUE ); |
388 | } | 436 | } |
@@ -466 +514,10 @@ void VideoWidget::setFullscreen ( bool b ) { | |||
466 | } | 514 | } |
515 | |||
516 | void VideoWidget::setPaused( bool b) { | ||
517 | // setToggleButton( VideoPause, b ); | ||
518 | } | ||
519 | |||
520 | void VideoWidget::setPlaying( bool b) { | ||
521 | setToggleButton( VideoPlay, b ); | ||
522 | } | ||
523 | |||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 830696e..92193a4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -43,8 +43,9 @@ class QSlider; | |||
43 | enum VideoButtons { | 43 | enum VideoButtons { |
44 | VideoPrevious, | ||
45 | VideoStop, | 44 | VideoStop, |
46 | VideoPlay, | 45 | VideoPlay, |
47 | VideoPause, | 46 | // VideoPause, |
47 | VideoPrevious, | ||
48 | VideoNext, | 48 | VideoNext, |
49 | VideoPlayList, | 49 | VideoVolUp, |
50 | VideoVolDown, | ||
50 | VideoFullscreen | 51 | VideoFullscreen |
@@ -64,4 +65,4 @@ public slots: | |||
64 | void sliderReleased( ); | 65 | void sliderReleased( ); |
65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } | 66 | void setPaused( bool b); |
66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } | 67 | void setPlaying( bool b); |
67 | void setFullscreen( bool b ); | 68 | void setFullscreen( bool b ); |