summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 20:56:19 (UTC)
committer simon <simon>2002-12-02 20:56:19 (UTC)
commit649ea9e9586ce51847ebeb9c062290137c9248f4 (patch) (unidiff)
tree334d6fe0fe91e29ed3600d96443ab104939c1eef
parent0090a335a7162f4b0d34f78850ebf9a8bd544c01 (diff)
downloadopie-649ea9e9586ce51847ebeb9c062290137c9248f4.zip
opie-649ea9e9586ce51847ebeb9c062290137c9248f4.tar.gz
opie-649ea9e9586ce51847ebeb9c062290137c9248f4.tar.bz2
- centralized the button command handling into MediaWidget (as it is
duplicated between AudioWidget and VideoWidget -- the latter still to come though)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp30
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h24
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h10
4 files changed, 35 insertions, 48 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index d9beb90..3070bc3 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -52,4 +52,2 @@
52 52
53extern PlayListWidget *playList;
54
55static const int xo = -2; // movable x offset 53static const int xo = -2; // movable x offset
@@ -395,12 +393,12 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
395 switch (i) { 393 switch (i) {
396 case AudioVolumeUp: 394 case VolumeUp:
397 emit moreClicked(); 395 emit moreClicked();
398 return; 396 return;
399 case AudioVolumeDown: 397 case VolumeDown:
400 emit lessClicked(); 398 emit lessClicked();
401 return; 399 return;
402 case AudioForward: 400 case Forward:
403 emit forwardClicked(); 401 emit forwardClicked();
404 return; 402 return;
405 case AudioBack: 403 case Back:
406 emit backClicked(); 404 emit backClicked();
@@ -419,21 +417,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
419 qDebug("mouseEvent %d", i); 417 qDebug("mouseEvent %d", i);
420 switch (i) { 418 handleCommand( static_cast<Command>( i ), audioButtons[ i ].isDown );
421 case AudioPlay:
422 if( mediaPlayerState.isPaused() ) {
423 mediaPlayerState.setPaused( FALSE );
424 return;
425 } else if( !mediaPlayerState.isPaused() ) {
426 mediaPlayerState.setPaused( TRUE );
427 return;
428 }
429 case AudioStop: mediaPlayerState.setPlaying(FALSE); return;
430 case AudioNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
431 case AudioPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
432 case AudioLoop: mediaPlayerState.setLooping(audioButtons[i].isDown); return;
433 case AudioVolumeUp: emit moreReleased(); return;
434 case AudioVolumeDown: emit lessReleased(); return;
435 case AudioPlayList: mediaPlayerState.setList(); return;
436 case AudioForward: emit forwardReleased(); return;
437 case AudioBack: emit backReleased(); return;
438 }
439 } 419 }
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 087d711..1778a30 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -51,18 +51,2 @@ class QPixmap;
51 51
52namespace {
53
54enum AudioButtons {
55 AudioPlay=0,
56 AudioStop,
57 AudioNext,
58 AudioPrevious,
59 AudioVolumeUp,
60 AudioVolumeDown,
61 AudioLoop,
62 AudioPlayList,
63 AudioForward,
64 AudioBack
65};
66};
67
68class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
@@ -77,3 +61,3 @@ public slots:
77 void sliderReleased( ); 61 void sliderReleased( );
78 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 62 void setLooping( bool b) { setToggleButton( Loop, b ); }
79 void setPosition( long ); 63 void setPosition( long );
@@ -83,3 +67,3 @@ public:
83 virtual void setLength( long ); 67 virtual void setLength( long );
84 virtual void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
85 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
@@ -89,8 +73,4 @@ signals:
89 void lessClicked(); 73 void lessClicked();
90 void moreReleased();
91 void lessReleased();
92 void forwardClicked(); 74 void forwardClicked();
93 void backClicked(); 75 void backClicked();
94 void forwardReleased();
95 void backReleased();
96 void sliderMoved(long); 76 void sliderMoved(long);
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index d58e87e..01a7295 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -21,4 +21,5 @@
21#include "mediawidget.h" 21#include "mediawidget.h"
22#include "playlistwidget.h"
22 23
23extern MediaPlayerState *mediaPlayerState; 24extern PlayListWidget *playList;
24 25
@@ -39,2 +40,18 @@ MediaWidget::~MediaWidget()
39 40
41void MediaWidget::handleCommand( Command command, bool buttonDown )
42{
43 switch ( command ) {
44 case Play: mediaPlayerState.togglePaused();
45 case Stop: mediaPlayerState.setPlaying(FALSE); return;
46 case Next: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
47 case Previous: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
48 case Loop: mediaPlayerState.setLooping( buttonDown ); return;
49 case VolumeUp: emit moreReleased(); return;
50 case VolumeDown: emit lessReleased(); return;
51 case PlayList: mediaPlayerState.setList(); return;
52 case Forward: emit forwardReleased(); return;
53 case Back: emit backReleased(); return;
54 }
55}
56
40/* vim: et sw=4 ts=4 57/* vim: et sw=4 ts=4
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 64adba9..550f0fc 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -30,2 +30,4 @@ class MediaWidget : public QWidget
30public: 30public:
31 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
32
31 MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 33 MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
@@ -38,3 +40,11 @@ public slots:
38 40
41signals:
42 void moreReleased();
43 void lessReleased();
44 void forwardReleased();
45 void backReleased();
46
39protected: 47protected:
48 void handleCommand( Command command, bool buttonDown );
49
40 MediaPlayerState &mediaPlayerState; 50 MediaPlayerState &mediaPlayerState;