-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 32 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 2 |
3 files changed, 31 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index be59d8d..0ab0124 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -57,82 +57,86 @@ void MediaPlayer::play() { } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { mediaPlayerState->setPaused( FALSE ); return; } if ( mediaPlayerState->paused() ) { mediaPlayerState->setPaused( FALSE ); return; } const DocLnk *playListCurrent = playList->current(); if ( playListCurrent != NULL ) { currentFile = playListCurrent; } audioUI->setTickerText( currentFile->file( ) ); xineControl->play( currentFile->file() ); // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben // Ob auch video 'v' : 'a' // mediaPlayerState->setView( 'v' ); // abspielen starten. } void MediaPlayer::prev() { - if ( playList->prev() ) - play(); - else if ( mediaPlayerState->looping() ) { - if ( playList->last() ) - play(); - } else - mediaPlayerState->setList(); + if ( playList->prev() ) { + play(); + } else if ( mediaPlayerState->looping() ) { + if ( playList->last() ) { + play(); + } + } else { + mediaPlayerState->setList(); + } } void MediaPlayer::next() { - if ( playList->next() ) - play(); - else if ( mediaPlayerState->looping() ) { - if ( playList->first() ) - play(); - } else - mediaPlayerState->setList(); + if ( playList->next() ) { + play(); + } else if ( mediaPlayerState->looping() ) { + if ( playList->first() ) { + play(); + } + } else { + mediaPlayerState->setList(); + } } void MediaPlayer::startDecreasingVolume() { volumeDirection = -1; startTimer( 100 ); // da kommt demnächst osound denk ich mal // AudioDevice::decreaseVolume(); } void MediaPlayer::startIncreasingVolume() { volumeDirection = +1; startTimer( 100 ); // AudioDevice::increaseVolume(); } void MediaPlayer::stopChangingVolume() { killTimers(); } void MediaPlayer::timerEvent( QTimerEvent * ) { // if ( volumeDirection == +1 ) // AudioDevice::increaseVolume(); // else if ( volumeDirection == -1 ) // AudioDevice::decreaseVolume(); } void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index aaa1a24..cda9be2 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -1,51 +1,59 @@ #include "xinecontrol.h" #include "mediaplayerstate.h" extern MediaPlayerState *mediaPlayerState; XineControl::XineControl( QObject *parent, const char *name ) : QObject( parent, name ) { libXine = new XINE::Lib(); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) ); + connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); } XineControl::~XineControl() { delete libXine; } void XineControl::play( const QString& fileName ) { libXine->play( fileName ); mediaPlayerState->setPlaying( true ); + // default to audio view until we know how to handle video + mediaPlayerState->setView('a'); + // determines of slider is shown + mediaPlayerState->isStreaming = false; // hier dann schaun welcher view } -void XineControl::stop() { - libXine->stop(); - mediaPlayerState->setPlaying( false ); +void XineControl::stop( bool isSet ) { + if ( isSet) { + libXine->stop(); + } + // mediaPlayerState->setPlaying( false ); } -void XineControl::pause( bool ) { +void XineControl::pause( bool isSet) { + libXine->pause(); } int XineControl::currentTime() { // todo: jede sekunde überprüfen m_currentTime = libXine->currentTime(); return m_currentTime; } void XineControl::length() { m_length = libXine->length(); mediaPlayerState->setLength( m_length ); } int XineControl::position() { m_position = (m_currentTime/m_length*100); mediaPlayerState->setPosition( m_position ); return m_position; emit positionChanged( m_position ); } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 58ad8ec..e45f1df 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -1,38 +1,38 @@ #ifndef XINECONTROL_H #define XINECONTROL_H #include "lib.h" #include <qobject.h> class XineControl : public QObject { Q_OBJECT public: XineControl( QObject *parent = 0, const char *name =0 ); ~XineControl(); public slots: void play( const QString& fileName ); - void stop(); + void stop( bool ); void pause( bool ); int currentTime(); // get length of media file and set it void length(); int position(); private: XINE::Lib *libXine; int m_length; int m_currentTime; int m_position; signals: void positionChanged( int position ); }; #endif |