Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 84 |
1 files changed, 51 insertions, 33 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 3bd04bc..15c70c3 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -318,13 +318,13 @@ void PlayListWidget::setDocument( const QString& fileref ) { | |||
318 | void PlayListWidget::useSelectedDocument() { | 318 | void PlayListWidget::useSelectedDocument() { |
319 | d->setDocumentUsed = FALSE; | 319 | d->setDocumentUsed = FALSE; |
320 | } | 320 | } |
321 | 321 | ||
322 | 322 | ||
323 | const DocLnk *PlayListWidget::current() { // this is fugly | 323 | const DocLnk *PlayListWidget::current() { // this is fugly |
324 | switch ( tabWidget->currentPageIndex() ) { | 324 | switch ( whichList() ) { |
325 | case 0: //playlist | 325 | case 0: //playlist |
326 | { | 326 | { |
327 | // qDebug("playlist"); | 327 | // qDebug("playlist"); |
328 | if ( mediaPlayerState->playlist() ) { | 328 | if ( mediaPlayerState->playlist() ) { |
329 | return d->selectedFiles->current(); | 329 | return d->selectedFiles->current(); |
330 | } else if ( d->setDocumentUsed && d->current ) { | 330 | } else if ( d->setDocumentUsed && d->current ) { |
@@ -391,12 +391,13 @@ bool PlayListWidget::prev() { | |||
391 | return mediaPlayerState->looping(); | 391 | return mediaPlayerState->looping(); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | 395 | ||
396 | bool PlayListWidget::next() { | 396 | bool PlayListWidget::next() { |
397 | qDebug("<<<<<<<<<<<<next()"); | ||
397 | if ( mediaPlayerState->playlist() ) { | 398 | if ( mediaPlayerState->playlist() ) { |
398 | if ( mediaPlayerState->shuffled() ) { | 399 | if ( mediaPlayerState->shuffled() ) { |
399 | return prev(); | 400 | return prev(); |
400 | } else { | 401 | } else { |
401 | if ( !d->selectedFiles->next() ) { | 402 | if ( !d->selectedFiles->next() ) { |
402 | if ( mediaPlayerState->looping() ) { | 403 | if ( mediaPlayerState->looping() ) { |
@@ -494,13 +495,13 @@ void PlayListWidget::addSelected() { | |||
494 | 495 | ||
495 | Config cfg( "OpiePlayer" ); | 496 | Config cfg( "OpiePlayer" ); |
496 | cfg.setGroup("PlayList"); | 497 | cfg.setGroup("PlayList"); |
497 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 498 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
498 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 499 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
499 | 500 | ||
500 | switch (tabWidget->currentPageIndex()) { | 501 | switch (whichList()) { |
501 | case 0: //playlist | 502 | case 0: //playlist |
502 | break; | 503 | break; |
503 | case 1: { //audio | 504 | case 1: { //audio |
504 | QListViewItemIterator it( audioView ); | 505 | QListViewItemIterator it( audioView ); |
505 | // iterate through all items of the listview | 506 | // iterate through all items of the listview |
506 | for ( ; it.current(); ++it ) { | 507 | for ( ; it.current(); ++it ) { |
@@ -554,13 +555,13 @@ void PlayListWidget::playIt( QListViewItem *it) { | |||
554 | 555 | ||
555 | 556 | ||
556 | void PlayListWidget::addToSelection( QListViewItem *it) { | 557 | void PlayListWidget::addToSelection( QListViewItem *it) { |
557 | d->setDocumentUsed = FALSE; | 558 | d->setDocumentUsed = FALSE; |
558 | 559 | ||
559 | if(it) { | 560 | if(it) { |
560 | switch (tabWidget->currentPageIndex()) { | 561 | switch ( whichList()) { |
561 | case 1: { | 562 | case 1: { |
562 | QListIterator<DocLnk> dit( files.children() ); | 563 | QListIterator<DocLnk> dit( files.children() ); |
563 | for ( ; dit.current(); ++dit ) { | 564 | for ( ; dit.current(); ++dit ) { |
564 | if( dit.current()->name() == it->text(0)) { | 565 | if( dit.current()->name() == it->text(0)) { |
565 | if(QFileInfo( dit.current()->file()).exists()) | 566 | if(QFileInfo( dit.current()->file()).exists()) |
566 | d->selectedFiles->addToSelection( **dit ); | 567 | d->selectedFiles->addToSelection( **dit ); |
@@ -585,13 +586,13 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
585 | } | 586 | } |
586 | } | 587 | } |
587 | 588 | ||
588 | 589 | ||
589 | void PlayListWidget::tabChanged(QWidget *) { | 590 | void PlayListWidget::tabChanged(QWidget *) { |
590 | 591 | ||
591 | switch ( tabWidget->currentPageIndex()) { | 592 | switch ( whichList()) { |
592 | case 0: | 593 | case 0: |
593 | { | 594 | { |
594 | if( !tbDeletePlaylist->isHidden() ) { | 595 | if( !tbDeletePlaylist->isHidden() ) { |
595 | tbDeletePlaylist->hide(); | 596 | tbDeletePlaylist->hide(); |
596 | } | 597 | } |
597 | d->tbRemoveFromList->setEnabled(TRUE); | 598 | d->tbRemoveFromList->setEnabled(TRUE); |
@@ -631,41 +632,40 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
631 | break; | 632 | break; |
632 | }; | 633 | }; |
633 | } | 634 | } |
634 | 635 | ||
635 | 636 | ||
636 | void PlayListWidget::btnPlay(bool b) { | 637 | void PlayListWidget::btnPlay(bool b) { |
637 | // mediaPlayerState->setPlaying(b); | ||
638 | switch ( tabWidget->currentPageIndex()) { | ||
639 | case 0: | ||
640 | { | ||
641 | mediaPlayerState->setPlaying(b); | ||
642 | } | ||
643 | break; | ||
644 | case 1: | ||
645 | { | ||
646 | addToSelection( audioView->currentItem() ); | ||
647 | mediaPlayerState->setPlaying(b); | ||
648 | d->selectedFiles->removeSelected( ); | ||
649 | tabWidget->setCurrentPage(1); | ||
650 | d->selectedFiles->unSelect(); | ||
651 | insanityBool=FALSE; | ||
652 | }// audioView->clearSelection(); | ||
653 | break; | ||
654 | case 2: | ||
655 | { | ||
656 | addToSelection( videoView->currentItem() ); | ||
657 | mediaPlayerState->setPlaying(b); | 638 | mediaPlayerState->setPlaying(b); |
658 | qApp->processEvents(); | 639 | qApp->processEvents(); |
659 | d->selectedFiles->removeSelected( ); | ||
660 | tabWidget->setCurrentPage(2); | ||
661 | d->selectedFiles->unSelect(); | ||
662 | insanityBool=FALSE; | 640 | insanityBool=FALSE; |
663 | }// videoView->clearSelection(); | 641 | // switch ( whichList()) { |
664 | break; | 642 | // case 0: |
665 | }; | 643 | // { |
644 | // mediaPlayerState->setPlaying(b); | ||
645 | // } | ||
646 | // break; | ||
647 | // case 1: | ||
648 | // { | ||
649 | // mediaPlayerState->setPlaying(b); | ||
650 | // qApp->processEvents(); | ||
651 | // insanityBool=FALSE; | ||
652 | // }// audioView->clearSelection(); | ||
653 | // break; | ||
654 | // case 2: | ||
655 | // { | ||
656 | // // addToSelection( videoView->currentItem() ); | ||
657 | // mediaPlayerState->setPlaying(b); | ||
658 | // qApp->processEvents(); | ||
659 | // // d->selectedFiles->removeSelected( ); | ||
660 | // // tabWidget->setCurrentPage(2); | ||
661 | // // d->selectedFiles->unSelect(); | ||
662 | // insanityBool=FALSE; | ||
663 | // }// videoView->clearSelection(); | ||
664 | // break; | ||
665 | // }; | ||
666 | 666 | ||
667 | } | 667 | } |
668 | 668 | ||
669 | void PlayListWidget::deletePlaylist() { | 669 | void PlayListWidget::deletePlaylist() { |
670 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 670 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
671 | (tr("You really want to delete\nthis playlist?")), | 671 | (tr("You really want to delete\nthis playlist?")), |
@@ -733,13 +733,14 @@ void PlayListWidget::populateAudioView() { | |||
733 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 733 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
734 | long size; | 734 | long size; |
735 | if( dit.current()->file().left(4) == "http" ) | 735 | if( dit.current()->file().left(4) == "http" ) |
736 | size=0; | 736 | size=0; |
737 | else | 737 | else |
738 | size = QFile( dit.current()->file() ).size(); | 738 | size = QFile( dit.current()->file() ).size(); |
739 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); | 739 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
740 | QString::number(size ), storage, dit.current()->file()); | ||
740 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 741 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
741 | } | 742 | } |
742 | } | 743 | } |
743 | } | 744 | } |
744 | 745 | ||
745 | 746 | ||
@@ -752,26 +753,27 @@ void PlayListWidget::populateVideoView() { | |||
752 | scanForVideo(); | 753 | scanForVideo(); |
753 | } | 754 | } |
754 | 755 | ||
755 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 756 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
756 | QListIterator<FileSystem> it ( fs ); | 757 | QListIterator<FileSystem> it ( fs ); |
757 | videoView->clear(); | 758 | videoView->clear(); |
758 | QString storage; | 759 | QString storage, pathName; |
759 | for ( ; Vdit.current(); ++Vdit ) { | 760 | for ( ; Vdit.current(); ++Vdit ) { |
760 | for( ; it.current(); ++it ) { | 761 | for( ; it.current(); ++it ) { |
761 | const QString name = (*it)->name(); | 762 | const QString name = (*it)->name(); |
762 | const QString path = (*it)->path(); | 763 | const QString path = (*it)->path(); |
763 | if( Vdit.current()->file().find(path) != -1 ) { | 764 | if( Vdit.current()->file().find(path) != -1 ) { |
764 | storage=name; | 765 | storage=name; |
766 | pathName=path; | ||
765 | } | 767 | } |
766 | } | 768 | } |
767 | 769 | ||
768 | QListViewItem * newItem; | 770 | QListViewItem * newItem; |
769 | if ( QFile( Vdit.current()->file() ).exists() ) { | 771 | if ( QFile( Vdit.current()->file() ).exists() ) { |
770 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 772 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
771 | QString::number( QFile( Vdit.current()->file() ).size() ), storage ); | 773 | QString::number( QFile( Vdit.current()->file() ).size() ), storage, Vdit.current()->file()); |
772 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 774 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
773 | } | 775 | } |
774 | } | 776 | } |
775 | } | 777 | } |
776 | 778 | ||
777 | 779 | ||
@@ -1059,6 +1061,22 @@ void PlayListWidget::skinsMenuActivated( int item ) { | |||
1059 | skinsMenu->setItemChecked( item, TRUE ); | 1061 | skinsMenu->setItemChecked( item, TRUE ); |
1060 | 1062 | ||
1061 | Config cfg( "OpiePlayer" ); | 1063 | Config cfg( "OpiePlayer" ); |
1062 | cfg.setGroup("Options"); | 1064 | cfg.setGroup("Options"); |
1063 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1065 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1064 | } | 1066 | } |
1067 | |||
1068 | int PlayListWidget::whichList() { | ||
1069 | return tabWidget->currentPageIndex(); | ||
1070 | } | ||
1071 | |||
1072 | QString PlayListWidget::currentFileListPathName() { | ||
1073 | switch (whichList()) { | ||
1074 | case 1: | ||
1075 | return audioView->currentItem()->text(3); | ||
1076 | break; | ||
1077 | case 2: | ||
1078 | return videoView->currentItem()->text(3); | ||
1079 | break; | ||
1080 | }; | ||
1081 | return ""; | ||
1082 | } | ||