author | harlekin <harlekin> | 2002-07-06 23:21:45 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-06 23:21:45 (UTC) |
commit | f975653aeec521ec473ed27eba1fc4d7648c0dd3 (patch) (side-by-side diff) | |
tree | 3273440fc22fba619a90846e71ce8fde54dcd980 | |
parent | 345c2059bdcfcde8c03c7ae6332b075705ac0a6f (diff) | |
download | opie-f975653aeec521ec473ed27eba1fc4d7648c0dd3.zip opie-f975653aeec521ec473ed27eba1fc4d7648c0dd3.tar.gz opie-f975653aeec521ec473ed27eba1fc4d7648c0dd3.tar.bz2 |
first try to get stuff together
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 51 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 38 |
7 files changed, 107 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 87184ba..be59d8d 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -17,2 +17,3 @@ + extern AudioWidget *audioUI; @@ -26,2 +27,3 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) + xineControl = new XineControl(); // QPEApplication::grabKeyboard(); // EVIL @@ -38,2 +40,3 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); + } @@ -45,5 +48,6 @@ void MediaPlayer::pauseCheck( bool b ) { // Only pause if playing - if ( b && !mediaPlayerState->playing() ) + if ( b && !mediaPlayerState->playing() ) { mediaPlayerState->setPaused( FALSE ); } +} @@ -72,2 +76,3 @@ void MediaPlayer::setPlaying( bool play ) { + xineControl->play( currentFile->file() ); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index c4d38b5..7b79066 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -9,2 +9,3 @@ +#include "xinecontrol.h" @@ -38,2 +39,4 @@ private: const DocLnk *currentFile; + XineControl *xineControl; + }; diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 2f24b00..3090b08 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -1,4 +1 @@ - - - #include <qpe/qpeapplication.h> @@ -9,3 +6,2 @@ #include <qdir.h> -#include <qpe/mediaplayerplugininterface.h> #include "mediaplayerstate.h" @@ -22,2 +18,3 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) readConfig( cfg ); + } @@ -28,2 +25,3 @@ MediaPlayerState::~MediaPlayerState() { writeConfig( cfg ); + } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 7aa0ff2..dbbb0f2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -87,2 +87,4 @@ private: void writeConfig( Config& cfg ) const; + + }; diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 47683ac..a6c7c2b 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro @@ -4,11 +4,11 @@ CONFIG = qt warn_on release DESTDIR = $(OPIEDIR)/bin -HEADERS = playlistselection.h mediaplayerstate.h \ +HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h\ videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h SOURCES = main.cpp \ - playlistselection.cpp mediaplayerstate.cpp \ + playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp\ videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp TARGET = opieplayer -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lpthread -lopie +INCLUDEPATH += $(OPIEDIR)/include /usr/include +DEPENDPATH += $(OPIEDIR)/include /usr/include +LIBS += -lqpe -lpthread -lopie -lxine -lxineutils diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp new file mode 100644 index 0000000..aaa1a24 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -0,0 +1,51 @@ + +#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 ) ) ); + +} + +XineControl::~XineControl() { + delete libXine; +} + +void XineControl::play( const QString& fileName ) { + libXine->play( fileName ); + mediaPlayerState->setPlaying( true ); + // hier dann schaun welcher view +} + +void XineControl::stop() { + libXine->stop(); + mediaPlayerState->setPlaying( false ); +} + +void XineControl::pause( bool ) { + 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 new file mode 100644 index 0000000..cba83c0 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -0,0 +1,38 @@ + +#ifndef XINECONTROL_H +#define XINECONTROL_H + +#include "lib.h" +#include <qobject.h> + +class XineControl : public QObject { + Q_OBJECT +public: + XineControl( QObject *parent, const char *name ); + ~XineControl(); + +private slots: + void play( const QString& fileName ); + void stop(); + 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 |