-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index a708cf6..92da73b 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -696,192 +696,201 @@ void PlayListWidget::scanForAudio() { | |||
696 | delete sdit.current(); | 696 | delete sdit.current(); |
697 | } | 697 | } |
698 | // Global::findDocuments( &files, "audio/*"); | 698 | // Global::findDocuments( &files, "audio/*"); |
699 | Global::findDocuments( &files, audioMimes); | 699 | Global::findDocuments( &files, audioMimes); |
700 | audioScan = true; | 700 | audioScan = true; |
701 | populateAudioView(); | 701 | populateAudioView(); |
702 | } | 702 | } |
703 | 703 | ||
704 | void PlayListWidget::scanForVideo() { | 704 | void PlayListWidget::scanForVideo() { |
705 | // qDebug("scan for video"); | 705 | // qDebug("scan for video"); |
706 | vFiles.detachChildren(); | 706 | vFiles.detachChildren(); |
707 | QListIterator<DocLnk> sdit( vFiles.children() ); | 707 | QListIterator<DocLnk> sdit( vFiles.children() ); |
708 | for ( ; sdit.current(); ++sdit ) { | 708 | for ( ; sdit.current(); ++sdit ) { |
709 | delete sdit.current(); | 709 | delete sdit.current(); |
710 | } | 710 | } |
711 | Global::findDocuments(&vFiles, "video/*"); | 711 | Global::findDocuments(&vFiles, "video/*"); |
712 | videoScan = true; | 712 | videoScan = true; |
713 | populateVideoView(); | 713 | populateVideoView(); |
714 | } | 714 | } |
715 | 715 | ||
716 | void PlayListWidget::populateAudioView() { | 716 | void PlayListWidget::populateAudioView() { |
717 | audioView->clear(); | 717 | audioView->clear(); |
718 | StorageInfo storageInfo; | 718 | StorageInfo storageInfo; |
719 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | 719 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); |
720 | if(!audioScan) { | 720 | if(!audioScan) { |
721 | scanForAudio(); | 721 | scanForAudio(); |
722 | } | 722 | } |
723 | 723 | ||
724 | QListIterator<DocLnk> dit( files.children() ); | 724 | QListIterator<DocLnk> dit( files.children() ); |
725 | // QListIterator<FileSystem> it ( fs ); | 725 | // QListIterator<FileSystem> it ( fs ); |
726 | audioView->clear(); | 726 | audioView->clear(); |
727 | 727 | ||
728 | QString storage; | 728 | QString storage; |
729 | for ( ; dit.current(); ++dit ) { | 729 | for ( ; dit.current(); ++dit ) { |
730 | // // for( ; it.current(); ++it ){ | 730 | // // for( ; it.current(); ++it ){ |
731 | // const QString name = (*dit)->name(); | 731 | // const QString name = (*dit)->name(); |
732 | // const QString path = (*dit)->path(); | 732 | // const QString path = (*dit)->path(); |
733 | // if(dit.current()->file().find(path) != -1 ) { | 733 | // if(dit.current()->file().find(path) != -1 ) { |
734 | // storage = name; | 734 | // storage = name; |
735 | // // } | 735 | // // } |
736 | // } | 736 | // } |
737 | 737 | ||
738 | QListViewItem * newItem; | 738 | QListViewItem * newItem; |
739 | if ( QFile( dit.current()->file()).exists() || | 739 | if ( QFile( dit.current()->file()).exists() || |
740 | dit.current()->file().left(4) == "http" ) { | 740 | dit.current()->file().left(4) == "http" ) { |
741 | long size; | 741 | long size; |
742 | if( dit.current()->file().left(4) == "http" ) | 742 | if( dit.current()->file().left(4) == "http" ) |
743 | size=0; | 743 | size=0; |
744 | else | 744 | else |
745 | size = QFile( dit.current()->file() ).size(); | 745 | size = QFile( dit.current()->file() ).size(); |
746 | 746 | ||
747 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 747 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
748 | QString::number(size ), "" /*storage*/, | 748 | QString::number(size ), "" /*storage*/, |
749 | dit.current()->file() ); | 749 | dit.current()->file() ); |
750 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 750 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
751 | // qDebug("<<<< "+dit.current()->file()); | 751 | // qDebug("<<<< "+dit.current()->file()); |
752 | } | 752 | } |
753 | } | 753 | } |
754 | audioPopulated=true; | 754 | audioPopulated=true; |
755 | } | 755 | } |
756 | 756 | ||
757 | 757 | ||
758 | void PlayListWidget::populateVideoView() { | 758 | void PlayListWidget::populateVideoView() { |
759 | videoView->clear(); | 759 | videoView->clear(); |
760 | StorageInfo storageInfo; | 760 | StorageInfo storageInfo; |
761 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | 761 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); |
762 | 762 | ||
763 | if(!videoScan ) { | 763 | if(!videoScan ) { |
764 | scanForVideo(); | 764 | scanForVideo(); |
765 | } | 765 | } |
766 | 766 | ||
767 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 767 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
768 | // QListIterator<FileSystem> it ( fs ); | 768 | // QListIterator<FileSystem> it ( fs ); |
769 | videoView->clear(); | 769 | videoView->clear(); |
770 | QString storage, pathName; | 770 | QString storage, pathName; |
771 | for ( ; Vdit.current(); ++Vdit ) { | 771 | for ( ; Vdit.current(); ++Vdit ) { |
772 | // // for( ; it.current(); ++it ) { | 772 | // // for( ; it.current(); ++it ) { |
773 | // const QString name = (*Vdit)->name(); | 773 | // const QString name = (*Vdit)->name(); |
774 | // const QString path = (*Vdit)->path(); | 774 | // const QString path = (*Vdit)->path(); |
775 | // if( Vdit.current()->file().find(path) != -1 ) { | 775 | // if( Vdit.current()->file().find(path) != -1 ) { |
776 | // storage=name; | 776 | // storage=name; |
777 | // pathName=path; | 777 | // pathName=path; |
778 | // // } | 778 | // // } |
779 | // } | 779 | // } |
780 | 780 | ||
781 | QListViewItem * newItem; | 781 | QListViewItem * newItem; |
782 | if ( QFile( Vdit.current()->file() ).exists() ) { | 782 | if ( QFile( Vdit.current()->file() ).exists() ) { |
783 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 783 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
784 | QString::number( QFile( Vdit.current()->file() ).size() ), | 784 | QString::number( QFile( Vdit.current()->file() ).size() ), |
785 | ""/*storage*/, Vdit.current()->file()); | 785 | ""/*storage*/, Vdit.current()->file()); |
786 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 786 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
787 | } | 787 | } |
788 | } | 788 | } |
789 | videoPopulated=true; | 789 | videoPopulated=true; |
790 | } | 790 | } |
791 | 791 | ||
792 | QListView *PlayListWidget::currentFileListView() const | ||
793 | { | ||
794 | switch ( currentTab() ) { | ||
795 | case AudioFiles: return audioView; | ||
796 | case VideoFiles: return videoView; | ||
797 | default: assert( false ); | ||
798 | } | ||
799 | return 0; | ||
800 | } | ||
792 | 801 | ||
793 | void PlayListWidget::openFile() { | 802 | void PlayListWidget::openFile() { |
794 | // http://66.28.164.33:2080 | 803 | // http://66.28.164.33:2080 |
795 | // http://somafm.com/star0242.m3u | 804 | // http://somafm.com/star0242.m3u |
796 | QString filename, name; | 805 | QString filename, name; |
797 | InputDialog *fileDlg; | 806 | InputDialog *fileDlg; |
798 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 807 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
799 | fileDlg->exec(); | 808 | fileDlg->exec(); |
800 | if( fileDlg->result() == 1 ) { | 809 | if( fileDlg->result() == 1 ) { |
801 | filename = fileDlg->text(); | 810 | filename = fileDlg->text(); |
802 | qDebug( "Selected filename is " + filename ); | 811 | qDebug( "Selected filename is " + filename ); |
803 | // Om3u *m3uList; | 812 | // Om3u *m3uList; |
804 | DocLnk lnk; | 813 | DocLnk lnk; |
805 | Config cfg( "OpiePlayer" ); | 814 | Config cfg( "OpiePlayer" ); |
806 | cfg.setGroup("PlayList"); | 815 | cfg.setGroup("PlayList"); |
807 | 816 | ||
808 | if(filename.left(4) == "http") { | 817 | if(filename.left(4) == "http") { |
809 | QString m3uFile, m3uFilePath; | 818 | QString m3uFile, m3uFilePath; |
810 | if(filename.find(":",8,TRUE) != -1) { //found a port | 819 | if(filename.find(":",8,TRUE) != -1) { //found a port |
811 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 820 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
812 | m3uFile = m3uFile.right( 7); | 821 | m3uFile = m3uFile.right( 7); |
813 | } else if(filename.left(4) == "http"){ | 822 | } else if(filename.left(4) == "http"){ |
814 | m3uFile=filename; | 823 | m3uFile=filename; |
815 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 824 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
816 | } else{ | 825 | } else{ |
817 | m3uFile=filename; | 826 | m3uFile=filename; |
818 | } | 827 | } |
819 | 828 | ||
820 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 829 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
821 | lnk.setName( filename ); //sets name | 830 | lnk.setName( filename ); //sets name |
822 | lnk.setFile( filename ); //sets file name | 831 | lnk.setFile( filename ); //sets file name |
823 | 832 | ||
824 | // lnk.setIcon("opieplayer2/musicfile"); | 833 | // lnk.setIcon("opieplayer2/musicfile"); |
825 | 834 | ||
826 | d->selectedFiles->addToSelection( lnk ); | 835 | d->selectedFiles->addToSelection( lnk ); |
827 | writeCurrentM3u(); | 836 | writeCurrentM3u(); |
828 | d->selectedFiles->setSelectedItem( lnk.name()); | 837 | d->selectedFiles->setSelectedItem( lnk.name()); |
829 | } | 838 | } |
830 | else if( filename.right( 3) == "m3u" ) { | 839 | else if( filename.right( 3) == "m3u" ) { |
831 | readm3u( filename ); | 840 | readm3u( filename ); |
832 | 841 | ||
833 | } else if( filename.right(3) == "pls" ) { | 842 | } else if( filename.right(3) == "pls" ) { |
834 | readPls( filename ); | 843 | readPls( filename ); |
835 | } else { | 844 | } else { |
836 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 845 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
837 | lnk.setFile( filename ); //sets file name | 846 | lnk.setFile( filename ); //sets file name |
838 | d->selectedFiles->addToSelection( lnk); | 847 | d->selectedFiles->addToSelection( lnk); |
839 | writeCurrentM3u(); | 848 | writeCurrentM3u(); |
840 | d->selectedFiles->setSelectedItem( lnk.name()); | 849 | d->selectedFiles->setSelectedItem( lnk.name()); |
841 | } | 850 | } |
842 | } | 851 | } |
843 | 852 | ||
844 | if( fileDlg ) { | 853 | if( fileDlg ) { |
845 | delete fileDlg; | 854 | delete fileDlg; |
846 | } | 855 | } |
847 | } | 856 | } |
848 | 857 | ||
849 | /* | 858 | /* |
850 | reads m3u and shows files/urls to playlist widget */ | 859 | reads m3u and shows files/urls to playlist widget */ |
851 | void PlayListWidget::readm3u( const QString &filename ) { | 860 | void PlayListWidget::readm3u( const QString &filename ) { |
852 | qDebug( "read m3u filename " + filename ); | 861 | qDebug( "read m3u filename " + filename ); |
853 | 862 | ||
854 | Om3u *m3uList; | 863 | Om3u *m3uList; |
855 | QString s, name; | 864 | QString s, name; |
856 | m3uList = new Om3u( filename, IO_ReadOnly ); | 865 | m3uList = new Om3u( filename, IO_ReadOnly ); |
857 | m3uList->readM3u(); | 866 | m3uList->readM3u(); |
858 | DocLnk lnk; | 867 | DocLnk lnk; |
859 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 868 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
860 | s = *it; | 869 | s = *it; |
861 | // qDebug("reading "+ s); | 870 | // qDebug("reading "+ s); |
862 | if(s.left(4)=="http") { | 871 | if(s.left(4)=="http") { |
863 | lnk.setName( s ); //sets file name | 872 | lnk.setName( s ); //sets file name |
864 | lnk.setIcon("opieplayer2/musicfile"); | 873 | lnk.setIcon("opieplayer2/musicfile"); |
865 | lnk.setFile( s ); //sets file name | 874 | lnk.setFile( s ); //sets file name |
866 | 875 | ||
867 | } else { | 876 | } else { |
868 | // if( QFileInfo( s ).exists() ) { | 877 | // if( QFileInfo( s ).exists() ) { |
869 | lnk.setName( QFileInfo(s).baseName()); | 878 | lnk.setName( QFileInfo(s).baseName()); |
870 | // if(s.right(4) == '.') {//if regular file | 879 | // if(s.right(4) == '.') {//if regular file |
871 | if(s.left(1) != "/") { | 880 | if(s.left(1) != "/") { |
872 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 881 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
873 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 882 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
874 | // lnk.setIcon(MimeType(s).pixmap() ); | 883 | // lnk.setIcon(MimeType(s).pixmap() ); |
875 | // lnk.setIcon("SoundPlayer"); | 884 | // lnk.setIcon("SoundPlayer"); |
876 | } else { | 885 | } else { |
877 | // qDebug("set link2 "+s); | 886 | // qDebug("set link2 "+s); |
878 | lnk.setFile( s); | 887 | lnk.setFile( s); |
879 | // lnk.setIcon(MimeType(s).pixmap() ); | 888 | // lnk.setIcon(MimeType(s).pixmap() ); |
880 | // lnk.setIcon("SoundPlayer"); | 889 | // lnk.setIcon("SoundPlayer"); |
881 | } | 890 | } |
882 | } | 891 | } |
883 | d->selectedFiles->addToSelection( lnk ); | 892 | d->selectedFiles->addToSelection( lnk ); |
884 | } | 893 | } |
885 | Config config( "OpiePlayer" ); | 894 | Config config( "OpiePlayer" ); |
886 | config.setGroup( "PlayList" ); | 895 | config.setGroup( "PlayList" ); |
887 | 896 | ||
@@ -1060,105 +1069,98 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | |||
1060 | tabWidget->setCurrentPage( 0 ); | 1069 | tabWidget->setCurrentPage( 0 ); |
1061 | break; | 1070 | break; |
1062 | case Key_2: | 1071 | case Key_2: |
1063 | tabWidget->setCurrentPage( 1 ); | 1072 | tabWidget->setCurrentPage( 1 ); |
1064 | break; | 1073 | break; |
1065 | case Key_3: | 1074 | case Key_3: |
1066 | tabWidget->setCurrentPage( 2 ); | 1075 | tabWidget->setCurrentPage( 2 ); |
1067 | break; | 1076 | break; |
1068 | case Key_4: | 1077 | case Key_4: |
1069 | tabWidget->setCurrentPage( 3 ); | 1078 | tabWidget->setCurrentPage( 3 ); |
1070 | break; | 1079 | break; |
1071 | case Key_Down: | 1080 | case Key_Down: |
1072 | if ( !d->selectedFiles->next() ) | 1081 | if ( !d->selectedFiles->next() ) |
1073 | d->selectedFiles->first(); | 1082 | d->selectedFiles->first(); |
1074 | break; | 1083 | break; |
1075 | case Key_Up: | 1084 | case Key_Up: |
1076 | if ( !d->selectedFiles->prev() ) | 1085 | if ( !d->selectedFiles->prev() ) |
1077 | // d->selectedFiles->last(); | 1086 | // d->selectedFiles->last(); |
1078 | break; | 1087 | break; |
1079 | } | 1088 | } |
1080 | } | 1089 | } |
1081 | 1090 | ||
1082 | void PlayListWidget::pmViewActivated(int index) { | 1091 | void PlayListWidget::pmViewActivated(int index) { |
1083 | // qDebug("%d", index); | 1092 | // qDebug("%d", index); |
1084 | switch(index) { | 1093 | switch(index) { |
1085 | case -16: | 1094 | case -16: |
1086 | { | 1095 | { |
1087 | mediaPlayerState->toggleFullscreen(); | 1096 | mediaPlayerState->toggleFullscreen(); |
1088 | bool b=mediaPlayerState->isFullscreen(); | 1097 | bool b=mediaPlayerState->isFullscreen(); |
1089 | pmView->setItemChecked( index, b); | 1098 | pmView->setItemChecked( index, b); |
1090 | Config cfg( "OpiePlayer" ); | 1099 | Config cfg( "OpiePlayer" ); |
1091 | cfg.writeEntry( "FullScreen", b ); | 1100 | cfg.writeEntry( "FullScreen", b ); |
1092 | } | 1101 | } |
1093 | break; | 1102 | break; |
1094 | }; | 1103 | }; |
1095 | } | 1104 | } |
1096 | 1105 | ||
1097 | void PlayListWidget::populateSkinsMenu() { | 1106 | void PlayListWidget::populateSkinsMenu() { |
1098 | int item = 0; | 1107 | int item = 0; |
1099 | defaultSkinIndex = 0; | 1108 | defaultSkinIndex = 0; |
1100 | QString skinName; | 1109 | QString skinName; |
1101 | Config cfg( "OpiePlayer" ); | 1110 | Config cfg( "OpiePlayer" ); |
1102 | cfg.setGroup("Options" ); | 1111 | cfg.setGroup("Options" ); |
1103 | QString skin = cfg.readEntry( "Skin", "default" ); | 1112 | QString skin = cfg.readEntry( "Skin", "default" ); |
1104 | 1113 | ||
1105 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1114 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1106 | skinsDir.setFilter( QDir::Dirs ); | 1115 | skinsDir.setFilter( QDir::Dirs ); |
1107 | skinsDir.setSorting(QDir::Name ); | 1116 | skinsDir.setSorting(QDir::Name ); |
1108 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1117 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1109 | QFileInfoListIterator it( *skinslist ); | 1118 | QFileInfoListIterator it( *skinslist ); |
1110 | QFileInfo *fi; | 1119 | QFileInfo *fi; |
1111 | while ( ( fi = it.current() ) ) { | 1120 | while ( ( fi = it.current() ) ) { |
1112 | skinName = fi->fileName(); | 1121 | skinName = fi->fileName(); |
1113 | // qDebug( fi->fileName() ); | 1122 | // qDebug( fi->fileName() ); |
1114 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1123 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1115 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1124 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1116 | } | 1125 | } |
1117 | if( skinName == "default" ) { | 1126 | if( skinName == "default" ) { |
1118 | defaultSkinIndex = item; | 1127 | defaultSkinIndex = item; |
1119 | } | 1128 | } |
1120 | if( skinName == skin ) { | 1129 | if( skinName == skin ) { |
1121 | skinsMenu->setItemChecked( item, TRUE ); | 1130 | skinsMenu->setItemChecked( item, TRUE ); |
1122 | } | 1131 | } |
1123 | ++it; | 1132 | ++it; |
1124 | } | 1133 | } |
1125 | } | 1134 | } |
1126 | 1135 | ||
1127 | void PlayListWidget::skinsMenuActivated( int item ) { | 1136 | void PlayListWidget::skinsMenuActivated( int item ) { |
1128 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1137 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1129 | skinsMenu->setItemChecked( i, FALSE ); | 1138 | skinsMenu->setItemChecked( i, FALSE ); |
1130 | } | 1139 | } |
1131 | skinsMenu->setItemChecked( item, TRUE ); | 1140 | skinsMenu->setItemChecked( item, TRUE ); |
1132 | 1141 | ||
1133 | Config cfg( "OpiePlayer" ); | 1142 | Config cfg( "OpiePlayer" ); |
1134 | cfg.setGroup("Options"); | 1143 | cfg.setGroup("Options"); |
1135 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1144 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1136 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1145 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1137 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1146 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); |
1138 | } | 1147 | } |
1139 | 1148 | ||
1140 | int PlayListWidget::whichList() const { | 1149 | int PlayListWidget::whichList() const { |
1141 | return tabWidget->currentPageIndex(); | 1150 | return tabWidget->currentPageIndex(); |
1142 | } | 1151 | } |
1143 | 1152 | ||
1144 | PlayListWidget::TabType PlayListWidget::currentTab() const | 1153 | PlayListWidget::TabType PlayListWidget::currentTab() const |
1145 | { | 1154 | { |
1146 | static const TabType indexToTabType[ NumTabTypes ] = | 1155 | static const TabType indexToTabType[ NumTabTypes ] = |
1147 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 1156 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
1148 | 1157 | ||
1149 | int index = tabWidget->currentPageIndex(); | 1158 | int index = tabWidget->currentPageIndex(); |
1150 | assert( index < NumTabTypes && index >= 0 ); | 1159 | assert( index < NumTabTypes && index >= 0 ); |
1151 | 1160 | ||
1152 | return indexToTabType[ index ]; | 1161 | return indexToTabType[ index ]; |
1153 | } | 1162 | } |
1154 | 1163 | ||
1155 | QString PlayListWidget::currentFileListPathName() const { | 1164 | QString PlayListWidget::currentFileListPathName() const { |
1156 | switch (currentTab()) { | 1165 | return currentFileListView()->currentItem()->text( 3 ); |
1157 | case AudioFiles: | ||
1158 | return audioView->currentItem()->text(3); | ||
1159 | case VideoFiles: | ||
1160 | return videoView->currentItem()->text(3); | ||
1161 | default: assert( false ); | ||
1162 | }; | ||
1163 | return QString::null; | ||
1164 | } | 1166 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 7044abe..a608eae 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -1,124 +1,126 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef PLAY_LIST_WIDGET_H | 34 | #ifndef PLAY_LIST_WIDGET_H |
35 | #define PLAY_LIST_WIDGET_H | 35 | #define PLAY_LIST_WIDGET_H |
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qpe/fileselector.h> | 40 | #include <qpe/fileselector.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qpopupmenu.h> | 42 | #include <qpopupmenu.h> |
43 | 43 | ||
44 | #include "playlistwidgetgui.h" | 44 | #include "playlistwidgetgui.h" |
45 | 45 | ||
46 | 46 | ||
47 | //class PlayListWidgetPrivate; | 47 | //class PlayListWidgetPrivate; |
48 | class Config; | 48 | class Config; |
49 | class QListViewItem; | 49 | class QListViewItem; |
50 | class QListView; | 50 | class QListView; |
51 | class QPoint; | 51 | class QPoint; |
52 | class QAction; | 52 | class QAction; |
53 | class QLabel; | 53 | class QLabel; |
54 | 54 | ||
55 | class PlayListWidget : public PlayListWidgetGui { | 55 | class PlayListWidget : public PlayListWidgetGui { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists, NumTabTypes = 4 }; | 58 | enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists, NumTabTypes = 4 }; |
59 | 59 | ||
60 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 60 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
61 | ~PlayListWidget(); | 61 | ~PlayListWidget(); |
62 | DocLnkSet files; | 62 | DocLnkSet files; |
63 | DocLnkSet vFiles; | 63 | DocLnkSet vFiles; |
64 | bool fromSetDocument; | 64 | bool fromSetDocument; |
65 | bool insanityBool; | 65 | bool insanityBool; |
66 | QString setDocFileRef, currentPlayList; | 66 | QString setDocFileRef, currentPlayList; |
67 | // retrieve the current playlist entry (media file link) | 67 | // retrieve the current playlist entry (media file link) |
68 | const DocLnk *current(); | 68 | const DocLnk *current(); |
69 | void useSelectedDocument(); | 69 | void useSelectedDocument(); |
70 | int selected; | 70 | int selected; |
71 | int whichList() const; | 71 | int whichList() const; |
72 | TabType currentTab() const; | 72 | TabType currentTab() const; |
73 | 73 | ||
74 | public slots: | 74 | public slots: |
75 | bool first(); | 75 | bool first(); |
76 | bool last(); | 76 | bool last(); |
77 | bool next(); | 77 | bool next(); |
78 | bool prev(); | 78 | bool prev(); |
79 | void writeDefaultPlaylist( ); | 79 | void writeDefaultPlaylist( ); |
80 | QString currentFileListPathName() const; | 80 | QString currentFileListPathName() const; |
81 | protected: | 81 | protected: |
82 | void keyReleaseEvent( QKeyEvent *e); | 82 | void keyReleaseEvent( QKeyEvent *e); |
83 | 83 | ||
84 | private: | 84 | private: |
85 | int defaultSkinIndex; | 85 | int defaultSkinIndex; |
86 | bool audioScan, videoScan, audioPopulated, videoPopulated; | 86 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
87 | void readm3u(const QString &); | 87 | void readm3u(const QString &); |
88 | void readPls(const QString &); | 88 | void readPls(const QString &); |
89 | void initializeStates(); | 89 | void initializeStates(); |
90 | void populateAudioView(); | 90 | void populateAudioView(); |
91 | void populateVideoView(); | 91 | void populateVideoView(); |
92 | 92 | ||
93 | QListView *currentFileListView() const; | ||
94 | |||
93 | private slots: | 95 | private slots: |
94 | void populateSkinsMenu(); | 96 | void populateSkinsMenu(); |
95 | void skinsMenuActivated(int); | 97 | void skinsMenuActivated(int); |
96 | void pmViewActivated(int); | 98 | void pmViewActivated(int); |
97 | void writem3u(); | 99 | void writem3u(); |
98 | void writeCurrentM3u(); | 100 | void writeCurrentM3u(); |
99 | void scanForAudio(); | 101 | void scanForAudio(); |
100 | void scanForVideo(); | 102 | void scanForVideo(); |
101 | void openFile(); | 103 | void openFile(); |
102 | void setDocument( const QString& fileref ); | 104 | void setDocument( const QString& fileref ); |
103 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 105 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
104 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 106 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
105 | void setPlaylist( bool ); // Show/Hide the playlist | 107 | void setPlaylist( bool ); // Show/Hide the playlist |
106 | void clearList(); | 108 | void clearList(); |
107 | void addAllToList(); | 109 | void addAllToList(); |
108 | void addAllMusicToList(); | 110 | void addAllMusicToList(); |
109 | void addAllVideoToList(); | 111 | void addAllVideoToList(); |
110 | void saveList(); // Save the playlist | 112 | void saveList(); // Save the playlist |
111 | void loadList( const DocLnk &); // Load a playlist | 113 | void loadList( const DocLnk &); // Load a playlist |
112 | void playIt( QListViewItem *); | 114 | void playIt( QListViewItem *); |
113 | void btnPlay(bool); | 115 | void btnPlay(bool); |
114 | void deletePlaylist(); | 116 | void deletePlaylist(); |
115 | void addSelected(); | 117 | void addSelected(); |
116 | void removeSelected(); | 118 | void removeSelected(); |
117 | void tabChanged(QWidget*); | 119 | void tabChanged(QWidget*); |
118 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 120 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
119 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 121 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
120 | void playSelected(); | 122 | void playSelected(); |
121 | }; | 123 | }; |
122 | 124 | ||
123 | #endif // PLAY_LIST_WIDGET_H | 125 | #endif // PLAY_LIST_WIDGET_H |
124 | 126 | ||