-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 |
4 files changed, 23 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 74bc390..1600320 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -160,7 +160,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : resizeEvent( NULL ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); - connect( mediaPlayerState, SIGNAL( mediaTypeChanged(MediaPlayerState::MediaType) ), this, SLOT( setMediaType(MediaPlayerState::MediaType) ) ); + connect( mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) ); connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); @@ -264,15 +264,15 @@ void AudioWidget::setLength( long max ) { } -void AudioWidget::setMediaType( MediaPlayerState::MediaType mediaType ) { - if ( mediaType == MediaPlayerState::Video ) { - killTimers(); - hide(); +void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { + if ( mediaType == MediaPlayerState::Audio ) { + // startTimer( 150 ); + showMaximized(); return; } - // startTimer( 150 ); - showMaximized(); + killTimers(); + hide(); } diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 3f0c059..91fcbc5 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -81,7 +81,7 @@ public slots: void setPosition( long ); void setLength( long ); void setSeekable( bool ); - void setMediaType( MediaPlayerState::MediaType mediaType ); + void setDisplayType( MediaPlayerState::DisplayType displayType ); signals: void moreClicked(); diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 22451b7..6806adc 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -41,7 +41,7 @@ #include <qdir.h> #include "mediaplayerstate.h" - +#include <assert.h> //#define MediaPlayerDebug(x) qDebug x #define MediaPlayerDebug(x) @@ -85,9 +85,17 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { cfg.writeEntry( "VideoGamma", videoGamma ); } -MediaPlayerState::MediaType MediaPlayerState::mediaType() const +MediaPlayerState::DisplayType MediaPlayerState::displayType() const { - return view() == 'a' ? MediaPlayerState::Audio : MediaPlayerState::Video; + char v = view(); + switch ( v ) { + case 'a': return MediaPlayerState::Audio; + case 'v': return MediaPlayerState::Video; + case 'l': return MediaPlayerState::MediaSelection; + default: assert( false ); + } + // never reached + return MediaPlayerState::MediaSelection; } // slots @@ -208,7 +216,7 @@ void MediaPlayerState::setView( char v ) { } curView = v; emit viewChanged(v); - emit mediaTypeChanged( mediaType() ); + emit displayTypeChanged( displayType() ); } void MediaPlayerState::setPrev(){ diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 05264cf..ca531c5 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -47,7 +47,7 @@ class Config; class MediaPlayerState : public QObject { Q_OBJECT public: - enum MediaType { Audio, Video }; + enum DisplayType { Audio, Video, MediaSelection }; MediaPlayerState( QObject *parent, const char *name ); ~MediaPlayerState(); @@ -64,7 +64,7 @@ public: long position() const { return curPosition; } long length() const { return curLength; } char view() const { return curView; } - MediaType mediaType() const; + DisplayType displayType() const; public slots: void setIsStreaming( bool b ); @@ -111,7 +111,7 @@ signals: void positionUpdated( long ); // When the media file progresses void lengthChanged( long ); void viewChanged( char ); - void mediaTypeChanged( MediaPlayerState::MediaType type ); + void displayTypeChanged( MediaPlayerState::DisplayType type ); void isSeekableToggled( bool ); void blankToggled( bool ); void videoGammaChanged( int ); |