-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 @@ -159,9 +159,9 @@ 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 ) ) ); @@ -263,17 +263,17 @@ void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState->position(), 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(); } void AudioWidget::setSeekable( bool isSeekable ) { 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 @@ -80,9 +80,9 @@ public slots: void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } void setPosition( long ); void setLength( long ); void setSeekable( bool ); - void setMediaType( MediaPlayerState::MediaType mediaType ); + void setDisplayType( MediaPlayerState::DisplayType displayType ); signals: void moreClicked(); void lessClicked(); 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 @@ -40,9 +40,9 @@ #include <qobject.h> #include <qdir.h> #include "mediaplayerstate.h" - +#include <assert.h> //#define MediaPlayerDebug(x) qDebug x #define MediaPlayerDebug(x) @@ -84,11 +84,19 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { cfg.writeEntry( "Shuffle", shuffled ); 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 void MediaPlayerState::setIsStreaming( bool b ) { @@ -207,9 +215,9 @@ void MediaPlayerState::setView( char v ) { return; } curView = v; emit viewChanged(v); - emit mediaTypeChanged( mediaType() ); + emit displayTypeChanged( displayType() ); } void MediaPlayerState::setPrev(){ emit prev(); 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 @@ -46,9 +46,9 @@ 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(); @@ -63,9 +63,9 @@ public: bool isStopped() const { return stopped; } 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 ); void setIsSeekable( bool b ); @@ -110,9 +110,9 @@ signals: void positionChanged( long ); // When the slider is moved 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 ); void prev(); |