summaryrefslogtreecommitdiff
path: root/core/multimedia
Unidiff
Diffstat (limited to 'core/multimedia') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp16
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp31
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp24
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.cpp18
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp6
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp2
-rw-r--r--core/multimedia/opieplayer/om3u.cpp4
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp142
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp14
10 files changed, 117 insertions, 142 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 73e41dc..d01d2ba 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -144,24 +144,24 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
144#endif 144#endif
145} 145}
146 146
147 147
148 148
149AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { 149AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
150 qDebug("creating new audio device"); 150 // qDebug("creating new audio device");
151// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; 151// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
152 d = new AudioDevicePrivate; 152 d = new AudioDevicePrivate;
153 d->frequency = f; 153 d->frequency = f;
154 d->channels = chs; 154 d->channels = chs;
155 d->bytesPerSample = bps; 155 d->bytesPerSample = bps;
156 qDebug("%d",bps); 156 // qDebug("%d",bps);
157 int format=0; 157 int format=0;
158 if( bps == 8) format = AFMT_U8; 158 if( bps == 8) format = AFMT_U8;
159 else if( bps <= 0) format = AFMT_S16_LE; 159 else if( bps <= 0) format = AFMT_S16_LE;
160 else format = AFMT_S16_LE; 160 else format = AFMT_S16_LE;
161 qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); 161 // qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
162 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); 162 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
163 163
164 int fragments = 0x10000 * 8 + sound_fragment_shift; 164 int fragments = 0x10000 * 8 + sound_fragment_shift;
165 int capabilities = 0; 165 int capabilities = 0;
166 166
167 167
@@ -188,16 +188,16 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
188 if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1) 188 if(ioctl( d->handle, SNDCTL_DSP_GETCAPS, &capabilities )==-1)
189 perror("ioctl(\"SNDCTL_DSP_GETCAPS\")"); 189 perror("ioctl(\"SNDCTL_DSP_GETCAPS\")");
190 if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1) 190 if(ioctl( d->handle, SNDCTL_DSP_SETFRAGMENT, &fragments )==-1)
191 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); 191 perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")");
192 if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1) 192 if(ioctl( d->handle, SNDCTL_DSP_SETFMT, & format )==-1)
193 perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); 193 perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
194 qDebug("freq %d", d->frequency); 194 // qDebug("freq %d", d->frequency);
195 if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) 195 if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1)
196 perror("ioctl(\"SNDCTL_DSP_SPEED\")"); 196 perror("ioctl(\"SNDCTL_DSP_SPEED\")");
197 qDebug("channels %d",d->channels); 197 // qDebug("channels %d",d->channels);
198 if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { 198 if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) {
199 d->channels = ( d->channels == 1 ) ? 2 : d->channels; 199 d->channels = ( d->channels == 1 ) ? 2 : d->channels;
200 if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) 200 if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1)
201 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); 201 perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
202 } 202 }
203// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; 203// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE;
@@ -215,13 +215,13 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
215 //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); 215 //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" );
216 216
217} 217}
218 218
219 219
220AudioDevice::~AudioDevice() { 220AudioDevice::~AudioDevice() {
221 qDebug("destryo audiodevice"); 221 // qDebug("destryo audiodevice");
222// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; 222// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
223 223
224# ifndef KEEP_DEVICE_OPEN 224# ifndef KEEP_DEVICE_OPEN
225 close( d->handle ); // Now it should be safe to shut the handle 225 close( d->handle ); // Now it should be safe to shut the handle
226# endif 226# endif
227 delete d->unwrittenBuffer; 227 delete d->unwrittenBuffer;
@@ -239,13 +239,13 @@ void AudioDevice::volumeChanged( bool muted )
239 239
240void AudioDevice::write( char *buffer, unsigned int length ) 240void AudioDevice::write( char *buffer, unsigned int length )
241{ 241{
242 int t = ::write( d->handle, buffer, length ); 242 int t = ::write( d->handle, buffer, length );
243 if ( t<0 ) t = 0; 243 if ( t<0 ) t = 0;
244 if ( t != (int)length) { 244 if ( t != (int)length) {
245 qDebug("Ahhh!! memcpys 1"); 245 // qDebug("Ahhh!! memcpys 1");
246 memcpy(d->unwrittenBuffer,buffer+t,length-t); 246 memcpy(d->unwrittenBuffer,buffer+t,length-t);
247 d->unwritten = length-t; 247 d->unwritten = length-t;
248 } 248 }
249//#endif 249//#endif
250} 250}
251 251
@@ -302,12 +302,12 @@ unsigned int AudioDevice::canWrite() const
302} 302}
303 303
304 304
305int AudioDevice::bytesWritten() { 305int AudioDevice::bytesWritten() {
306 int buffered = 0; 306 int buffered = 0;
307 if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) { 307 if ( ioctl( d->handle, SNDCTL_DSP_GETODELAY, &buffered ) ) {
308 qDebug( "failed to get audio device position" ); 308 // qDebug( "failed to get audio device position" );
309 return -1; 309 return -1;
310 } 310 }
311 return buffered; 311 return buffered;
312} 312}
313 313
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index a1973e9..b187cb4 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -73,13 +73,13 @@ static void changeTextColor( QWidget *w ) {
73static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 73static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
74 74
75AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 75AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
76 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) 76 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this )
77{ 77{
78 setCaption( tr("OpiePlayer") ); 78 setCaption( tr("OpiePlayer") );
79 qDebug("<<<<<audioWidget"); 79 // qDebug("<<<<<audioWidget");
80 80
81 Config cfg("OpiePlayer"); 81 Config cfg("OpiePlayer");
82 cfg.setGroup("Options"); 82 cfg.setGroup("Options");
83 skin = cfg.readEntry("Skin","default"); 83 skin = cfg.readEntry("Skin","default");
84 //skin = "scaleTest"; 84 //skin = "scaleTest";
85// color of background, frame, degree of transparency 85// color of background, frame, degree of transparency
@@ -87,13 +87,13 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
87// QString skinPath = "opieplayer/skins/" + skin; 87// QString skinPath = "opieplayer/skins/" + skin;
88 QString skinPath; 88 QString skinPath;
89 skinPath = "opieplayer2/skins/" + skin; 89 skinPath = "opieplayer2/skins/" + skin;
90 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 90 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
91 skinPath = "opieplayer2/skins/default"; 91 skinPath = "opieplayer2/skins/default";
92 92
93 qDebug("skin path " + skinPath); 93 // qDebug("skin path " + skinPath);
94 94
95 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 95 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
96 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 96 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
97 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 97 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
98 98
99 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 99 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
@@ -157,28 +157,29 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
157 // Intialise state 157 // Intialise state
158 setLength( mediaPlayerState->length() ); 158 setLength( mediaPlayerState->length() );
159 setPosition( mediaPlayerState->position() ); 159 setPosition( mediaPlayerState->position() );
160 setLooping( mediaPlayerState->fullscreen() ); 160 setLooping( mediaPlayerState->fullscreen() );
161// setPaused( mediaPlayerState->paused() ); 161// setPaused( mediaPlayerState->paused() );
162 setPlaying( mediaPlayerState->playing() ); 162 setPlaying( mediaPlayerState->playing() );
163 163this->setFocus();
164} 164}
165 165
166 166
167AudioWidget::~AudioWidget() { 167AudioWidget::~AudioWidget() {
168 // setPlaying( false);
168 169
169 for ( int i = 0; i < 10; i++ ) { 170 for ( int i = 0; i < 10; i++ ) {
170 delete buttonPixUp[i]; 171 if(buttonPixUp[i]) delete buttonPixUp[i];
171 delete buttonPixDown[i]; 172 if(buttonPixDown[i]) delete buttonPixDown[i];
172 } 173 }
173 delete pixBg; 174 if(pixBg) delete pixBg;
174 delete imgUp; 175 if(imgUp) delete imgUp;
175 delete imgDn; 176 if(imgDn) delete imgDn;
176 delete imgButtonMask; 177 if(imgButtonMask) delete imgButtonMask;
177 for ( int i = 0; i < 10; i++ ) { 178 for ( int i = 0; i < 10; i++ ) {
178 delete masks[i]; 179 if(masks[i]) delete masks[i];
179 } 180 }
180} 181}
181 182
182 183
183QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 184QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
184 QPixmap pix( img.width(), img.height() ); 185 QPixmap pix( img.width(), img.height() );
@@ -276,23 +277,25 @@ void AudioWidget::setView( char view ) {
276// show(); 277// show();
277 showMaximized(); 278 showMaximized();
278 } else { 279 } else {
279 killTimers(); 280 killTimers();
280 hide(); 281 hide();
281 } 282 }
283
282} 284}
283 285
284 286
285static QString timeAsString( long length ) { 287static QString timeAsString( long length ) {
286 length /= 44100; 288 length /= 44100;
287 int minutes = length / 60; 289 int minutes = length / 60;
288 int seconds = length % 60; 290 int seconds = length % 60;
289 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 291 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
290} 292}
291 293
292void AudioWidget::updateSlider( long i, long max ) { 294void AudioWidget::updateSlider( long i, long max ) {
295this->setFocus();
293 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 296 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
294 297
295 if ( max == 0 ) 298 if ( max == 0 )
296 return; 299 return;
297 // Will flicker too much if we don't do this 300 // Will flicker too much if we don't do this
298 // Scale to something reasonable 301 // Scale to something reasonable
@@ -354,25 +357,25 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
354 int x = event->pos().x() - xoff; 357 int x = event->pos().x() - xoff;
355 int y = event->pos().y() - yoff; 358 int y = event->pos().y() - yoff;
356 359
357 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 360 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
358 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 361 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
359 362
360 if ( isOnButton && i == AudioVolumeUp ) 363// if ( isOnButton && i == AudioVolumeUp )
361 qDebug("on up"); 364// qDebug("on up");
362 365
363 if ( isOnButton && !audioButtons[i].isHeld ) { 366 if ( isOnButton && !audioButtons[i].isHeld ) {
364 audioButtons[i].isHeld = TRUE; 367 audioButtons[i].isHeld = TRUE;
365 toggleButton(i); 368 toggleButton(i);
366 switch (i) { 369 switch (i) {
367 case AudioVolumeUp: 370 case AudioVolumeUp:
368 qDebug("more clicked"); 371 // qDebug("more clicked");
369 emit moreClicked(); 372 emit moreClicked();
370 return; 373 return;
371 case AudioVolumeDown: 374 case AudioVolumeDown:
372 qDebug("less clicked"); 375 // qDebug("less clicked");
373 emit lessClicked(); 376 emit lessClicked();
374 return; 377 return;
375 case AudioForward: 378 case AudioForward:
376 emit forwardClicked(); 379 emit forwardClicked();
377 return; 380 return;
378 case AudioBack: 381 case AudioBack:
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 8cf0a75..82242a3 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -97,30 +97,30 @@ Mutex *audioMutex;
97 97
98 98
99LoopControl::LoopControl( QObject *parent, const char *name ) 99LoopControl::LoopControl( QObject *parent, const char *name )
100 : QObject( parent, name ) { 100 : QObject( parent, name ) {
101 isMuted = FALSE; 101 isMuted = FALSE;
102 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); 102 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) );
103qDebug("starting loopcontrol"); 103 //qDebug("starting loopcontrol");
104 audioMutex = new Mutex; 104 audioMutex = new Mutex;
105 105
106 pthread_attr_init(&audio_attr); 106 pthread_attr_init(&audio_attr);
107#define USE_REALTIME_AUDIO_THREAD 107#define USE_REALTIME_AUDIO_THREAD
108#ifdef USE_REALTIME_AUDIO_THREAD 108#ifdef USE_REALTIME_AUDIO_THREAD
109 // Attempt to set it to real-time round robin 109 // Attempt to set it to real-time round robin
110 if ( pthread_attr_setschedpolicy( &audio_attr, SCHED_RR ) == 0 ) { 110 if ( pthread_attr_setschedpolicy( &audio_attr, SCHED_RR ) == 0 ) {
111 sched_param params; 111 sched_param params;
112 params.sched_priority = 50; 112 params.sched_priority = 50;
113 pthread_attr_setschedparam(&audio_attr,&params); 113 pthread_attr_setschedparam(&audio_attr,&params);
114 } else { 114 } else {
115 qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); 115 // qDebug( "Error setting up a realtime thread, reverting to using a normal thread." );
116 pthread_attr_destroy(&audio_attr); 116 pthread_attr_destroy(&audio_attr);
117 pthread_attr_init(&audio_attr); 117 pthread_attr_init(&audio_attr);
118 } 118 }
119#endif 119#endif
120qDebug("create audio thread"); 120 //qDebug("create audio thread");
121 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); 121 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this);
122} 122}
123 123
124 124
125LoopControl::~LoopControl() { 125LoopControl::~LoopControl() {
126 stop(); 126 stop();
@@ -224,27 +224,27 @@ void LoopControl::startAudio() {
224 if ( moreAudio ) { 224 if ( moreAudio ) {
225 225
226 if ( !isMuted && mediaPlayerState->curDecoder() ) { 226 if ( !isMuted && mediaPlayerState->curDecoder() ) {
227 227
228 currentSample = audioSampleCounter + 1; 228 currentSample = audioSampleCounter + 1;
229 229
230 if ( currentSample != audioSampleCounter + 1 ) 230// if ( currentSample != audioSampleCounter + 1 )
231 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); 231// qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
232 232
233 long samplesRead = 0; 233 long samplesRead = 0;
234 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 234 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
235 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; 235 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
236 long sampleWaitTime = currentSample - sampleWeShouldBeAt; 236 long sampleWaitTime = currentSample - sampleWeShouldBeAt;
237 237
238// this causes drop outs not sure why its even here 238// this causes drop outs not sure why its even here
239 if ( hasVideoChannel ) { 239 if ( hasVideoChannel ) {
240 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { 240 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
241 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 241 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
242 } 242 }
243 else if ( sampleWaitTime <= -5000 ) { 243 else if ( sampleWaitTime <= -5000 ) {
244 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 244 // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
245 // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 245 // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
246 currentSample = sampleWeShouldBeAt; 246 currentSample = sampleWeShouldBeAt;
247 } 247 }
248} 248}
249 249
250 audioDevice->write( audioBuffer, samplesRead * 2 * channels ); 250 audioDevice->write( audioBuffer, samplesRead * 2 * channels );
@@ -358,13 +358,13 @@ bool LoopControl::init( const QString& filename ) {
358 audioMutex->lock(); 358 audioMutex->lock();
359 359
360 fileName = filename; 360 fileName = filename;
361 stream = 0; // only play stream 0 for now 361 stream = 0; // only play stream 0 for now
362 current_frame = total_video_frames = total_audio_samples = 0; 362 current_frame = total_video_frames = total_audio_samples = 0;
363 363
364 qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); 364 // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() );
365 365
366 // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin 366 // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin
367// if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { 367// if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) {
368// if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename )) { 368// if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename )) {
369// total_audio_samples = mediaPlayerState->libMpeg3Decoder()->audioSamples( 0 ); 369// total_audio_samples = mediaPlayerState->libMpeg3Decoder()->audioSamples( 0 );
370// mediaPlayerState->libMpeg3Decoder()->close(); 370// mediaPlayerState->libMpeg3Decoder()->close();
@@ -384,29 +384,29 @@ bool LoopControl::init( const QString& filename ) {
384 384
385 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMpeg3Plugin") ) 385 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMpeg3Plugin") )
386 channels = 2; //dont akx me why, but it needs this hack 386 channels = 2; //dont akx me why, but it needs this hack
387 else 387 else
388 channels = mediaPlayerState->curDecoder()->audioChannels( astream ); 388 channels = mediaPlayerState->curDecoder()->audioChannels( astream );
389 389
390 qDebug( "LC- channels = %d", channels ); 390 // qDebug( "LC- channels = %d", channels );
391 391
392// if ( !total_audio_samples ) 392// if ( !total_audio_samples )
393 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); 393 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
394 394
395 total_audio_samples += 1000; 395 total_audio_samples += 1000;
396 qDebug("total samples %d", total_audio_samples); 396 // qDebug("total samples %d", total_audio_samples);
397 mediaPlayerState->setLength( total_audio_samples ); 397 mediaPlayerState->setLength( total_audio_samples );
398 398
399 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 399 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
400 qDebug( "LC- frequency = %d", freq ); 400 // qDebug( "LC- frequency = %d", freq );
401 401
402 audioSampleCounter = 0; 402 audioSampleCounter = 0;
403 int bits_per_sample; 403 int bits_per_sample;
404 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { 404 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
405 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); 405 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
406 qDebug("using stupid hack"); 406 // qDebug("using stupid hack");
407 } else { 407 } else {
408 bits_per_sample=0; 408 bits_per_sample=0;
409 } 409 }
410 410
411 audioDevice = new AudioDevice( freq, channels, bits_per_sample); 411 audioDevice = new AudioDevice( freq, channels, bits_per_sample);
412 audioBuffer = new char[ audioDevice->bufferSize() ]; 412 audioBuffer = new char[ audioDevice->bufferSize() ];
@@ -448,13 +448,13 @@ bool LoopControl::init( const QString& filename ) {
448 448
449 return TRUE; 449 return TRUE;
450} 450}
451 451
452 452
453void LoopControl::play() { 453void LoopControl::play() {
454 qDebug("LC- play"); 454 // qDebug("LC- play");
455 mediaPlayerState->setPosition( 0); //uglyhack 455 mediaPlayerState->setPosition( 0); //uglyhack
456 456
457#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 457#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
458 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) { 458 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {
459 disabledSuspendScreenSaver = TRUE; 459 disabledSuspendScreenSaver = TRUE;
460 previousSuspendMode = hasVideoChannel; 460 previousSuspendMode = hasVideoChannel;
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
index e99c97b..364e77b 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
@@ -189,13 +189,13 @@ void LoopControl::setPosition( long pos ) {
189 return; 189 return;
190 } 190 }
191 191
192 if ( hasVideoChannel && hasAudioChannel ) { 192 if ( hasVideoChannel && hasAudioChannel ) {
193 videoMutex->lock(); 193 videoMutex->lock();
194 audioMutex->lock(); 194 audioMutex->lock();
195qDebug("setting position"); 195 //qDebug("setting position");
196 playtime.restart(); 196 playtime.restart();
197 playtime = playtime.addMSecs( -pos * 1000 / framerate ); 197 playtime = playtime.addMSecs( -pos * 1000 / framerate );
198 //begin = clock() - (double)pos * CLOCKS_PER_SEC / framerate; 198 //begin = clock() - (double)pos * CLOCKS_PER_SEC / framerate;
199 current_frame = pos + 1; 199 current_frame = pos + 1;
200 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); 200 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
201 prev_frame = current_frame - 1; 201 prev_frame = current_frame - 1;
@@ -305,13 +305,13 @@ void LoopControl::startVideo() {
305 bool check = current_frame && current_frame > prev_frame; 305 bool check = current_frame && current_frame > prev_frame;
306 videoMutex->unlock(); 306 videoMutex->unlock();
307 307
308 if ( check ) { 308 if ( check ) {
309 videoMutex->lock(); 309 videoMutex->lock();
310 if ( current_frame > prev_frame + 1 ) { 310 if ( current_frame > prev_frame + 1 ) {
311 qDebug("skipped a frame"); 311 // qDebug("skipped a frame");
312 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); 312 mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
313 } 313 }
314 prev_frame = current_frame; 314 prev_frame = current_frame;
315 if ( moreVideo = videoUI->playVideo() ) 315 if ( moreVideo = videoUI->playVideo() )
316 emitChangePos = TRUE; 316 emitChangePos = TRUE;
317 videoMutex->unlock(); 317 videoMutex->unlock();
@@ -338,14 +338,14 @@ void LoopControl::startAudio() {
338 audioMutex->lock(); 338 audioMutex->lock();
339 currentSample = mediaPlayerState->curDecoder()->audioGetSample( stream ); 339 currentSample = mediaPlayerState->curDecoder()->audioGetSample( stream );
340 340
341 if ( currentSample == 0 ) 341 if ( currentSample == 0 )
342 currentSample = audioSampleCounter + 1; 342 currentSample = audioSampleCounter + 1;
343 343
344 if ( currentSample != audioSampleCounter + 1 ) 344// if ( currentSample != audioSampleCounter + 1 )
345 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); 345// qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
346 audioMutex->unlock(); 346 audioMutex->unlock();
347 347
348/* 348/*
349 int sampleWeShouldBeAt = int( playtime.elapsed() ) * freq / 1000; 349 int sampleWeShouldBeAt = int( playtime.elapsed() ) * freq / 1000;
350 350
351 if ( sampleWeShouldBeAt - currentSample > 20000 ) { 351 if ( sampleWeShouldBeAt - currentSample > 20000 ) {
@@ -368,13 +368,13 @@ void LoopControl::startAudio() {
368 if ( sampleWaitTime >= 0 && sampleWaitTime <= 2000 ) { 368 if ( sampleWaitTime >= 0 && sampleWaitTime <= 2000 ) {
369 //qDebug("sampleWaitTime: %i", sampleWaitTime); 369 //qDebug("sampleWaitTime: %i", sampleWaitTime);
370 usleep( ( sampleWaitTime * 1000000 ) / ( freq ) ); 370 usleep( ( sampleWaitTime * 1000000 ) / ( freq ) );
371 } else { 371 } else {
372 audioMutex->lock(); 372 audioMutex->lock();
373 if ( sampleWaitTime <= -2000 ) { 373 if ( sampleWaitTime <= -2000 ) {
374 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 374 // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
375 mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 375 mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
376 currentSample = sampleWeShouldBeAt; 376 currentSample = sampleWeShouldBeAt;
377 } 377 }
378 audioMutex->unlock(); 378 audioMutex->unlock();
379 } 379 }
380 380
@@ -399,13 +399,13 @@ void LoopControl::startAudio() {
399 else 399 else
400 moreAudio = FALSE; 400 moreAudio = FALSE;
401 401
402 } 402 }
403 } 403 }
404 404
405 qDebug( "End of file" ); 405 // qDebug( "End of file" );
406 406
407 if ( !moreVideo && !moreAudio ) 407 if ( !moreVideo && !moreAudio )
408 emitPlayFinished = TRUE; 408 emitPlayFinished = TRUE;
409 409
410 pthread_exit(NULL); 410 pthread_exit(NULL);
411} 411}
@@ -413,23 +413,23 @@ void LoopControl::startAudio() {
413void LoopControl::killTimers() { 413void LoopControl::killTimers() {
414 if ( hasVideoChannel ) { 414 if ( hasVideoChannel ) {
415 if ( pthread_self() != video_tid ) { 415 if ( pthread_self() != video_tid ) {
416 if ( pthread_cancel(video_tid) == 0 ) { 416 if ( pthread_cancel(video_tid) == 0 ) {
417 void *thread_result = 0; 417 void *thread_result = 0;
418 if ( pthread_join(video_tid,&thread_result) != 0 ) 418 if ( pthread_join(video_tid,&thread_result) != 0 )
419 qDebug("thread join error 1"); 419 // qDebug("thread join error 1");
420 pthread_attr_destroy(&video_attr); 420 pthread_attr_destroy(&video_attr);
421 } 421 }
422 } 422 }
423 } 423 }
424 if ( hasAudioChannel ) { 424 if ( hasAudioChannel ) {
425 if ( pthread_self() != audio_tid ) { 425 if ( pthread_self() != audio_tid ) {
426 if ( pthread_cancel(audio_tid) == 0 ) { 426 if ( pthread_cancel(audio_tid) == 0 ) {
427 void *thread_result = 0; 427 void *thread_result = 0;
428 if ( pthread_join(audio_tid,&thread_result) != 0 ) 428 if ( pthread_join(audio_tid,&thread_result) != 0 )
429 qDebug("thread join error 2"); 429 // qDebug("thread join error 2");
430 pthread_attr_destroy(&audio_attr); 430 pthread_attr_destroy(&audio_attr);
431 } 431 }
432 } 432 }
433 } 433 }
434} 434}
435 435
@@ -510,13 +510,13 @@ void LoopControl::stop( bool willPlayAgainShortly ) {
510bool LoopControl::init( const QString& filename ) { 510bool LoopControl::init( const QString& filename ) {
511 stop(); 511 stop();
512 fileName = filename; 512 fileName = filename;
513 stream = 0; // only play stream 0 for now 513 stream = 0; // only play stream 0 for now
514 current_frame = total_video_frames = total_audio_samples = 0; 514 current_frame = total_video_frames = total_audio_samples = 0;
515 515
516 qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); 516 // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() );
517 517
518 // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin 518 // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin
519 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { 519 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) {
520 if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename ) ) { 520 if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename ) ) {
521 total_audio_samples = mediaPlayerState->libMpeg3Decoder()->audioSamples( 0 ); 521 total_audio_samples = mediaPlayerState->libMpeg3Decoder()->audioSamples( 0 );
522 mediaPlayerState->libMpeg3Decoder()->close(); 522 mediaPlayerState->libMpeg3Decoder()->close();
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index 4f3823a..753b2e3 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -77,24 +77,24 @@ void MediaPlayer::play() {
77 mediaPlayerState->setPlaying( FALSE ); 77 mediaPlayerState->setPlaying( FALSE );
78 mediaPlayerState->setPlaying( TRUE ); 78 mediaPlayerState->setPlaying( TRUE );
79} 79}
80 80
81 81
82void MediaPlayer::setPlaying( bool play ) { 82void MediaPlayer::setPlaying( bool play ) {
83 qDebug("MediaPlayer setPlaying"); 83 // qDebug("MediaPlayer setPlaying %d", play);
84 if ( !play ) { 84 if ( !play ) {
85 mediaPlayerState->setPaused( FALSE ); 85 mediaPlayerState->setPaused( FALSE );
86 loopControl->stop( FALSE ); 86 loopControl->stop( FALSE );
87 return; 87 return;
88 } 88 }
89 89
90 if ( mediaPlayerState->paused() ) { 90 if ( mediaPlayerState->paused() ) {
91 mediaPlayerState->setPaused( FALSE ); 91 mediaPlayerState->setPaused( FALSE );
92 return; 92 return;
93 } 93 }
94 qDebug("about to ctrash"); 94 // qDebug("about to ctrash");
95 const DocLnk *playListCurrent = playList->current(); 95 const DocLnk *playListCurrent = playList->current();
96 96
97 if ( playListCurrent != NULL ) { 97 if ( playListCurrent != NULL ) {
98 loopControl->stop( TRUE ); 98 loopControl->stop( TRUE );
99 currentFile = playListCurrent; 99 currentFile = playListCurrent;
100 } 100 }
@@ -253,13 +253,13 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
253 break; 253 break;
254 case Key_F10: //contacts 254 case Key_F10: //contacts
255 break; 255 break;
256 case Key_F11: //menu 256 case Key_F11: //menu
257 break; 257 break;
258 case Key_F12: //home 258 case Key_F12: //home
259 qDebug("Blank here"); 259 // qDebug("Blank here");
260 break; 260 break;
261 case Key_F13: //mail 261 case Key_F13: //mail
262 break; 262 break;
263 } 263 }
264} 264}
265 265
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index cf166d6..6823076 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -124,13 +124,13 @@ MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
124// ### hack to get true sample count 124// ### hack to get true sample count
125// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 125// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
126// return libwavdecoder; 126// return libwavdecoder;
127// } 127// }
128 128
129void MediaPlayerState::loadPlugins() { 129void MediaPlayerState::loadPlugins() {
130 qDebug("load plugins"); 130 // qDebug("load plugins");
131#ifndef QT_NO_COMPONENT 131#ifndef QT_NO_COMPONENT
132 QValueList<MediaPlayerPlugin>::Iterator mit; 132 QValueList<MediaPlayerPlugin>::Iterator mit;
133 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 133 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
134 (*mit).iface->release(); 134 (*mit).iface->release();
135 (*mit).library->unload(); 135 (*mit).library->unload();
136 delete (*mit).library; 136 delete (*mit).library;
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 3541e5f..8b92a8c 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -67,13 +67,13 @@ Om3u::~Om3u(){}
67void Om3u::readM3u() { 67void Om3u::readM3u() {
68// qDebug("<<<<<<reading m3u "+f.name()); 68// qDebug("<<<<<<reading m3u "+f.name());
69 QTextStream t(&f); 69 QTextStream t(&f);
70 QString s; 70 QString s;
71 while ( !t.atEnd() ) { 71 while ( !t.atEnd() ) {
72 s=t.readLine(); 72 s=t.readLine();
73 qDebug(s); 73 // qDebug(s);
74 if( s.find( "#", 0, TRUE) == -1 ) { 74 if( s.find( "#", 0, TRUE) == -1 ) {
75 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 75 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
76 s = s.right( s.length() -2 ); 76 s = s.right( s.length() -2 );
77 QFileInfo f( s ); 77 QFileInfo f( s );
78 QString name = fullBaseName ( f ); 78 QString name = fullBaseName ( f );
79 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 79 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
@@ -132,13 +132,13 @@ void Om3u::readPls() { //it's a pls file
132} 132}
133 133
134void Om3u::write() { //writes list to m3u file 134void Om3u::write() { //writes list to m3u file
135 QString list; 135 QString list;
136 if(count()>0) { 136 if(count()>0) {
137 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 137 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
138 qDebug(*it); 138 // qDebug(*it);
139 list += *it+"\n"; 139 list += *it+"\n";
140 } 140 }
141 f.writeBlock( list, list.length() ); 141 f.writeBlock( list, list.length() );
142 } 142 }
143// f.close(); 143// f.close();
144} 144}
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 67187f8..94567f2 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -191,13 +191,13 @@ void PlayListSelection::unSelect()
191 191
192void PlayListSelection::writeCurrent( Config& cfg ) { 192void PlayListSelection::writeCurrent( Config& cfg ) {
193 cfg.setGroup("PlayList"); 193 cfg.setGroup("PlayList");
194 QListViewItem *item = selectedItem(); 194 QListViewItem *item = selectedItem();
195 if ( item ) 195 if ( item )
196 cfg.writeEntry("current", item->text(0) ); 196 cfg.writeEntry("current", item->text(0) );
197 qDebug(item->text(0)); 197 // qDebug(item->text(0));
198 198
199} 199}
200 200
201void PlayListSelection::setSelectedItem(const QString &strk ) { 201void PlayListSelection::setSelectedItem(const QString &strk ) {
202 202
203 unSelect(); 203 unSelect();
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 7ea95ab..1fc7dd8 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -304,19 +304,18 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
304 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 304 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
305 305
306 tabWidget->insertTab( vTab,tr("Video")); 306 tabWidget->insertTab( vTab,tr("Video"));
307 307
308 QWidget *LTab; 308 QWidget *LTab;
309 LTab = new QWidget( tabWidget, "LTab" ); 309 LTab = new QWidget( tabWidget, "LTab" );
310 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 310 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE);
311 311
312 QGridLayout *layoutL = new QGridLayout( LTab ); 312 QGridLayout *layoutL = new QGridLayout( LTab );
313 layoutL->setSpacing( 2); 313 layoutL->setSpacing( 2);
314 layoutL->setMargin( 2); 314 layoutL->setMargin( 2);
315 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 315 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 );
316// playLists->setMinimumSize(233,260);
317 316
318 tabWidget->insertTab(LTab,tr("Lists")); 317 tabWidget->insertTab(LTab,tr("Lists"));
319 318
320 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 319 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
321 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 320 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
322 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 321 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
@@ -355,18 +354,18 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
355 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 354 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
356 355
357 setCentralWidget( vbox5 ); 356 setCentralWidget( vbox5 );
358 357
359 Config cfg( "OpiePlayer" ); 358 Config cfg( "OpiePlayer" );
360 readConfig( cfg ); 359 readConfig( cfg );
361 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 360
362 loadList(DocLnk( currentPlaylist)); 361 currentPlayList = cfg.readEntry("CurrentPlaylist","default");
363 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); 362 loadList(DocLnk( currentPlayList));
363 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList)));
364 364
365 initializeStates(); 365 initializeStates();
366 // audioUI->setFocus();
367} 366}
368 367
369 368
370PlayListWidget::~PlayListWidget() { 369PlayListWidget::~PlayListWidget() {
371 Config cfg( "OpiePlayer" ); 370 Config cfg( "OpiePlayer" );
372 writeConfig( cfg ); 371 writeConfig( cfg );
@@ -418,21 +417,22 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
418 cfg.writeEntry( entryName, lnk->linkFile() ); 417 cfg.writeEntry( entryName, lnk->linkFile() );
419 // if this link does exist, add it so we have the file 418 // if this link does exist, add it so we have the file
420 // next time... 419 // next time...
421 if ( !QFile::exists( lnk->linkFile() ) ) { 420 if ( !QFile::exists( lnk->linkFile() ) ) {
422 // the way writing lnks doesn't really check for out 421 // the way writing lnks doesn't really check for out
423 // of disk space, but check it anyway. 422 // of disk space, but check it anyway.
424 if ( !lnk->writeLink() ) { 423// if ( !lnk->writeLink() ) {
425 QMessageBox::critical( 0, tr("Out of space"), 424// QMessageBox::critical( 0, tr("Out of space"),
426 tr( "There was a problem saving " 425// tr( "There was a problem saving "
427 "the playlist.\n" 426// "the playlist.\n"
428 "Your playlist " 427// "Your playlist "
429 "may be missing some entries\n" 428// "may be missing some entries\n"
430 "the next time you start it." ) 429// "the next time you start it." )
431 ); 430// );
432 } 431// }
432
433 } 433 }
434 noOfFiles++; 434 noOfFiles++;
435 } 435 }
436 } 436 }
437 while ( d->selectedFiles->next() ); 437 while ( d->selectedFiles->next() );
438 cfg.writeEntry("NumberOfFiles", noOfFiles ); 438 cfg.writeEntry("NumberOfFiles", noOfFiles );
@@ -444,18 +444,24 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
444 if ( mediaPlayerState->playlist() ) { 444 if ( mediaPlayerState->playlist() ) {
445 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) 445 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
446 d->selectedFiles->addToSelection( lnk ); 446 d->selectedFiles->addToSelection( lnk );
447 } 447 }
448 else 448 else
449 mediaPlayerState->setPlaying( true); 449 mediaPlayerState->setPlaying( true);
450
450} 451}
451 452
452 453
453void PlayListWidget::clearList() { 454void PlayListWidget::clearList() {
454 while ( first() ) 455 while ( first() )
455 d->selectedFiles->removeSelected(); 456 d->selectedFiles->removeSelected();
457 Config cfg( "OpiePlayer" );
458 cfg.setGroup("PlayList");
459 cfg.writeEntry("CurrentPlaylist","");
460 currentPlayList="";
461
456} 462}
457 463
458 464
459void PlayListWidget::addAllToList() { 465void PlayListWidget::addAllToList() {
460 DocLnkSet filesAll; 466 DocLnkSet filesAll;
461 Global::findDocuments(&filesAll, "video/*;audio/*"); 467 Global::findDocuments(&filesAll, "video/*;audio/*");
@@ -494,63 +500,68 @@ void PlayListWidget::addAllVideoToList() {
494} 500}
495 501
496 502
497void PlayListWidget::setDocument(const QString& fileref) { 503void PlayListWidget::setDocument(const QString& fileref) {
498 fromSetDocument = true; 504 fromSetDocument = true;
499 d->setDocumentUsed = TRUE; 505 d->setDocumentUsed = TRUE;
500 d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true ); 506 setDocumentEx(fileref);
501 mediaPlayerState->setPlaying( FALSE );
502 qApp->processEvents();
503 mediaPlayerState->setPlaying( TRUE );
504} 507}
505 508
506void PlayListWidget::setDocumentEx(const QString& fileref) { 509void PlayListWidget::setDocumentEx(const QString& fileref) {
507 510 qDebug("opieplayer receive "+fileref);
511 clearList();
512 DocLnk lnk;
508 QFileInfo fileInfo(fileref); 513 QFileInfo fileInfo(fileref);
509 if ( !fileInfo.exists() ) { 514 if ( !fileInfo.exists() ) {
510 QMessageBox::critical( 0, tr( "Invalid File" ), 515 QMessageBox::critical( 0, tr( "Invalid File" ),
511 tr( "There was a problem in getting the file." ) ); 516 tr( "There was a problem in getting the file." ) );
512 return; 517 return;
513 } 518 }
514 qDebug("setDocument "+fileref); 519 // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref);
515 QString extension = fileInfo.extension(false); 520 QString extension = fileInfo.extension(false);
516 if( extension.find( "m3u", 0, false) != -1) { //is m3u 521 if( extension.find( "m3u", 0, false) != -1) { //is m3u
517 readm3u( fileref); 522 readm3u( fileref);
518 } 523 }
519 else if( extension.find( "pls", 0, false) != -1 ) { //is pls 524 else if( extension.find( "pls", 0, false) != -1 ) { //is pls
520 readPls( fileref); 525 readPls( fileref);
521 } 526 }
522 else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist 527 else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist
523 clearList(); 528 clearList();
524 DocLnk lnk;
525 lnk.setName( fileInfo.baseName() ); //sets name 529 lnk.setName( fileInfo.baseName() ); //sets name
526 lnk.setFile( fileref ); //sets file name 530 lnk.setFile( fileref ); //sets file name
531 lnk.setIcon("Sound");
527 //addToSelection( lnk ); 532 //addToSelection( lnk );
528 533
529 loadList( lnk); 534 loadList( lnk);
530 d->selectedFiles->first(); 535 d->selectedFiles->first();
531 } else { 536 } else {
532 clearList(); 537 if( fileref.find(".desktop",0,TRUE) != -1) {
533 DocLnk lnk; 538 lnk = DocLnk(fileref);
539 } else {
534 lnk.setName( fileInfo.baseName() ); //sets name 540 lnk.setName( fileInfo.baseName() ); //sets name
535 lnk.setFile( fileref ); //sets file name 541 lnk.setFile( fileref ); //sets file name
542 lnk.setIcon("Sound");
543 }
544
536 addToSelection( lnk ); 545 addToSelection( lnk );
537// addToSelection( DocLnk( fileref ) ); 546// addToSelection( DocLnk( fileref ) );
547 lnk.removeLinkFile();
548 // qApp->processEvents();
549 }
550 setCaption(tr("OpiePlayer"));
538 d->setDocumentUsed = TRUE; 551 d->setDocumentUsed = TRUE;
552 d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true );
539 mediaPlayerState->setPlaying( FALSE ); 553 mediaPlayerState->setPlaying( FALSE );
540 qApp->processEvents(); 554 qApp->processEvents();
541 mediaPlayerState->setPlaying( TRUE ); 555 mediaPlayerState->setPlaying( TRUE );
542 // qApp->processEvents(); 556
543 setCaption(tr("OpiePlayer"));
544 }
545} 557}
546 558
547 559
548void PlayListWidget::setActiveWindow() { 560void PlayListWidget::setActiveWindow() {
549 qDebug("SETTING active window"); 561 // qDebug("SETTING active window");
550
551 // When we get raised we need to ensure that it switches views 562 // When we get raised we need to ensure that it switches views
552 char origView = mediaPlayerState->view(); 563 char origView = mediaPlayerState->view();
553 mediaPlayerState->setView( 'l' ); // invalidate 564 mediaPlayerState->setView( 'l' ); // invalidate
554 mediaPlayerState->setView( origView ); // now switch back 565 mediaPlayerState->setView( origView ); // now switch back
555} 566}
556 567
@@ -558,58 +569,40 @@ void PlayListWidget::setActiveWindow() {
558void PlayListWidget::useSelectedDocument() { 569void PlayListWidget::useSelectedDocument() {
559 d->setDocumentUsed = FALSE; 570 d->setDocumentUsed = FALSE;
560} 571}
561 572
562 573
563const DocLnk *PlayListWidget::current() { // this is fugly 574const DocLnk *PlayListWidget::current() { // this is fugly
564
565// if( fromSetDocument) {
566// qDebug("from setDoc");
567// DocLnkSet files;
568// Global::findDocuments(&files, "video/*;audio/*");
569// QListIterator<DocLnk> dit( files.children() );
570// for ( ; dit.current(); ++dit ) {
571// if(dit.current()->linkFile() == setDocFileRef) {
572// qDebug(setDocFileRef);
573// return dit;
574// }
575// }
576// } else
577
578 qDebug("current");
579
580 switch (tabWidget->currentPageIndex()) { 575 switch (tabWidget->currentPageIndex()) {
581 case 0: //playlist 576 case 0: //playlist
582 { 577 {
583 qDebug("playlist"); 578 // qDebug("playlist");
584 if ( mediaPlayerState->playlist() ) { 579 if ( mediaPlayerState->playlist() ) {
585 return d->selectedFiles->current(); 580 return d->selectedFiles->current();
586 } 581 }
587 else if ( d->setDocumentUsed && d->current ) { 582 else if ( d->setDocumentUsed && d->current ) {
588 return d->current; 583 return d->current;
589 } else { 584 } else {
590 return &(d->files->selectedDocument()); 585 return &(d->files->selectedDocument());
591 } 586 }
592 } 587 }
593 break; 588 break;
594 case 1://audio 589 case 1://audio
595 { 590 {
596 qDebug("audioView"); 591 // qDebug("audioView");
597 QListIterator<DocLnk> dit( files.children() ); 592 QListIterator<DocLnk> dit( files.children() );
598 for ( ; dit.current(); ++dit ) { 593 for ( ; dit.current(); ++dit ) {
599 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { 594 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
600 qDebug("here");
601 insanityBool=TRUE; 595 insanityBool=TRUE;
602 return dit; 596 return dit;
603 } 597 }
604 } 598 }
605 } 599 }
606 break; 600 break;
607 case 2: // video 601 case 2: // video
608 { 602 {
609 qDebug("videoView");
610 QListIterator<DocLnk> Vdit( vFiles.children() ); 603 QListIterator<DocLnk> Vdit( vFiles.children() );
611 for ( ; Vdit.current(); ++Vdit ) { 604 for ( ; Vdit.current(); ++Vdit ) {
612 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { 605 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
613 insanityBool=TRUE; 606 insanityBool=TRUE;
614 return Vdit; 607 return Vdit;
615 } 608 }
@@ -714,13 +707,12 @@ void PlayListWidget::setView( char view ) {
714 showMaximized(); 707 showMaximized();
715 else 708 else
716 hide(); 709 hide();
717} 710}
718 711
719void PlayListWidget::addSelected() { 712void PlayListWidget::addSelected() {
720 qDebug("addSelected");
721 DocLnk lnk; 713 DocLnk lnk;
722 QString filename; 714 QString filename;
723 switch (tabWidget->currentPageIndex()) { 715 switch (tabWidget->currentPageIndex()) {
724 716
725 case 0: //playlist 717 case 0: //playlist
726 return; 718 return;
@@ -764,13 +756,12 @@ void PlayListWidget::removeSelected() {
764 d->selectedFiles->removeSelected( ); 756 d->selectedFiles->removeSelected( );
765} 757}
766 758
767void PlayListWidget::playIt( QListViewItem *) { 759void PlayListWidget::playIt( QListViewItem *) {
768// d->setDocumentUsed = FALSE; 760// d->setDocumentUsed = FALSE;
769// mediaPlayerState->curPosition =0; 761// mediaPlayerState->curPosition =0;
770 qDebug("playIt");
771 // mediaPlayerState->setPlaying(FALSE); 762 // mediaPlayerState->setPlaying(FALSE);
772 mediaPlayerState->setPlaying(TRUE); 763 mediaPlayerState->setPlaying(TRUE);
773 d->selectedFiles->unSelect(); 764 d->selectedFiles->unSelect();
774} 765}
775 766
776void PlayListWidget::addToSelection( QListViewItem *it) { 767void PlayListWidget::addToSelection( QListViewItem *it) {
@@ -838,43 +829,39 @@ void PlayListWidget::tabChanged(QWidget *) {
838 } 829 }
839 break; 830 break;
840 }; 831 };
841} 832}
842 833
843void PlayListWidget::btnPlay(bool b) { 834void PlayListWidget::btnPlay(bool b) {
844 qDebug("<<<<<<<<<<<<<<<BtnPlay %d", b);
845// mediaPlayerState->setPlaying(b); 835// mediaPlayerState->setPlaying(b);
846 switch ( tabWidget->currentPageIndex()) { 836 switch ( tabWidget->currentPageIndex()) {
847 case 0: 837 case 0:
848 { 838 {
849 qDebug("1");
850// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 839// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
851// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { 840// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
852// QMessageBox::message("Note","You are trying to play\na malformed url."); 841// QMessageBox::message("Note","You are trying to play\na malformed url.");
853// } else { 842// } else {
854 mediaPlayerState->setPlaying(b); 843 mediaPlayerState->setPlaying(b);
855 insanityBool=FALSE; 844 insanityBool=FALSE;
856 qDebug("insanity"); 845 qDebug("insanity");
857// } 846// }
858 } 847 }
859 break; 848 break;
860 case 1: 849 case 1:
861 { 850 {
862 qDebug("2");
863// d->selectedFiles->unSelect(); 851// d->selectedFiles->unSelect();
864 addToSelection( audioView->currentItem() ); 852 addToSelection( audioView->currentItem() );
865 mediaPlayerState->setPlaying( b); 853 mediaPlayerState->setPlaying( b);
866 d->selectedFiles->removeSelected( ); 854 d->selectedFiles->removeSelected( );
867 d->selectedFiles->unSelect(); 855 d->selectedFiles->unSelect();
868 tabWidget->setCurrentPage(1); 856 tabWidget->setCurrentPage(1);
869 insanityBool=FALSE; 857 insanityBool=FALSE;
870 }// audioView->clearSelection(); 858 }// audioView->clearSelection();
871 break; 859 break;
872 case 2: 860 case 2:
873 { 861 {
874 qDebug("3");
875 862
876 addToSelection( videoView->currentItem() ); 863 addToSelection( videoView->currentItem() );
877 mediaPlayerState->setPlaying( b); 864 mediaPlayerState->setPlaying( b);
878// qApp->processEvents(); 865// qApp->processEvents();
879 d->selectedFiles->removeSelected( ); 866 d->selectedFiles->removeSelected( );
880 d->selectedFiles->unSelect(); 867 d->selectedFiles->unSelect();
@@ -919,13 +906,12 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int
919 break; 906 break;
920 }; 907 };
921} 908}
922 909
923void PlayListWidget::playSelected() 910void PlayListWidget::playSelected()
924{ 911{
925 qDebug("playSelected");
926 btnPlay( true); 912 btnPlay( true);
927// d->selectedFiles->unSelect(); 913// d->selectedFiles->unSelect();
928} 914}
929 915
930void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) 916void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int)
931{ 917{
@@ -946,13 +932,13 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
946 932
947} 933}
948 934
949void PlayListWidget::listDelete() { 935void PlayListWidget::listDelete() {
950 Config cfg( "OpiePlayer" ); 936 Config cfg( "OpiePlayer" );
951 cfg.setGroup("PlayList"); 937 cfg.setGroup("PlayList");
952 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 938 currentPlayList = cfg.readEntry("CurrentPlaylist","");
953 QString file; 939 QString file;
954// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 940// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
955 switch ( tabWidget->currentPageIndex()) { 941 switch ( tabWidget->currentPageIndex()) {
956 case 0: 942 case 0:
957 break; 943 break;
958 case 1: 944 case 1:
@@ -1070,45 +1056,34 @@ void PlayListWidget::populateVideoView() {
1070 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); 1056 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" ));
1071 } 1057 }
1072 } 1058 }
1073} 1059}
1074 1060
1075void PlayListWidget::openFile() { 1061void PlayListWidget::openFile() {
1076 qDebug("<<<<<<<<<OPEN File");
1077 QString filename, name; 1062 QString filename, name;
1078 InputDialog *fileDlg; 1063 InputDialog *fileDlg;
1079 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 1064 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
1080 fileDlg->exec(); 1065 fileDlg->exec();
1081 if( fileDlg->result() == 1 ) { 1066 if( fileDlg->result() == 1 ) {
1082 filename = fileDlg->text(); 1067 filename = fileDlg->text();
1083 qDebug( "Selected filename is " + filename ); 1068 // qDebug( "Selected filename is " + filename );
1084// Om3u *m3uList;
1085 DocLnk lnk; 1069 DocLnk lnk;
1086 Config cfg( "OpiePlayer" ); 1070 Config cfg( "OpiePlayer" );
1087 cfg.setGroup("PlayList"); 1071 cfg.setGroup("PlayList");
1088 1072
1089 QString m3uFile; 1073 QString m3uFile;
1090 m3uFile = filename; 1074 m3uFile = filename;
1091 if(filename.left(4) == "http") { 1075 if(filename.left(4) == "http") {
1092 if(filename.find(":",8,TRUE) != -1) { //found a port 1076 if(filename.find(":",8,TRUE) != -1) { //found a port
1093 1077
1094// m3uFile = filename.left( filename.find( ":",8,TRUE));
1095 m3uFile = filename; 1078 m3uFile = filename;
1096 if( m3uFile.right( 1 ).find( '/' ) == -1) { 1079 if( m3uFile.right( 1 ).find( '/' ) == -1) {
1097 m3uFile += "/"; 1080 m3uFile += "/";
1098 } 1081 }
1099 filename = m3uFile; 1082 filename = m3uFile;
1100// qDebug("1 "+m3uFile); 1083 = }
1101// } else if(filename.left(4) == "http"){
1102// m3uFile=filename;
1103// m3uFile = m3uFile.right( m3uFile.length() - 7);
1104// qDebug("2 "+m3uFile);
1105// } else{
1106// m3uFile=filename;
1107// qDebug("3 "+m3uFile);
1108 }
1109 lnk.setName( m3uFile ); //sets name 1084 lnk.setName( m3uFile ); //sets name
1110 lnk.setFile( filename ); //sets file name 1085 lnk.setFile( filename ); //sets file name
1111 lnk.setIcon("opieplayer2/musicfile"); 1086 lnk.setIcon("opieplayer2/musicfile");
1112 d->selectedFiles->addToSelection( lnk ); 1087 d->selectedFiles->addToSelection( lnk );
1113 writeCurrentM3u(); 1088 writeCurrentM3u();
1114 } 1089 }
@@ -1118,12 +1093,13 @@ void PlayListWidget::openFile() {
1118 } else if( filename.right(3) == "pls" ) { 1093 } else if( filename.right(3) == "pls" ) {
1119 readPls( filename ); 1094 readPls( filename );
1120 } else { 1095 } else {
1121 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name 1096 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
1122 lnk.setFile( filename ); //sets file name 1097 lnk.setFile( filename ); //sets file name
1123 d->selectedFiles->addToSelection( lnk); 1098 d->selectedFiles->addToSelection( lnk);
1099 lnk.removeLinkFile();
1124 writeCurrentM3u(); 1100 writeCurrentM3u();
1125 } 1101 }
1126 } 1102 }
1127 1103
1128 if( fileDlg ) { 1104 if( fileDlg ) {
1129 delete fileDlg; 1105 delete fileDlg;
@@ -1131,13 +1107,13 @@ void PlayListWidget::openFile() {
1131} 1107}
1132 1108
1133 1109
1134/* 1110/*
1135reads m3u and shows files/urls to playlist widget */ 1111reads m3u and shows files/urls to playlist widget */
1136void PlayListWidget::readm3u( const QString &filename ) { 1112void PlayListWidget::readm3u( const QString &filename ) {
1137 qDebug( "read m3u filename " + filename ); 1113 // qDebug( "read m3u filename " + filename );
1138 1114
1139 Om3u *m3uList; 1115 Om3u *m3uList;
1140 QString s, name; 1116 QString s, name;
1141 m3uList = new Om3u( filename, IO_ReadOnly ); 1117 m3uList = new Om3u( filename, IO_ReadOnly );
1142 m3uList->readM3u(); 1118 m3uList->readM3u();
1143 DocLnk lnk; 1119 DocLnk lnk;
@@ -1188,13 +1164,13 @@ void PlayListWidget::readm3u( const QString &filename ) {
1188} 1164}
1189 1165
1190/* 1166/*
1191reads pls and adds files/urls to playlist */ 1167reads pls and adds files/urls to playlist */
1192void PlayListWidget::readPls( const QString &filename ) { 1168void PlayListWidget::readPls( const QString &filename ) {
1193 1169
1194 qDebug( "pls filename is " + filename ); 1170 // qDebug( "pls filename is " + filename );
1195 Om3u *m3uList; 1171 Om3u *m3uList;
1196 QString s, name; 1172 QString s, name;
1197 m3uList = new Om3u( filename, IO_ReadOnly ); 1173 m3uList = new Om3u( filename, IO_ReadOnly );
1198 m3uList->readPls(); 1174 m3uList->readPls();
1199 1175
1200 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 1176 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
@@ -1231,26 +1207,26 @@ void PlayListWidget::readPls( const QString &filename ) {
1231 if(m3uList) delete m3uList; 1207 if(m3uList) delete m3uList;
1232} 1208}
1233 1209
1234/* 1210/*
1235 writes current playlist to current m3u file */ 1211 writes current playlist to current m3u file */
1236void PlayListWidget::writeCurrentM3u() { 1212void PlayListWidget::writeCurrentM3u() {
1237 qDebug("writing to current m3u"); 1213 // qDebug("writing to current m3u");
1238 Config cfg( "OpiePlayer" ); 1214 Config cfg( "OpiePlayer" );
1239 cfg.setGroup("PlayList"); 1215 cfg.setGroup("PlayList");
1240 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 1216 currentPlayList = cfg.readEntry("CurrentPlaylist","");
1241 Om3u *m3uList; 1217 Om3u *m3uList;
1242 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 1218 m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate );
1243 1219
1244 if( d->selectedFiles->first()) { 1220 if( d->selectedFiles->first()) {
1245 do { 1221 do {
1246 qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); 1222 // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file());
1247 m3uList->add( d->selectedFiles->current()->file() ); 1223 m3uList->add( d->selectedFiles->current()->file() );
1248 } 1224 }
1249 while ( d->selectedFiles->next() ); 1225 while ( d->selectedFiles->next() );
1250 qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 1226 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
1251 m3uList->write(); 1227 m3uList->write();
1252 m3uList->close(); 1228 m3uList->close();
1253 1229
1254 if(m3uList) delete m3uList; 1230 if(m3uList) delete m3uList;
1255 } 1231 }
1256} 1232}
@@ -1301,13 +1277,13 @@ void PlayListWidget::writem3u() {
1301 config.setGroup( "PlayList" ); 1277 config.setGroup( "PlayList" );
1302 1278
1303 config.writeEntry("CurrentPlaylist",filename); 1279 config.writeEntry("CurrentPlaylist",filename);
1304 currentPlayList=filename; 1280 currentPlayList=filename;
1305 1281
1306 if(!lnk.writeLink()) { 1282 if(!lnk.writeLink()) {
1307 qDebug("Writing doclink did not work"); 1283 // qDebug("Writing doclink did not work");
1308 } 1284 }
1309 1285
1310 setCaption(tr("OpiePlayer: ") + name); 1286 setCaption(tr("OpiePlayer: ") + name);
1311 } 1287 }
1312 } 1288 }
1313} 1289}
@@ -1331,24 +1307,22 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1331// doBlank(); 1307// doBlank();
1332 break; 1308 break;
1333 case Key_F13: //mail 1309 case Key_F13: //mail
1334// doUnblank(); 1310// doUnblank();
1335 break; 1311 break;
1336 case Key_Q: //add to playlist 1312 case Key_Q: //add to playlist
1337 qDebug("Add");
1338 addSelected(); 1313 addSelected();
1339 break; 1314 break;
1340 case Key_R: //remove from playlist 1315 case Key_R: //remove from playlist
1341 removeSelected(); 1316 removeSelected();
1342 break; 1317 break;
1343// case Key_P: //play 1318// case Key_P: //play
1344// qDebug("Play"); 1319// qDebug("Play");
1345// playSelected(); 1320// playSelected();
1346// break; 1321// break;
1347 case Key_Space: 1322 case Key_Space:
1348 qDebug("Play");
1349// playSelected(); puh 1323// playSelected(); puh
1350 break; 1324 break;
1351 case Key_1: 1325 case Key_1:
1352 tabWidget->setCurrentPage(0); 1326 tabWidget->setCurrentPage(0);
1353 break; 1327 break;
1354 case Key_2: 1328 case Key_2:
@@ -1395,25 +1369,25 @@ void PlayListWidget::keyPressEvent( QKeyEvent *)
1395// playSelected(); 1369// playSelected();
1396// break; 1370// break;
1397// } 1371// }
1398} 1372}
1399 1373
1400void PlayListWidget::doBlank() { 1374void PlayListWidget::doBlank() {
1401 qDebug("do blanking"); 1375 // qDebug("do blanking");
1402 fd=open("/dev/fb0",O_RDWR); 1376 fd=open("/dev/fb0",O_RDWR);
1403 if (fd != -1) { 1377 if (fd != -1) {
1404 ioctl(fd,FBIOBLANK,1); 1378 ioctl(fd,FBIOBLANK,1);
1405// close(fd); 1379// close(fd);
1406 } 1380 }
1407} 1381}
1408 1382
1409void PlayListWidget::doUnblank() { 1383void PlayListWidget::doUnblank() {
1410 // this crashes opieplayer with a segfault 1384 // this crashes opieplayer with a segfault
1411// int fd; 1385// int fd;
1412// fd=open("/dev/fb0",O_RDWR); 1386// fd=open("/dev/fb0",O_RDWR);
1413 qDebug("do unblanking"); 1387 // qDebug("do unblanking");
1414 if (fd != -1) { 1388 if (fd != -1) {
1415 ioctl(fd,FBIOBLANK,0); 1389 ioctl(fd,FBIOBLANK,0);
1416 close(fd); 1390 close(fd);
1417 } 1391 }
1418 QCopEnvelope h("QPE/System", "setBacklight(int)"); 1392 QCopEnvelope h("QPE/System", "setBacklight(int)");
1419 h <<-3;// v[1]; // -3 Force on 1393 h <<-3;// v[1]; // -3 Force on
@@ -1458,13 +1432,13 @@ void PlayListWidget::skinsMenuActivated( int item ) {
1458 Config cfg( "OpiePlayer" ); 1432 Config cfg( "OpiePlayer" );
1459 cfg.setGroup("Options"); 1433 cfg.setGroup("Options");
1460 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1434 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1461} 1435}
1462 1436
1463void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1437void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1464 qDebug("qcop message "+msg ); 1438 // qDebug("qcop message "+msg );
1465 QDataStream stream ( data, IO_ReadOnly ); 1439 QDataStream stream ( data, IO_ReadOnly );
1466 if ( msg == "play()" ) { //plays current selection 1440 if ( msg == "play()" ) { //plays current selection
1467 btnPlay( true); 1441 btnPlay( true);
1468 } else if ( msg == "stop()" ) { 1442 } else if ( msg == "stop()" ) {
1469 mediaPlayerState->setPlaying( false); 1443 mediaPlayerState->setPlaying( false);
1470 } else if ( msg == "togglePause()" ) { 1444 } else if ( msg == "togglePause()" ) {
@@ -1495,12 +1469,10 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1495 lnk.setName( fileInfo.baseName() ); //sets name 1469 lnk.setName( fileInfo.baseName() ); //sets name
1496 lnk.setFile( file ); //sets file name 1470 lnk.setFile( file ); //sets file name
1497 addToSelection( lnk ); 1471 addToSelection( lnk );
1498 } else if ( msg == "rem(QString)" ) { //remove from playlist 1472 } else if ( msg == "rem(QString)" ) { //remove from playlist
1499 QString file; 1473 QString file;
1500 stream >> file; 1474 stream >> file;
1501
1502 } else if ( msg == "setDocument(QString)" ) { //loop or not loop 1475 } else if ( msg == "setDocument(QString)" ) { //loop or not loop
1503 QCopEnvelope h("QPE/Application/opieplayer", "raise()"); 1476 QCopEnvelope h("QPE/Application/opieplayer", "raise()");
1504 } 1477 }
1505
1506} 1478}
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 48104ca..02c8568 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -83,13 +83,13 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
83 83
84 QString skinPath; 84 QString skinPath;
85 skinPath = "opieplayer2/skins/" + skin; 85 skinPath = "opieplayer2/skins/" + skin;
86 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 86 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
87 skinPath = "opieplayer2/skins/default"; 87 skinPath = "opieplayer2/skins/default";
88 88
89 qDebug("skin path " + skinPath); 89 // qDebug("skin path " + skinPath);
90 90
91// QString skinPath = "opieplayer2/skins/" + skin; 91// QString skinPath = "opieplayer2/skins/" + skin;
92 92
93 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 93 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
94 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 94 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
95 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 95 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
@@ -98,13 +98,13 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
98 imgButtonMask->fill( 0 ); 98 imgButtonMask->fill( 0 );
99 99
100 for ( int i = 0; i < 7; i++ ) 100 for ( int i = 0; i < 7; i++ )
101 { 101 {
102 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + 102 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath +
103 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 103 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
104 qDebug("loading "+filename); 104 // qDebug("loading "+filename);
105 masks[i] = new QBitmap( filename ); 105 masks[i] = new QBitmap( filename );
106 106
107 if ( !masks[i]->isNull() ) 107 if ( !masks[i]->isNull() )
108 { 108 {
109 QImage imgMask = masks[i]->convertToImage(); 109 QImage imgMask = masks[i]->convertToImage();
110 uchar **dest = imgButtonMask->jumpTable(); 110 uchar **dest = imgButtonMask->jumpTable();
@@ -116,13 +116,13 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
116 if ( !qRed( imgMask.pixel( x, y ) ) ) 116 if ( !qRed( imgMask.pixel( x, y ) ) )
117 line[x] = i + 1; 117 line[x] = i + 1;
118 } 118 }
119 } 119 }
120 } 120 }
121 } 121 }
122 qDebug("finished loading first pics"); 122 // qDebug("finished loading first pics");
123 for ( int i = 0; i < 7; i++ ) 123 for ( int i = 0; i < 7; i++ )
124 { 124 {
125 buttonPixUp[i] = NULL; 125 buttonPixUp[i] = NULL;
126 buttonPixDown[i] = NULL; 126 buttonPixDown[i] = NULL;
127 } 127 }
128 128
@@ -348,35 +348,35 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
348 setToggleButton( i, FALSE ); 348 setToggleButton( i, FALSE );
349 } 349 }
350 350
351 switch(i) { 351 switch(i) {
352 352
353 case VideoPlay: { 353 case VideoPlay: {
354 qDebug("play"); 354 // qDebug("play");
355 if( !mediaPlayerState->playing()) { 355 if( !mediaPlayerState->playing()) {
356 mediaPlayerState->setPlaying( true); 356 mediaPlayerState->setPlaying( true);
357 setToggleButton( i-1, false ); 357 setToggleButton( i-1, false );
358 setToggleButton( i, false ); 358 setToggleButton( i, false );
359 return; 359 return;
360 } 360 }
361 if( mediaPlayerState->isPaused ) { 361 if( mediaPlayerState->isPaused ) {
362 qDebug("isPaused"); 362 // qDebug("isPaused");
363 setToggleButton( i, FALSE ); 363 setToggleButton( i, FALSE );
364 mediaPlayerState->setPaused( FALSE ); 364 mediaPlayerState->setPaused( FALSE );
365 return; 365 return;
366 } else if( !mediaPlayerState->isPaused ) { 366 } else if( !mediaPlayerState->isPaused ) {
367 qDebug("is not paused"); 367 // qDebug("is not paused");
368 setToggleButton( i, TRUE ); 368 setToggleButton( i, TRUE );
369 mediaPlayerState->setPaused( TRUE ); 369 mediaPlayerState->setPaused( TRUE );
370 return; 370 return;
371 } else { 371 } else {
372 return; 372 return;
373 } 373 }
374 } 374 }
375 375
376 case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; 376 case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return;
377 case VideoNext: mediaPlayerState->setNext(); return; 377 case VideoNext: mediaPlayerState->setNext(); return;
378 case VideoPrevious: mediaPlayerState->setPrev(); return; 378 case VideoPrevious: mediaPlayerState->setPrev(); return;
379 case VideoVolUp: emit moreReleased(); return; 379 case VideoVolUp: emit moreReleased(); return;
380 case VideoVolDown: emit lessReleased(); return; 380 case VideoVolDown: emit lessReleased(); return;
381 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 381 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
382 } 382 }