Diffstat (limited to 'noncore/multimedia/opieplayer2/xinecontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
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 | } | ||