author | llornkcor <llornkcor> | 2002-11-14 03:38:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-14 03:38:48 (UTC) |
commit | 8b1dd63f359c491bdcadb7e2ce39410a1d92a926 (patch) (unidiff) | |
tree | b260127fd6b123a57f42e76ce4c2ea4051cd83cd | |
parent | 5250e8571646f422a0830adcb137df8332ec0fe7 (diff) | |
download | opie-8b1dd63f359c491bdcadb7e2ce39410a1d92a926.zip opie-8b1dd63f359c491bdcadb7e2ce39410a1d92a926.tar.gz opie-8b1dd63f359c491bdcadb7e2ce39410a1d92a926.tar.bz2 |
fix multiselect addto playlist
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 16467c0..ccf654f 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -358,399 +358,411 @@ void PlayListWidget::addAllMusicToList() { | |||
358 | void PlayListWidget::addAllVideoToList() { | 358 | void 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 | ||
391 | void PlayListWidget::setDocument( const QString& fileref ) { | 391 | void 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 | ||
421 | void PlayListWidget::useSelectedDocument() { | 421 | void PlayListWidget::useSelectedDocument() { |
422 | d->setDocumentUsed = FALSE; | 422 | d->setDocumentUsed = FALSE; |
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||
426 | const DocLnk *PlayListWidget::current() { // this is fugly | 426 | const 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 | ||
445 | bool PlayListWidget::prev() { | 445 | bool 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 | ||
475 | bool PlayListWidget::next() { | 475 | bool 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 | ||
496 | bool PlayListWidget::first() { | 496 | bool 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 | ||
504 | bool PlayListWidget::last() { | 504 | bool 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 | ||
517 | void PlayListWidget::loadList( const DocLnk & lnk) { | 517 | void 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 | ||
531 | void PlayListWidget::setPlaylist( bool shown ) { | 531 | void 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 | ||
540 | void PlayListWidget::addSelected() { | 540 | void 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 | filename=audioView->currentItem()->text(3); | 550 | QListViewItemIterator it( audioView ); |
551 | // d->selectedFiles->next(); | 551 | for ( ; it.current(); ++it ) { |
552 | if ( it.current()->isSelected() ) { | ||
553 | filename=it.current()->text(3); | ||
554 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
555 | lnk.setFile( filename ); //sets file name | ||
556 | d->selectedFiles->addToSelection( lnk); | ||
557 | } | ||
558 | } | ||
552 | } | 559 | } |
553 | break; | 560 | break; |
554 | 561 | ||
555 | case 2: { // video | 562 | case 2: { // video |
556 | filename=videoView->currentItem()->text(3); | 563 | QListViewItemIterator it( videoView ); |
557 | // tabWidget->setCurrentPage(0); | 564 | for ( ; it.current(); ++it ) { |
565 | if ( it.current()->isSelected() ) { | ||
566 | // myFile = (*it); | ||
558 | 567 | ||
568 | filename=it.current()->text(3); | ||
569 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
570 | lnk.setFile( filename ); //sets file name | ||
571 | d->selectedFiles->addToSelection( lnk); | ||
572 | } | ||
573 | } | ||
559 | } | 574 | } |
560 | break; | 575 | break; |
561 | }; | 576 | }; |
562 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
563 | lnk.setFile( filename ); //sets file name | ||
564 | d->selectedFiles->addToSelection( lnk); | ||
565 | tabWidget->setCurrentPage(0); | 577 | tabWidget->setCurrentPage(0); |
566 | writeCurrentM3u(); | 578 | writeCurrentM3u(); |
567 | } | 579 | } |
568 | 580 | ||
569 | 581 | ||
570 | void PlayListWidget::removeSelected() { | 582 | void PlayListWidget::removeSelected() { |
571 | d->selectedFiles->removeSelected( ); | 583 | d->selectedFiles->removeSelected( ); |
572 | writeCurrentM3u(); | 584 | writeCurrentM3u(); |
573 | } | 585 | } |
574 | 586 | ||
575 | 587 | ||
576 | void PlayListWidget::playIt( QListViewItem *it) { | 588 | void PlayListWidget::playIt( QListViewItem *it) { |
577 | if(!it) return; | 589 | if(!it) return; |
578 | mediaPlayerState->setPlaying(FALSE); | 590 | mediaPlayerState->setPlaying(FALSE); |
579 | mediaPlayerState->setPlaying(TRUE); | 591 | mediaPlayerState->setPlaying(TRUE); |
580 | d->selectedFiles->unSelect(); | 592 | d->selectedFiles->unSelect(); |
581 | } | 593 | } |
582 | 594 | ||
583 | 595 | ||
584 | void PlayListWidget::addToSelection( QListViewItem *it) { | 596 | void PlayListWidget::addToSelection( QListViewItem *it) { |
585 | d->setDocumentUsed = FALSE; | 597 | d->setDocumentUsed = FALSE; |
586 | 598 | ||
587 | if(it) { | 599 | if(it) { |
588 | switch ( whichList()) { | 600 | switch ( whichList()) { |
589 | case 0: //playlist | 601 | case 0: //playlist |
590 | return; | 602 | return; |
591 | break; | 603 | break; |
592 | }; | 604 | }; |
593 | // case 1: { | 605 | // case 1: { |
594 | DocLnk lnk; | 606 | DocLnk lnk; |
595 | QString filename; | 607 | QString filename; |
596 | 608 | ||
597 | filename=it->text(3); | 609 | filename=it->text(3); |
598 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 610 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
599 | lnk.setFile( filename ); //sets file name | 611 | lnk.setFile( filename ); //sets file name |
600 | d->selectedFiles->addToSelection( lnk); | 612 | d->selectedFiles->addToSelection( lnk); |
601 | 613 | ||
602 | writeCurrentM3u(); | 614 | writeCurrentM3u(); |
603 | tabWidget->setCurrentPage(0); | 615 | tabWidget->setCurrentPage(0); |
604 | 616 | ||
605 | } | 617 | } |
606 | } | 618 | } |
607 | 619 | ||
608 | 620 | ||
609 | void PlayListWidget::tabChanged(QWidget *) { | 621 | void PlayListWidget::tabChanged(QWidget *) { |
610 | 622 | ||
611 | switch ( whichList()) { | 623 | switch ( whichList()) { |
612 | case 0: | 624 | case 0: |
613 | { | 625 | { |
614 | if( !tbDeletePlaylist->isHidden() ) { | 626 | if( !tbDeletePlaylist->isHidden() ) { |
615 | tbDeletePlaylist->hide(); | 627 | tbDeletePlaylist->hide(); |
616 | } | 628 | } |
617 | d->tbRemoveFromList->setEnabled(TRUE); | 629 | d->tbRemoveFromList->setEnabled(TRUE); |
618 | d->tbAddToList->setEnabled(FALSE); | 630 | d->tbAddToList->setEnabled(FALSE); |
619 | } | 631 | } |
620 | break; | 632 | break; |
621 | case 1: | 633 | case 1: |
622 | { | 634 | { |
623 | // audioView->clear(); | 635 | // audioView->clear(); |
624 | if(!audioPopulated) populateAudioView(); | 636 | if(!audioPopulated) populateAudioView(); |
625 | 637 | ||
626 | if( !tbDeletePlaylist->isHidden() ) { | 638 | if( !tbDeletePlaylist->isHidden() ) { |
627 | tbDeletePlaylist->hide(); | 639 | tbDeletePlaylist->hide(); |
628 | } | 640 | } |
629 | d->tbRemoveFromList->setEnabled(FALSE); | 641 | d->tbRemoveFromList->setEnabled(FALSE); |
630 | d->tbAddToList->setEnabled(TRUE); | 642 | d->tbAddToList->setEnabled(TRUE); |
631 | } | 643 | } |
632 | break; | 644 | break; |
633 | case 2: | 645 | case 2: |
634 | { | 646 | { |
635 | // videoView->clear(); | 647 | // videoView->clear(); |
636 | if(!videoPopulated) populateVideoView(); | 648 | if(!videoPopulated) populateVideoView(); |
637 | if( !tbDeletePlaylist->isHidden() ) { | 649 | if( !tbDeletePlaylist->isHidden() ) { |
638 | tbDeletePlaylist->hide(); | 650 | tbDeletePlaylist->hide(); |
639 | } | 651 | } |
640 | d->tbRemoveFromList->setEnabled(FALSE); | 652 | d->tbRemoveFromList->setEnabled(FALSE); |
641 | d->tbAddToList->setEnabled(TRUE); | 653 | d->tbAddToList->setEnabled(TRUE); |
642 | } | 654 | } |
643 | break; | 655 | break; |
644 | case 3: | 656 | case 3: |
645 | { | 657 | { |
646 | if( tbDeletePlaylist->isHidden() ) { | 658 | if( tbDeletePlaylist->isHidden() ) { |
647 | tbDeletePlaylist->show(); | 659 | tbDeletePlaylist->show(); |
648 | } | 660 | } |
649 | playLists->reread(); | 661 | playLists->reread(); |
650 | } | 662 | } |
651 | break; | 663 | break; |
652 | }; | 664 | }; |
653 | } | 665 | } |
654 | 666 | ||
655 | 667 | ||
656 | void PlayListWidget::btnPlay(bool b) { | 668 | void PlayListWidget::btnPlay(bool b) { |
657 | // mediaPlayerState->setPlaying(false); | 669 | // mediaPlayerState->setPlaying(false); |
658 | mediaPlayerState->setPlaying(b); | 670 | mediaPlayerState->setPlaying(b); |
659 | insanityBool=FALSE; | 671 | insanityBool=FALSE; |
660 | } | 672 | } |
661 | 673 | ||
662 | void PlayListWidget::deletePlaylist() { | 674 | void PlayListWidget::deletePlaylist() { |
663 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 675 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
664 | (tr("You really want to delete\nthis playlist?")), | 676 | (tr("You really want to delete\nthis playlist?")), |
665 | (tr("Yes")), (tr("No")), 0 )){ | 677 | (tr("Yes")), (tr("No")), 0 )){ |
666 | case 0: // Yes clicked, | 678 | case 0: // Yes clicked, |
667 | QFile().remove(playLists->selectedDocument().file()); | 679 | QFile().remove(playLists->selectedDocument().file()); |
668 | QFile().remove(playLists->selectedDocument().linkFile()); | 680 | QFile().remove(playLists->selectedDocument().linkFile()); |
669 | playLists->reread(); | 681 | playLists->reread(); |
670 | break; | 682 | break; |
671 | case 1: // Cancel | 683 | case 1: // Cancel |
672 | break; | 684 | break; |
673 | }; | 685 | }; |
674 | } | 686 | } |
675 | 687 | ||
676 | 688 | ||
677 | void PlayListWidget::playSelected() { | 689 | void PlayListWidget::playSelected() { |
678 | btnPlay( TRUE); | 690 | btnPlay( TRUE); |
679 | } | 691 | } |
680 | 692 | ||
681 | 693 | ||
682 | void PlayListWidget::scanForAudio() { | 694 | void PlayListWidget::scanForAudio() { |
683 | // qDebug("scan for audio"); | 695 | // qDebug("scan for audio"); |
684 | files.detachChildren(); | 696 | files.detachChildren(); |
685 | QListIterator<DocLnk> sdit( files.children() ); | 697 | QListIterator<DocLnk> sdit( files.children() ); |
686 | for ( ; sdit.current(); ++sdit ) { | 698 | for ( ; sdit.current(); ++sdit ) { |
687 | delete sdit.current(); | 699 | delete sdit.current(); |
688 | } | 700 | } |
689 | // Global::findDocuments( &files, "audio/*"); | 701 | // Global::findDocuments( &files, "audio/*"); |
690 | Global::findDocuments( &files, audioMimes); | 702 | Global::findDocuments( &files, audioMimes); |
691 | audioScan = true; | 703 | audioScan = true; |
692 | populateAudioView(); | 704 | populateAudioView(); |
693 | } | 705 | } |
694 | 706 | ||
695 | void PlayListWidget::scanForVideo() { | 707 | void PlayListWidget::scanForVideo() { |
696 | // qDebug("scan for video"); | 708 | // qDebug("scan for video"); |
697 | vFiles.detachChildren(); | 709 | vFiles.detachChildren(); |
698 | QListIterator<DocLnk> sdit( vFiles.children() ); | 710 | QListIterator<DocLnk> sdit( vFiles.children() ); |
699 | for ( ; sdit.current(); ++sdit ) { | 711 | for ( ; sdit.current(); ++sdit ) { |
700 | delete sdit.current(); | 712 | delete sdit.current(); |
701 | } | 713 | } |
702 | Global::findDocuments(&vFiles, "video/*"); | 714 | Global::findDocuments(&vFiles, "video/*"); |
703 | videoScan = true; | 715 | videoScan = true; |
704 | populateVideoView(); | 716 | populateVideoView(); |
705 | } | 717 | } |
706 | 718 | ||
707 | void PlayListWidget::populateAudioView() { | 719 | void PlayListWidget::populateAudioView() { |
708 | audioView->clear(); | 720 | audioView->clear(); |
709 | StorageInfo storageInfo; | 721 | StorageInfo storageInfo; |
710 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 722 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
711 | if(!audioScan) { | 723 | if(!audioScan) { |
712 | scanForAudio(); | 724 | scanForAudio(); |
713 | } | 725 | } |
714 | 726 | ||
715 | QListIterator<DocLnk> dit( files.children() ); | 727 | QListIterator<DocLnk> dit( files.children() ); |
716 | // QListIterator<FileSystem> it ( fs ); | 728 | // QListIterator<FileSystem> it ( fs ); |
717 | audioView->clear(); | 729 | audioView->clear(); |
718 | 730 | ||
719 | QString storage; | 731 | QString storage; |
720 | for ( ; dit.current(); ++dit ) { | 732 | for ( ; dit.current(); ++dit ) { |
721 | // // for( ; it.current(); ++it ){ | 733 | // // for( ; it.current(); ++it ){ |
722 | // const QString name = (*dit)->name(); | 734 | // const QString name = (*dit)->name(); |
723 | // const QString path = (*dit)->path(); | 735 | // const QString path = (*dit)->path(); |
724 | // if(dit.current()->file().find(path) != -1 ) { | 736 | // if(dit.current()->file().find(path) != -1 ) { |
725 | // storage = name; | 737 | // storage = name; |
726 | // // } | 738 | // // } |
727 | // } | 739 | // } |
728 | 740 | ||
729 | QListViewItem * newItem; | 741 | QListViewItem * newItem; |
730 | if ( QFile( dit.current()->file()).exists() || | 742 | if ( QFile( dit.current()->file()).exists() || |
731 | dit.current()->file().left(4) == "http" ) { | 743 | dit.current()->file().left(4) == "http" ) { |
732 | long size; | 744 | long size; |
733 | if( dit.current()->file().left(4) == "http" ) | 745 | if( dit.current()->file().left(4) == "http" ) |
734 | size=0; | 746 | size=0; |
735 | else | 747 | else |
736 | size = QFile( dit.current()->file() ).size(); | 748 | size = QFile( dit.current()->file() ).size(); |
737 | 749 | ||
738 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 750 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
739 | QString::number(size ), "" /*storage*/, | 751 | QString::number(size ), "" /*storage*/, |
740 | dit.current()->file() ); | 752 | dit.current()->file() ); |
741 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 753 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
742 | // qDebug("<<<< "+dit.current()->file()); | 754 | // qDebug("<<<< "+dit.current()->file()); |
743 | } | 755 | } |
744 | } | 756 | } |
745 | audioPopulated=true; | 757 | audioPopulated=true; |
746 | } | 758 | } |
747 | 759 | ||
748 | 760 | ||
749 | void PlayListWidget::populateVideoView() { | 761 | void PlayListWidget::populateVideoView() { |
750 | videoView->clear(); | 762 | videoView->clear(); |
751 | StorageInfo storageInfo; | 763 | StorageInfo storageInfo; |
752 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 764 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
753 | 765 | ||
754 | if(!videoScan ) { | 766 | if(!videoScan ) { |
755 | scanForVideo(); | 767 | scanForVideo(); |
756 | } | 768 | } |
@@ -807,339 +819,339 @@ void PlayListWidget::openFile() { | |||
807 | } else{ | 819 | } else{ |
808 | m3uFile=filename; | 820 | m3uFile=filename; |
809 | } | 821 | } |
810 | 822 | ||
811 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 823 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
812 | lnk.setName( filename ); //sets name | 824 | lnk.setName( filename ); //sets name |
813 | lnk.setFile( filename ); //sets file name | 825 | lnk.setFile( filename ); //sets file name |
814 | 826 | ||
815 | // lnk.setIcon("opieplayer2/musicfile"); | 827 | // lnk.setIcon("opieplayer2/musicfile"); |
816 | 828 | ||
817 | d->selectedFiles->addToSelection( lnk ); | 829 | d->selectedFiles->addToSelection( lnk ); |
818 | writeCurrentM3u(); | 830 | writeCurrentM3u(); |
819 | d->selectedFiles->setSelectedItem( lnk.name()); | 831 | d->selectedFiles->setSelectedItem( lnk.name()); |
820 | } | 832 | } |
821 | else if( filename.right( 3) == "m3u" ) { | 833 | else if( filename.right( 3) == "m3u" ) { |
822 | readm3u( filename ); | 834 | readm3u( filename ); |
823 | 835 | ||
824 | } else if( filename.right(3) == "pls" ) { | 836 | } else if( filename.right(3) == "pls" ) { |
825 | readPls( filename ); | 837 | readPls( filename ); |
826 | } else { | 838 | } else { |
827 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 839 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
828 | lnk.setFile( filename ); //sets file name | 840 | lnk.setFile( filename ); //sets file name |
829 | d->selectedFiles->addToSelection( lnk); | 841 | d->selectedFiles->addToSelection( lnk); |
830 | writeCurrentM3u(); | 842 | writeCurrentM3u(); |
831 | d->selectedFiles->setSelectedItem( lnk.name()); | 843 | d->selectedFiles->setSelectedItem( lnk.name()); |
832 | } | 844 | } |
833 | } | 845 | } |
834 | 846 | ||
835 | if( fileDlg ) { | 847 | if( fileDlg ) { |
836 | delete fileDlg; | 848 | delete fileDlg; |
837 | } | 849 | } |
838 | } | 850 | } |
839 | 851 | ||
840 | /* | 852 | /* |
841 | reads m3u and shows files/urls to playlist widget */ | 853 | reads m3u and shows files/urls to playlist widget */ |
842 | void PlayListWidget::readm3u( const QString &filename ) { | 854 | void PlayListWidget::readm3u( const QString &filename ) { |
843 | qDebug( "read m3u filename " + filename ); | 855 | qDebug( "read m3u filename " + filename ); |
844 | 856 | ||
845 | Om3u *m3uList; | 857 | Om3u *m3uList; |
846 | QString s, name; | 858 | QString s, name; |
847 | m3uList = new Om3u( filename, IO_ReadOnly ); | 859 | m3uList = new Om3u( filename, IO_ReadOnly ); |
848 | m3uList->readM3u(); | 860 | m3uList->readM3u(); |
849 | DocLnk lnk; | 861 | DocLnk lnk; |
850 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 862 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
851 | s = *it; | 863 | s = *it; |
852 | // qDebug("reading "+ s); | 864 | // qDebug("reading "+ s); |
853 | if(s.left(4)=="http") { | 865 | if(s.left(4)=="http") { |
854 | lnk.setName( s ); //sets file name | 866 | lnk.setName( s ); //sets file name |
855 | lnk.setIcon("opieplayer2/musicfile"); | 867 | lnk.setIcon("opieplayer2/musicfile"); |
856 | lnk.setFile( s ); //sets file name | 868 | lnk.setFile( s ); //sets file name |
857 | 869 | ||
858 | } else { | 870 | } else { |
859 | // if( QFileInfo( s ).exists() ) { | 871 | // if( QFileInfo( s ).exists() ) { |
860 | lnk.setName( QFileInfo(s).baseName()); | 872 | lnk.setName( QFileInfo(s).baseName()); |
861 | // if(s.right(4) == '.') {//if regular file | 873 | // if(s.right(4) == '.') {//if regular file |
862 | if(s.left(1) != "/") { | 874 | if(s.left(1) != "/") { |
863 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 875 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
864 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 876 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
865 | // lnk.setIcon(MimeType(s).pixmap() ); | 877 | // lnk.setIcon(MimeType(s).pixmap() ); |
866 | // lnk.setIcon("SoundPlayer"); | 878 | // lnk.setIcon("SoundPlayer"); |
867 | } else { | 879 | } else { |
868 | // qDebug("set link2 "+s); | 880 | // qDebug("set link2 "+s); |
869 | lnk.setFile( s); | 881 | lnk.setFile( s); |
870 | // lnk.setIcon(MimeType(s).pixmap() ); | 882 | // lnk.setIcon(MimeType(s).pixmap() ); |
871 | // lnk.setIcon("SoundPlayer"); | 883 | // lnk.setIcon("SoundPlayer"); |
872 | } | 884 | } |
873 | } | 885 | } |
874 | d->selectedFiles->addToSelection( lnk ); | 886 | d->selectedFiles->addToSelection( lnk ); |
875 | } | 887 | } |
876 | Config config( "OpiePlayer" ); | 888 | Config config( "OpiePlayer" ); |
877 | config.setGroup( "PlayList" ); | 889 | config.setGroup( "PlayList" ); |
878 | 890 | ||
879 | config.writeEntry("CurrentPlaylist",filename); | 891 | config.writeEntry("CurrentPlaylist",filename); |
880 | config.write(); | 892 | config.write(); |
881 | currentPlayList=filename; | 893 | currentPlayList=filename; |
882 | 894 | ||
883 | // m3uList->write(); | 895 | // m3uList->write(); |
884 | m3uList->close(); | 896 | m3uList->close(); |
885 | if(m3uList) delete m3uList; | 897 | if(m3uList) delete m3uList; |
886 | 898 | ||
887 | d->selectedFiles->setSelectedItem( s); | 899 | d->selectedFiles->setSelectedItem( s); |
888 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 900 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
889 | 901 | ||
890 | } | 902 | } |
891 | 903 | ||
892 | /* | 904 | /* |
893 | reads pls and adds files/urls to playlist */ | 905 | reads pls and adds files/urls to playlist */ |
894 | void PlayListWidget::readPls( const QString &filename ) { | 906 | void PlayListWidget::readPls( const QString &filename ) { |
895 | 907 | ||
896 | qDebug( "pls filename is " + filename ); | 908 | qDebug( "pls filename is " + filename ); |
897 | Om3u *m3uList; | 909 | Om3u *m3uList; |
898 | QString s, name; | 910 | QString s, name; |
899 | m3uList = new Om3u( filename, IO_ReadOnly ); | 911 | m3uList = new Om3u( filename, IO_ReadOnly ); |
900 | m3uList->readPls(); | 912 | m3uList->readPls(); |
901 | 913 | ||
902 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 914 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
903 | s = *it; | 915 | s = *it; |
904 | // s.replace( QRegExp( "%20" )," " ); | 916 | // s.replace( QRegExp( "%20" )," " ); |
905 | DocLnk lnk( s ); | 917 | DocLnk lnk( s ); |
906 | QFileInfo f( s ); | 918 | QFileInfo f( s ); |
907 | QString name = f.baseName(); | 919 | QString name = f.baseName(); |
908 | 920 | ||
909 | if( name.left( 4 ) == "http" ) { | 921 | if( name.left( 4 ) == "http" ) { |
910 | name = s.right( s.length() - 7); | 922 | name = s.right( s.length() - 7); |
911 | } else { | 923 | } else { |
912 | name = s; | 924 | name = s; |
913 | } | 925 | } |
914 | 926 | ||
915 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 927 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
916 | 928 | ||
917 | lnk.setName( name ); | 929 | lnk.setName( name ); |
918 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | 930 | if( s.at( s.length() - 4) == '.') {// if this is probably a file |
919 | lnk.setFile( s ); | 931 | lnk.setFile( s ); |
920 | } else { //if its a url | 932 | } else { //if its a url |
921 | // if( name.right( 1 ).find( '/' ) == -1) { | 933 | // if( name.right( 1 ).find( '/' ) == -1) { |
922 | // s += "/"; | 934 | // s += "/"; |
923 | // } | 935 | // } |
924 | lnk.setFile( s ); | 936 | lnk.setFile( s ); |
925 | } | 937 | } |
926 | lnk.setType( "audio/x-mpegurl" ); | 938 | lnk.setType( "audio/x-mpegurl" ); |
927 | 939 | ||
928 | lnk.writeLink(); | 940 | lnk.writeLink(); |
929 | d->selectedFiles->addToSelection( lnk ); | 941 | d->selectedFiles->addToSelection( lnk ); |
930 | } | 942 | } |
931 | 943 | ||
932 | m3uList->close(); | 944 | m3uList->close(); |
933 | if(m3uList) delete m3uList; | 945 | if(m3uList) delete m3uList; |
934 | } | 946 | } |
935 | 947 | ||
936 | /* | 948 | /* |
937 | writes current playlist to current m3u file */ | 949 | writes current playlist to current m3u file */ |
938 | void PlayListWidget::writeCurrentM3u() { | 950 | void PlayListWidget::writeCurrentM3u() { |
939 | qDebug("writing to current m3u"); | 951 | qDebug("writing to current m3u"); |
940 | Config cfg( "OpiePlayer" ); | 952 | Config cfg( "OpiePlayer" ); |
941 | cfg.setGroup("PlayList"); | 953 | cfg.setGroup("PlayList"); |
942 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 954 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
943 | 955 | ||
944 | Om3u *m3uList; | 956 | Om3u *m3uList; |
945 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 957 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
946 | if( d->selectedFiles->first()) { | 958 | if( d->selectedFiles->first()) { |
947 | 959 | ||
948 | do { | 960 | do { |
949 | qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 961 | qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
950 | m3uList->add( d->selectedFiles->current()->file() ); | 962 | m3uList->add( d->selectedFiles->current()->file() ); |
951 | } | 963 | } |
952 | while ( d->selectedFiles->next() ); | 964 | while ( d->selectedFiles->next() ); |
953 | qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 965 | qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
954 | m3uList->write(); | 966 | m3uList->write(); |
955 | m3uList->close(); | 967 | m3uList->close(); |
956 | 968 | ||
957 | if(m3uList) delete m3uList; | 969 | if(m3uList) delete m3uList; |
958 | } | 970 | } |
959 | 971 | ||
960 | } | 972 | } |
961 | 973 | ||
962 | /* | 974 | /* |
963 | writes current playlist to m3u file */ | 975 | writes current playlist to m3u file */ |
964 | void PlayListWidget::writem3u() { | 976 | void PlayListWidget::writem3u() { |
965 | InputDialog *fileDlg; | 977 | InputDialog *fileDlg; |
966 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 978 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
967 | fileDlg->exec(); | 979 | fileDlg->exec(); |
968 | QString name, filename, list; | 980 | QString name, filename, list; |
969 | Om3u *m3uList; | 981 | Om3u *m3uList; |
970 | 982 | ||
971 | if( fileDlg->result() == 1 ) { | 983 | if( fileDlg->result() == 1 ) { |
972 | name = fileDlg->text(); | 984 | name = fileDlg->text(); |
973 | // qDebug( filename ); | 985 | // qDebug( filename ); |
974 | 986 | ||
975 | if( name.left( 1) != "/" ) { | 987 | if( name.left( 1) != "/" ) { |
976 | filename = QPEApplication::documentDir() + "/" + name; | 988 | filename = QPEApplication::documentDir() + "/" + name; |
977 | } | 989 | } |
978 | 990 | ||
979 | if( name.right( 3 ) != "m3u" ) { | 991 | if( name.right( 3 ) != "m3u" ) { |
980 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | 992 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; |
981 | } | 993 | } |
982 | 994 | ||
983 | if( d->selectedFiles->first()) { | 995 | if( d->selectedFiles->first()) { |
984 | m3uList = new Om3u(filename, IO_ReadWrite); | 996 | m3uList = new Om3u(filename, IO_ReadWrite); |
985 | 997 | ||
986 | do { | 998 | do { |
987 | m3uList->add( d->selectedFiles->current()->file()); | 999 | m3uList->add( d->selectedFiles->current()->file()); |
988 | } | 1000 | } |
989 | while ( d->selectedFiles->next() ); | 1001 | while ( d->selectedFiles->next() ); |
990 | // qDebug( list ); | 1002 | // qDebug( list ); |
991 | m3uList->write(); | 1003 | m3uList->write(); |
992 | m3uList->close(); | 1004 | m3uList->close(); |
993 | if(m3uList) delete m3uList; | 1005 | if(m3uList) delete m3uList; |
994 | 1006 | ||
995 | if(fileDlg) delete fileDlg; | 1007 | if(fileDlg) delete fileDlg; |
996 | 1008 | ||
997 | DocLnk lnk; | 1009 | DocLnk lnk; |
998 | lnk.setFile( filename); | 1010 | lnk.setFile( filename); |
999 | // lnk.setIcon("opieplayer2/playlist2"); | 1011 | lnk.setIcon("opieplayer2/playlist2"); |
1000 | lnk.setName( name); //sets file name | 1012 | lnk.setName( name); //sets file name |
1001 | 1013 | ||
1002 | // qDebug(filename); | 1014 | // qDebug(filename); |
1003 | Config config( "OpiePlayer" ); | 1015 | Config config( "OpiePlayer" ); |
1004 | config.setGroup( "PlayList" ); | 1016 | config.setGroup( "PlayList" ); |
1005 | 1017 | ||
1006 | config.writeEntry("CurrentPlaylist",filename); | 1018 | config.writeEntry("CurrentPlaylist",filename); |
1007 | currentPlayList=filename; | 1019 | currentPlayList=filename; |
1008 | 1020 | ||
1009 | if(!lnk.writeLink()) { | 1021 | if(!lnk.writeLink()) { |
1010 | qDebug("Writing doclink did not work"); | 1022 | qDebug("Writing doclink did not work"); |
1011 | } | 1023 | } |
1012 | 1024 | ||
1013 | setCaption(tr("OpiePlayer: ") + name); | 1025 | setCaption(tr("OpiePlayer: ") + name); |
1014 | } | 1026 | } |
1015 | } | 1027 | } |
1016 | } | 1028 | } |
1017 | 1029 | ||
1018 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 1030 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
1019 | switch ( e->key() ) { | 1031 | switch ( e->key() ) { |
1020 | ////////////////////////////// Zaurus keys | 1032 | ////////////////////////////// Zaurus keys |
1021 | case Key_F9: //activity | 1033 | case Key_F9: //activity |
1022 | // if(audioUI->isHidden()) | 1034 | // if(audioUI->isHidden()) |
1023 | // audioUI->showMaximized(); | 1035 | // audioUI->showMaximized(); |
1024 | break; | 1036 | break; |
1025 | case Key_F10: //contacts | 1037 | case Key_F10: //contacts |
1026 | // if( videoUI->isHidden()) | 1038 | // if( videoUI->isHidden()) |
1027 | // videoUI->showMaximized(); | 1039 | // videoUI->showMaximized(); |
1028 | break; | 1040 | break; |
1029 | case Key_F11: //menu | 1041 | case Key_F11: //menu |
1030 | break; | 1042 | break; |
1031 | case Key_F12: //home | 1043 | case Key_F12: //home |
1032 | // doBlank(); | 1044 | // doBlank(); |
1033 | break; | 1045 | break; |
1034 | case Key_F13: //mail | 1046 | case Key_F13: //mail |
1035 | // doUnblank(); | 1047 | // doUnblank(); |
1036 | break; | 1048 | break; |
1037 | case Key_Q: //add to playlist | 1049 | case Key_Q: //add to playlist |
1038 | addSelected(); | 1050 | addSelected(); |
1039 | break; | 1051 | break; |
1040 | case Key_R: //remove from playlist | 1052 | case Key_R: //remove from playlist |
1041 | removeSelected(); | 1053 | removeSelected(); |
1042 | break; | 1054 | break; |
1043 | // case Key_P: //play | 1055 | // case Key_P: //play |
1044 | // qDebug("Play"); | 1056 | // qDebug("Play"); |
1045 | // playSelected(); | 1057 | // playSelected(); |
1046 | // break; | 1058 | // break; |
1047 | case Key_Space: | 1059 | case Key_Space: |
1048 | // playSelected(); puh | 1060 | // playSelected(); puh |
1049 | break; | 1061 | break; |
1050 | case Key_1: | 1062 | case Key_1: |
1051 | tabWidget->setCurrentPage( 0 ); | 1063 | tabWidget->setCurrentPage( 0 ); |
1052 | break; | 1064 | break; |
1053 | case Key_2: | 1065 | case Key_2: |
1054 | tabWidget->setCurrentPage( 1 ); | 1066 | tabWidget->setCurrentPage( 1 ); |
1055 | break; | 1067 | break; |
1056 | case Key_3: | 1068 | case Key_3: |
1057 | tabWidget->setCurrentPage( 2 ); | 1069 | tabWidget->setCurrentPage( 2 ); |
1058 | break; | 1070 | break; |
1059 | case Key_4: | 1071 | case Key_4: |
1060 | tabWidget->setCurrentPage( 3 ); | 1072 | tabWidget->setCurrentPage( 3 ); |
1061 | break; | 1073 | break; |
1062 | case Key_Down: | 1074 | case Key_Down: |
1063 | if ( !d->selectedFiles->next() ) | 1075 | if ( !d->selectedFiles->next() ) |
1064 | d->selectedFiles->first(); | 1076 | d->selectedFiles->first(); |
1065 | break; | 1077 | break; |
1066 | case Key_Up: | 1078 | case Key_Up: |
1067 | if ( !d->selectedFiles->prev() ) | 1079 | if ( !d->selectedFiles->prev() ) |
1068 | // d->selectedFiles->last(); | 1080 | // d->selectedFiles->last(); |
1069 | break; | 1081 | break; |
1070 | } | 1082 | } |
1071 | } | 1083 | } |
1072 | 1084 | ||
1073 | void PlayListWidget::pmViewActivated(int index) { | 1085 | void PlayListWidget::pmViewActivated(int index) { |
1074 | // qDebug("%d", index); | 1086 | // qDebug("%d", index); |
1075 | switch(index) { | 1087 | switch(index) { |
1076 | case -16: | 1088 | case -16: |
1077 | { | 1089 | { |
1078 | mediaPlayerState->toggleFullscreen(); | 1090 | mediaPlayerState->toggleFullscreen(); |
1079 | bool b=mediaPlayerState->fullscreen(); | 1091 | bool b=mediaPlayerState->fullscreen(); |
1080 | pmView->setItemChecked( index, b); | 1092 | pmView->setItemChecked( index, b); |
1081 | Config cfg( "OpiePlayer" ); | 1093 | Config cfg( "OpiePlayer" ); |
1082 | cfg.writeEntry( "FullScreen", b ); | 1094 | cfg.writeEntry( "FullScreen", b ); |
1083 | } | 1095 | } |
1084 | break; | 1096 | break; |
1085 | }; | 1097 | }; |
1086 | } | 1098 | } |
1087 | 1099 | ||
1088 | void PlayListWidget::populateSkinsMenu() { | 1100 | void PlayListWidget::populateSkinsMenu() { |
1089 | int item = 0; | 1101 | int item = 0; |
1090 | defaultSkinIndex = 0; | 1102 | defaultSkinIndex = 0; |
1091 | QString skinName; | 1103 | QString skinName; |
1092 | Config cfg( "OpiePlayer" ); | 1104 | Config cfg( "OpiePlayer" ); |
1093 | cfg.setGroup("Options" ); | 1105 | cfg.setGroup("Options" ); |
1094 | QString skin = cfg.readEntry( "Skin", "default" ); | 1106 | QString skin = cfg.readEntry( "Skin", "default" ); |
1095 | 1107 | ||
1096 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1108 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1097 | skinsDir.setFilter( QDir::Dirs ); | 1109 | skinsDir.setFilter( QDir::Dirs ); |
1098 | skinsDir.setSorting(QDir::Name ); | 1110 | skinsDir.setSorting(QDir::Name ); |
1099 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1111 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1100 | QFileInfoListIterator it( *skinslist ); | 1112 | QFileInfoListIterator it( *skinslist ); |
1101 | QFileInfo *fi; | 1113 | QFileInfo *fi; |
1102 | while ( ( fi = it.current() ) ) { | 1114 | while ( ( fi = it.current() ) ) { |
1103 | skinName = fi->fileName(); | 1115 | skinName = fi->fileName(); |
1104 | // qDebug( fi->fileName() ); | 1116 | // qDebug( fi->fileName() ); |
1105 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1117 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1106 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1118 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1107 | } | 1119 | } |
1108 | if( skinName == "default" ) { | 1120 | if( skinName == "default" ) { |
1109 | defaultSkinIndex = item; | 1121 | defaultSkinIndex = item; |
1110 | } | 1122 | } |
1111 | if( skinName == skin ) { | 1123 | if( skinName == skin ) { |
1112 | skinsMenu->setItemChecked( item, TRUE ); | 1124 | skinsMenu->setItemChecked( item, TRUE ); |
1113 | } | 1125 | } |
1114 | ++it; | 1126 | ++it; |
1115 | } | 1127 | } |
1116 | } | 1128 | } |
1117 | 1129 | ||
1118 | void PlayListWidget::skinsMenuActivated( int item ) { | 1130 | void PlayListWidget::skinsMenuActivated( int item ) { |
1119 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1131 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1120 | skinsMenu->setItemChecked( i, FALSE ); | 1132 | skinsMenu->setItemChecked( i, FALSE ); |
1121 | } | 1133 | } |
1122 | skinsMenu->setItemChecked( item, TRUE ); | 1134 | skinsMenu->setItemChecked( item, TRUE ); |
1123 | 1135 | ||
1124 | Config cfg( "OpiePlayer" ); | 1136 | Config cfg( "OpiePlayer" ); |
1125 | cfg.setGroup("Options"); | 1137 | cfg.setGroup("Options"); |
1126 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1138 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1127 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1139 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1128 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1140 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); |
1129 | } | 1141 | } |
1130 | 1142 | ||
1131 | int PlayListWidget::whichList() { | 1143 | int PlayListWidget::whichList() { |
1132 | return tabWidget->currentPageIndex(); | 1144 | return tabWidget->currentPageIndex(); |
1133 | } | 1145 | } |
1134 | 1146 | ||
1135 | QString PlayListWidget::currentFileListPathName() { | 1147 | QString PlayListWidget::currentFileListPathName() { |
1136 | switch (whichList()) { | 1148 | switch (whichList()) { |
1137 | case 1: | 1149 | case 1: |
1138 | return audioView->currentItem()->text(3); | 1150 | return audioView->currentItem()->text(3); |
1139 | break; | 1151 | break; |
1140 | case 2: | 1152 | case 2: |
1141 | return videoView->currentItem()->text(3); | 1153 | return videoView->currentItem()->text(3); |
1142 | break; | 1154 | break; |
1143 | }; | 1155 | }; |
1144 | return ""; | 1156 | return ""; |
1145 | } | 1157 | } |