author | llornkcor <llornkcor> | 2002-09-21 02:34:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-21 02:34:35 (UTC) |
commit | 2f560ac908935bd4bc4a6b8852d27676100510bb (patch) (unidiff) | |
tree | 867ee58eb1846f68ec2adf0ec3e6a8d1cccd7ef0 | |
parent | 56d434ffe69337186941eba1b5b5dee16da537d7 (diff) | |
download | opie-2f560ac908935bd4bc4a6b8852d27676100510bb.zip opie-2f560ac908935bd4bc4a6b8852d27676100510bb.tar.gz opie-2f560ac908935bd4bc4a6b8852d27676100510bb.tar.bz2 |
playlist might have only one letter in name.. needs to be seen also
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 20adf17..4c4a921 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -348,194 +348,194 @@ bool PlayListWidget::prev() { | |||
348 | if ( !d->selectedFiles->next() ) | 348 | if ( !d->selectedFiles->next() ) |
349 | d->selectedFiles->first(); | 349 | d->selectedFiles->first(); |
350 | } | 350 | } |
351 | if ( cur == current() ) | 351 | if ( cur == current() ) |
352 | if ( !d->selectedFiles->next() ) { | 352 | if ( !d->selectedFiles->next() ) { |
353 | d->selectedFiles->first(); | 353 | d->selectedFiles->first(); |
354 | } | 354 | } |
355 | return TRUE; | 355 | return TRUE; |
356 | } else { | 356 | } else { |
357 | if ( !d->selectedFiles->prev() ) { | 357 | if ( !d->selectedFiles->prev() ) { |
358 | if ( mediaPlayerState->looping() ) { | 358 | if ( mediaPlayerState->looping() ) { |
359 | return d->selectedFiles->last(); | 359 | return d->selectedFiles->last(); |
360 | } else { | 360 | } else { |
361 | return FALSE; | 361 | return FALSE; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | return TRUE; | 364 | return TRUE; |
365 | } | 365 | } |
366 | } else { | 366 | } else { |
367 | return mediaPlayerState->looping(); | 367 | return mediaPlayerState->looping(); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | 371 | ||
372 | bool PlayListWidget::next() { | 372 | bool PlayListWidget::next() { |
373 | qDebug("<<<<<<<<<<<<next()"); | 373 | qDebug("<<<<<<<<<<<<next()"); |
374 | if ( mediaPlayerState->playlist() ) { | 374 | if ( mediaPlayerState->playlist() ) { |
375 | if ( mediaPlayerState->shuffled() ) { | 375 | if ( mediaPlayerState->shuffled() ) { |
376 | return prev(); | 376 | return prev(); |
377 | } else { | 377 | } else { |
378 | if ( !d->selectedFiles->next() ) { | 378 | if ( !d->selectedFiles->next() ) { |
379 | if ( mediaPlayerState->looping() ) { | 379 | if ( mediaPlayerState->looping() ) { |
380 | return d->selectedFiles->first(); | 380 | return d->selectedFiles->first(); |
381 | } else { | 381 | } else { |
382 | return FALSE; | 382 | return FALSE; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | return TRUE; | 385 | return TRUE; |
386 | } | 386 | } |
387 | } else { | 387 | } else { |
388 | return mediaPlayerState->looping(); | 388 | return mediaPlayerState->looping(); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | 392 | ||
393 | bool PlayListWidget::first() { | 393 | bool PlayListWidget::first() { |
394 | if ( mediaPlayerState->playlist() ) | 394 | if ( mediaPlayerState->playlist() ) |
395 | return d->selectedFiles->first(); | 395 | return d->selectedFiles->first(); |
396 | else | 396 | else |
397 | return mediaPlayerState->looping(); | 397 | return mediaPlayerState->looping(); |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | bool PlayListWidget::last() { | 401 | bool PlayListWidget::last() { |
402 | if ( mediaPlayerState->playlist() ) | 402 | if ( mediaPlayerState->playlist() ) |
403 | return d->selectedFiles->last(); | 403 | return d->selectedFiles->last(); |
404 | else | 404 | else |
405 | return mediaPlayerState->looping(); | 405 | return mediaPlayerState->looping(); |
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | ||
409 | void PlayListWidget::saveList() { | 409 | void PlayListWidget::saveList() { |
410 | 410 | ||
411 | QString filename; | 411 | QString filename; |
412 | InputDialog *fileDlg = 0l; | 412 | InputDialog *fileDlg = 0l; |
413 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); | 413 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); |
414 | fileDlg->exec(); | 414 | fileDlg->exec(); |
415 | if( fileDlg->result() == 1 ) { | 415 | if( fileDlg->result() == 1 ) { |
416 | if ( d->current ) | 416 | if ( d->current ) |
417 | delete d->current; | 417 | delete d->current; |
418 | filename = fileDlg->text();//+".playlist"; | 418 | filename = fileDlg->text();//+".playlist"; |
419 | // qDebug("saving playlist "+filename+".playlist"); | 419 | // qDebug("saving playlist "+filename+".playlist"); |
420 | Config cfg( filename +".playlist"); | 420 | Config cfg( filename +".playlist"); |
421 | writeConfig( cfg ); | 421 | writeConfig( cfg ); |
422 | 422 | ||
423 | DocLnk lnk; | 423 | DocLnk lnk; |
424 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 424 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
425 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 425 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
426 | lnk.setIcon("opieplayer2/playlist2"); | 426 | lnk.setIcon("opieplayer2/playlist2"); |
427 | lnk.setName( filename); //sets file name | 427 | lnk.setName( filename); //sets file name |
428 | // qDebug(filename); | 428 | // qDebug(filename); |
429 | if(!lnk.writeLink()) { | 429 | if(!lnk.writeLink()) { |
430 | qDebug("Writing doclink did not work"); | 430 | qDebug("Writing doclink did not work"); |
431 | } | 431 | } |
432 | } | 432 | } |
433 | Config config( "OpiePlayer" ); | 433 | Config config( "OpiePlayer" ); |
434 | config.writeEntry("CurrentPlaylist",filename); | 434 | config.writeEntry("CurrentPlaylist",filename); |
435 | setCaption(tr("OpiePlayer: ")+filename); | 435 | setCaption(tr("OpiePlayer: ")+filename); |
436 | d->selectedFiles->first(); | 436 | d->selectedFiles->first(); |
437 | if(fileDlg) { | 437 | if(fileDlg) { |
438 | delete fileDlg; | 438 | delete fileDlg; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | void PlayListWidget::loadList( const DocLnk & lnk) { | 442 | void PlayListWidget::loadList( const DocLnk & lnk) { |
443 | QString name= lnk.name(); | 443 | QString name= lnk.name(); |
444 | // qDebug("currentList is "+name); | 444 | // qDebug("currentList is "+name); |
445 | if( name.length()>1) { | 445 | if( name.length()>0) { |
446 | setCaption("OpiePlayer: "+name); | 446 | setCaption("OpiePlayer: "+name); |
447 | // qDebug("load list "+ name+".playlist"); | 447 | // qDebug("load list "+ name+".playlist"); |
448 | clearList(); | 448 | clearList(); |
449 | Config cfg( name+".playlist"); | 449 | Config cfg( name+".playlist"); |
450 | readConfig(cfg); | 450 | readConfig(cfg); |
451 | 451 | ||
452 | tabWidget->setCurrentPage(0); | 452 | tabWidget->setCurrentPage(0); |
453 | 453 | ||
454 | Config config( "OpiePlayer" ); | 454 | Config config( "OpiePlayer" ); |
455 | config.writeEntry("CurrentPlaylist", name); | 455 | config.writeEntry("CurrentPlaylist", name); |
456 | // d->selectedFiles->first(); | 456 | // d->selectedFiles->first(); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
461 | void PlayListWidget::setPlaylist( bool shown ) { | 461 | void PlayListWidget::setPlaylist( bool shown ) { |
462 | if ( shown ) { | 462 | if ( shown ) { |
463 | d->playListFrame->show(); | 463 | d->playListFrame->show(); |
464 | } else { | 464 | } else { |
465 | d->playListFrame->hide(); | 465 | d->playListFrame->hide(); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | 469 | ||
470 | void PlayListWidget::addSelected() { | 470 | void PlayListWidget::addSelected() { |
471 | 471 | ||
472 | Config cfg( "OpiePlayer" ); | 472 | Config cfg( "OpiePlayer" ); |
473 | cfg.setGroup("PlayList"); | 473 | cfg.setGroup("PlayList"); |
474 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 474 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
475 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 475 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
476 | 476 | ||
477 | switch (whichList()) { | 477 | switch (whichList()) { |
478 | case 0: //playlist | 478 | case 0: //playlist |
479 | break; | 479 | break; |
480 | case 1: { //audio | 480 | case 1: { //audio |
481 | QListViewItemIterator it( audioView ); | 481 | QListViewItemIterator it( audioView ); |
482 | // iterate through all items of the listview | 482 | // iterate through all items of the listview |
483 | for ( ; it.current(); ++it ) { | 483 | for ( ; it.current(); ++it ) { |
484 | if ( it.current()->isSelected() ) { | 484 | if ( it.current()->isSelected() ) { |
485 | QListIterator<DocLnk> dit( files.children() ); | 485 | QListIterator<DocLnk> dit( files.children() ); |
486 | for ( ; dit.current(); ++dit ) { | 486 | for ( ; dit.current(); ++dit ) { |
487 | if( dit.current()->name() == it.current()->text(0) ) { | 487 | if( dit.current()->name() == it.current()->text(0) ) { |
488 | if(QFileInfo( dit.current()->file()).exists()) | 488 | if(QFileInfo( dit.current()->file()).exists()) |
489 | d->selectedFiles->addToSelection( **dit ); | 489 | d->selectedFiles->addToSelection( **dit ); |
490 | } | 490 | } |
491 | } | 491 | } |
492 | audioView->setSelected( it.current(),FALSE); | 492 | audioView->setSelected( it.current(),FALSE); |
493 | } | 493 | } |
494 | } | 494 | } |
495 | tabWidget->setCurrentPage(0); | 495 | tabWidget->setCurrentPage(0); |
496 | } | 496 | } |
497 | break; | 497 | break; |
498 | case 2: { // video | 498 | case 2: { // video |
499 | QListViewItemIterator it( videoView ); | 499 | QListViewItemIterator it( videoView ); |
500 | // iterate through all items of the listview | 500 | // iterate through all items of the listview |
501 | for ( ; it.current(); ++it ) { | 501 | for ( ; it.current(); ++it ) { |
502 | if ( it.current()->isSelected() ) { | 502 | if ( it.current()->isSelected() ) { |
503 | QListIterator<DocLnk> dit( vFiles.children() ); | 503 | QListIterator<DocLnk> dit( vFiles.children() ); |
504 | for ( ; dit.current(); ++dit ) { | 504 | for ( ; dit.current(); ++dit ) { |
505 | if( dit.current()->name() == it.current()->text(0) ) { | 505 | if( dit.current()->name() == it.current()->text(0) ) { |
506 | if(QFileInfo( dit.current()->file()).exists()) | 506 | if(QFileInfo( dit.current()->file()).exists()) |
507 | d->selectedFiles->addToSelection( **dit ); | 507 | d->selectedFiles->addToSelection( **dit ); |
508 | } | 508 | } |
509 | } | 509 | } |
510 | videoView->setSelected( it.current(),FALSE); | 510 | videoView->setSelected( it.current(),FALSE); |
511 | } | 511 | } |
512 | } | 512 | } |
513 | tabWidget->setCurrentPage(0); | 513 | tabWidget->setCurrentPage(0); |
514 | } | 514 | } |
515 | break; | 515 | break; |
516 | }; | 516 | }; |
517 | } | 517 | } |
518 | 518 | ||
519 | 519 | ||
520 | void PlayListWidget::removeSelected() { | 520 | void PlayListWidget::removeSelected() { |
521 | d->selectedFiles->removeSelected( ); | 521 | d->selectedFiles->removeSelected( ); |
522 | } | 522 | } |
523 | 523 | ||
524 | 524 | ||
525 | void PlayListWidget::playIt( QListViewItem *it) { | 525 | void PlayListWidget::playIt( QListViewItem *it) { |
526 | if(!it) return; | 526 | if(!it) return; |
527 | mediaPlayerState->setPlaying(FALSE); | 527 | mediaPlayerState->setPlaying(FALSE); |
528 | mediaPlayerState->setPlaying(TRUE); | 528 | mediaPlayerState->setPlaying(TRUE); |
529 | d->selectedFiles->unSelect(); | 529 | d->selectedFiles->unSelect(); |
530 | } | 530 | } |
531 | 531 | ||
532 | 532 | ||
533 | void PlayListWidget::addToSelection( QListViewItem *it) { | 533 | void PlayListWidget::addToSelection( QListViewItem *it) { |
534 | d->setDocumentUsed = FALSE; | 534 | d->setDocumentUsed = FALSE; |
535 | 535 | ||
536 | if(it) { | 536 | if(it) { |
537 | switch ( whichList()) { | 537 | switch ( whichList()) { |
538 | case 1: { | 538 | case 1: { |
539 | QListIterator<DocLnk> dit( files.children() ); | 539 | QListIterator<DocLnk> dit( files.children() ); |
540 | for ( ; dit.current(); ++dit ) { | 540 | for ( ; dit.current(); ++dit ) { |
541 | if( dit.current()->name() == it->text(0)) { | 541 | if( dit.current()->name() == it->text(0)) { |