summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 14:25:49 (UTC)
committer simon <simon>2002-12-11 14:25:49 (UTC)
commit7a17954c26add31f28b69989f54e0f28a17c8949 (patch) (unidiff)
tree8603026771be07c996f49a29375fda64c8cd0e67
parent16138f0cdf46994d20ade71b5621b82fb9386933 (diff)
downloadopie-7a17954c26add31f28b69989f54e0f28a17c8949.zip
opie-7a17954c26add31f28b69989f54e0f28a17c8949.tar.gz
opie-7a17954c26add31f28b69989f54e0f28a17c8949.tar.bz2
- roll back the threaded xine initialization, the mediaplayer initialization
state and the PlayButton change set - instead load the audio-/video widget and the xine control on-demand. much faster and much simpler for startup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp92
-rw-r--r--noncore/multimedia/opieplayer2/lib.h22
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp120
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h14
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h6
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h18
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h6
11 files changed, 84 insertions, 241 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 20fd1e2..1e0dc21 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -74,4 +74,2 @@ Lib::Lib( XineVideoWidget* widget )
74{ 74{
75 ThreadUtil::AutoLock lock( m_initGuard );
76 m_initialized = false;
77 m_video = false; 75 m_video = false;
@@ -91,15 +89,4 @@ Lib::Lib( XineVideoWidget* widget )
91 89
92 start();
93}
94
95void Lib::run()
96{
97 initialize();
98}
99
100void Lib::initialize()
101{
102 m_xine = xine_new( ); 90 m_xine = xine_new( );
103 91
104 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
105 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 92 xine_config_load( m_xine, QFile::encodeName( configPath ) );
@@ -132,7 +119,2 @@ void Lib::initialize()
132 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 119 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
133
134 ThreadUtil::AutoLock lock( m_initGuard );
135 m_initialized = true;
136
137 send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay );
138} 120}
@@ -140,6 +122,2 @@ void Lib::initialize()
140Lib::~Lib() { 122Lib::~Lib() {
141 ThreadUtil::AutoLock lock( m_initGuard );
142
143 assert( m_initialized );
144
145// free( m_config ); 123// free( m_config );
@@ -158,13 +136,2 @@ Lib::~Lib() {
158 136
159void Lib::assertInitialized() const
160{
161 ThreadUtil::AutoLock lock( m_initGuard );
162
163 if ( m_initialized )
164 return;
165
166 qDebug( "LibXine: xine function called while not being initialized, yet! Fix the caller!" );
167 assert( m_initialized );
168}
169
170void Lib::resize ( const QSize &s ) { 137void Lib::resize ( const QSize &s ) {
@@ -195,4 +162,2 @@ int Lib::subVersion() {
195int Lib::play( const QString& fileName, int startPos, int start_time ) { 162int Lib::play( const QString& fileName, int startPos, int start_time ) {
196 assertInitialized();
197
198 QString str = fileName.stripWhiteSpace(); 163 QString str = fileName.stripWhiteSpace();
@@ -205,4 +170,2 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) {
205void Lib::stop() { 170void Lib::stop() {
206 assertInitialized();
207
208 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 171 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
@@ -212,4 +175,2 @@ void Lib::stop() {
212void Lib::pause( bool toggle ) { 175void Lib::pause( bool toggle ) {
213 assertInitialized();
214
215 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 176 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
@@ -218,4 +179,2 @@ void Lib::pause( bool toggle ) {
218int Lib::speed() const { 179int Lib::speed() const {
219 assertInitialized();
220
221 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 180 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
@@ -224,4 +183,2 @@ int Lib::speed() const {
224void Lib::setSpeed( int speed ) { 183void Lib::setSpeed( int speed ) {
225 assertInitialized();
226
227 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 184 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
@@ -230,4 +187,2 @@ void Lib::setSpeed( int speed ) {
230int Lib::status() const { 187int Lib::status() const {
231 assertInitialized();
232
233 return xine_get_status( m_stream ); 188 return xine_get_status( m_stream );
@@ -236,4 +191,2 @@ int Lib::status() const {
236int Lib::currentPosition() const { 191int Lib::currentPosition() const {
237 assertInitialized();
238
239 int pos, time, length; 192 int pos, time, length;
@@ -244,4 +197,2 @@ int Lib::currentPosition() const {
244int Lib::currentTime() const { 197int Lib::currentTime() const {
245 assertInitialized();
246
247 int pos, time, length; 198 int pos, time, length;
@@ -252,4 +203,2 @@ int Lib::currentTime() const {
252int Lib::length() const { 203int Lib::length() const {
253 assertInitialized();
254
255 int pos, time, length; 204 int pos, time, length;
@@ -260,4 +209,2 @@ int Lib::length() const {
260bool Lib::isSeekable() const { 209bool Lib::isSeekable() const {
261 assertInitialized();
262
263 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 210 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
@@ -266,4 +213,2 @@ bool Lib::isSeekable() const {
266void Lib::seekTo( int time ) { 213void Lib::seekTo( int time ) {
267 assertInitialized();
268
269 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 214 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
@@ -275,4 +220,2 @@ void Lib::seekTo( int time ) {
275Frame Lib::currentFrame() const { 220Frame Lib::currentFrame() const {
276 assertInitialized();
277
278 Frame frame; 221 Frame frame;
@@ -282,4 +225,2 @@ Frame Lib::currentFrame() const {
282QString Lib::metaInfo( int number) const { 225QString Lib::metaInfo( int number) const {
283 assertInitialized();
284
285 return xine_get_meta_info( m_stream, number ); 226 return xine_get_meta_info( m_stream, number );
@@ -288,4 +229,2 @@ QString Lib::metaInfo( int number) const {
288int Lib::error() const { 229int Lib::error() const {
289 assertInitialized();
290
291 return xine_get_error( m_stream ); 230 return xine_get_error( m_stream );
@@ -296,10 +235,3 @@ void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
296 assert( sendType == ThreadUtil::Channel::OneWay ); 235 assert( sendType == ThreadUtil::Channel::OneWay );
297 switch ( msg->type() ) { 236 handleXineEvent( msg->type() );
298 case XineMessageType:
299 handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent );
300 break;
301 case InitializationMessageType:
302 emit initialized();
303 break;
304 }
305 delete msg; 237 delete msg;
@@ -308,3 +240,3 @@ void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
308void Lib::handleXineEvent( const xine_event_t* t ) { 240void Lib::handleXineEvent( const xine_event_t* t ) {
309 send( new XineMessage( t->type ), OneWay ); 241 send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
310} 242}
@@ -312,4 +244,2 @@ void Lib::handleXineEvent( const xine_event_t* t ) {
312void Lib::handleXineEvent( int type ) { 244void Lib::handleXineEvent( int type ) {
313 assertInitialized();
314
315 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 245 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
@@ -321,4 +251,2 @@ void Lib::handleXineEvent( int type ) {
321void Lib::setShowVideo( bool video ) { 251void Lib::setShowVideo( bool video ) {
322 assertInitialized();
323
324 m_video = video; 252 m_video = video;
@@ -328,4 +256,2 @@ void Lib::setShowVideo( bool video ) {
328bool Lib::isShowingVideo() const { 256bool Lib::isShowingVideo() const {
329 assertInitialized();
330
331 return ::null_is_showing_video( m_videoOutput ); 257 return ::null_is_showing_video( m_videoOutput );
@@ -334,4 +260,2 @@ bool Lib::isShowingVideo() const {
334bool Lib::hasVideo() const { 260bool Lib::hasVideo() const {
335 assertInitialized();
336
337 return xine_get_stream_info( m_stream, 18 ); 261 return xine_get_stream_info( m_stream, 18 );
@@ -340,4 +264,2 @@ bool Lib::hasVideo() const {
340void Lib::showVideoFullScreen( bool fullScreen ) { 264void Lib::showVideoFullScreen( bool fullScreen ) {
341 assertInitialized();
342
343 ::null_set_fullscreen( m_videoOutput, fullScreen ); 265 ::null_set_fullscreen( m_videoOutput, fullScreen );
@@ -346,4 +268,2 @@ void Lib::showVideoFullScreen( bool fullScreen ) {
346bool Lib::isVideoFullScreen() const { 268bool Lib::isVideoFullScreen() const {
347 assertInitialized();
348
349 return ::null_is_fullscreen( m_videoOutput ); 269 return ::null_is_fullscreen( m_videoOutput );
@@ -352,4 +272,2 @@ bool Lib::isVideoFullScreen() const {
352void Lib::setScaling( bool scale ) { 272void Lib::setScaling( bool scale ) {
353 assertInitialized();
354
355 ::null_set_scaling( m_videoOutput, scale ); 273 ::null_set_scaling( m_videoOutput, scale );
@@ -358,4 +276,2 @@ void Lib::setScaling( bool scale ) {
358void Lib::setGamma( int value ) { 276void Lib::setGamma( int value ) {
359 assertInitialized();
360
361 //qDebug( QString( "%1").arg(value) ); 277 //qDebug( QString( "%1").arg(value) );
@@ -366,4 +282,2 @@ void Lib::setGamma( int value ) {
366bool Lib::isScaling() const { 282bool Lib::isScaling() const {
367 assertInitialized();
368
369 return ::null_is_scaling( m_videoOutput ); 283 return ::null_is_scaling( m_videoOutput );
@@ -381,4 +295,2 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame,
381void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 295void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
382 assertInitialized();
383
384 if ( !m_video ) { 296 if ( !m_video ) {
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 34b85b9..aba2ec9 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -57,3 +57,3 @@ namespace XINE {
57 class Frame; 57 class Frame;
58 class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread 58 class Lib : public ThreadUtil::Channel
59 { 59 {
@@ -185,23 +185,3 @@ namespace XINE {
185 185
186 virtual void run();
187
188 private: 186 private:
189 void initialize();
190
191 void assertInitialized() const;
192
193 enum { XineMessageType = 1, InitializationMessageType };
194
195 struct XineMessage : public ThreadUtil::ChannelMessage
196 {
197 XineMessage( int _xineEvent ) : ThreadUtil::ChannelMessage( XineMessageType ),
198 xineEvent( _xineEvent )
199 {}
200
201 int xineEvent;
202 };
203
204 mutable ThreadUtil::Mutex m_initGuard;
205 bool m_initialized : 1;
206
207 int m_bytes_per_pixel; 187 int m_bytes_per_pixel;
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index c230d6f..bbc60dd 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -33,6 +33,5 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
33 33
34 audioUI = 0; 34 m_audioUI = 0;
35 videoUI = 0; 35 m_videoUI = 0;
36 xineControl = 0; 36 m_xineControl = 0;
37 recreateAudioAndVideoWidgets();
38 37
@@ -62,5 +61,5 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
62MediaPlayer::~MediaPlayer() { 61MediaPlayer::~MediaPlayer() {
63 delete xineControl; 62 delete m_xineControl;
64 delete audioUI; 63 delete m_audioUI;
65 delete videoUI; 64 delete m_videoUI;
66 delete volControl; 65 delete volControl;
@@ -105,3 +104,3 @@ void MediaPlayer::setPlaying( bool play ) {
105 fileName = playListEntry.name; 104 fileName = playListEntry.name;
106 xineControl->play( playListEntry.file ); 105 xineControl()->play( playListEntry.file );
107 106
@@ -112,15 +111,15 @@ void MediaPlayer::setPlaying( bool play ) {
112 fileName = QFileInfo( fileName ).baseName(); 111 fileName = QFileInfo( fileName ).baseName();
113 if ( xineControl->getMetaInfo().isEmpty() ) { 112 if ( xineControl()->getMetaInfo().isEmpty() ) {
114 tickerText = tr( " File: " ) + fileName; 113 tickerText = tr( " File: " ) + fileName;
115 } else { 114 } else {
116 tickerText = xineControl->getMetaInfo(); 115 tickerText = xineControl()->getMetaInfo();
117 } 116 }
118 } else { 117 } else {
119 if ( xineControl->getMetaInfo().isEmpty() ) { 118 if ( xineControl()->getMetaInfo().isEmpty() ) {
120 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 119 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
121 } else { 120 } else {
122 tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; 121 tickerText = xineControl()->getMetaInfo() + " Length: " + time + " ";
123 } 122 }
124 } 123 }
125 audioUI->setTickerText( tickerText ); 124 audioUI()->setTickerText( tickerText );
126} 125}
@@ -191,10 +190,10 @@ void MediaPlayer::stopChangingVolume() {
191 int h=0; 190 int h=0;
192 if( !xineControl->hasVideo() ) { 191 if( !xineControl()->hasVideo() ) {
193 w = audioUI->width(); 192 w = audioUI()->width();
194 h = audioUI->height(); 193 h = audioUI()->height();
195 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 194 audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
196 } else { 195 } else {
197 w = videoUI->width(); 196 w = videoUI()->width();
198 h = videoUI->height(); 197 h = videoUI()->height();
199 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 198 videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
200 } 199 }
@@ -222,5 +221,5 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
222 int w=0; int h=0; 221 int w=0; int h=0;
223 if( !xineControl->hasVideo() ) { 222 if( !xineControl()->hasVideo() ) {
224 w = audioUI->width(); 223 w = audioUI()->width();
225 h = audioUI->height(); 224 h = audioUI()->height();
226 225
@@ -228,3 +227,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
228 if ( onScreenDisplayVolume > v ) { 227 if ( onScreenDisplayVolume > v ) {
229 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 228 audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
230 } 229 }
@@ -233,3 +232,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
233 onScreenDisplayVolume = v; 232 onScreenDisplayVolume = v;
234 QPainter p( audioUI ); 233 QPainter p( audioUI() );
235 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 234 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
@@ -251,4 +250,4 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
251 } else { 250 } else {
252 w = videoUI->width(); 251 w = videoUI()->width();
253 h = videoUI->height(); 252 h = videoUI()->height();
254 253
@@ -256,3 +255,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
256 if ( onScreenDisplayVolume > v ) { 255 if ( onScreenDisplayVolume > v ) {
257 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 256 videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
258 } 257 }
@@ -261,3 +260,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
261 onScreenDisplayVolume = v; 260 onScreenDisplayVolume = v;
262 QPainter p( videoUI ); 261 QPainter p( videoUI() );
263 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 262 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
@@ -348,23 +347,42 @@ void MediaPlayer::cleanUp() {// this happens on closing
348 347
349void MediaPlayer::recreateAudioAndVideoWidgets() 348void MediaPlayer::recreateAudioAndVideoWidgets() const
350{ 349{
351 delete xineControl; 350 delete m_xineControl;
352 delete audioUI; 351 delete m_audioUI;
353 delete videoUI; 352 delete m_videoUI;
354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 353 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 354 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
356 355
357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 356 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 357 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 358 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 359 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
361 360
362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 361 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 362 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 363 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 364 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
366 365
367 xineControl = new XineControl( videoUI->vidWidget(), mediaPlayerState ); 366 m_xineControl = new XineControl( m_videoUI->vidWidget(), mediaPlayerState );
368 connect( xineControl, SIGNAL( initialized() ), 367}
369 &mediaPlayerState, SLOT( setBackendInitialized() ) ); 368
369AudioWidget *MediaPlayer::audioUI() const
370{
371 if ( !m_audioUI )
372 recreateAudioAndVideoWidgets();
373 return m_audioUI;
374}
375
376VideoWidget *MediaPlayer::videoUI() const
377{
378 if ( !m_videoUI )
379 recreateAudioAndVideoWidgets();
380 return m_videoUI;
381}
382
383XineControl *MediaPlayer::xineControl() const
384{
385 if ( !m_xineControl )
386 recreateAudioAndVideoWidgets();
387 return m_xineControl;
370} 388}
@@ -373,4 +391,4 @@ void MediaPlayer::reloadSkins()
373{ 391{
374 audioUI->loadSkin(); 392 audioUI()->loadSkin();
375 videoUI->loadSkin(); 393 videoUI()->loadSkin();
376} 394}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 6b316f6..5975731 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -56,3 +56,2 @@ public:
56public slots: 56public slots:
57 void recreateAudioAndVideoWidgets();
58 void reloadSkins(); 57 void reloadSkins();
@@ -74,3 +73,7 @@ protected:
74 void keyReleaseEvent( QKeyEvent *e); 73 void keyReleaseEvent( QKeyEvent *e);
74
75private: 75private:
76 AudioWidget *audioUI() const;
77 VideoWidget *videoUI() const;
78 XineControl *xineControl() const;
76 79
@@ -79,3 +82,2 @@ private:
79 int volumeDirection; 82 int volumeDirection;
80 XineControl *xineControl;
81 VolumeControl *volControl; 83 VolumeControl *volControl;
@@ -83,4 +85,8 @@ private:
83 PlayListWidget &playList; 85 PlayListWidget &playList;
84 AudioWidget *audioUI; 86
85 VideoWidget *videoUI; 87 void recreateAudioAndVideoWidgets() const;
88
89 mutable XineControl *m_xineControl;
90 mutable AudioWidget *m_audioUI;
91 mutable VideoWidget *m_videoUI;
86}; 92};
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index d54d870..40fa1a4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -55,3 +55,2 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
55 seekable = true; 55 seekable = true;
56 backendInitialized = false;
57} 56}
@@ -88,14 +87,2 @@ void MediaPlayerState::writeConfig( Config& cfg ) const {
88 87
89bool MediaPlayerState::isInitialized() const
90{
91 return backendInitialized; // for now, more to come (skin stuff)
92}
93
94void MediaPlayerState::setBackendInitialized()
95{
96 assert( backendInitialized == false );
97 backendInitialized = true;
98 emit initialized();
99}
100
101MediaPlayerState::DisplayType MediaPlayerState::displayType() const 88MediaPlayerState::DisplayType MediaPlayerState::displayType() const
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 6fe6d76..7408fdc 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -63,3 +63,2 @@ public:
63 bool isStopped() const { return stopped; } 63 bool isStopped() const { return stopped; }
64 bool isInitialized() const;
65 long position() const { return curPosition; } 64 long position() const { return curPosition; }
@@ -100,4 +99,2 @@ public slots:
100 99
101 void setBackendInitialized();
102
103signals: 100signals:
@@ -120,4 +117,2 @@ signals:
120 117
121 void initialized();
122
123private: 118private:
@@ -134,3 +129,2 @@ private:
134 bool stopped : 1; 129 bool stopped : 1;
135 bool backendInitialized : 1;
136 long curPosition; 130 long curPosition;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 8e4f56d..c35e03d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -67,3 +67,3 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
67 this , SLOT(removeSelected() ) ); 67 this , SLOT(removeSelected() ) );
68 d->tbPlay = new PlayButton( mediaPlayerState, bar, tr( "Play" ), "opieplayer2/play", 68 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
69 this , SLOT( btnPlay( bool) ), TRUE ); 69 this , SLOT( btnPlay( bool) ), TRUE );
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 23b7a70..5fc0c39 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -205,24 +205,2 @@ void PlayListWidgetGui::setActiveWindow() {
205 205
206PlayButton::PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name,
207 const QString &icon, QObject *handler, const QString &slot, bool t )
208 : ToolButton( parent, name, icon, handler, slot, t ), mediaPlayerState( _mediaPlayerState ),
209 m_lastEnableStatus( true )
210{
211 connect( &mediaPlayerState, SIGNAL( initialized() ),
212 this, SLOT( checkInitializationStatus() ) );
213}
214
215void PlayButton::setEnabled( bool enable )
216{
217 m_lastEnableStatus = enable;
218
219 enable &= mediaPlayerState.isInitialized();
220
221 ToolButton::setEnabled( enable );
222}
223
224void PlayButton::checkInitializationStatus()
225{
226 setEnabled( m_lastEnableStatus );
227}
228 206
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 1aa8ac8..c965b0d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -86,20 +86,2 @@ public:
86 86
87class PlayButton : public ToolButton
88{
89 Q_OBJECT
90public:
91 PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name,
92 const QString& icon, QObject *handler, const QString& slot, bool t = FALSE );
93
94protected:
95 virtual void setEnabled( bool enable );
96
97private slots:
98 void checkInitializationStatus();
99
100private:
101 MediaPlayerState &mediaPlayerState;
102 bool m_lastEnableStatus : 1;
103};
104
105class MenuItem : public QAction { 87class MenuItem : public QAction {
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index e791c3b..ee2cd83 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -57,3 +57,3 @@ XineControl::XineControl( XineVideoWidget *xineWidget,
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 connect( libXine, SIGNAL( initialized() ), this, SLOT( xineInitialized() ) ); 58 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
59 59
@@ -128,10 +128,2 @@ void XineControl::setGamma( int value ) {
128 128
129void XineControl::xineInitialized()
130{
131 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
132 libXine->resize( xineVideoWidget->videoSize() );
133
134 emit initialized();
135}
136
137void XineControl::stop( bool isSet ) { 129void XineControl::stop( bool isSet ) {
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 085de3f..fdc5d2b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -102,6 +102,2 @@ public slots:
102 102
103
104private slots:
105 void xineInitialized();
106
107private: 103private:
@@ -120,4 +116,2 @@ signals:
120 void positionChanged( long ); 116 void positionChanged( long );
121
122 void initialized();
123}; 117};