summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-14 04:00:08 (UTC)
committer llornkcor <llornkcor>2002-11-14 04:00:08 (UTC)
commitabf6aa1c155e3d5df3092f4261edb7143656de7e (patch) (unidiff)
tree1637f4e330b28334e415f7984444cf391b4b12f5
parent8b1dd63f359c491bdcadb7e2ce39410a1d92a926 (diff)
downloadopie-abf6aa1c155e3d5df3092f4261edb7143656de7e.zip
opie-abf6aa1c155e3d5df3092f4261edb7143656de7e.tar.gz
opie-abf6aa1c155e3d5df3092f4261edb7143656de7e.tar.bz2
clear selection after adding to playlist
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index ccf654f..1138dc2 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -173,785 +173,786 @@ PlayListWidget::~PlayListWidget() {
173 } 173 }
174 delete d; 174 delete d;
175} 175}
176 176
177 177
178void PlayListWidget::initializeStates() { 178void PlayListWidget::initializeStates() {
179 d->tbPlay->setOn( mediaPlayerState->playing() ); 179 d->tbPlay->setOn( mediaPlayerState->playing() );
180 d->tbLoop->setOn( mediaPlayerState->looping() ); 180 d->tbLoop->setOn( mediaPlayerState->looping() );
181 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 181 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
182 setPlaylist( true ); 182 setPlaylist( true );
183} 183}
184 184
185void PlayListWidget::writeDefaultPlaylist() { 185void PlayListWidget::writeDefaultPlaylist() {
186 186
187 Config config( "OpiePlayer" ); 187 Config config( "OpiePlayer" );
188 config.setGroup( "PlayList" ); 188 config.setGroup( "PlayList" );
189 QString filename=QPEApplication::documentDir() + "/default.m3u"; 189 QString filename=QPEApplication::documentDir() + "/default.m3u";
190 QString currentString = config.readEntry( "CurrentPlaylist", filename); 190 QString currentString = config.readEntry( "CurrentPlaylist", filename);
191 if( currentString == filename) { 191 if( currentString == filename) {
192 Om3u *m3uList; 192 Om3u *m3uList;
193 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 193 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
194 if( d->selectedFiles->first() ) { 194 if( d->selectedFiles->first() ) {
195 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 195 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
196 do { 196 do {
197 // qDebug(d->selectedFiles->current()->file()); 197 // qDebug(d->selectedFiles->current()->file());
198 m3uList->add( d->selectedFiles->current()->file() ); 198 m3uList->add( d->selectedFiles->current()->file() );
199 } 199 }
200 while ( d->selectedFiles->next() ); 200 while ( d->selectedFiles->next() );
201 201
202 m3uList->write(); 202 m3uList->write();
203 m3uList->close(); 203 m3uList->close();
204 if(m3uList) delete m3uList; 204 if(m3uList) delete m3uList;
205 205
206 } 206 }
207 } 207 }
208} 208}
209 209
210void PlayListWidget::addToSelection( const DocLnk& lnk ) { 210void PlayListWidget::addToSelection( const DocLnk& lnk ) {
211 d->setDocumentUsed = FALSE; 211 d->setDocumentUsed = FALSE;
212 if ( mediaPlayerState->playlist() ) { 212 if ( mediaPlayerState->playlist() ) {
213 if( QFileInfo( lnk.file() ).exists() || 213 if( QFileInfo( lnk.file() ).exists() ||
214 lnk.file().left(4) == "http" ) { 214 lnk.file().left(4) == "http" ) {
215 d->selectedFiles->addToSelection( lnk ); 215 d->selectedFiles->addToSelection( lnk );
216 } 216 }
217// writeCurrentM3u(); 217// writeCurrentM3u();
218 } 218 }
219 else 219 else
220 mediaPlayerState->setPlaying( TRUE ); 220 mediaPlayerState->setPlaying( TRUE );
221} 221}
222 222
223 223
224void PlayListWidget::clearList() { 224void PlayListWidget::clearList() {
225 while ( first() ) { 225 while ( first() ) {
226 d->selectedFiles->removeSelected(); 226 d->selectedFiles->removeSelected();
227 } 227 }
228} 228}
229 229
230void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 230void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
231 switch (mouse) { 231 switch (mouse) {
232 case 1: 232 case 1:
233 break; 233 break;
234 case 2: 234 case 2:
235 { 235 {
236 QPopupMenu m; 236 QPopupMenu m;
237 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 237 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
238 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 238 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
239 m.exec( QCursor::pos() ); 239 m.exec( QCursor::pos() );
240 } 240 }
241 break; 241 break;
242 } 242 }
243} 243}
244 244
245 245
246void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 246void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
247 switch (mouse) { 247 switch (mouse) {
248 case 1: 248 case 1:
249 break; 249 break;
250 case 2: 250 case 2:
251 { 251 {
252 QPopupMenu m; 252 QPopupMenu m;
253 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 253 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
254 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 254 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
255 m.exec( QCursor::pos() ); 255 m.exec( QCursor::pos() );
256 } 256 }
257 break; 257 break;
258 } 258 }
259} 259}
260 260
261 261
262void PlayListWidget::addAllToList() { 262void PlayListWidget::addAllToList() {
263 263
264// QTime t; 264// QTime t;
265// t.start(); 265// t.start();
266 266
267 if(!audioScan) { 267 if(!audioScan) {
268 if(audioView->childCount() < 1) 268 if(audioView->childCount() < 1)
269 populateAudioView(); 269 populateAudioView();
270 } 270 }
271 271
272 QListViewItemIterator audioIt( audioView ); 272 QListViewItemIterator audioIt( audioView );
273 DocLnk lnk; 273 DocLnk lnk;
274 QString filename; 274 QString filename;
275 // iterate through all items of the listview 275 // iterate through all items of the listview
276 for ( ; audioIt.current(); ++audioIt ) { 276 for ( ; audioIt.current(); ++audioIt ) {
277 filename = audioIt.current()->text(3); 277 filename = audioIt.current()->text(3);
278 lnk.setName( QFileInfo(filename).baseName() ); //sets name 278 lnk.setName( QFileInfo(filename).baseName() ); //sets name
279 lnk.setFile( filename ); //sets file name 279 lnk.setFile( filename ); //sets file name
280 d->selectedFiles->addToSelection( lnk); 280 d->selectedFiles->addToSelection( lnk);
281 } 281 }
282 282
283 if(!videoScan) { 283 if(!videoScan) {
284 if(videoView->childCount() < 1) 284 if(videoView->childCount() < 1)
285 populateVideoView(); 285 populateVideoView();
286 } 286 }
287 287
288 QListViewItemIterator videoIt( videoView ); 288 QListViewItemIterator videoIt( videoView );
289 for ( ; videoIt.current(); ++videoIt ) { 289 for ( ; videoIt.current(); ++videoIt ) {
290 filename = videoIt.current()->text(3); 290 filename = videoIt.current()->text(3);
291 lnk.setName( QFileInfo(filename).baseName() ); //sets name 291 lnk.setName( QFileInfo(filename).baseName() ); //sets name
292 lnk.setFile( filename ); //sets file name 292 lnk.setFile( filename ); //sets file name
293 d->selectedFiles->addToSelection( lnk); 293 d->selectedFiles->addToSelection( lnk);
294 } 294 }
295 295
296 // d->selectedFiles->addToSelection( ); 296 // d->selectedFiles->addToSelection( );
297 // if ( it.current()->isSelected() ) 297 // if ( it.current()->isSelected() )
298 // lst->append( audioIt.current() ); 298 // lst->append( audioIt.current() );
299 // } 299 // }
300 300
301 /* 301 /*
302 if(!audioScan) 302 if(!audioScan)
303 scanForAudio(); 303 scanForAudio();
304 if(!videoScan) 304 if(!videoScan)
305 scanForVideo(); 305 scanForVideo();
306 306
307 DocLnkSet filesAll; 307 DocLnkSet filesAll;
308 Global::findDocuments(&filesAll, "video/*;"+audioMimes); 308 Global::findDocuments(&filesAll, "video/*;"+audioMimes);
309 QListIterator<DocLnk> Adit( filesAll.children() ); 309 QListIterator<DocLnk> Adit( filesAll.children() );
310 for ( ; Adit.current(); ++Adit ) { 310 for ( ; Adit.current(); ++Adit ) {
311 if( QFileInfo( Adit.current()->file() ).exists() ) { 311 if( QFileInfo( Adit.current()->file() ).exists() ) {
312 d->selectedFiles->addToSelection( **Adit ); 312 d->selectedFiles->addToSelection( **Adit );
313 } 313 }
314 } 314 }
315*/ 315*/
316 // qDebug("elapsed time %d", t.elapsed() ); 316 // qDebug("elapsed time %d", t.elapsed() );
317 317
318 tabWidget->setCurrentPage(0); 318 tabWidget->setCurrentPage(0);
319 319
320 writeCurrentM3u(); 320 writeCurrentM3u();
321 d->selectedFiles->first(); 321 d->selectedFiles->first();
322} 322}
323 323
324 324
325void PlayListWidget::addAllMusicToList() { 325void PlayListWidget::addAllMusicToList() {
326 326
327 if(!audioScan) { 327 if(!audioScan) {
328 if(audioView->childCount() < 1) 328 if(audioView->childCount() < 1)
329 populateAudioView(); 329 populateAudioView();
330 } 330 }
331 331
332 QListViewItemIterator audioIt( audioView ); 332 QListViewItemIterator audioIt( audioView );
333 DocLnk lnk; 333 DocLnk lnk;
334 QString filename; 334 QString filename;
335 // iterate through all items of the listview 335 // iterate through all items of the listview
336 for ( ; audioIt.current(); ++audioIt ) { 336 for ( ; audioIt.current(); ++audioIt ) {
337 filename = audioIt.current()->text(3); 337 filename = audioIt.current()->text(3);
338 lnk.setName( QFileInfo(filename).baseName() ); //sets name 338 lnk.setName( QFileInfo(filename).baseName() ); //sets name
339 lnk.setFile( filename ); //sets file name 339 lnk.setFile( filename ); //sets file name
340 d->selectedFiles->addToSelection( lnk); 340 d->selectedFiles->addToSelection( lnk);
341 } 341 }
342 342
343 /* if(!audioScan) 343 /* if(!audioScan)
344 scanForAudio(); 344 scanForAudio();
345 QListIterator<DocLnk> dit( files.children() ); 345 QListIterator<DocLnk> dit( files.children() );
346 for ( ; dit.current(); ++dit ) { 346 for ( ; dit.current(); ++dit ) {
347 if( QFileInfo(dit.current()->file() ).exists() ) { 347 if( QFileInfo(dit.current()->file() ).exists() ) {
348 d->selectedFiles->addToSelection( **dit ); 348 d->selectedFiles->addToSelection( **dit );
349 } 349 }
350 } 350 }
351 */ 351 */
352 tabWidget->setCurrentPage(0); 352 tabWidget->setCurrentPage(0);
353 writeCurrentM3u(); 353 writeCurrentM3u();
354 d->selectedFiles->first(); 354 d->selectedFiles->first();
355} 355}
356 356
357 357
358void PlayListWidget::addAllVideoToList() { 358void PlayListWidget::addAllVideoToList() {
359 359
360 if(!videoScan) { 360 if(!videoScan) {
361 if(videoView->childCount() < 1) 361 if(videoView->childCount() < 1)
362 populateVideoView(); 362 populateVideoView();
363 } 363 }
364 364
365 QListViewItemIterator videoIt( videoView ); 365 QListViewItemIterator videoIt( videoView );
366 DocLnk lnk; 366 DocLnk lnk;
367 QString filename; 367 QString filename;
368 for ( ; videoIt.current(); ++videoIt ) { 368 for ( ; videoIt.current(); ++videoIt ) {
369 filename = videoIt.current()->text(3); 369 filename = videoIt.current()->text(3);
370 lnk.setName( QFileInfo(filename).baseName() ); //sets name 370 lnk.setName( QFileInfo(filename).baseName() ); //sets name
371 lnk.setFile( filename ); //sets file name 371 lnk.setFile( filename ); //sets file name
372 d->selectedFiles->addToSelection( lnk); 372 d->selectedFiles->addToSelection( lnk);
373 } 373 }
374 374
375 375
376 /* if(!videoScan) 376 /* if(!videoScan)
377 scanForVideo(); 377 scanForVideo();
378 QListIterator<DocLnk> dit( vFiles.children() ); 378 QListIterator<DocLnk> dit( vFiles.children() );
379 for ( ; dit.current(); ++dit ) { 379 for ( ; dit.current(); ++dit ) {
380 if( QFileInfo( dit.current()->file() ).exists() ) { 380 if( QFileInfo( dit.current()->file() ).exists() ) {
381 d->selectedFiles->addToSelection( **dit ); 381 d->selectedFiles->addToSelection( **dit );
382 } 382 }
383 } 383 }
384*/ 384*/
385 tabWidget->setCurrentPage(0); 385 tabWidget->setCurrentPage(0);
386 writeCurrentM3u(); 386 writeCurrentM3u();
387 d->selectedFiles->first(); 387 d->selectedFiles->first();
388} 388}
389 389
390 390
391void PlayListWidget::setDocument( const QString& fileref ) { 391void PlayListWidget::setDocument( const QString& fileref ) {
392 qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 392 qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
393 fromSetDocument = TRUE; 393 fromSetDocument = TRUE;
394 if ( fileref.isNull() ) { 394 if ( fileref.isNull() ) {
395 QMessageBox::warning( this, tr( "Invalid File" ), 395 QMessageBox::warning( this, tr( "Invalid File" ),
396 tr( "There was a problem in getting the file." ) ); 396 tr( "There was a problem in getting the file." ) );
397 return; 397 return;
398 } 398 }
399 399
400 clearList(); 400 clearList();
401 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 401 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
402 readm3u( fileref ); 402 readm3u( fileref );
403 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 403 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
404 readm3u( DocLnk( fileref).file() ); 404 readm3u( DocLnk( fileref).file() );
405 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 405 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
406 readPls( fileref ); 406 readPls( fileref );
407 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 407 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
408 readPls( DocLnk( fileref).file() ); 408 readPls( DocLnk( fileref).file() );
409 } else { 409 } else {
410 clearList(); 410 clearList();
411 addToSelection( DocLnk( fileref ) ); 411 addToSelection( DocLnk( fileref ) );
412 writeCurrentM3u(); 412 writeCurrentM3u();
413 413
414 d->setDocumentUsed = TRUE; 414 d->setDocumentUsed = TRUE;
415 mediaPlayerState->setPlaying( FALSE ); 415 mediaPlayerState->setPlaying( FALSE );
416 mediaPlayerState->setPlaying( TRUE ); 416 mediaPlayerState->setPlaying( TRUE );
417 } 417 }
418} 418}
419 419
420 420
421void PlayListWidget::useSelectedDocument() { 421void PlayListWidget::useSelectedDocument() {
422 d->setDocumentUsed = FALSE; 422 d->setDocumentUsed = FALSE;
423} 423}
424 424
425 425
426const DocLnk *PlayListWidget::current() { // this is fugly 426const DocLnk *PlayListWidget::current() { // this is fugly
427 switch ( whichList() ) { 427 switch ( whichList() ) {
428 case 0: //playlist 428 case 0: //playlist
429 { 429 {
430// qDebug("playlist"); 430// qDebug("playlist");
431 if ( mediaPlayerState->playlist() ) { 431 if ( mediaPlayerState->playlist() ) {
432 return d->selectedFiles->current(); 432 return d->selectedFiles->current();
433 } else if ( d->setDocumentUsed && d->current ) { 433 } else if ( d->setDocumentUsed && d->current ) {
434 return d->current; 434 return d->current;
435 } else { 435 } else {
436 return &(d->files->selectedDocument()); 436 return &(d->files->selectedDocument());
437 } 437 }
438 } 438 }
439 break; 439 break;
440 }; 440 };
441 return 0; 441 return 0;
442} 442}
443 443
444 444
445bool PlayListWidget::prev() { 445bool PlayListWidget::prev() {
446 if ( mediaPlayerState->playlist() ) { 446 if ( mediaPlayerState->playlist() ) {
447 if ( mediaPlayerState->shuffled() ) { 447 if ( mediaPlayerState->shuffled() ) {
448 const DocLnk *cur = current(); 448 const DocLnk *cur = current();
449 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 449 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
450 for ( int i = 0; i < j; i++ ) { 450 for ( int i = 0; i < j; i++ ) {
451 if ( !d->selectedFiles->next() ) 451 if ( !d->selectedFiles->next() )
452 d->selectedFiles->first(); 452 d->selectedFiles->first();
453 } 453 }
454 if ( cur == current() ) 454 if ( cur == current() )
455 if ( !d->selectedFiles->next() ) { 455 if ( !d->selectedFiles->next() ) {
456 d->selectedFiles->first(); 456 d->selectedFiles->first();
457 } 457 }
458 return TRUE; 458 return TRUE;
459 } else { 459 } else {
460 if ( !d->selectedFiles->prev() ) { 460 if ( !d->selectedFiles->prev() ) {
461 if ( mediaPlayerState->looping() ) { 461 if ( mediaPlayerState->looping() ) {
462 return d->selectedFiles->last(); 462 return d->selectedFiles->last();
463 } else { 463 } else {
464 return FALSE; 464 return FALSE;
465 } 465 }
466 } 466 }
467 return TRUE; 467 return TRUE;
468 } 468 }
469 } else { 469 } else {
470 return mediaPlayerState->looping(); 470 return mediaPlayerState->looping();
471 } 471 }
472} 472}
473 473
474 474
475bool PlayListWidget::next() { 475bool PlayListWidget::next() {
476//qDebug("<<<<<<<<<<<<next()"); 476//qDebug("<<<<<<<<<<<<next()");
477 if ( mediaPlayerState->playlist() ) { 477 if ( mediaPlayerState->playlist() ) {
478 if ( mediaPlayerState->shuffled() ) { 478 if ( mediaPlayerState->shuffled() ) {
479 return prev(); 479 return prev();
480 } else { 480 } else {
481 if ( !d->selectedFiles->next() ) { 481 if ( !d->selectedFiles->next() ) {
482 if ( mediaPlayerState->looping() ) { 482 if ( mediaPlayerState->looping() ) {
483 return d->selectedFiles->first(); 483 return d->selectedFiles->first();
484 } else { 484 } else {
485 return FALSE; 485 return FALSE;
486 } 486 }
487 } 487 }
488 return TRUE; 488 return TRUE;
489 } 489 }
490 } else { 490 } else {
491 return mediaPlayerState->looping(); 491 return mediaPlayerState->looping();
492 } 492 }
493} 493}
494 494
495 495
496bool PlayListWidget::first() { 496bool PlayListWidget::first() {
497 if ( mediaPlayerState->playlist() ) 497 if ( mediaPlayerState->playlist() )
498 return d->selectedFiles->first(); 498 return d->selectedFiles->first();
499 else 499 else
500 return mediaPlayerState->looping(); 500 return mediaPlayerState->looping();
501} 501}
502 502
503 503
504bool PlayListWidget::last() { 504bool PlayListWidget::last() {
505 if ( mediaPlayerState->playlist() ) 505 if ( mediaPlayerState->playlist() )
506 return d->selectedFiles->last(); 506 return d->selectedFiles->last();
507 else 507 else
508 return mediaPlayerState->looping(); 508 return mediaPlayerState->looping();
509} 509}
510 510
511 511
512 void PlayListWidget::saveList() { 512 void PlayListWidget::saveList() {
513 writem3u(); 513 writem3u();
514 } 514 }
515 515
516 516
517void PlayListWidget::loadList( const DocLnk & lnk) { 517void PlayListWidget::loadList( const DocLnk & lnk) {
518 QString name = lnk.name(); 518 QString name = lnk.name();
519 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 519 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
520 520
521 if( name.length()>0) { 521 if( name.length()>0) {
522 setCaption("OpiePlayer: "+name); 522 setCaption("OpiePlayer: "+name);
523// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 523// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
524 clearList(); 524 clearList();
525 readm3u(lnk.file()); 525 readm3u(lnk.file());
526 tabWidget->setCurrentPage(0); 526 tabWidget->setCurrentPage(0);
527 } 527 }
528} 528}
529 529
530 530
531void PlayListWidget::setPlaylist( bool shown ) { 531void PlayListWidget::setPlaylist( bool shown ) {
532 if ( shown ) { 532 if ( shown ) {
533 d->playListFrame->show(); 533 d->playListFrame->show();
534 } else { 534 } else {
535 d->playListFrame->hide(); 535 d->playListFrame->hide();
536 } 536 }
537} 537}
538 538
539 539
540void PlayListWidget::addSelected() { 540void PlayListWidget::addSelected() {
541 qDebug("addSelected"); 541 qDebug("addSelected");
542 DocLnk lnk; 542 DocLnk lnk;
543 QString filename; 543 QString filename;
544 switch (whichList()) { 544 switch (whichList()) {
545 545
546 case 0: //playlist 546 case 0: //playlist
547 return; 547 return;
548 break; 548 break;
549 case 1: { //audio 549 case 1: { //audio
550 QListViewItemIterator it( audioView ); 550 QListViewItemIterator it( audioView );
551 for ( ; it.current(); ++it ) { 551 for ( ; it.current(); ++it ) {
552 if ( it.current()->isSelected() ) { 552 if ( it.current()->isSelected() ) {
553 filename=it.current()->text(3); 553 filename=it.current()->text(3);
554 lnk.setName( QFileInfo(filename).baseName() ); //sets name 554 lnk.setName( QFileInfo(filename).baseName() ); //sets name
555 lnk.setFile( filename ); //sets file name 555 lnk.setFile( filename ); //sets file name
556 d->selectedFiles->addToSelection( lnk); 556 d->selectedFiles->addToSelection( lnk);
557
557 } 558 }
558 } 559 }
560 audioView->clearSelection();
559 } 561 }
560 break; 562 break;
561 563
562 case 2: { // video 564 case 2: { // video
563 QListViewItemIterator it( videoView ); 565 QListViewItemIterator it( videoView );
564 for ( ; it.current(); ++it ) { 566 for ( ; it.current(); ++it ) {
565 if ( it.current()->isSelected() ) { 567 if ( it.current()->isSelected() ) {
566 // myFile = (*it);
567
568 filename=it.current()->text(3); 568 filename=it.current()->text(3);
569 lnk.setName( QFileInfo(filename).baseName() ); //sets name 569 lnk.setName( QFileInfo(filename).baseName() ); //sets name
570 lnk.setFile( filename ); //sets file name 570 lnk.setFile( filename ); //sets file name
571 d->selectedFiles->addToSelection( lnk); 571 d->selectedFiles->addToSelection( lnk);
572 } 572 }
573 } 573 }
574 videoView->clearSelection();
574 } 575 }
575 break; 576 break;
576 }; 577 };
577 tabWidget->setCurrentPage(0); 578 tabWidget->setCurrentPage(0);
578 writeCurrentM3u(); 579 writeCurrentM3u();
579} 580}
580 581
581 582
582void PlayListWidget::removeSelected() { 583void PlayListWidget::removeSelected() {
583 d->selectedFiles->removeSelected( ); 584 d->selectedFiles->removeSelected( );
584 writeCurrentM3u(); 585 writeCurrentM3u();
585} 586}
586 587
587 588
588void PlayListWidget::playIt( QListViewItem *it) { 589void PlayListWidget::playIt( QListViewItem *it) {
589 if(!it) return; 590 if(!it) return;
590 mediaPlayerState->setPlaying(FALSE); 591 mediaPlayerState->setPlaying(FALSE);
591 mediaPlayerState->setPlaying(TRUE); 592 mediaPlayerState->setPlaying(TRUE);
592 d->selectedFiles->unSelect(); 593 d->selectedFiles->unSelect();
593} 594}
594 595
595 596
596void PlayListWidget::addToSelection( QListViewItem *it) { 597void PlayListWidget::addToSelection( QListViewItem *it) {
597 d->setDocumentUsed = FALSE; 598 d->setDocumentUsed = FALSE;
598 599
599 if(it) { 600 if(it) {
600 switch ( whichList()) { 601 switch ( whichList()) {
601 case 0: //playlist 602 case 0: //playlist
602 return; 603 return;
603 break; 604 break;
604 }; 605 };
605 // case 1: { 606 // case 1: {
606 DocLnk lnk; 607 DocLnk lnk;
607 QString filename; 608 QString filename;
608 609
609 filename=it->text(3); 610 filename=it->text(3);
610 lnk.setName( QFileInfo(filename).baseName() ); //sets name 611 lnk.setName( QFileInfo(filename).baseName() ); //sets name
611 lnk.setFile( filename ); //sets file name 612 lnk.setFile( filename ); //sets file name
612 d->selectedFiles->addToSelection( lnk); 613 d->selectedFiles->addToSelection( lnk);
613 614
614 writeCurrentM3u(); 615 writeCurrentM3u();
615 tabWidget->setCurrentPage(0); 616 tabWidget->setCurrentPage(0);
616 617
617 } 618 }
618} 619}
619 620
620 621
621void PlayListWidget::tabChanged(QWidget *) { 622void PlayListWidget::tabChanged(QWidget *) {
622 623
623 switch ( whichList()) { 624 switch ( whichList()) {
624 case 0: 625 case 0:
625 { 626 {
626 if( !tbDeletePlaylist->isHidden() ) { 627 if( !tbDeletePlaylist->isHidden() ) {
627 tbDeletePlaylist->hide(); 628 tbDeletePlaylist->hide();
628 } 629 }
629 d->tbRemoveFromList->setEnabled(TRUE); 630 d->tbRemoveFromList->setEnabled(TRUE);
630 d->tbAddToList->setEnabled(FALSE); 631 d->tbAddToList->setEnabled(FALSE);
631 } 632 }
632 break; 633 break;
633 case 1: 634 case 1:
634 { 635 {
635 // audioView->clear(); 636 // audioView->clear();
636 if(!audioPopulated) populateAudioView(); 637 if(!audioPopulated) populateAudioView();
637 638
638 if( !tbDeletePlaylist->isHidden() ) { 639 if( !tbDeletePlaylist->isHidden() ) {
639 tbDeletePlaylist->hide(); 640 tbDeletePlaylist->hide();
640 } 641 }
641 d->tbRemoveFromList->setEnabled(FALSE); 642 d->tbRemoveFromList->setEnabled(FALSE);
642 d->tbAddToList->setEnabled(TRUE); 643 d->tbAddToList->setEnabled(TRUE);
643 } 644 }
644 break; 645 break;
645 case 2: 646 case 2:
646 { 647 {
647 // videoView->clear(); 648 // videoView->clear();
648 if(!videoPopulated) populateVideoView(); 649 if(!videoPopulated) populateVideoView();
649 if( !tbDeletePlaylist->isHidden() ) { 650 if( !tbDeletePlaylist->isHidden() ) {
650 tbDeletePlaylist->hide(); 651 tbDeletePlaylist->hide();
651 } 652 }
652 d->tbRemoveFromList->setEnabled(FALSE); 653 d->tbRemoveFromList->setEnabled(FALSE);
653 d->tbAddToList->setEnabled(TRUE); 654 d->tbAddToList->setEnabled(TRUE);
654 } 655 }
655 break; 656 break;
656 case 3: 657 case 3:
657 { 658 {
658 if( tbDeletePlaylist->isHidden() ) { 659 if( tbDeletePlaylist->isHidden() ) {
659 tbDeletePlaylist->show(); 660 tbDeletePlaylist->show();
660 } 661 }
661 playLists->reread(); 662 playLists->reread();
662 } 663 }
663 break; 664 break;
664 }; 665 };
665} 666}
666 667
667 668
668void PlayListWidget::btnPlay(bool b) { 669void PlayListWidget::btnPlay(bool b) {
669// mediaPlayerState->setPlaying(false); 670// mediaPlayerState->setPlaying(false);
670 mediaPlayerState->setPlaying(b); 671 mediaPlayerState->setPlaying(b);
671 insanityBool=FALSE; 672 insanityBool=FALSE;
672} 673}
673 674
674void PlayListWidget::deletePlaylist() { 675void PlayListWidget::deletePlaylist() {
675 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 676 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
676 (tr("You really want to delete\nthis playlist?")), 677 (tr("You really want to delete\nthis playlist?")),
677 (tr("Yes")), (tr("No")), 0 )){ 678 (tr("Yes")), (tr("No")), 0 )){
678 case 0: // Yes clicked, 679 case 0: // Yes clicked,
679 QFile().remove(playLists->selectedDocument().file()); 680 QFile().remove(playLists->selectedDocument().file());
680 QFile().remove(playLists->selectedDocument().linkFile()); 681 QFile().remove(playLists->selectedDocument().linkFile());
681 playLists->reread(); 682 playLists->reread();
682 break; 683 break;
683 case 1: // Cancel 684 case 1: // Cancel
684 break; 685 break;
685 }; 686 };
686} 687}
687 688
688 689
689void PlayListWidget::playSelected() { 690void PlayListWidget::playSelected() {
690 btnPlay( TRUE); 691 btnPlay( TRUE);
691} 692}
692 693
693 694
694void PlayListWidget::scanForAudio() { 695void PlayListWidget::scanForAudio() {
695// qDebug("scan for audio"); 696// qDebug("scan for audio");
696 files.detachChildren(); 697 files.detachChildren();
697 QListIterator<DocLnk> sdit( files.children() ); 698 QListIterator<DocLnk> sdit( files.children() );
698 for ( ; sdit.current(); ++sdit ) { 699 for ( ; sdit.current(); ++sdit ) {
699 delete sdit.current(); 700 delete sdit.current();
700 } 701 }
701// Global::findDocuments( &files, "audio/*"); 702// Global::findDocuments( &files, "audio/*");
702 Global::findDocuments( &files, audioMimes); 703 Global::findDocuments( &files, audioMimes);
703 audioScan = true; 704 audioScan = true;
704 populateAudioView(); 705 populateAudioView();
705} 706}
706 707
707void PlayListWidget::scanForVideo() { 708void PlayListWidget::scanForVideo() {
708// qDebug("scan for video"); 709// qDebug("scan for video");
709 vFiles.detachChildren(); 710 vFiles.detachChildren();
710 QListIterator<DocLnk> sdit( vFiles.children() ); 711 QListIterator<DocLnk> sdit( vFiles.children() );
711 for ( ; sdit.current(); ++sdit ) { 712 for ( ; sdit.current(); ++sdit ) {
712 delete sdit.current(); 713 delete sdit.current();
713 } 714 }
714 Global::findDocuments(&vFiles, "video/*"); 715 Global::findDocuments(&vFiles, "video/*");
715 videoScan = true; 716 videoScan = true;
716 populateVideoView(); 717 populateVideoView();
717} 718}
718 719
719void PlayListWidget::populateAudioView() { 720void PlayListWidget::populateAudioView() {
720 audioView->clear(); 721 audioView->clear();
721 StorageInfo storageInfo; 722 StorageInfo storageInfo;
722 const QList<FileSystem> &fs = storageInfo.fileSystems(); 723 const QList<FileSystem> &fs = storageInfo.fileSystems();
723 if(!audioScan) { 724 if(!audioScan) {
724 scanForAudio(); 725 scanForAudio();
725 } 726 }
726 727
727 QListIterator<DocLnk> dit( files.children() ); 728 QListIterator<DocLnk> dit( files.children() );
728 // QListIterator<FileSystem> it ( fs ); 729 // QListIterator<FileSystem> it ( fs );
729 audioView->clear(); 730 audioView->clear();
730 731
731 QString storage; 732 QString storage;
732 for ( ; dit.current(); ++dit ) { 733 for ( ; dit.current(); ++dit ) {
733// // for( ; it.current(); ++it ){ 734// // for( ; it.current(); ++it ){
734// const QString name = (*dit)->name(); 735// const QString name = (*dit)->name();
735// const QString path = (*dit)->path(); 736// const QString path = (*dit)->path();
736// if(dit.current()->file().find(path) != -1 ) { 737// if(dit.current()->file().find(path) != -1 ) {
737// storage = name; 738// storage = name;
738// // } 739// // }
739// } 740// }
740 741
741 QListViewItem * newItem; 742 QListViewItem * newItem;
742 if ( QFile( dit.current()->file()).exists() || 743 if ( QFile( dit.current()->file()).exists() ||
743 dit.current()->file().left(4) == "http" ) { 744 dit.current()->file().left(4) == "http" ) {
744 long size; 745 long size;
745 if( dit.current()->file().left(4) == "http" ) 746 if( dit.current()->file().left(4) == "http" )
746 size=0; 747 size=0;
747 else 748 else
748 size = QFile( dit.current()->file() ).size(); 749 size = QFile( dit.current()->file() ).size();
749 750
750 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 751 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
751 QString::number(size ), "" /*storage*/, 752 QString::number(size ), "" /*storage*/,
752 dit.current()->file() ); 753 dit.current()->file() );
753 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 754 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
754// qDebug("<<<< "+dit.current()->file()); 755// qDebug("<<<< "+dit.current()->file());
755 } 756 }
756 } 757 }
757 audioPopulated=true; 758 audioPopulated=true;
758} 759}
759 760
760 761
761void PlayListWidget::populateVideoView() { 762void PlayListWidget::populateVideoView() {
762 videoView->clear(); 763 videoView->clear();
763 StorageInfo storageInfo; 764 StorageInfo storageInfo;
764 const QList<FileSystem> &fs = storageInfo.fileSystems(); 765 const QList<FileSystem> &fs = storageInfo.fileSystems();
765 766
766 if(!videoScan ) { 767 if(!videoScan ) {
767 scanForVideo(); 768 scanForVideo();
768 } 769 }
769 770
770 QListIterator<DocLnk> Vdit( vFiles.children() ); 771 QListIterator<DocLnk> Vdit( vFiles.children() );
771// QListIterator<FileSystem> it ( fs ); 772// QListIterator<FileSystem> it ( fs );
772 videoView->clear(); 773 videoView->clear();
773 QString storage, pathName; 774 QString storage, pathName;
774 for ( ; Vdit.current(); ++Vdit ) { 775 for ( ; Vdit.current(); ++Vdit ) {
775// // for( ; it.current(); ++it ) { 776// // for( ; it.current(); ++it ) {
776// const QString name = (*Vdit)->name(); 777// const QString name = (*Vdit)->name();
777// const QString path = (*Vdit)->path(); 778// const QString path = (*Vdit)->path();
778// if( Vdit.current()->file().find(path) != -1 ) { 779// if( Vdit.current()->file().find(path) != -1 ) {
779// storage=name; 780// storage=name;
780// pathName=path; 781// pathName=path;
781// // } 782// // }
782// } 783// }
783 784
784 QListViewItem * newItem; 785 QListViewItem * newItem;
785 if ( QFile( Vdit.current()->file() ).exists() ) { 786 if ( QFile( Vdit.current()->file() ).exists() ) {
786 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 787 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
787 QString::number( QFile( Vdit.current()->file() ).size() ), 788 QString::number( QFile( Vdit.current()->file() ).size() ),
788 ""/*storage*/, Vdit.current()->file()); 789 ""/*storage*/, Vdit.current()->file());
789 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 790 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
790 } 791 }
791 } 792 }
792 videoPopulated=true; 793 videoPopulated=true;
793} 794}
794 795
795 796
796void PlayListWidget::openFile() { 797void PlayListWidget::openFile() {
797 // http://66.28.164.33:2080 798 // http://66.28.164.33:2080
798 // http://somafm.com/star0242.m3u 799 // http://somafm.com/star0242.m3u
799 QString filename, name; 800 QString filename, name;
800 InputDialog *fileDlg; 801 InputDialog *fileDlg;
801 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 802 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
802 fileDlg->exec(); 803 fileDlg->exec();
803 if( fileDlg->result() == 1 ) { 804 if( fileDlg->result() == 1 ) {
804 filename = fileDlg->text(); 805 filename = fileDlg->text();
805 qDebug( "Selected filename is " + filename ); 806 qDebug( "Selected filename is " + filename );
806 Om3u *m3uList; 807 Om3u *m3uList;
807 DocLnk lnk; 808 DocLnk lnk;
808 Config cfg( "OpiePlayer" ); 809 Config cfg( "OpiePlayer" );
809 cfg.setGroup("PlayList"); 810 cfg.setGroup("PlayList");
810 811
811 if(filename.left(4) == "http") { 812 if(filename.left(4) == "http") {
812 QString m3uFile, m3uFilePath; 813 QString m3uFile, m3uFilePath;
813 if(filename.find(":",8,TRUE) != -1) { //found a port 814 if(filename.find(":",8,TRUE) != -1) { //found a port
814 m3uFile = filename.left( filename.find( ":",8,TRUE)); 815 m3uFile = filename.left( filename.find( ":",8,TRUE));
815 m3uFile = m3uFile.right( 7); 816 m3uFile = m3uFile.right( 7);
816 } else if(filename.left(4) == "http"){ 817 } else if(filename.left(4) == "http"){
817 m3uFile=filename; 818 m3uFile=filename;
818 m3uFile = m3uFile.right( m3uFile.length() - 7); 819 m3uFile = m3uFile.right( m3uFile.length() - 7);
819 } else{ 820 } else{
820 m3uFile=filename; 821 m3uFile=filename;
821 } 822 }
822 823
823// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 824// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
824 lnk.setName( filename ); //sets name 825 lnk.setName( filename ); //sets name
825 lnk.setFile( filename ); //sets file name 826 lnk.setFile( filename ); //sets file name
826 827
827// lnk.setIcon("opieplayer2/musicfile"); 828// lnk.setIcon("opieplayer2/musicfile");
828 829
829 d->selectedFiles->addToSelection( lnk ); 830 d->selectedFiles->addToSelection( lnk );
830 writeCurrentM3u(); 831 writeCurrentM3u();
831 d->selectedFiles->setSelectedItem( lnk.name()); 832 d->selectedFiles->setSelectedItem( lnk.name());
832 } 833 }
833 else if( filename.right( 3) == "m3u" ) { 834 else if( filename.right( 3) == "m3u" ) {
834 readm3u( filename ); 835 readm3u( filename );
835 836
836 } else if( filename.right(3) == "pls" ) { 837 } else if( filename.right(3) == "pls" ) {
837 readPls( filename ); 838 readPls( filename );
838 } else { 839 } else {
839 lnk.setName( QFileInfo(filename).baseName() ); //sets name 840 lnk.setName( QFileInfo(filename).baseName() ); //sets name
840 lnk.setFile( filename ); //sets file name 841 lnk.setFile( filename ); //sets file name
841 d->selectedFiles->addToSelection( lnk); 842 d->selectedFiles->addToSelection( lnk);
842 writeCurrentM3u(); 843 writeCurrentM3u();
843 d->selectedFiles->setSelectedItem( lnk.name()); 844 d->selectedFiles->setSelectedItem( lnk.name());
844 } 845 }
845 } 846 }
846 847
847 if( fileDlg ) { 848 if( fileDlg ) {
848 delete fileDlg; 849 delete fileDlg;
849 } 850 }
850} 851}
851 852
852/* 853/*
853reads m3u and shows files/urls to playlist widget */ 854reads m3u and shows files/urls to playlist widget */
854void PlayListWidget::readm3u( const QString &filename ) { 855void PlayListWidget::readm3u( const QString &filename ) {
855 qDebug( "read m3u filename " + filename ); 856 qDebug( "read m3u filename " + filename );
856 857
857 Om3u *m3uList; 858 Om3u *m3uList;
858 QString s, name; 859 QString s, name;
859 m3uList = new Om3u( filename, IO_ReadOnly ); 860 m3uList = new Om3u( filename, IO_ReadOnly );
860 m3uList->readM3u(); 861 m3uList->readM3u();
861 DocLnk lnk; 862 DocLnk lnk;
862 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 863 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
863 s = *it; 864 s = *it;
864// qDebug("reading "+ s); 865// qDebug("reading "+ s);
865 if(s.left(4)=="http") { 866 if(s.left(4)=="http") {
866 lnk.setName( s ); //sets file name 867 lnk.setName( s ); //sets file name
867 lnk.setIcon("opieplayer2/musicfile"); 868 lnk.setIcon("opieplayer2/musicfile");
868 lnk.setFile( s ); //sets file name 869 lnk.setFile( s ); //sets file name
869 870
870 } else { 871 } else {
871 // if( QFileInfo( s ).exists() ) { 872 // if( QFileInfo( s ).exists() ) {
872 lnk.setName( QFileInfo(s).baseName()); 873 lnk.setName( QFileInfo(s).baseName());
873 // if(s.right(4) == '.') {//if regular file 874 // if(s.right(4) == '.') {//if regular file
874 if(s.left(1) != "/") { 875 if(s.left(1) != "/") {
875 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 876 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
876 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 877 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
877// lnk.setIcon(MimeType(s).pixmap() ); 878// lnk.setIcon(MimeType(s).pixmap() );
878// lnk.setIcon("SoundPlayer"); 879// lnk.setIcon("SoundPlayer");
879 } else { 880 } else {
880 // qDebug("set link2 "+s); 881 // qDebug("set link2 "+s);
881 lnk.setFile( s); 882 lnk.setFile( s);
882// lnk.setIcon(MimeType(s).pixmap() ); 883// lnk.setIcon(MimeType(s).pixmap() );
883// lnk.setIcon("SoundPlayer"); 884// lnk.setIcon("SoundPlayer");
884 } 885 }
885 } 886 }
886 d->selectedFiles->addToSelection( lnk ); 887 d->selectedFiles->addToSelection( lnk );
887 } 888 }
888 Config config( "OpiePlayer" ); 889 Config config( "OpiePlayer" );
889 config.setGroup( "PlayList" ); 890 config.setGroup( "PlayList" );
890 891
891 config.writeEntry("CurrentPlaylist",filename); 892 config.writeEntry("CurrentPlaylist",filename);
892 config.write(); 893 config.write();
893 currentPlayList=filename; 894 currentPlayList=filename;
894 895
895// m3uList->write(); 896// m3uList->write();
896 m3uList->close(); 897 m3uList->close();
897 if(m3uList) delete m3uList; 898 if(m3uList) delete m3uList;
898 899
899 d->selectedFiles->setSelectedItem( s); 900 d->selectedFiles->setSelectedItem( s);
900 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 901 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
901 902
902} 903}
903 904
904/* 905/*
905reads pls and adds files/urls to playlist */ 906reads pls and adds files/urls to playlist */
906void PlayListWidget::readPls( const QString &filename ) { 907void PlayListWidget::readPls( const QString &filename ) {
907 908
908 qDebug( "pls filename is " + filename ); 909 qDebug( "pls filename is " + filename );
909 Om3u *m3uList; 910 Om3u *m3uList;
910 QString s, name; 911 QString s, name;
911 m3uList = new Om3u( filename, IO_ReadOnly ); 912 m3uList = new Om3u( filename, IO_ReadOnly );
912 m3uList->readPls(); 913 m3uList->readPls();
913 914
914 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 915 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
915 s = *it; 916 s = *it;
916 // s.replace( QRegExp( "%20" )," " ); 917 // s.replace( QRegExp( "%20" )," " );
917 DocLnk lnk( s ); 918 DocLnk lnk( s );
918 QFileInfo f( s ); 919 QFileInfo f( s );
919 QString name = f.baseName(); 920 QString name = f.baseName();
920 921
921 if( name.left( 4 ) == "http" ) { 922 if( name.left( 4 ) == "http" ) {
922 name = s.right( s.length() - 7); 923 name = s.right( s.length() - 7);
923 } else { 924 } else {
924 name = s; 925 name = s;
925 } 926 }
926 927
927 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 928 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
928 929
929 lnk.setName( name ); 930 lnk.setName( name );
930 if( s.at( s.length() - 4) == '.') {// if this is probably a file 931 if( s.at( s.length() - 4) == '.') {// if this is probably a file
931 lnk.setFile( s ); 932 lnk.setFile( s );
932 } else { //if its a url 933 } else { //if its a url
933// if( name.right( 1 ).find( '/' ) == -1) { 934// if( name.right( 1 ).find( '/' ) == -1) {
934// s += "/"; 935// s += "/";
935// } 936// }
936 lnk.setFile( s ); 937 lnk.setFile( s );
937 } 938 }
938 lnk.setType( "audio/x-mpegurl" ); 939 lnk.setType( "audio/x-mpegurl" );
939 940
940 lnk.writeLink(); 941 lnk.writeLink();
941 d->selectedFiles->addToSelection( lnk ); 942 d->selectedFiles->addToSelection( lnk );
942 } 943 }
943 944
944 m3uList->close(); 945 m3uList->close();
945 if(m3uList) delete m3uList; 946 if(m3uList) delete m3uList;
946} 947}
947 948
948/* 949/*
949 writes current playlist to current m3u file */ 950 writes current playlist to current m3u file */
950void PlayListWidget::writeCurrentM3u() { 951void PlayListWidget::writeCurrentM3u() {
951 qDebug("writing to current m3u"); 952 qDebug("writing to current m3u");
952 Config cfg( "OpiePlayer" ); 953 Config cfg( "OpiePlayer" );
953 cfg.setGroup("PlayList"); 954 cfg.setGroup("PlayList");
954 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 955 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
955 956
956 Om3u *m3uList; 957 Om3u *m3uList;
957 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 958 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );