summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/playlistwidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 4460833..956d206 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -179,17 +179,17 @@ void PlayListWidget::writeDefaultPlaylist() {
179 Config config( "OpiePlayer" ); 179 Config config( "OpiePlayer" );
180 config.setGroup( "PlayList" ); 180 config.setGroup( "PlayList" );
181 QString filename=QPEApplication::documentDir() + "/default.m3u"; 181 QString filename=QPEApplication::documentDir() + "/default.m3u";
182 QString currentString = config.readEntry( "CurrentPlaylist", filename); 182 QString currentString = config.readEntry( "CurrentPlaylist", filename);
183 if( currentString == filename) { 183 if( currentString == filename) {
184 Om3u *m3uList; 184 Om3u *m3uList;
185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 185 // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
186 if( d->selectedFiles->first() ) { 186 if( d->selectedFiles->first() ) {
187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
188 do { 188 do {
189 // qDebug(d->selectedFiles->current()->file()); 189 // odebug << d->selectedFiles->current()->file() << oendl;
190 m3uList->add( d->selectedFiles->current()->file() ); 190 m3uList->add( d->selectedFiles->current()->file() );
191 } 191 }
192 while ( d->selectedFiles->next() ); 192 while ( d->selectedFiles->next() );
193 193
194 m3uList->write(); 194 m3uList->write();
195 m3uList->close(); 195 m3uList->close();
@@ -322,13 +322,13 @@ void PlayListWidget::addAllVideoToList() {
322 writeCurrentM3u(); 322 writeCurrentM3u();
323 d->selectedFiles->first(); 323 d->selectedFiles->first();
324} 324}
325 325
326 326
327void PlayListWidget::setDocument( const QString& fileref ) { 327void PlayListWidget::setDocument( const QString& fileref ) {
328 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 328 // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
329 fromSetDocument = TRUE; 329 fromSetDocument = TRUE;
330 QFileInfo fileInfo(fileref); 330 QFileInfo fileInfo(fileref);
331 331
332 if ( !fileInfo.exists() ) { 332 if ( !fileInfo.exists() ) {
333 QMessageBox::warning( this, tr( "Invalid File" ), 333 QMessageBox::warning( this, tr( "Invalid File" ),
334 tr( "There was a problem in getting the file." ) ); 334 tr( "There was a problem in getting the file." ) );
@@ -398,13 +398,13 @@ bool PlayListWidget::prev() {
398 return TRUE; 398 return TRUE;
399 } 399 }
400} 400}
401 401
402 402
403bool PlayListWidget::next() { 403bool PlayListWidget::next() {
404//qDebug("<<<<<<<<<<<<next()"); 404//odebug << "<<<<<<<<<<<<next()" << oendl;
405 if ( mediaPlayerState->isShuffled() ) { 405 if ( mediaPlayerState->isShuffled() ) {
406 return prev(); 406 return prev();
407 } else { 407 } else {
408 if ( !d->selectedFiles->next() ) { 408 if ( !d->selectedFiles->next() ) {
409 if ( mediaPlayerState->isLooping() ) { 409 if ( mediaPlayerState->isLooping() ) {
410 return d->selectedFiles->first(); 410 return d->selectedFiles->first();
@@ -609,13 +609,13 @@ void PlayListWidget::openURL() {
609 QString filename, name; 609 QString filename, name;
610 InputDialog *fileDlg; 610 InputDialog *fileDlg;
611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
612 fileDlg->exec(); 612 fileDlg->exec();
613 if( fileDlg->result() == 1 ) { 613 if( fileDlg->result() == 1 ) {
614 filename = fileDlg->text(); 614 filename = fileDlg->text();
615 qDebug( "Selected filename is " + filename ); 615 odebug << "Selected filename is " + filename << oendl;
616 // Om3u *m3uList; 616 // Om3u *m3uList;
617 DocLnk lnk; 617 DocLnk lnk;
618 Config cfg( "OpiePlayer" ); 618 Config cfg( "OpiePlayer" );
619 cfg.setGroup("PlayList"); 619 cfg.setGroup("PlayList");
620 620
621 if(filename.left(4) == "http") { 621 if(filename.left(4) == "http") {
@@ -685,13 +685,13 @@ void PlayListWidget::openFile() {
685 str=str.right(str.length()-1); 685 str=str.right(str.length()-1);
686 } 686 }
687 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); 687 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() );
688 688
689 if( !str.isEmpty() ) { 689 if( !str.isEmpty() ) {
690 690
691 qDebug( "Selected filename is " + str ); 691 odebug << "Selected filename is " + str << oendl;
692 filename = str; 692 filename = str;
693 DocLnk lnk; 693 DocLnk lnk;
694 694
695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
696 readListFromFile( filename ); 696 readListFromFile( filename );
697 } else { 697 } else {
@@ -703,26 +703,26 @@ void PlayListWidget::openFile() {
703 } 703 }
704 } 704 }
705} 705}
706 706
707 707
708void PlayListWidget::readListFromFile( const QString &filename ) { 708void PlayListWidget::readListFromFile( const QString &filename ) {
709 qDebug( "read list filename " + filename ); 709 odebug << "read list filename " + filename << oendl;
710 QFileInfo fi(filename); 710 QFileInfo fi(filename);
711 Om3u *m3uList; 711 Om3u *m3uList;
712 QString s, name; 712 QString s, name;
713 m3uList = new Om3u( filename, IO_ReadOnly ); 713 m3uList = new Om3u( filename, IO_ReadOnly );
714 if(fi.extension(false).find("m3u",0,false) != -1 ) 714 if(fi.extension(false).find("m3u",0,false) != -1 )
715 m3uList->readM3u(); 715 m3uList->readM3u();
716 else if(fi.extension(false).find("pls",0,false) != -1 ) 716 else if(fi.extension(false).find("pls",0,false) != -1 )
717 m3uList->readPls(); 717 m3uList->readPls();
718 718
719 DocLnk lnk; 719 DocLnk lnk;
720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
721 s = *it; 721 s = *it;
722 // qDebug(s); 722 // odebug << s << oendl;
723 if(s.left(4)=="http") { 723 if(s.left(4)=="http") {
724 lnk.setName( s ); //sets file name 724 lnk.setName( s ); //sets file name
725 lnk.setIcon("opieplayer2/musicfile"); 725 lnk.setIcon("opieplayer2/musicfile");
726 lnk.setFile( s ); //sets file name 726 lnk.setFile( s ); //sets file name
727 727
728 } else { //is file 728 } else { //is file
@@ -750,27 +750,27 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
751 751
752} 752}
753 753
754// writes current playlist to current m3u file */ 754// writes current playlist to current m3u file */
755 void PlayListWidget::writeCurrentM3u() { 755 void PlayListWidget::writeCurrentM3u() {
756 qDebug("writing to current m3u"); 756 odebug << "writing to current m3u" << oendl;
757 Config cfg( "OpiePlayer" ); 757 Config cfg( "OpiePlayer" );
758 cfg.setGroup("PlayList"); 758 cfg.setGroup("PlayList");
759 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 759 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
760 760
761 Om3u *m3uList; 761 Om3u *m3uList;
762 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 762 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
763 if( d->selectedFiles->first()) { 763 if( d->selectedFiles->first()) {
764 764
765 do { 765 do {
766 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 766 // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
767 m3uList->add( d->selectedFiles->current()->file() ); 767 m3uList->add( d->selectedFiles->current()->file() );
768 } 768 }
769 while ( d->selectedFiles->next() ); 769 while ( d->selectedFiles->next() );
770 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 770 // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
771 m3uList->write(); 771 m3uList->write();
772 m3uList->close(); 772 m3uList->close();
773 } 773 }
774 delete m3uList; 774 delete m3uList;
775 775
776 } 776 }
@@ -809,13 +809,13 @@ void PlayListWidget::writem3u() {
809 QString name, filename, list; 809 QString name, filename, list;
810 Om3u *m3uList; 810 Om3u *m3uList;
811 811
812 if( !str.isEmpty() ) { 812 if( !str.isEmpty() ) {
813 name = str; 813 name = str;
814 // name = fileDlg->text(); 814 // name = fileDlg->text();
815// qDebug( filename ); 815// odebug << filename << oendl;
816 if( name.find("/",0,true) != -1) {// assume they specify a file path 816 if( name.find("/",0,true) != -1) {// assume they specify a file path
817 filename = name; 817 filename = name;
818 name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); 818 name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
819 } 819 }
820 else //otherwise dump it somewhere noticable 820 else //otherwise dump it somewhere noticable
821 filename = QPEApplication::documentDir() + "/" + name; 821 filename = QPEApplication::documentDir() + "/" + name;
@@ -827,33 +827,33 @@ void PlayListWidget::writem3u() {
827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); 827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate);
828 828
829 do { 829 do {
830 m3uList->add( d->selectedFiles->current()->file()); 830 m3uList->add( d->selectedFiles->current()->file());
831 } 831 }
832 while ( d->selectedFiles->next() ); 832 while ( d->selectedFiles->next() );
833 // qDebug( list ); 833 // odebug << list << oendl;
834 m3uList->write(); 834 m3uList->write();
835 m3uList->close(); 835 m3uList->close();
836 delete m3uList; 836 delete m3uList;
837 837
838 //delete fileDlg; 838 //delete fileDlg;
839 839
840 DocLnk lnk; 840 DocLnk lnk;
841 lnk.setFile( filename); 841 lnk.setFile( filename);
842 lnk.setIcon("opieplayer2/playlist2"); 842 lnk.setIcon("opieplayer2/playlist2");
843 lnk.setName( name); //sets file name 843 lnk.setName( name); //sets file name
844 844
845 // qDebug(filename); 845 // odebug << filename << oendl;
846 Config config( "OpiePlayer" ); 846 Config config( "OpiePlayer" );
847 config.setGroup( "PlayList" ); 847 config.setGroup( "PlayList" );
848 848
849 config.writeEntry("CurrentPlaylist",filename); 849 config.writeEntry("CurrentPlaylist",filename);
850 currentPlayList=filename; 850 currentPlayList=filename;
851 851
852 if(!lnk.writeLink()) { 852 if(!lnk.writeLink()) {
853 qDebug("Writing doclink did not work"); 853 odebug << "Writing doclink did not work" << oendl;
854 } 854 }
855 855
856 setCaption(tr("OpiePlayer: ") + name); 856 setCaption(tr("OpiePlayer: ") + name);
857 } 857 }
858 } 858 }
859} 859}
@@ -881,13 +881,13 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
881 addSelected(); 881 addSelected();
882 break; 882 break;
883 case Key_R: //remove from playlist 883 case Key_R: //remove from playlist
884 removeSelected(); 884 removeSelected();
885 break; 885 break;
886 // case Key_P: //play 886 // case Key_P: //play
887 // qDebug("Play"); 887 // odebug << "Play" << oendl;
888 // playSelected(); 888 // playSelected();
889 // break; 889 // break;
890 case Key_Space: 890 case Key_Space:
891 // playSelected(); puh 891 // playSelected(); puh
892 break; 892 break;
893 case Key_1: 893 case Key_1:
@@ -911,13 +911,13 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
911 // d->selectedFiles->last(); 911 // d->selectedFiles->last();
912 break; 912 break;
913 } 913 }
914} 914}
915 915
916void PlayListWidget::pmViewActivated(int index) { 916void PlayListWidget::pmViewActivated(int index) {
917// qDebug("%d", index); 917// odebug << "" << index << "" << oendl;
918 switch(index) { 918 switch(index) {
919 case -16: 919 case -16:
920 { 920 {
921 mediaPlayerState->toggleFullscreen(); 921 mediaPlayerState->toggleFullscreen();
922 bool b=mediaPlayerState->isFullscreen(); 922 bool b=mediaPlayerState->isFullscreen();
923 pmView->setItemChecked( index, b); 923 pmView->setItemChecked( index, b);
@@ -941,13 +941,13 @@ void PlayListWidget::populateSkinsMenu() {
941 skinsDir.setSorting(QDir::Name ); 941 skinsDir.setSorting(QDir::Name );
942 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 942 const QFileInfoList *skinslist = skinsDir.entryInfoList();
943 QFileInfoListIterator it( *skinslist ); 943 QFileInfoListIterator it( *skinslist );
944 QFileInfo *fi; 944 QFileInfo *fi;
945 while ( ( fi = it.current() ) ) { 945 while ( ( fi = it.current() ) ) {
946 skinName = fi->fileName(); 946 skinName = fi->fileName();
947// qDebug( fi->fileName() ); 947// odebug << fi->fileName() << oendl;
948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
949 item = skinsMenu->insertItem( fi->fileName() ) ; 949 item = skinsMenu->insertItem( fi->fileName() ) ;
950 } 950 }
951 if( skinName == "default" ) { 951 if( skinName == "default" ) {
952 defaultSkinIndex = item; 952 defaultSkinIndex = item;
953 } 953 }
@@ -997,13 +997,13 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const
997QString PlayListWidget::currentFileListPathName() const { 997QString PlayListWidget::currentFileListPathName() const {
998 return currentFileListView->currentItem()->text( 3 ); 998 return currentFileListView->currentItem()->text( 3 );
999} 999}
1000 1000
1001 1001
1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1003 qDebug("qcop message "+msg ); 1003 odebug << "qcop message "+msg << oendl;
1004 QDataStream stream ( data, IO_ReadOnly ); 1004 QDataStream stream ( data, IO_ReadOnly );
1005 if ( msg == "play()" ) { //plays current selection 1005 if ( msg == "play()" ) { //plays current selection
1006 btnPlay( true); 1006 btnPlay( true);
1007 } else if ( msg == "stop()" ) { 1007 } else if ( msg == "stop()" ) {
1008 mediaPlayerState->setPlaying( false); 1008 mediaPlayerState->setPlaying( false);
1009 } else if ( msg == "togglePause()" ) { 1009 } else if ( msg == "togglePause()" ) {