summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h4
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro10
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp51
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h38
7 files changed, 116 insertions, 19 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
@@ -1,96 +1,101 @@
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qwidgetstack.h>
#include <qfile.h>
#include "mediaplayer.h"
#include "playlistwidget.h"
#include "audiowidget.h"
#include "mediaplayerstate.h"
+
extern AudioWidget *audioUI;
extern PlayListWidget *playList;
extern MediaPlayerState *mediaPlayerState;
MediaPlayer::MediaPlayer( QObject *parent, const char *name )
: QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
+ xineControl = new XineControl();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
- connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
- connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
+ connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
+ connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
+
+ connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
+ connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
+ connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
+ connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
- connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
- connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
- connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
- connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
}
MediaPlayer::~MediaPlayer() {
}
void MediaPlayer::pauseCheck( bool b ) {
// Only pause if playing
- if ( b && !mediaPlayerState->playing() )
- mediaPlayerState->setPaused( FALSE );
+ if ( b && !mediaPlayerState->playing() ) {
+ mediaPlayerState->setPaused( FALSE );
+ }
}
void MediaPlayer::play() {
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
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() );
+ 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();
}
void MediaPlayer::next() {
if ( playList->next() )
play();
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
@@ -1,43 +1,46 @@
#ifndef MEDIA_PLAYER_H
#define MEDIA_PLAYER_H
#include <qmainwindow.h>
#include <qframe.h>
#include <qpe/qlibrary.h>
#include <qpe/mediaplayerplugininterface.h>
+#include "xinecontrol.h"
class DocLnk;
class MediaPlayer : public QObject {
Q_OBJECT
public:
MediaPlayer( QObject *parent, const char *name );
~MediaPlayer();
private slots:
void setPlaying( bool );
void pauseCheck( bool );
void play();
void next();
void prev();
void startIncreasingVolume();
void startDecreasingVolume();
void stopChangingVolume();
void cleanUp();
protected:
void timerEvent( QTimerEvent *e );
void keyReleaseEvent( QKeyEvent *e);
void doBlank();
void doUnblank();
private:
int volumeDirection;
const DocLnk *currentFile;
+ XineControl *xineControl;
+
};
#endif // MEDIA_PLAYER_H
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,52 +1,50 @@
-
-
-
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qobject.h>
#include <qdir.h>
-#include <qpe/mediaplayerplugininterface.h>
#include "mediaplayerstate.h"
//#define MediaPlayerDebug(x) qDebug x
#define MediaPlayerDebug(x)
MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
: QObject( parent, name ) {
Config cfg( "OpiePlayer" );
readConfig( cfg );
+
}
MediaPlayerState::~MediaPlayerState() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
+
}
void MediaPlayerState::readConfig( Config& cfg ) {
cfg.setGroup("Options");
isFullscreen = cfg.readBoolEntry( "FullScreen" );
isScaled = cfg.readBoolEntry( "Scaling" );
isLooping = cfg.readBoolEntry( "Looping" );
isShuffled = cfg.readBoolEntry( "Shuffle" );
usePlaylist = cfg.readBoolEntry( "UsePlayList" );
usePlaylist = TRUE;
isPlaying = FALSE;
isPaused = FALSE;
curPosition = 0;
curLength = 0;
curView = 'l';
}
void MediaPlayerState::writeConfig( Config& cfg ) const {
cfg.setGroup("Options");
cfg.writeEntry("FullScreen", isFullscreen );
cfg.writeEntry("Scaling", isScaled );
cfg.writeEntry("Looping", isLooping );
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
@@ -20,73 +20,75 @@ public:
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 );
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 setPrev();
void setNext();
void setList();
void setVideo();
void setAudio();
void toggleFullscreen();
void toggleScaled();
void toggleLooping();
void toggleShuffled();
void togglePlaylist();
void togglePaused();
void togglePlaying();
signals:
void fullscreenToggled( bool );
void scaledToggled( bool );
void loopingToggled( bool );
void shuffledToggled( bool );
void playlistToggled( bool );
void pausedToggled( bool );
void playingToggled( bool );
void positionChanged( long ); // When the slider is moved
void positionUpdated( long ); // When the media file progresses
void lengthChanged( long );
void viewChanged( char );
void prev();
void next();
private:
bool isFullscreen;
bool isScaled;
bool isLooping;
bool isShuffled;
bool usePlaylist;
bool isPaused;
bool isPlaying;
long curPosition;
long curLength;
char curView;
void readConfig( Config& cfg );
void writeConfig( Config& cfg ) const;
+
+
};
#endif // MEDIA_PLAYER_STATE_H
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
@@ -1,17 +1,17 @@
TEMPLATE = app
CONFIG = qt warn_on release
#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
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
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