author | harlekin <harlekin> | 2002-07-03 15:42:34 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-03 15:42:34 (UTC) |
commit | 3035c46ce448317f786d974094f78ce43e594a57 (patch) (side-by-side diff) | |
tree | f0c84f34ee2ecbae4d00ed6cfde3cb955802a470 | |
parent | e1e4956ec7ffa9a07f98b03e831f0f9627556a6c (diff) | |
download | opie-3035c46ce448317f786d974094f78ce43e594a57.zip opie-3035c46ce448317f786d974094f78ce43e594a57.tar.gz opie-3035c46ce448317f786d974094f78ce43e594a57.tar.bz2 |
even more code cleanups .-)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 195 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 75 |
4 files changed, 227 insertions, 67 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 1b0de5d..125fd72 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -56,6 +56,4 @@ void Ticker::drawContents( QPainter *p ) { - - struct MediaButton { int xPos, yPos; @@ -65,6 +63,4 @@ struct MediaButton { - - // Layout information for the audioButtons (and if it is a toggle button or not) MediaButton audioButtons[] = { @@ -84,6 +80,5 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : - QWidget( parent, name, f ) -{ + QWidget( parent, name, f ) { setCaption( tr("OpiePlayer - Audio") ); Config cfg("OpiePlayer"); @@ -128,8 +123,6 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState->playing() ); - } - AudioWidget::~AudioWidget() { mediaPlayerState->isStreaming = FALSE; @@ -157,5 +150,4 @@ void AudioWidget::sliderReleased() { } - void AudioWidget::setPosition( long i ) { // qDebug("set position %d",i); diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 687aff6..c13ea63 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp @@ -12,11 +12,11 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - if ( !name ) - setName( "InputDialog" ); + : QDialog( parent, name, modal, fl ) { + if ( !name ) { + setName( "InputDialog" ); + } resize( 234, 115); setMaximumSize( QSize( 240, 40)); - setCaption( tr(name ) ); + setCaption( tr( name ) ); QPushButton *browserButton; @@ -31,8 +31,6 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags * Destroys the object and frees any allocated resources */ -InputDialog::~InputDialog() -{ +InputDialog::~InputDialog() { inputText= LineEdit1->text(); - } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index d1d30e4..2f24b00 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -18,5 +18,5 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) - : QObject( parent, name ), decoder( NULL ) { + : QObject( parent, name ) { Config cfg( "OpiePlayer" ); readConfig( cfg ); @@ -56,15 +56,190 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { -struct MediaPlayerPlugin { -#ifndef QT_NO_COMPONENT - QLibrary *library; -#endif - MediaPlayerPluginInterface *iface; - MediaPlayerDecoder *decoder; - MediaPlayerEncoder *encoder; -}; -static QValueList<MediaPlayerPlugin> pluginList; +// public stuff +bool MediaPlayerState::fullscreen() { + return isFullscreen; +} + +bool MediaPlayerState::scaled() { + return isScaled; +} + +bool MediaPlayerState::looping() { + return isLooping; +} + +bool MediaPlayerState::shuffled() { + return isShuffled; +} + + +bool MediaPlayerState:: playlist() { + return usePlaylist; +} + +bool MediaPlayerState::paused() { + return isPaused; +} + +bool MediaPlayerState::playing() { + return isPlaying; +} + +long MediaPlayerState::position() { + return curPosition; +} + +long MediaPlayerState::length() { + return curLength; +} + +char MediaPlayerState::view() { + return curView; +} + +// slots +void MediaPlayerState::setFullscreen( bool b ) { + if ( isFullscreen == b ) { + return; + } + isFullscreen = b; + emit fullscreenToggled(b); +} + + +void MediaPlayerState::setScaled( bool b ) { + if ( isScaled == b ) { + return; + } + isScaled = b; + emit scaledToggled(b); +} + +void MediaPlayerState::setLooping( bool b ) { + if ( isLooping == b ) { + return; + } + isLooping = b; + emit loopingToggled(b); +} + +void MediaPlayerState::setShuffled( bool b ) { + if ( isShuffled == b ) { + return; + } + isShuffled = b; + emit shuffledToggled(b); +} + +void MediaPlayerState::setPlaylist( bool b ) { + if ( usePlaylist == b ) { + return; + } + usePlaylist = b; + emit playlistToggled(b); +} + +void MediaPlayerState::setPaused( bool b ) { + if ( isPaused == b ) { + return; + } + isPaused = b; + emit pausedToggled(b); +} + +void MediaPlayerState::setPlaying( bool b ) { + if ( isPlaying == b ) { + return; + } + isPlaying = b; + emit playingToggled(b); +} + +void MediaPlayerState::setPosition( long p ) { + if ( curPosition == p ) { + return; + } + curPosition = p; + emit positionChanged(p); +} + +void MediaPlayerState::updatePosition( long p ){ + if ( curPosition == p ) { + return; + } + curPosition = p; + emit positionUpdated(p); +} + +void MediaPlayerState::setLength( long l ) { + if ( curLength == l ) { + return; + } + curLength = l; + emit lengthChanged(l); +} + +void MediaPlayerState::setView( char v ) { + if ( curView == v ) { + return; + } + curView = v; + emit viewChanged(v); +} + +void MediaPlayerState::setPrev(){ + emit prev(); +} + +void MediaPlayerState::setNext() { + emit next(); +} + +void MediaPlayerState::setList() { + setPlaying( FALSE ); + setView('l'); +} + +void MediaPlayerState::setVideo() { + setView('v'); +} + +void MediaPlayerState::setAudio() { + setView('a'); +} + + + +void MediaPlayerState::toggleFullscreen() { + setFullscreen( !isFullscreen ); +} + +void MediaPlayerState::toggleScaled() { + setScaled( !isScaled); +} + +void MediaPlayerState::toggleLooping() { + setLooping( !isLooping); +} + +void MediaPlayerState::toggleShuffled() { + setShuffled( !isShuffled); +} + +void MediaPlayerState::togglePlaylist() { + setPlaylist( !usePlaylist); +} + +void MediaPlayerState::togglePaused() { + setPaused( !isPaused); +} + +void MediaPlayerState::togglePlaying() { + setPlaying( !isPlaying); +} + + diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 8a64939..7aa0ff2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -18,44 +18,41 @@ public: bool isStreaming; - bool fullscreen() { return isFullscreen; } - bool scaled() { return isScaled; } - bool looping() { return isLooping; } - bool shuffled() { return isShuffled; } - bool playlist() { return usePlaylist; } - bool paused() { return isPaused; } - bool playing() { return isPlaying; } - long position() { return curPosition; } - long length() { return curLength; } - char view() { return curView; } - - MediaPlayerDecoder *newDecoder( const QString& file ); - MediaPlayerDecoder *curDecoder(); + bool fullscreen(); + bool scaled(); + bool looping(); + bool shuffled(); + bool playlist(); + bool paused(); + bool playing(); + long position(); + long length(); + char view(); public slots: - void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); } - void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); } - void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } - void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } - void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } - void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } - void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } - void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); } - void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); } - void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); } - void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); } - - void setPrev() { emit prev(); } - void setNext() { emit next(); } - void setList() { setPlaying( FALSE ); setView('l'); } - void setVideo() { setView('v'); } - void setAudio() { setView('a'); } - - void toggleFullscreen() { setFullscreen( !isFullscreen ); } - void toggleScaled() { setScaled( !isScaled); } - void toggleLooping() { setLooping( !isLooping); } - void toggleShuffled() { setShuffled( !isShuffled); } - void togglePlaylist() { setPlaylist( !usePlaylist); } - void togglePaused() { setPaused( !isPaused); } - void togglePlaying() { setPlaying( !isPlaying); } + void setFullscreen( bool b ); + void setScaled( bool b ); + void setLooping( bool b ); + void setShuffled( bool b ); + void setPlaylist( bool b ); + void setPaused( bool b ); + void setPlaying( bool b ); + void setPosition( long p ); + void updatePosition( long p ); + void setLength( long l ); + void setView( char v ); + + void setPrev() ; + void setNext(); + void setList(); + void setVideo(); + void setAudio(); + + void toggleFullscreen(); + void toggleScaled(); + void toggleLooping(); + void toggleShuffled(); + void togglePlaylist(); + void togglePaused(); + void togglePlaying(); signals: @@ -87,6 +84,4 @@ private: char curView; - MediaPlayerDecoder *decoder; - void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; |