author | llornkcor <llornkcor> | 2002-06-17 23:27:07 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-17 23:27:07 (UTC) |
commit | 33fea370b99c4d6985de14aa913534fb4b1188d3 (patch) (unidiff) | |
tree | 356afa8be87f8e16030ec386bfa514ebf2f0a274 | |
parent | 8b089ad594fad0eed4303bc83db4910784e17dd5 (diff) | |
download | opie-33fea370b99c4d6985de14aa913534fb4b1188d3.zip opie-33fea370b99c4d6985de14aa913534fb4b1188d3.tar.gz opie-33fea370b99c4d6985de14aa913534fb4b1188d3.tar.bz2 |
need special case for urls to be added
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index b0d4958..41fcb30 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -357,129 +357,129 @@ void PlayListWidget::initializeStates() { | |||
357 | setPlaylist( true); | 357 | setPlaylist( true); |
358 | // d->selectedFiles->first(); | 358 | // d->selectedFiles->first(); |
359 | 359 | ||
360 | } | 360 | } |
361 | 361 | ||
362 | 362 | ||
363 | void PlayListWidget::readConfig( Config& cfg ) { | 363 | void PlayListWidget::readConfig( Config& cfg ) { |
364 | cfg.setGroup("PlayList"); | 364 | cfg.setGroup("PlayList"); |
365 | QString currentString = cfg.readEntry("current", "" ); | 365 | QString currentString = cfg.readEntry("current", "" ); |
366 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 366 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
367 | for ( int i = 0; i < noOfFiles; i++ ) { | 367 | for ( int i = 0; i < noOfFiles; i++ ) { |
368 | QString entryName; | 368 | QString entryName; |
369 | entryName.sprintf( "File%i", i + 1 ); | 369 | entryName.sprintf( "File%i", i + 1 ); |
370 | QString linkFile = cfg.readEntry( entryName ); | 370 | QString linkFile = cfg.readEntry( entryName ); |
371 | DocLnk lnk( linkFile ); | 371 | DocLnk lnk( linkFile ); |
372 | if ( lnk.isValid() ) { | 372 | if ( lnk.isValid() ) { |
373 | d->selectedFiles->addToSelection( lnk ); | 373 | d->selectedFiles->addToSelection( lnk ); |
374 | } | 374 | } |
375 | } | 375 | } |
376 | d->selectedFiles->setSelectedItem( currentString); | 376 | d->selectedFiles->setSelectedItem( currentString); |
377 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); | 377 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); |
378 | } | 378 | } |
379 | 379 | ||
380 | 380 | ||
381 | void PlayListWidget::writeConfig( Config& cfg ) const { | 381 | void PlayListWidget::writeConfig( Config& cfg ) const { |
382 | 382 | ||
383 | d->selectedFiles->writeCurrent( cfg); | 383 | d->selectedFiles->writeCurrent( cfg); |
384 | cfg.setGroup("PlayList"); | 384 | cfg.setGroup("PlayList"); |
385 | int noOfFiles = 0; | 385 | int noOfFiles = 0; |
386 | d->selectedFiles->first(); | 386 | d->selectedFiles->first(); |
387 | do { | 387 | do { |
388 | const DocLnk *lnk = d->selectedFiles->current(); | 388 | const DocLnk *lnk = d->selectedFiles->current(); |
389 | if ( lnk ) { | 389 | if ( lnk ) { |
390 | QString entryName; | 390 | QString entryName; |
391 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 391 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
392 | // qDebug(entryName); | 392 | // qDebug(entryName); |
393 | cfg.writeEntry( entryName, lnk->linkFile() ); | 393 | cfg.writeEntry( entryName, lnk->linkFile() ); |
394 | // if this link does exist, add it so we have the file | 394 | // if this link does exist, add it so we have the file |
395 | // next time... | 395 | // next time... |
396 | if ( !QFile::exists( lnk->linkFile() ) ) { | 396 | if ( !QFile::exists( lnk->linkFile() ) ) { |
397 | // the way writing lnks doesn't really check for out | 397 | // the way writing lnks doesn't really check for out |
398 | // of disk space, but check it anyway. | 398 | // of disk space, but check it anyway. |
399 | if ( !lnk->writeLink() ) { | 399 | if ( !lnk->writeLink() ) { |
400 | QMessageBox::critical( 0, tr("Out of space"), | 400 | QMessageBox::critical( 0, tr("Out of space"), |
401 | tr( "There was a problem saving " | 401 | tr( "There was a problem saving " |
402 | "the playlist.\n" | 402 | "the playlist.\n" |
403 | "Your playlist " | 403 | "Your playlist " |
404 | "may be missing some entries\n" | 404 | "may be missing some entries\n" |
405 | "the next time you start it." ) | 405 | "the next time you start it." ) |
406 | ); | 406 | ); |
407 | } | 407 | } |
408 | } | 408 | } |
409 | noOfFiles++; | 409 | noOfFiles++; |
410 | } | 410 | } |
411 | } | 411 | } |
412 | while ( d->selectedFiles->next() ); | 412 | while ( d->selectedFiles->next() ); |
413 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 413 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
414 | } | 414 | } |
415 | 415 | ||
416 | 416 | ||
417 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 417 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
418 | // qDebug("add"); | 418 | // qDebug("add"); |
419 | d->setDocumentUsed = FALSE; | 419 | d->setDocumentUsed = FALSE; |
420 | if ( mediaPlayerState->playlist() ) { | 420 | if ( mediaPlayerState->playlist() ) { |
421 | if(QFileInfo(lnk.file()).exists()) | 421 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) |
422 | d->selectedFiles->addToSelection( lnk ); | 422 | d->selectedFiles->addToSelection( lnk ); |
423 | } | 423 | } |
424 | else | 424 | else |
425 | mediaPlayerState->setPlaying( TRUE ); | 425 | mediaPlayerState->setPlaying( TRUE ); |
426 | } | 426 | } |
427 | 427 | ||
428 | 428 | ||
429 | void PlayListWidget::clearList() { | 429 | void PlayListWidget::clearList() { |
430 | while ( first() ) | 430 | while ( first() ) |
431 | d->selectedFiles->removeSelected(); | 431 | d->selectedFiles->removeSelected(); |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | void PlayListWidget::addAllToList() { | 435 | void PlayListWidget::addAllToList() { |
436 | DocLnkSet filesAll; | 436 | DocLnkSet filesAll; |
437 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 437 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
438 | QListIterator<DocLnk> Adit( filesAll.children() ); | 438 | QListIterator<DocLnk> Adit( filesAll.children() ); |
439 | for ( ; Adit.current(); ++Adit ) | 439 | for ( ; Adit.current(); ++Adit ) |
440 | if(QFileInfo(Adit.current()->file()).exists()) | 440 | if(QFileInfo(Adit.current()->file()).exists()) |
441 | d->selectedFiles->addToSelection( **Adit ); | 441 | d->selectedFiles->addToSelection( **Adit ); |
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||
445 | void PlayListWidget::addAllMusicToList() { | 445 | void PlayListWidget::addAllMusicToList() { |
446 | QListIterator<DocLnk> dit( files.children() ); | 446 | QListIterator<DocLnk> dit( files.children() ); |
447 | for ( ; dit.current(); ++dit ) | 447 | for ( ; dit.current(); ++dit ) |
448 | if(QFileInfo(dit.current()->file()).exists()) | 448 | if(QFileInfo(dit.current()->file()).exists()) |
449 | d->selectedFiles->addToSelection( **dit ); | 449 | d->selectedFiles->addToSelection( **dit ); |
450 | } | 450 | } |
451 | 451 | ||
452 | 452 | ||
453 | void PlayListWidget::addAllVideoToList() { | 453 | void PlayListWidget::addAllVideoToList() { |
454 | QListIterator<DocLnk> dit( vFiles.children() ); | 454 | QListIterator<DocLnk> dit( vFiles.children() ); |
455 | for ( ; dit.current(); ++dit ) | 455 | for ( ; dit.current(); ++dit ) |
456 | if(QFileInfo( dit.current()->file()).exists()) | 456 | if(QFileInfo( dit.current()->file()).exists()) |
457 | d->selectedFiles->addToSelection( **dit ); | 457 | d->selectedFiles->addToSelection( **dit ); |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
461 | void PlayListWidget::setDocument(const QString& fileref) { | 461 | void PlayListWidget::setDocument(const QString& fileref) { |
462 | qDebug(fileref); | 462 | qDebug(fileref); |
463 | fromSetDocument = TRUE; | 463 | fromSetDocument = TRUE; |
464 | if ( fileref.isNull() ) { | 464 | if ( fileref.isNull() ) { |
465 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 465 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
466 | return; | 466 | return; |
467 | } | 467 | } |
468 | // qDebug("setDocument "+fileref); | 468 | // qDebug("setDocument "+fileref); |
469 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 469 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
470 | readm3u( fileref); | 470 | readm3u( fileref); |
471 | } | 471 | } |
472 | else if(fileref.find("pls",0,TRUE) != -1) { //is pls | 472 | else if(fileref.find("pls",0,TRUE) != -1) { //is pls |
473 | readPls( fileref); | 473 | readPls( fileref); |
474 | } | 474 | } |
475 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | 475 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist |
476 | clearList(); | 476 | clearList(); |
477 | loadList(DocLnk(fileref)); | 477 | loadList(DocLnk(fileref)); |
478 | d->selectedFiles->first(); | 478 | d->selectedFiles->first(); |
479 | } else { | 479 | } else { |
480 | clearList(); | 480 | clearList(); |
481 | addToSelection( DocLnk( fileref ) ); | 481 | addToSelection( DocLnk( fileref ) ); |
482 | d->setDocumentUsed = TRUE; | 482 | d->setDocumentUsed = TRUE; |
483 | mediaPlayerState->setPlaying( FALSE ); | 483 | mediaPlayerState->setPlaying( FALSE ); |
484 | qApp->processEvents(); | 484 | qApp->processEvents(); |
485 | mediaPlayerState->setPlaying( TRUE ); | 485 | mediaPlayerState->setPlaying( TRUE ); |