author | harlekin <harlekin> | 2002-07-06 23:21:45 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-06 23:21:45 (UTC) |
commit | f975653aeec521ec473ed27eba1fc4d7648c0dd3 (patch) (unidiff) | |
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 | 23 | ||||
-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 | 4 | ||||
-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, 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 | |||
@@ -17,2 +17,3 @@ | |||
17 | 17 | ||
18 | |||
18 | extern AudioWidget *audioUI; | 19 | extern AudioWidget *audioUI; |
@@ -26,2 +27,3 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
26 | 27 | ||
28 | xineControl = new XineControl(); | ||
27 | // QPEApplication::grabKeyboard(); // EVIL | 29 | // QPEApplication::grabKeyboard(); // EVIL |
@@ -31,9 +33,10 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
31 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 33 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
32 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 34 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
33 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 35 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
36 | |||
37 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
38 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
39 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
40 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
34 | 41 | ||
35 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | ||
36 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | ||
37 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
38 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | ||
39 | } | 42 | } |
@@ -45,4 +48,5 @@ void MediaPlayer::pauseCheck( bool b ) { | |||
45 | // Only pause if playing | 48 | // Only pause if playing |
46 | if ( b && !mediaPlayerState->playing() ) | 49 | if ( b && !mediaPlayerState->playing() ) { |
47 | mediaPlayerState->setPaused( FALSE ); | 50 | mediaPlayerState->setPaused( FALSE ); |
51 | } | ||
48 | } | 52 | } |
@@ -70,4 +74,5 @@ void MediaPlayer::setPlaying( bool play ) { | |||
70 | 74 | ||
71 | audioUI->setTickerText( currentFile->file() ); | 75 | audioUI->setTickerText( currentFile->file( ) ); |
72 | 76 | ||
77 | xineControl->play( currentFile->file() ); | ||
73 | 78 | ||
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 @@ | |||
9 | 9 | ||
10 | #include "xinecontrol.h" | ||
10 | 11 | ||
@@ -38,2 +39,4 @@ private: | |||
38 | const DocLnk *currentFile; | 39 | const DocLnk *currentFile; |
40 | XineControl *xineControl; | ||
41 | |||
39 | }; | 42 | }; |
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 @@ | |||
1 | |||
2 | |||
3 | |||
4 | #include <qpe/qpeapplication.h> | #include <qpe/qpeapplication.h> | |
@@ -9,3 +6,2 @@ | |||
9 | #include <qdir.h> | 6 | #include <qdir.h> |
10 | #include <qpe/mediaplayerplugininterface.h> | ||
11 | #include "mediaplayerstate.h" | 7 | #include "mediaplayerstate.h" |
@@ -22,2 +18,3 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | |||
22 | readConfig( cfg ); | 18 | readConfig( cfg ); |
19 | |||
23 | } | 20 | } |
@@ -28,2 +25,3 @@ MediaPlayerState::~MediaPlayerState() { | |||
28 | writeConfig( cfg ); | 25 | writeConfig( cfg ); |
26 | |||
29 | } | 27 | } |
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 | |||
@@ -43,3 +43,3 @@ public slots: | |||
43 | 43 | ||
44 | void setPrev() ; | 44 | void setPrev(); |
45 | void setNext(); | 45 | void setNext(); |
@@ -87,2 +87,4 @@ private: | |||
87 | void writeConfig( Config& cfg ) const; | 87 | void writeConfig( Config& cfg ) const; |
88 | |||
89 | |||
88 | }; | 90 | }; |
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 | |||
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = playlistselection.h mediaplayerstate.h \ | 5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h\ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h | 6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h |
7 | SOURCES = main.cpp \ | 7 | SOURCES = main.cpp \ |
8 | playlistselection.cpp mediaplayerstate.cpp \ | 8 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp\ |
9 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp | 9 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp |
10 | TARGET = opieplayer | 10 | TARGET = opieplayer |
11 | INCLUDEPATH += $(OPIEDIR)/include | 11 | INCLUDEPATH += $(OPIEDIR)/include /usr/include |
12 | DEPENDPATH += $(OPIEDIR)/include | 12 | DEPENDPATH += $(OPIEDIR)/include /usr/include |
13 | LIBS += -lqpe -lpthread -lopie | 13 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils |
14 | 14 | ||
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 @@ | |||
1 | |||
2 | #include "xinecontrol.h" | ||
3 | #include "mediaplayerstate.h" | ||
4 | |||
5 | extern MediaPlayerState *mediaPlayerState; | ||
6 | |||
7 | XineControl::XineControl( QObject *parent, const char *name ) | ||
8 | : QObject( parent, name ) { | ||
9 | libXine = new XINE::Lib(); | ||
10 | |||
11 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | ||
12 | connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) ); | ||
13 | |||
14 | } | ||
15 | |||
16 | XineControl::~XineControl() { | ||
17 | delete libXine; | ||
18 | } | ||
19 | |||
20 | void XineControl::play( const QString& fileName ) { | ||
21 | libXine->play( fileName ); | ||
22 | mediaPlayerState->setPlaying( true ); | ||
23 | // hier dann schaun welcher view | ||
24 | } | ||
25 | |||
26 | void XineControl::stop() { | ||
27 | libXine->stop(); | ||
28 | mediaPlayerState->setPlaying( false ); | ||
29 | } | ||
30 | |||
31 | void XineControl::pause( bool ) { | ||
32 | libXine->pause(); | ||
33 | } | ||
34 | |||
35 | int XineControl::currentTime() { | ||
36 | // todo: jede sekunde �berpr�fen | ||
37 | m_currentTime = libXine->currentTime(); | ||
38 | return m_currentTime; | ||
39 | } | ||
40 | |||
41 | void XineControl::length() { | ||
42 | m_length = libXine->length(); | ||
43 | mediaPlayerState->setLength( m_length ); | ||
44 | } | ||
45 | |||
46 | int XineControl::position() { | ||
47 | m_position = (m_currentTime/m_length*100); | ||
48 | mediaPlayerState->setPosition( m_position ); | ||
49 | return m_position; | ||
50 | emit positionChanged( m_position ); | ||
51 | } | ||
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 @@ | |||
1 | |||
2 | #ifndef XINECONTROL_H | ||
3 | #define XINECONTROL_H | ||
4 | |||
5 | #include "lib.h" | ||
6 | #include <qobject.h> | ||
7 | |||
8 | class XineControl : public QObject { | ||
9 | Q_OBJECT | ||
10 | public: | ||
11 | XineControl( QObject *parent, const char *name ); | ||
12 | ~XineControl(); | ||
13 | |||
14 | private slots: | ||
15 | void play( const QString& fileName ); | ||
16 | void stop(); | ||
17 | void pause( bool ); | ||
18 | |||
19 | int currentTime(); | ||
20 | |||
21 | // get length of media file and set it | ||
22 | void length(); | ||
23 | |||
24 | int position(); | ||
25 | |||
26 | private: | ||
27 | XINE::Lib *libXine; | ||
28 | int m_length; | ||
29 | int m_currentTime; | ||
30 | int m_position; | ||
31 | |||
32 | signals: | ||
33 | void positionChanged( int position ); | ||
34 | |||
35 | }; | ||
36 | |||
37 | |||
38 | #endif | ||