-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 33 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 5 |
4 files changed, 21 insertions, 21 deletions
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index fd47ea5..7d11ca0 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp | |||
@@ -5,18 +5,16 @@ | |||
5 | #include "audiowidget.h" | 5 | #include "audiowidget.h" |
6 | #include "videowidget.h" | 6 | #include "videowidget.h" |
7 | #include "mediaplayer.h" | 7 | #include "mediaplayer.h" |
8 | 8 | ||
9 | MediaPlayerState *mediaPlayerState; | ||
10 | PlayListWidget *playList; | 9 | PlayListWidget *playList; |
11 | AudioWidget *audioUI; | 10 | AudioWidget *audioUI; |
12 | VideoWidget *videoUI; | 11 | VideoWidget *videoUI; |
13 | 12 | ||
14 | int main(int argc, char **argv) { | 13 | int main(int argc, char **argv) { |
15 | QPEApplication a(argc,argv); | 14 | QPEApplication a(argc,argv); |
16 | 15 | ||
17 | MediaPlayerState st( 0, "mediaPlayerState" ); | 16 | MediaPlayerState st( 0, "mediaPlayerState" ); |
18 | mediaPlayerState = &st; | ||
19 | PlayListWidget pl( st, 0, "playList" ); | 17 | PlayListWidget pl( st, 0, "playList" ); |
20 | playList = &pl; | 18 | playList = &pl; |
21 | pl.showMaximized(); | 19 | pl.showMaximized(); |
22 | AudioWidget aw( st, 0, "audioUI" ); | 20 | AudioWidget aw( st, 0, "audioUI" ); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 424259b..eccb5d9 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -59,9 +59,9 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, | |||
59 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 59 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
60 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 60 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
61 | 61 | ||
62 | volControl = new VolumeControl; | 62 | volControl = new VolumeControl; |
63 | xineControl = new XineControl(); | 63 | xineControl = new XineControl( mediaPlayerState ); |
64 | Config cfg( "OpiePlayer" ); | 64 | Config cfg( "OpiePlayer" ); |
65 | cfg.setGroup("PlayList"); | 65 | cfg.setGroup("PlayList"); |
66 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 66 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
67 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 67 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index e7d5a7b..071ef7c 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -39,22 +39,21 @@ | |||
39 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | #include "videowidget.h" | 41 | #include "videowidget.h" |
42 | 42 | ||
43 | extern MediaPlayerState *mediaPlayerState; | ||
44 | extern VideoWidget *videoUI; | 43 | extern VideoWidget *videoUI; |
45 | XineControl::XineControl( QObject *parent, const char *name ) | 44 | XineControl::XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
46 | : QObject( parent, name ) { | 45 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) { |
47 | 46 | ||
48 | libXine = new XINE::Lib( videoUI->vidWidget() ); | 47 | libXine = new XINE::Lib( videoUI->vidWidget() ); |
49 | 48 | ||
50 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); | 49 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 50 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 51 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); |
53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 52 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 53 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 54 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 55 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 56 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
58 | 57 | ||
59 | disabledSuspendScreenSaver = FALSE; | 58 | disabledSuspendScreenSaver = FALSE; |
60 | } | 59 | } |
@@ -79,12 +78,12 @@ void XineControl::play( const QString& fileName ) { | |||
79 | 78 | ||
80 | if ( !libXine->play( fileName, 0, 0 ) ) { | 79 | if ( !libXine->play( fileName, 0, 0 ) ) { |
81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 80 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
82 | // toggle stop so the the play button is reset | 81 | // toggle stop so the the play button is reset |
83 | mediaPlayerState->setPlaying( false ); | 82 | mediaPlayerState.setPlaying( false ); |
84 | return; | 83 | return; |
85 | } | 84 | } |
86 | mediaPlayerState->setPlaying( true ); | 85 | mediaPlayerState.setPlaying( true ); |
87 | 86 | ||
88 | MediaPlayerState::DisplayType displayType; | 87 | MediaPlayerState::DisplayType displayType; |
89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); | 88 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); |
90 | if ( !libXine->hasVideo() ) { | 89 | if ( !libXine->hasVideo() ) { |
@@ -98,12 +97,12 @@ void XineControl::play( const QString& fileName ) { | |||
98 | libXine->setShowVideo( true ); | 97 | libXine->setShowVideo( true ); |
99 | hasVideoChannel = TRUE; | 98 | hasVideoChannel = TRUE; |
100 | } | 99 | } |
101 | // determine if slider is shown | 100 | // determine if slider is shown |
102 | mediaPlayerState->setIsSeekable( libXine->isSeekable() ); | 101 | mediaPlayerState.setIsSeekable( libXine->isSeekable() ); |
103 | 102 | ||
104 | // which gui (video / audio) | 103 | // which gui (video / audio) |
105 | mediaPlayerState->setDisplayType( displayType ); | 104 | mediaPlayerState.setDisplayType( displayType ); |
106 | 105 | ||
107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 106 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
108 | if ( !disabledSuspendScreenSaver ) { | 107 | if ( !disabledSuspendScreenSaver ) { |
109 | disabledSuspendScreenSaver = TRUE; | 108 | disabledSuspendScreenSaver = TRUE; |
@@ -117,9 +116,9 @@ void XineControl::play( const QString& fileName ) { | |||
117 | position(); | 116 | position(); |
118 | } | 117 | } |
119 | 118 | ||
120 | void XineControl::nextMedia() { | 119 | void XineControl::nextMedia() { |
121 | mediaPlayerState->setNext(); | 120 | mediaPlayerState.setNext(); |
122 | } | 121 | } |
123 | 122 | ||
124 | void XineControl::setGamma( int value ) { | 123 | void XineControl::setGamma( int value ) { |
125 | libXine->setGamma( value ); | 124 | libXine->setGamma( value ); |
@@ -166,9 +165,9 @@ long XineControl::currentTime() { | |||
166 | * Set the length of the media file | 165 | * Set the length of the media file |
167 | */ | 166 | */ |
168 | void XineControl::length() { | 167 | void XineControl::length() { |
169 | m_length = libXine->length(); | 168 | m_length = libXine->length(); |
170 | mediaPlayerState->setLength( m_length ); | 169 | mediaPlayerState.setLength( m_length ); |
171 | } | 170 | } |
172 | 171 | ||
173 | 172 | ||
174 | /** | 173 | /** |
@@ -176,12 +175,12 @@ void XineControl::length() { | |||
176 | * @return long the postion in seconds | 175 | * @return long the postion in seconds |
177 | */ | 176 | */ |
178 | long XineControl::position() { | 177 | long XineControl::position() { |
179 | m_position = ( currentTime() ); | 178 | m_position = ( currentTime() ); |
180 | mediaPlayerState->updatePosition( m_position ); | 179 | mediaPlayerState.updatePosition( m_position ); |
181 | long emitPos = (long)m_position; | 180 | long emitPos = (long)m_position; |
182 | emit positionChanged( emitPos ); | 181 | emit positionChanged( emitPos ); |
183 | if( mediaPlayerState->isPlaying() ) { | 182 | if( mediaPlayerState.isPlaying() ) { |
184 | // needs to be stopped the media is stopped | 183 | // needs to be stopped the media is stopped |
185 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 184 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
186 | } | 185 | } |
187 | // qDebug("POSITION : %d", m_position); | 186 | // qDebug("POSITION : %d", m_position); |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index b1300a8..00486f2 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -36,12 +36,14 @@ | |||
36 | 36 | ||
37 | #include "lib.h" | 37 | #include "lib.h" |
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | #include "mediaplayerstate.h" | ||
41 | |||
40 | class XineControl : public QObject { | 42 | class XineControl : public QObject { |
41 | Q_OBJECT | 43 | Q_OBJECT |
42 | public: | 44 | public: |
43 | XineControl( QObject *parent = 0, const char *name =0 ); | 45 | XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); |
44 | ~XineControl(); | 46 | ~XineControl(); |
45 | 47 | ||
46 | bool hasVideo() const { return hasVideoChannel; } | 48 | bool hasVideo() const { return hasVideoChannel; } |
47 | bool hasAudio() const { return hasAudioChannel; } | 49 | bool hasAudio() const { return hasAudioChannel; } |
@@ -105,8 +107,9 @@ private: | |||
105 | QString m_fileName; | 107 | QString m_fileName; |
106 | bool disabledSuspendScreenSaver : 1; | 108 | bool disabledSuspendScreenSaver : 1; |
107 | bool hasVideoChannel : 1; | 109 | bool hasVideoChannel : 1; |
108 | bool hasAudioChannel : 1; | 110 | bool hasAudioChannel : 1; |
111 | MediaPlayerState &mediaPlayerState; | ||
109 | 112 | ||
110 | signals: | 113 | signals: |
111 | void positionChanged( long ); | 114 | void positionChanged( long ); |
112 | 115 | ||