summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -51,6 +51,4 @@
#include "playlistwidget.h"
-extern PlayListWidget *playList;
-
static const int xo = -2; // movable x offset
static const int yo = 22; // movable y offset
@@ -394,14 +392,14 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
toggleButton(i);
switch (i) {
- case AudioVolumeUp:
+ case VolumeUp:
emit moreClicked();
return;
- case AudioVolumeDown:
+ case VolumeDown:
emit lessClicked();
return;
- case AudioForward:
+ case Forward:
emit forwardClicked();
return;
- case AudioBack:
+ case Back:
emit backClicked();
return;
@@ -418,23 +416,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
}
qDebug("mouseEvent %d", i);
- switch (i) {
- case AudioPlay:
- if( mediaPlayerState.isPaused() ) {
- mediaPlayerState.setPaused( FALSE );
- return;
- } else if( !mediaPlayerState.isPaused() ) {
- mediaPlayerState.setPaused( TRUE );
- return;
- }
- case AudioStop: mediaPlayerState.setPlaying(FALSE); return;
- case AudioNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
- case AudioPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
- case AudioLoop: mediaPlayerState.setLooping(audioButtons[i].isDown); return;
- case AudioVolumeUp: emit moreReleased(); return;
- case AudioVolumeDown: emit lessReleased(); return;
- case AudioPlayList: mediaPlayerState.setList(); return;
- case AudioForward: emit forwardReleased(); return;
- case AudioBack: emit backReleased(); return;
- }
+ handleCommand( static_cast<Command>( i ), audioButtons[ i ].isDown );
}
}
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
@@ -50,20 +50,4 @@
class QPixmap;
-namespace {
-
-enum AudioButtons {
- AudioPlay=0,
- AudioStop,
- AudioNext,
- AudioPrevious,
- AudioVolumeUp,
- AudioVolumeDown,
- AudioLoop,
- AudioPlayList,
- AudioForward,
- AudioBack
-};
-};
-
class AudioWidget : public MediaWidget {
Q_OBJECT
@@ -76,5 +60,5 @@ public slots:
void sliderPressed( );
void sliderReleased( );
- void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
+ void setLooping( bool b) { setToggleButton( Loop, b ); }
void setPosition( long );
void setSeekable( bool );
@@ -82,5 +66,5 @@ public slots:
public:
virtual void setLength( long );
- virtual void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
+ virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
@@ -88,10 +72,6 @@ signals:
void moreClicked();
void lessClicked();
- void moreReleased();
- void lessReleased();
void forwardClicked();
void backClicked();
- void forwardReleased();
- void backReleased();
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
@@ -20,6 +20,7 @@
#include "mediawidget.h"
+#include "playlistwidget.h"
-extern MediaPlayerState *mediaPlayerState;
+extern PlayListWidget *playList;
MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
@@ -38,4 +39,20 @@ MediaWidget::~MediaWidget()
}
+void MediaWidget::handleCommand( Command command, bool buttonDown )
+{
+ switch ( command ) {
+ case Play: mediaPlayerState.togglePaused();
+ case Stop: mediaPlayerState.setPlaying(FALSE); return;
+ case Next: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
+ case Previous: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
+ case Loop: mediaPlayerState.setLooping( buttonDown ); return;
+ case VolumeUp: emit moreReleased(); return;
+ case VolumeDown: emit lessReleased(); return;
+ case PlayList: mediaPlayerState.setList(); return;
+ case Forward: emit forwardReleased(); return;
+ case Back: emit backReleased(); return;
+ }
+}
+
/* 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
@@ -29,4 +29,6 @@ class MediaWidget : public QWidget
Q_OBJECT
public:
+ enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
+
MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
virtual ~MediaWidget();
@@ -37,5 +39,13 @@ public slots:
virtual void setPlaying( bool playing ) = 0;
+signals:
+ void moreReleased();
+ void lessReleased();
+ void forwardReleased();
+ void backReleased();
+
protected:
+ void handleCommand( Command command, bool buttonDown );
+
MediaPlayerState &mediaPlayerState;
};