-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 92 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 120 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.h | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 6 |
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 | |||
@@ -69,14 +69,12 @@ extern "C" { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( XineVideoWidget* widget ) | 73 | Lib::Lib( XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
76 | m_initialized = false; | ||
77 | m_video = false; | 75 | m_video = false; |
78 | m_wid = widget; | 76 | m_wid = widget; |
79 | printf("Lib"); | 77 | printf("Lib"); |
80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 78 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
81 | // get the configuration | 79 | // get the configuration |
82 | 80 | ||
@@ -86,25 +84,14 @@ Lib::Lib( XineVideoWidget* widget ) | |||
86 | f.open(IO_WriteOnly); | 84 | f.open(IO_WriteOnly); |
87 | QTextStream ts( &f ); | 85 | QTextStream ts( &f ); |
88 | ts << "misc.memcpy_method:glibc\n"; | 86 | ts << "misc.memcpy_method:glibc\n"; |
89 | f.close(); | 87 | f.close(); |
90 | } | 88 | } |
91 | 89 | ||
92 | start(); | ||
93 | } | ||
94 | |||
95 | void Lib::run() | ||
96 | { | ||
97 | initialize(); | ||
98 | } | ||
99 | |||
100 | void 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 ) ); |
106 | 93 | ||
107 | xine_init( m_xine ); | 94 | xine_init( m_xine ); |
108 | 95 | ||
109 | // allocate oss for sound | 96 | // allocate oss for sound |
110 | // and fb for framebuffer | 97 | // and fb for framebuffer |
@@ -127,24 +114,15 @@ void Lib::initialize() | |||
127 | // m_wid->repaint(); | 114 | // m_wid->repaint(); |
128 | } | 115 | } |
129 | 116 | ||
130 | m_queue = xine_event_new_queue (m_stream); | 117 | m_queue = xine_event_new_queue (m_stream); |
131 | 118 | ||
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 | } |
139 | 121 | ||
140 | Lib::~Lib() { | 122 | Lib::~Lib() { |
141 | ThreadUtil::AutoLock lock( m_initGuard ); | ||
142 | |||
143 | assert( m_initialized ); | ||
144 | |||
145 | // free( m_config ); | 123 | // free( m_config ); |
146 | 124 | ||
147 | xine_close( m_stream ); | 125 | xine_close( m_stream ); |
148 | 126 | ||
149 | xine_event_dispose_queue( m_queue ); | 127 | xine_event_dispose_queue( m_queue ); |
150 | 128 | ||
@@ -153,23 +131,12 @@ Lib::~Lib() { | |||
153 | xine_exit( m_xine ); | 131 | xine_exit( m_xine ); |
154 | /* FIXME either free or delete but valgrind bitches against both */ | 132 | /* FIXME either free or delete but valgrind bitches against both */ |
155 | //free( m_videoOutput ); | 133 | //free( m_videoOutput ); |
156 | //delete m_audioOutput; | 134 | //delete m_audioOutput; |
157 | } | 135 | } |
158 | 136 | ||
159 | void 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 | |||
170 | void Lib::resize ( const QSize &s ) { | 137 | void Lib::resize ( const QSize &s ) { |
171 | if ( s. width ( ) && s. height ( ) ) { | 138 | if ( s. width ( ) && s. height ( ) ) { |
172 | ::null_set_gui_width( m_videoOutput, s. width() ); | 139 | ::null_set_gui_width( m_videoOutput, s. width() ); |
173 | ::null_set_gui_height( m_videoOutput, s. height() ); | 140 | ::null_set_gui_height( m_videoOutput, s. height() ); |
174 | } | 141 | } |
175 | } | 142 | } |
@@ -190,185 +157,132 @@ int Lib::subVersion() { | |||
190 | int major, minor, sub; | 157 | int major, minor, sub; |
191 | xine_get_version ( &major, &minor, &sub ); | 158 | xine_get_version ( &major, &minor, &sub ); |
192 | return sub; | 159 | return sub; |
193 | } | 160 | } |
194 | 161 | ||
195 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 162 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
196 | assertInitialized(); | ||
197 | |||
198 | QString str = fileName.stripWhiteSpace(); | 163 | QString str = fileName.stripWhiteSpace(); |
199 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { | 164 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { |
200 | return 0; | 165 | return 0; |
201 | } | 166 | } |
202 | return xine_play( m_stream, startPos, start_time); | 167 | return xine_play( m_stream, startPos, start_time); |
203 | } | 168 | } |
204 | 169 | ||
205 | void Lib::stop() { | 170 | void Lib::stop() { |
206 | assertInitialized(); | ||
207 | |||
208 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 171 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
209 | xine_stop( m_stream ); | 172 | xine_stop( m_stream ); |
210 | } | 173 | } |
211 | 174 | ||
212 | void Lib::pause( bool toggle ) { | 175 | void 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 ); |
216 | } | 177 | } |
217 | 178 | ||
218 | int Lib::speed() const { | 179 | int 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 ); |
222 | } | 181 | } |
223 | 182 | ||
224 | void Lib::setSpeed( int speed ) { | 183 | void 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 ); |
228 | } | 185 | } |
229 | 186 | ||
230 | int Lib::status() const { | 187 | int Lib::status() const { |
231 | assertInitialized(); | ||
232 | |||
233 | return xine_get_status( m_stream ); | 188 | return xine_get_status( m_stream ); |
234 | } | 189 | } |
235 | 190 | ||
236 | int Lib::currentPosition() const { | 191 | int Lib::currentPosition() const { |
237 | assertInitialized(); | ||
238 | |||
239 | int pos, time, length; | 192 | int pos, time, length; |
240 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 193 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
241 | return pos; | 194 | return pos; |
242 | } | 195 | } |
243 | 196 | ||
244 | int Lib::currentTime() const { | 197 | int Lib::currentTime() const { |
245 | assertInitialized(); | ||
246 | |||
247 | int pos, time, length; | 198 | int pos, time, length; |
248 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 199 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
249 | return time/1000; | 200 | return time/1000; |
250 | } | 201 | } |
251 | 202 | ||
252 | int Lib::length() const { | 203 | int Lib::length() const { |
253 | assertInitialized(); | ||
254 | |||
255 | int pos, time, length; | 204 | int pos, time, length; |
256 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 205 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
257 | return length/1000; | 206 | return length/1000; |
258 | } | 207 | } |
259 | 208 | ||
260 | bool Lib::isSeekable() const { | 209 | bool 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 ); |
264 | } | 211 | } |
265 | 212 | ||
266 | void Lib::seekTo( int time ) { | 213 | void 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 :_( |
270 | // since its now milliseconds we need *1000 | 215 | // since its now milliseconds we need *1000 |
271 | xine_play( m_stream, 0, time*1000 ); | 216 | xine_play( m_stream, 0, time*1000 ); |
272 | } | 217 | } |
273 | 218 | ||
274 | 219 | ||
275 | Frame Lib::currentFrame() const { | 220 | Frame Lib::currentFrame() const { |
276 | assertInitialized(); | ||
277 | |||
278 | Frame frame; | 221 | Frame frame; |
279 | return frame; | 222 | return frame; |
280 | }; | 223 | }; |
281 | 224 | ||
282 | QString Lib::metaInfo( int number) const { | 225 | QString 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 ); |
286 | } | 227 | } |
287 | 228 | ||
288 | int Lib::error() const { | 229 | int Lib::error() const { |
289 | assertInitialized(); | ||
290 | |||
291 | return xine_get_error( m_stream ); | 230 | return xine_get_error( m_stream ); |
292 | }; | 231 | }; |
293 | 232 | ||
294 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 233 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
295 | { | 234 | { |
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; |
306 | } | 238 | } |
307 | 239 | ||
308 | void Lib::handleXineEvent( const xine_event_t* t ) { | 240 | void Lib::handleXineEvent( const xine_event_t* t ) { |
309 | send( new XineMessage( t->type ), OneWay ); | 241 | send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); |
310 | } | 242 | } |
311 | 243 | ||
312 | void Lib::handleXineEvent( int type ) { | 244 | void Lib::handleXineEvent( int type ) { |
313 | assertInitialized(); | ||
314 | |||
315 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { | 245 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
316 | emit stopped(); | 246 | emit stopped(); |
317 | } | 247 | } |
318 | } | 248 | } |
319 | 249 | ||
320 | 250 | ||
321 | void Lib::setShowVideo( bool video ) { | 251 | void Lib::setShowVideo( bool video ) { |
322 | assertInitialized(); | ||
323 | |||
324 | m_video = video; | 252 | m_video = video; |
325 | ::null_set_show_video( m_videoOutput, video ); | 253 | ::null_set_show_video( m_videoOutput, video ); |
326 | } | 254 | } |
327 | 255 | ||
328 | bool Lib::isShowingVideo() const { | 256 | bool Lib::isShowingVideo() const { |
329 | assertInitialized(); | ||
330 | |||
331 | return ::null_is_showing_video( m_videoOutput ); | 257 | return ::null_is_showing_video( m_videoOutput ); |
332 | } | 258 | } |
333 | 259 | ||
334 | bool Lib::hasVideo() const { | 260 | bool Lib::hasVideo() const { |
335 | assertInitialized(); | ||
336 | |||
337 | return xine_get_stream_info( m_stream, 18 ); | 261 | return xine_get_stream_info( m_stream, 18 ); |
338 | } | 262 | } |
339 | 263 | ||
340 | void Lib::showVideoFullScreen( bool fullScreen ) { | 264 | void Lib::showVideoFullScreen( bool fullScreen ) { |
341 | assertInitialized(); | ||
342 | |||
343 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 265 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
344 | } | 266 | } |
345 | 267 | ||
346 | bool Lib::isVideoFullScreen() const { | 268 | bool Lib::isVideoFullScreen() const { |
347 | assertInitialized(); | ||
348 | |||
349 | return ::null_is_fullscreen( m_videoOutput ); | 269 | return ::null_is_fullscreen( m_videoOutput ); |
350 | } | 270 | } |
351 | 271 | ||
352 | void Lib::setScaling( bool scale ) { | 272 | void Lib::setScaling( bool scale ) { |
353 | assertInitialized(); | ||
354 | |||
355 | ::null_set_scaling( m_videoOutput, scale ); | 273 | ::null_set_scaling( m_videoOutput, scale ); |
356 | } | 274 | } |
357 | 275 | ||
358 | void Lib::setGamma( int value ) { | 276 | void Lib::setGamma( int value ) { |
359 | assertInitialized(); | ||
360 | |||
361 | //qDebug( QString( "%1").arg(value) ); | 277 | //qDebug( QString( "%1").arg(value) ); |
362 | /* int gammaValue = ( 100 + value ); */ | 278 | /* int gammaValue = ( 100 + value ); */ |
363 | ::null_set_videoGamma( m_videoOutput, value ); | 279 | ::null_set_videoGamma( m_videoOutput, value ); |
364 | } | 280 | } |
365 | 281 | ||
366 | bool Lib::isScaling() const { | 282 | bool Lib::isScaling() const { |
367 | assertInitialized(); | ||
368 | |||
369 | return ::null_is_scaling( m_videoOutput ); | 283 | return ::null_is_scaling( m_videoOutput ); |
370 | } | 284 | } |
371 | 285 | ||
372 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | 286 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { |
373 | ( (Lib*)user_data)->handleXineEvent( t ); | 287 | ( (Lib*)user_data)->handleXineEvent( t ); |
374 | } | 288 | } |
@@ -376,14 +290,12 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | |||
376 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 290 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
377 | int width, int height, int bytes ) { | 291 | int width, int height, int bytes ) { |
378 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 292 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
379 | } | 293 | } |
380 | 294 | ||
381 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 295 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
382 | assertInitialized(); | ||
383 | |||
384 | if ( !m_video ) { | 296 | if ( !m_video ) { |
385 | qWarning("not showing video now"); | 297 | qWarning("not showing video now"); |
386 | return; | 298 | return; |
387 | } | 299 | } |
388 | m_wid-> setVideoFrame ( frame, width, height, bytes ); | 300 | m_wid-> setVideoFrame ( frame, width, height, bytes ); |
389 | } | 301 | } |
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 | |||
@@ -52,13 +52,13 @@ namespace XINE { | |||
52 | * of libxine for easy every day use | 52 | * of libxine for easy every day use |
53 | * This will become a full C++ Wrapper | 53 | * This will become a full C++ Wrapper |
54 | * It supports playing, pausing, info, | 54 | * It supports playing, pausing, info, |
55 | * stooping, seeking. | 55 | * stooping, seeking. |
56 | */ | 56 | */ |
57 | class Frame; | 57 | class Frame; |
58 | class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread | 58 | class Lib : public ThreadUtil::Channel |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | public: | 61 | public: |
62 | Lib(XineVideoWidget* = 0); | 62 | Lib(XineVideoWidget* = 0); |
63 | ~Lib(); | 63 | ~Lib(); |
64 | static int majorVersion(); | 64 | static int majorVersion(); |
@@ -180,33 +180,13 @@ namespace XINE { | |||
180 | 180 | ||
181 | void initialized(); | 181 | void initialized(); |
182 | 182 | ||
183 | protected: | 183 | protected: |
184 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 184 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
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; |
208 | bool m_video:1; | 188 | bool m_video:1; |
209 | XineVideoWidget *m_wid; | 189 | XineVideoWidget *m_wid; |
210 | xine_t *m_xine; | 190 | xine_t *m_xine; |
211 | xine_stream_t *m_stream; | 191 | xine_stream_t *m_stream; |
212 | xine_cfg_entry_t *m_config; | 192 | xine_cfg_entry_t *m_config; |
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 | |||
@@ -28,16 +28,15 @@ | |||
28 | 28 | ||
29 | #define FBIOBLANK 0x4611 | 29 | #define FBIOBLANK 0x4611 |
30 | 30 | ||
31 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 31 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
32 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { | 32 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { |
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 | ||
39 | fd=-1;fl=-1; | 38 | fd=-1;fl=-1; |
40 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); | 39 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
41 | 40 | ||
42 | qApp->processEvents(); | 41 | qApp->processEvents(); |
43 | // QPEApplication::grabKeyboard(); // EVIL | 42 | // QPEApplication::grabKeyboard(); // EVIL |
@@ -57,15 +56,15 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla | |||
57 | cfg.setGroup("PlayList"); | 56 | cfg.setGroup("PlayList"); |
58 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 57 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
59 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 58 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
60 | } | 59 | } |
61 | 60 | ||
62 | MediaPlayer::~MediaPlayer() { | 61 | MediaPlayer::~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; |
67 | } | 66 | } |
68 | 67 | ||
69 | void MediaPlayer::pauseCheck( bool b ) { | 68 | void MediaPlayer::pauseCheck( bool b ) { |
70 | if ( b && !mediaPlayerState.isPlaying() ) { | 69 | if ( b && !mediaPlayerState.isPlaying() ) { |
71 | mediaPlayerState.setPaused( FALSE ); | 70 | mediaPlayerState.setPaused( FALSE ); |
@@ -100,32 +99,32 @@ void MediaPlayer::setPlaying( bool play ) { | |||
100 | r = mediaPlayerState.isShuffled(); | 99 | r = mediaPlayerState.isShuffled(); |
101 | mediaPlayerState.setShuffled( false ); | 100 | mediaPlayerState.setShuffled( false ); |
102 | } | 101 | } |
103 | 102 | ||
104 | PlayListWidget::Entry playListEntry = playList.currentEntry(); | 103 | PlayListWidget::Entry playListEntry = playList.currentEntry(); |
105 | fileName = playListEntry.name; | 104 | fileName = playListEntry.name; |
106 | xineControl->play( playListEntry.file ); | 105 | xineControl()->play( playListEntry.file ); |
107 | 106 | ||
108 | long seconds = mediaPlayerState.length(); | 107 | long seconds = mediaPlayerState.length(); |
109 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 108 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
110 | 109 | ||
111 | if( fileName.left(4) == "http" ) { | 110 | if( fileName.left(4) == "http" ) { |
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 | } |
127 | 126 | ||
128 | 127 | ||
129 | void MediaPlayer::prev() { | 128 | void MediaPlayer::prev() { |
130 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist | 129 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist |
131 | if ( playList.prev() ) { | 130 | if ( playList.prev() ) { |
@@ -186,20 +185,20 @@ void MediaPlayer::stopChangingVolume() { | |||
186 | killTimers(); | 185 | killTimers(); |
187 | // Get rid of the on-screen display stuff | 186 | // Get rid of the on-screen display stuff |
188 | drawnOnScreenDisplay = FALSE; | 187 | drawnOnScreenDisplay = FALSE; |
189 | onScreenDisplayVolume = 0; | 188 | onScreenDisplayVolume = 0; |
190 | int w=0; | 189 | int w=0; |
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 | } |
201 | } | 200 | } |
202 | 201 | ||
203 | 202 | ||
204 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 203 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
205 | if ( volumeDirection == +1 ) { | 204 | if ( volumeDirection == +1 ) { |
@@ -217,24 +216,24 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
217 | 216 | ||
218 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 217 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
219 | return; | 218 | return; |
220 | } | 219 | } |
221 | 220 | ||
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 | ||
227 | if ( drawnOnScreenDisplay ) { | 226 | if ( drawnOnScreenDisplay ) { |
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 | } |
231 | } | 230 | } |
232 | drawnOnScreenDisplay = TRUE; | 231 | drawnOnScreenDisplay = TRUE; |
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 ) ); |
236 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 235 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
237 | 236 | ||
238 | QFont f; | 237 | QFont f; |
239 | f.setPixelSize( 20 ); | 238 | f.setPixelSize( 20 ); |
240 | f.setBold( TRUE ); | 239 | f.setBold( TRUE ); |
@@ -246,23 +245,23 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
246 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 245 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
247 | } else { | 246 | } else { |
248 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 247 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
249 | } | 248 | } |
250 | } | 249 | } |
251 | } else { | 250 | } else { |
252 | w = videoUI->width(); | 251 | w = videoUI()->width(); |
253 | h = videoUI->height(); | 252 | h = videoUI()->height(); |
254 | 253 | ||
255 | if ( drawnOnScreenDisplay ) { | 254 | if ( drawnOnScreenDisplay ) { |
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 | } |
259 | } | 258 | } |
260 | drawnOnScreenDisplay = TRUE; | 259 | drawnOnScreenDisplay = TRUE; |
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 ) ); |
264 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 263 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
265 | 264 | ||
266 | QFont f; | 265 | QFont f; |
267 | f.setPixelSize( 20 ); | 266 | f.setPixelSize( 20 ); |
268 | f.setBold( TRUE ); | 267 | f.setBold( TRUE ); |
@@ -343,35 +342,54 @@ void MediaPlayer::cleanUp() {// this happens on closing | |||
343 | playList.writeDefaultPlaylist( ); | 342 | playList.writeDefaultPlaylist( ); |
344 | 343 | ||
345 | // QPEApplication::grabKeyboard(); | 344 | // QPEApplication::grabKeyboard(); |
346 | // QPEApplication::ungrabKeyboard(); | 345 | // QPEApplication::ungrabKeyboard(); |
347 | } | 346 | } |
348 | 347 | ||
349 | void MediaPlayer::recreateAudioAndVideoWidgets() | 348 | void 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 | |
369 | AudioWidget *MediaPlayer::audioUI() const | ||
370 | { | ||
371 | if ( !m_audioUI ) | ||
372 | recreateAudioAndVideoWidgets(); | ||
373 | return m_audioUI; | ||
374 | } | ||
375 | |||
376 | VideoWidget *MediaPlayer::videoUI() const | ||
377 | { | ||
378 | if ( !m_videoUI ) | ||
379 | recreateAudioAndVideoWidgets(); | ||
380 | return m_videoUI; | ||
381 | } | ||
382 | |||
383 | XineControl *MediaPlayer::xineControl() const | ||
384 | { | ||
385 | if ( !m_xineControl ) | ||
386 | recreateAudioAndVideoWidgets(); | ||
387 | return m_xineControl; | ||
370 | } | 388 | } |
371 | 389 | ||
372 | void MediaPlayer::reloadSkins() | 390 | void MediaPlayer::reloadSkins() |
373 | { | 391 | { |
374 | audioUI->loadSkin(); | 392 | audioUI()->loadSkin(); |
375 | videoUI->loadSkin(); | 393 | videoUI()->loadSkin(); |
376 | } | 394 | } |
377 | 395 | ||
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 | |||
@@ -51,13 +51,12 @@ class MediaPlayer : public QObject { | |||
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); | 53 | MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); |
54 | ~MediaPlayer(); | 54 | ~MediaPlayer(); |
55 | 55 | ||
56 | public slots: | 56 | public slots: |
57 | void recreateAudioAndVideoWidgets(); | ||
58 | void reloadSkins(); | 57 | void reloadSkins(); |
59 | 58 | ||
60 | private slots: | 59 | private slots: |
61 | void setPlaying( bool ); | 60 | void setPlaying( bool ); |
62 | void pauseCheck( bool ); | 61 | void pauseCheck( bool ); |
63 | void play(); | 62 | void play(); |
@@ -69,22 +68,29 @@ private slots: | |||
69 | void cleanUp(); | 68 | void cleanUp(); |
70 | void blank( bool ); | 69 | void blank( bool ); |
71 | 70 | ||
72 | protected: | 71 | protected: |
73 | void timerEvent( QTimerEvent *e ); | 72 | void timerEvent( QTimerEvent *e ); |
74 | void keyReleaseEvent( QKeyEvent *e); | 73 | void keyReleaseEvent( QKeyEvent *e); |
74 | |||
75 | private: | 75 | private: |
76 | AudioWidget *audioUI() const; | ||
77 | VideoWidget *videoUI() const; | ||
78 | XineControl *xineControl() const; | ||
76 | 79 | ||
77 | bool isBlanked, l, r; | 80 | bool isBlanked, l, r; |
78 | int fd, fl; | 81 | int fd, fl; |
79 | int volumeDirection; | 82 | int volumeDirection; |
80 | XineControl *xineControl; | ||
81 | VolumeControl *volControl; | 83 | VolumeControl *volControl; |
82 | MediaPlayerState &mediaPlayerState; | 84 | MediaPlayerState &mediaPlayerState; |
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 | }; |
87 | 93 | ||
88 | 94 | ||
89 | #endif // MEDIA_PLAYER_H | 95 | #endif // MEDIA_PLAYER_H |
90 | 96 | ||
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 | |||
@@ -50,13 +50,12 @@ | |||
50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
51 | : QObject( parent, name ) { | 51 | : QObject( parent, name ) { |
52 | Config cfg( "OpiePlayer" ); | 52 | Config cfg( "OpiePlayer" ); |
53 | readConfig( cfg ); | 53 | readConfig( cfg ); |
54 | streaming = false; | 54 | streaming = false; |
55 | seekable = true; | 55 | seekable = true; |
56 | backendInitialized = false; | ||
57 | } | 56 | } |
58 | 57 | ||
59 | 58 | ||
60 | MediaPlayerState::~MediaPlayerState() { | 59 | MediaPlayerState::~MediaPlayerState() { |
61 | } | 60 | } |
62 | 61 | ||
@@ -83,24 +82,12 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
83 | cfg.writeEntry( "Scaling", scaled ); | 82 | cfg.writeEntry( "Scaling", scaled ); |
84 | cfg.writeEntry( "Looping", looping ); | 83 | cfg.writeEntry( "Looping", looping ); |
85 | cfg.writeEntry( "Shuffle", shuffled ); | 84 | cfg.writeEntry( "Shuffle", shuffled ); |
86 | cfg.writeEntry( "VideoGamma", videoGamma ); | 85 | cfg.writeEntry( "VideoGamma", videoGamma ); |
87 | } | 86 | } |
88 | 87 | ||
89 | bool MediaPlayerState::isInitialized() const | ||
90 | { | ||
91 | return backendInitialized; // for now, more to come (skin stuff) | ||
92 | } | ||
93 | |||
94 | void MediaPlayerState::setBackendInitialized() | ||
95 | { | ||
96 | assert( backendInitialized == false ); | ||
97 | backendInitialized = true; | ||
98 | emit initialized(); | ||
99 | } | ||
100 | |||
101 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | 88 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const |
102 | { | 89 | { |
103 | return m_displayType; | 90 | return m_displayType; |
104 | } | 91 | } |
105 | 92 | ||
106 | // slots | 93 | // slots |
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 | |||
@@ -58,13 +58,12 @@ public: | |||
58 | bool isScaled() const { return scaled; } | 58 | bool isScaled() const { return scaled; } |
59 | bool isLooping() const { return looping; } | 59 | bool isLooping() const { return looping; } |
60 | bool isShuffled() const { return shuffled; } | 60 | bool isShuffled() const { return shuffled; } |
61 | bool isPaused() const { return paused; } | 61 | bool isPaused() const { return paused; } |
62 | bool isPlaying() const { return playing; } | 62 | bool isPlaying() const { return playing; } |
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; } |
66 | long length() const { return curLength; } | 65 | long length() const { return curLength; } |
67 | DisplayType displayType() const; | 66 | DisplayType displayType() const; |
68 | 67 | ||
69 | public slots: | 68 | public slots: |
70 | void setIsStreaming( bool b ); | 69 | void setIsStreaming( bool b ); |
@@ -95,14 +94,12 @@ public slots: | |||
95 | void toggleShuffled(); | 94 | void toggleShuffled(); |
96 | void togglePaused(); | 95 | void togglePaused(); |
97 | void togglePlaying(); | 96 | void togglePlaying(); |
98 | void toggleBlank(); | 97 | void toggleBlank(); |
99 | void writeConfig( Config& cfg ) const; | 98 | void writeConfig( Config& cfg ) const; |
100 | 99 | ||
101 | void setBackendInitialized(); | ||
102 | |||
103 | signals: | 100 | signals: |
104 | void fullscreenToggled( bool ); | 101 | void fullscreenToggled( bool ); |
105 | void scaledToggled( bool ); | 102 | void scaledToggled( bool ); |
106 | void loopingToggled( bool ); | 103 | void loopingToggled( bool ); |
107 | void shuffledToggled( bool ); | 104 | void shuffledToggled( bool ); |
108 | void pausedToggled( bool ); | 105 | void pausedToggled( bool ); |
@@ -115,27 +112,24 @@ signals: | |||
115 | void isSeekableToggled( bool ); | 112 | void isSeekableToggled( bool ); |
116 | void blankToggled( bool ); | 113 | void blankToggled( bool ); |
117 | void videoGammaChanged( int ); | 114 | void videoGammaChanged( int ); |
118 | void prev(); | 115 | void prev(); |
119 | void next(); | 116 | void next(); |
120 | 117 | ||
121 | void initialized(); | ||
122 | |||
123 | private: | 118 | private: |
124 | bool streaming : 1; | 119 | bool streaming : 1; |
125 | bool seekable : 1; | 120 | bool seekable : 1; |
126 | bool fullscreen: 1; | 121 | bool fullscreen: 1; |
127 | bool scaled : 1; | 122 | bool scaled : 1; |
128 | bool blanked : 1; | 123 | bool blanked : 1; |
129 | bool looping : 1; | 124 | bool looping : 1; |
130 | bool shuffled : 1; | 125 | bool shuffled : 1; |
131 | bool usePlaylist : 1; | 126 | bool usePlaylist : 1; |
132 | bool paused : 1; | 127 | bool paused : 1; |
133 | bool playing : 1; | 128 | bool playing : 1; |
134 | bool stopped : 1; | 129 | bool stopped : 1; |
135 | bool backendInitialized : 1; | ||
136 | long curPosition; | 130 | long curPosition; |
137 | long curLength; | 131 | long curLength; |
138 | DisplayType m_displayType; | 132 | DisplayType m_displayType; |
139 | int videoGamma; | 133 | int videoGamma; |
140 | void readConfig( Config& cfg ); | 134 | void readConfig( Config& cfg ); |
141 | 135 | ||
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 | |||
@@ -62,13 +62,13 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
63 | "opieplayer2/add_to_playlist", | 63 | "opieplayer2/add_to_playlist", |
64 | this , SLOT(addSelected() ) ); | 64 | this , SLOT(addSelected() ) ); |
65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
66 | "opieplayer2/remove_from_playlist", | 66 | "opieplayer2/remove_from_playlist", |
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 ); |
70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
71 | &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 71 | &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
73 | &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 73 | &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
74 | 74 | ||
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 | |||
@@ -200,29 +200,7 @@ void PlayListWidgetGui::setActiveWindow() { | |||
200 | // When we get raised we need to ensure that it switches views | 200 | // When we get raised we need to ensure that it switches views |
201 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); | 201 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); |
202 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate | 202 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate |
203 | mediaPlayerState.setDisplayType( origDisplayType ); // now switch back | 203 | mediaPlayerState.setDisplayType( origDisplayType ); // now switch back |
204 | } | 204 | } |
205 | 205 | ||
206 | PlayButton::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 | |||
215 | void PlayButton::setEnabled( bool enable ) | ||
216 | { | ||
217 | m_lastEnableStatus = enable; | ||
218 | |||
219 | enable &= mediaPlayerState.isInitialized(); | ||
220 | |||
221 | ToolButton::setEnabled( enable ); | ||
222 | } | ||
223 | |||
224 | void 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 | |||
@@ -81,30 +81,12 @@ public: | |||
81 | setToggleButton( t ); | 81 | setToggleButton( t ); |
82 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 82 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
83 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 83 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
84 | } | 84 | } |
85 | }; | 85 | }; |
86 | 86 | ||
87 | class PlayButton : public ToolButton | ||
88 | { | ||
89 | Q_OBJECT | ||
90 | public: | ||
91 | PlayButton( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name, | ||
92 | const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ); | ||
93 | |||
94 | protected: | ||
95 | virtual void setEnabled( bool enable ); | ||
96 | |||
97 | private slots: | ||
98 | void checkInitializationStatus(); | ||
99 | |||
100 | private: | ||
101 | MediaPlayerState &mediaPlayerState; | ||
102 | bool m_lastEnableStatus : 1; | ||
103 | }; | ||
104 | |||
105 | class MenuItem : public QAction { | 87 | class MenuItem : public QAction { |
106 | 88 | ||
107 | public: | 89 | public: |
108 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 90 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
109 | : QAction( text, QString::null, 0, 0 ) { | 91 | : QAction( text, QString::null, 0, 0 ) { |
110 | connect( this, SIGNAL( activated() ), handler, slot ); | 92 | connect( this, SIGNAL( activated() ), handler, slot ); |
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 | |||
@@ -52,13 +52,13 @@ XineControl::XineControl( XineVideoWidget *xineWidget, | |||
52 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); | 52 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); |
53 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 53 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
54 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 54 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
55 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 55 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
56 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 56 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
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 | ||
60 | disabledSuspendScreenSaver = FALSE; | 60 | disabledSuspendScreenSaver = FALSE; |
61 | } | 61 | } |
62 | 62 | ||
63 | XineControl::~XineControl() { | 63 | XineControl::~XineControl() { |
64 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 64 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
@@ -123,20 +123,12 @@ void XineControl::nextMedia() { | |||
123 | } | 123 | } |
124 | 124 | ||
125 | void XineControl::setGamma( int value ) { | 125 | void XineControl::setGamma( int value ) { |
126 | libXine->setGamma( value ); | 126 | libXine->setGamma( value ); |
127 | } | 127 | } |
128 | 128 | ||
129 | void 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 | |||
137 | void XineControl::stop( bool isSet ) { | 129 | void XineControl::stop( bool isSet ) { |
138 | if ( !isSet ) { | 130 | if ( !isSet ) { |
139 | libXine->stop(); | 131 | libXine->stop(); |
140 | 132 | ||
141 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 133 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
142 | if ( disabledSuspendScreenSaver ) { | 134 | if ( disabledSuspendScreenSaver ) { |
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 | |||
@@ -97,16 +97,12 @@ public slots: | |||
97 | /** | 97 | /** |
98 | * Set the gamma value of the video output | 98 | * Set the gamma value of the video output |
99 | * @param int value between -100 and 100, 0 is original | 99 | * @param int value between -100 and 100, 0 is original |
100 | */ | 100 | */ |
101 | void setGamma( int ); | 101 | void setGamma( int ); |
102 | 102 | ||
103 | |||
104 | private slots: | ||
105 | void xineInitialized(); | ||
106 | |||
107 | private: | 103 | private: |
108 | XINE::Lib *libXine; | 104 | XINE::Lib *libXine; |
109 | long m_currentTime; | 105 | long m_currentTime; |
110 | long m_position; | 106 | long m_position; |
111 | int m_length; | 107 | int m_length; |
112 | QString m_fileName; | 108 | QString m_fileName; |
@@ -115,12 +111,10 @@ private: | |||
115 | bool hasAudioChannel : 1; | 111 | bool hasAudioChannel : 1; |
116 | MediaPlayerState &mediaPlayerState; | 112 | MediaPlayerState &mediaPlayerState; |
117 | XineVideoWidget *xineVideoWidget; | 113 | XineVideoWidget *xineVideoWidget; |
118 | 114 | ||
119 | signals: | 115 | signals: |
120 | void positionChanged( long ); | 116 | void positionChanged( long ); |
121 | |||
122 | void initialized(); | ||
123 | }; | 117 | }; |
124 | 118 | ||
125 | 119 | ||
126 | #endif | 120 | #endif |