Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 36f77be..d73f0cd 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -175,49 +175,46 @@ void PlayListWidget::initializeStates() { | |||
175 | d->tbLoop->setOn( mediaPlayerState->isLooping() ); | 175 | d->tbLoop->setOn( mediaPlayerState->isLooping() ); |
176 | d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); | 176 | d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); |
177 | d->playListFrame->show(); | 177 | d->playListFrame->show(); |
178 | } | 178 | } |
179 | 179 | ||
180 | void PlayListWidget::writeDefaultPlaylist() { | 180 | void PlayListWidget::writeDefaultPlaylist() { |
181 | 181 | ||
182 | Config config( "OpiePlayer" ); | 182 | Config config( "OpiePlayer" ); |
183 | config.setGroup( "PlayList" ); | 183 | config.setGroup( "PlayList" ); |
184 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 184 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
185 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 185 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
186 | if( currentString == filename) { | 186 | if( currentString == filename) { |
187 | Om3u *m3uList; | 187 | Om3u *m3uList; |
188 | // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl; | ||
189 | if( d->selectedFiles->first() ) { | 188 | if( d->selectedFiles->first() ) { |
190 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 189 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
191 | do { | 190 | do { |
192 | // odebug << d->selectedFiles->current()->file() << oendl; | ||
193 | m3uList->add( d->selectedFiles->current()->file() ); | 191 | m3uList->add( d->selectedFiles->current()->file() ); |
194 | } | 192 | } |
195 | while ( d->selectedFiles->next() ); | 193 | while ( d->selectedFiles->next() ); |
196 | 194 | ||
197 | m3uList->write(); | 195 | m3uList->write(); |
198 | m3uList->close(); | 196 | m3uList->close(); |
199 | delete m3uList; | 197 | delete m3uList; |
200 | 198 | ||
201 | } | 199 | } |
202 | } | 200 | } |
203 | } | 201 | } |
204 | 202 | ||
205 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 203 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
206 | d->setDocumentUsed = FALSE; | 204 | d->setDocumentUsed = FALSE; |
207 | if( QFileInfo( lnk.file() ).exists() || | 205 | if( QFileInfo( lnk.file() ).exists() || |
208 | lnk.file().left(4) == "http" ) { | 206 | lnk.file().left(4) == "http" ) { |
209 | d->selectedFiles->addToSelection( lnk ); | 207 | d->selectedFiles->addToSelection( lnk ); |
210 | } | 208 | } |
211 | // writeCurrentM3u(); | ||
212 | } | 209 | } |
213 | 210 | ||
214 | 211 | ||
215 | void PlayListWidget::clearList() { | 212 | void PlayListWidget::clearList() { |
216 | while ( first() ) { | 213 | while ( first() ) { |
217 | d->selectedFiles->removeSelected(); | 214 | d->selectedFiles->removeSelected(); |
218 | } | 215 | } |
219 | Config cfg( "OpiePlayer" ); | 216 | Config cfg( "OpiePlayer" ); |
220 | cfg.setGroup("PlayList"); | 217 | cfg.setGroup("PlayList"); |
221 | cfg.writeEntry("CurrentPlaylist","default"); | 218 | cfg.writeEntry("CurrentPlaylist","default"); |
222 | setCaption("OpiePlayer"); | 219 | setCaption("OpiePlayer"); |
223 | } | 220 | } |
@@ -319,32 +316,32 @@ void PlayListWidget::addAllVideoToList() { | |||
319 | filename = videoIt.current()->text(3); | 316 | filename = videoIt.current()->text(3); |
320 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 317 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
321 | lnk.setFile( filename ); //sets file name | 318 | lnk.setFile( filename ); //sets file name |
322 | d->selectedFiles->addToSelection( lnk); | 319 | d->selectedFiles->addToSelection( lnk); |
323 | } | 320 | } |
324 | tabWidget->setCurrentPage(0); | 321 | tabWidget->setCurrentPage(0); |
325 | writeCurrentM3u(); | 322 | writeCurrentM3u(); |
326 | d->selectedFiles->first(); | 323 | d->selectedFiles->first(); |
327 | } | 324 | } |
328 | 325 | ||
329 | 326 | ||
330 | void PlayListWidget::setDocument( const QString& _fileref ) { | 327 | void PlayListWidget::setDocument( const QString& _fileref ) { |
331 | // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; | 328 | // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; |
332 | QString fileref = _fileref; | 329 | QString fileref = _fileref; |
333 | fromSetDocument = TRUE; | 330 | fromSetDocument = TRUE; |
334 | 331 | ||
335 | DocLnk lnk(_fileref); | 332 | DocLnk lnk(_fileref); |
336 | if(lnk.isValid()) | 333 | if(lnk.isValid()) |
337 | fileref = lnk.file(); | 334 | fileref = lnk.file(); |
338 | 335 | ||
339 | QFileInfo fileInfo(fileref); | 336 | QFileInfo fileInfo(fileref); |
340 | 337 | ||
341 | if ( !fileInfo.exists() ) { | 338 | if ( !fileInfo.exists() ) { |
342 | QMessageBox::warning( this, tr( "Invalid File" ), | 339 | QMessageBox::warning( this, tr( "Invalid File" ), |
343 | tr( "There was a problem in getting the file." ) ); | 340 | tr( "There was a problem in getting the file." ) ); |
344 | return; | 341 | return; |
345 | } | 342 | } |
346 | 343 | ||
347 | clearList(); | 344 | clearList(); |
348 | QString extension = fileInfo.extension(false); | 345 | QString extension = fileInfo.extension(false); |
349 | 346 | ||
350 | if( extension.find( "m3u", 0, false) != -1 | 347 | if( extension.find( "m3u", 0, false) != -1 |
@@ -401,25 +398,25 @@ bool PlayListWidget::prev() { | |||
401 | if ( mediaPlayerState->isLooping() ) { | 398 | if ( mediaPlayerState->isLooping() ) { |
402 | return d->selectedFiles->last(); | 399 | return d->selectedFiles->last(); |
403 | } else { | 400 | } else { |
404 | return FALSE; | 401 | return FALSE; |
405 | } | 402 | } |
406 | } | 403 | } |
407 | return TRUE; | 404 | return TRUE; |
408 | } | 405 | } |
409 | } | 406 | } |
410 | 407 | ||
411 | 408 | ||
412 | bool PlayListWidget::next() { | 409 | bool PlayListWidget::next() { |
413 | //odebug << "<<<<<<<<<<<<next()" << oendl; | 410 | //odebug << "<<<<<<<<<<<<next()" << oendl; |
414 | if ( mediaPlayerState->isShuffled() ) { | 411 | if ( mediaPlayerState->isShuffled() ) { |
415 | return prev(); | 412 | return prev(); |
416 | } else { | 413 | } else { |
417 | if ( !d->selectedFiles->next() ) { | 414 | if ( !d->selectedFiles->next() ) { |
418 | if ( mediaPlayerState->isLooping() ) { | 415 | if ( mediaPlayerState->isLooping() ) { |
419 | return d->selectedFiles->first(); | 416 | return d->selectedFiles->first(); |
420 | } else { | 417 | } else { |
421 | return FALSE; | 418 | return FALSE; |
422 | } | 419 | } |
423 | } | 420 | } |
424 | return TRUE; | 421 | return TRUE; |
425 | } | 422 | } |
@@ -612,25 +609,25 @@ bool PlayListWidget::inFileListMode() const | |||
612 | return tab == AudioFiles || tab == VideoFiles; | 609 | return tab == AudioFiles || tab == VideoFiles; |
613 | } | 610 | } |
614 | 611 | ||
615 | void PlayListWidget::openURL() { | 612 | void PlayListWidget::openURL() { |
616 | // http://66.28.164.33:2080 | 613 | // http://66.28.164.33:2080 |
617 | // http://somafm.com/star0242.m3u | 614 | // http://somafm.com/star0242.m3u |
618 | QString filename, name; | 615 | QString filename, name; |
619 | InputDialog *fileDlg; | 616 | InputDialog *fileDlg; |
620 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); | 617 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); |
621 | fileDlg->exec(); | 618 | fileDlg->exec(); |
622 | if( fileDlg->result() == 1 ) { | 619 | if( fileDlg->result() == 1 ) { |
623 | filename = fileDlg->text(); | 620 | filename = fileDlg->text(); |
624 | odebug << "Selected filename is " + filename << oendl; | 621 | odebug << "Selected filename is " + filename << oendl; |
625 | // Om3u *m3uList; | 622 | // Om3u *m3uList; |
626 | DocLnk lnk; | 623 | DocLnk lnk; |
627 | Config cfg( "OpiePlayer" ); | 624 | Config cfg( "OpiePlayer" ); |
628 | cfg.setGroup("PlayList"); | 625 | cfg.setGroup("PlayList"); |
629 | 626 | ||
630 | if(filename.left(4) == "http") { | 627 | if(filename.left(4) == "http") { |
631 | QString m3uFile, m3uFilePath; | 628 | QString m3uFile, m3uFilePath; |
632 | if(filename.find(":",8,TRUE) != -1) { //found a port | 629 | if(filename.find(":",8,TRUE) != -1) { //found a port |
633 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 630 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
634 | m3uFile = m3uFile.right( 7); | 631 | m3uFile = m3uFile.right( 7); |
635 | } else if(filename.left(4) == "http"){ | 632 | } else if(filename.left(4) == "http"){ |
636 | m3uFile=filename; | 633 | m3uFile=filename; |
@@ -688,56 +685,56 @@ void PlayListWidget::openFile() { | |||
688 | 685 | ||
689 | QString str = OFileDialog::getOpenFileName( 1, | 686 | QString str = OFileDialog::getOpenFileName( 1, |
690 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | 687 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", |
691 | types, 0 ); | 688 | types, 0 ); |
692 | 689 | ||
693 | if(str.left(2) == "//") { | 690 | if(str.left(2) == "//") { |
694 | str=str.right(str.length()-1); | 691 | str=str.right(str.length()-1); |
695 | } | 692 | } |
696 | cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); | 693 | cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); |
697 | 694 | ||
698 | if( !str.isEmpty() ) { | 695 | if( !str.isEmpty() ) { |
699 | 696 | ||
700 | odebug << "Selected filename is " + str << oendl; | 697 | odebug << "Selected filename is " + str << oendl; |
701 | filename = str; | 698 | filename = str; |
702 | DocLnk lnk; | 699 | DocLnk lnk; |
703 | 700 | ||
704 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { | 701 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { |
705 | readListFromFile( filename ); | 702 | readListFromFile( filename ); |
706 | } else { | 703 | } else { |
707 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 704 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
708 | lnk.setFile( filename ); //sets file name | 705 | lnk.setFile( filename ); //sets file name |
709 | d->selectedFiles->addToSelection( lnk ); | 706 | d->selectedFiles->addToSelection( lnk ); |
710 | writeCurrentM3u(); | 707 | writeCurrentM3u(); |
711 | d->selectedFiles->setSelectedItem( lnk.name() ); | 708 | d->selectedFiles->setSelectedItem( lnk.name() ); |
712 | } | 709 | } |
713 | } | 710 | } |
714 | } | 711 | } |
715 | 712 | ||
716 | 713 | ||
717 | void PlayListWidget::readListFromFile( const QString &filename ) { | 714 | void PlayListWidget::readListFromFile( const QString &filename ) { |
718 | odebug << "read list filename " + filename << oendl; | 715 | odebug << "read list filename " + filename << oendl; |
719 | QFileInfo fi(filename); | 716 | QFileInfo fi(filename); |
720 | Om3u *m3uList; | 717 | Om3u *m3uList; |
721 | QString s, name; | 718 | QString s, name; |
722 | m3uList = new Om3u( filename, IO_ReadOnly ); | 719 | m3uList = new Om3u( filename, IO_ReadOnly ); |
723 | if(fi.extension(false).find("m3u",0,false) != -1 ) | 720 | if(fi.extension(false).find("m3u",0,false) != -1 ) |
724 | m3uList->readM3u(); | 721 | m3uList->readM3u(); |
725 | else if(fi.extension(false).find("pls",0,false) != -1 ) | 722 | else if(fi.extension(false).find("pls",0,false) != -1 ) |
726 | m3uList->readPls(); | 723 | m3uList->readPls(); |
727 | 724 | ||
728 | DocLnk lnk; | 725 | DocLnk lnk; |
729 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 726 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
730 | s = *it; | 727 | s = *it; |
731 | // odebug << s << oendl; | 728 | // odebug << s << oendl; |
732 | if(s.left(4)=="http") { | 729 | if(s.left(4)=="http") { |
733 | lnk.setName( s ); //sets file name | 730 | lnk.setName( s ); //sets file name |
734 | lnk.setIcon("opieplayer2/musicfile"); | 731 | lnk.setIcon("opieplayer2/musicfile"); |
735 | lnk.setFile( s ); //sets file name | 732 | lnk.setFile( s ); //sets file name |
736 | 733 | ||
737 | } else { //is file | 734 | } else { //is file |
738 | lnk.setName( QFileInfo(s).baseName()); | 735 | lnk.setName( QFileInfo(s).baseName()); |
739 | if(s.left(1) != "/") { | 736 | if(s.left(1) != "/") { |
740 | 737 | ||
741 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 738 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
742 | } else { | 739 | } else { |
743 | lnk.setFile( s); | 740 | lnk.setFile( s); |
@@ -753,39 +750,39 @@ void PlayListWidget::readListFromFile( const QString &filename ) { | |||
753 | currentPlayList=filename; | 750 | currentPlayList=filename; |
754 | 751 | ||
755 | m3uList->close(); | 752 | m3uList->close(); |
756 | delete m3uList; | 753 | delete m3uList; |
757 | 754 | ||
758 | d->selectedFiles->setSelectedItem( s); | 755 | d->selectedFiles->setSelectedItem( s); |
759 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 756 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
760 | 757 | ||
761 | } | 758 | } |
762 | 759 | ||
763 | // writes current playlist to current m3u file */ | 760 | // writes current playlist to current m3u file */ |
764 | void PlayListWidget::writeCurrentM3u() { | 761 | void PlayListWidget::writeCurrentM3u() { |
765 | odebug << "writing to current m3u" << oendl; | 762 | odebug << "writing to current m3u" << oendl; |
766 | Config cfg( "OpiePlayer" ); | 763 | Config cfg( "OpiePlayer" ); |
767 | cfg.setGroup("PlayList"); | 764 | cfg.setGroup("PlayList"); |
768 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 765 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
769 | 766 | ||
770 | Om3u *m3uList; | 767 | Om3u *m3uList; |
771 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 768 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
772 | if( d->selectedFiles->first()) { | 769 | if( d->selectedFiles->first()) { |
773 | 770 | ||
774 | do { | 771 | do { |
775 | // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; | 772 | // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; |
776 | m3uList->add( d->selectedFiles->current()->file() ); | 773 | m3uList->add( d->selectedFiles->current()->file() ); |
777 | } | 774 | } |
778 | while ( d->selectedFiles->next() ); | 775 | while ( d->selectedFiles->next() ); |
779 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; | 776 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; |
780 | m3uList->write(); | 777 | m3uList->write(); |
781 | m3uList->close(); | 778 | m3uList->close(); |
782 | } | 779 | } |
783 | delete m3uList; | 780 | delete m3uList; |
784 | 781 | ||
785 | } | 782 | } |
786 | 783 | ||
787 | /* | 784 | /* |
788 | writes current playlist to m3u file */ | 785 | writes current playlist to m3u file */ |
789 | void PlayListWidget::writem3u() { | 786 | void PlayListWidget::writem3u() { |
790 | //InputDilog *fileDlg; | 787 | //InputDilog *fileDlg; |
791 | //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 788 | //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
@@ -812,63 +809,63 @@ void PlayListWidget::writem3u() { | |||
812 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | 809 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", |
813 | types, 0 ); | 810 | types, 0 ); |
814 | if(str.left(2) == "//") str=str.right(str.length()-1); | 811 | if(str.left(2) == "//") str=str.right(str.length()-1); |
815 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); | 812 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); |
816 | 813 | ||
817 | 814 | ||
818 | QString name, filename, list; | 815 | QString name, filename, list; |
819 | Om3u *m3uList; | 816 | Om3u *m3uList; |
820 | 817 | ||
821 | if( !str.isEmpty() ) { | 818 | if( !str.isEmpty() ) { |
822 | name = str; | 819 | name = str; |
823 | // name = fileDlg->text(); | 820 | // name = fileDlg->text(); |
824 | // odebug << filename << oendl; | 821 | // odebug << filename << oendl; |
825 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 822 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
826 | filename = name; | 823 | filename = name; |
827 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 824 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
828 | } | 825 | } |
829 | else //otherwise dump it somewhere noticable | 826 | else //otherwise dump it somewhere noticable |
830 | filename = QPEApplication::documentDir() + "/" + name; | 827 | filename = QPEApplication::documentDir() + "/" + name; |
831 | 828 | ||
832 | if( filename.right( 3 ) != "m3u" ) //needs filename extension | 829 | if( filename.right( 3 ) != "m3u" ) //needs filename extension |
833 | filename += ".m3u"; | 830 | filename += ".m3u"; |
834 | 831 | ||
835 | if( d->selectedFiles->first()) { //ramble through playlist view | 832 | if( d->selectedFiles->first()) { //ramble through playlist view |
836 | m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); | 833 | m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); |
837 | 834 | ||
838 | do { | 835 | do { |
839 | m3uList->add( d->selectedFiles->current()->file()); | 836 | m3uList->add( d->selectedFiles->current()->file()); |
840 | } | 837 | } |
841 | while ( d->selectedFiles->next() ); | 838 | while ( d->selectedFiles->next() ); |
842 | // odebug << list << oendl; | 839 | // odebug << list << oendl; |
843 | m3uList->write(); | 840 | m3uList->write(); |
844 | m3uList->close(); | 841 | m3uList->close(); |
845 | delete m3uList; | 842 | delete m3uList; |
846 | 843 | ||
847 | //delete fileDlg; | 844 | //delete fileDlg; |
848 | 845 | ||
849 | DocLnk lnk; | 846 | DocLnk lnk; |
850 | lnk.setFile( filename); | 847 | lnk.setFile( filename); |
851 | lnk.setIcon("opieplayer2/playlist2"); | 848 | lnk.setIcon("opieplayer2/playlist2"); |
852 | lnk.setName( name); //sets file name | 849 | lnk.setName( name); //sets file name |
853 | 850 | ||
854 | // odebug << filename << oendl; | 851 | // odebug << filename << oendl; |
855 | Config config( "OpiePlayer" ); | 852 | Config config( "OpiePlayer" ); |
856 | config.setGroup( "PlayList" ); | 853 | config.setGroup( "PlayList" ); |
857 | 854 | ||
858 | config.writeEntry("CurrentPlaylist",filename); | 855 | config.writeEntry("CurrentPlaylist",filename); |
859 | currentPlayList=filename; | 856 | currentPlayList=filename; |
860 | 857 | ||
861 | if(!lnk.writeLink()) { | 858 | if(!lnk.writeLink()) { |
862 | odebug << "Writing doclink did not work" << oendl; | 859 | odebug << "Writing doclink did not work" << oendl; |
863 | } | 860 | } |
864 | 861 | ||
865 | setCaption(tr("OpiePlayer: ") + name); | 862 | setCaption(tr("OpiePlayer: ") + name); |
866 | } | 863 | } |
867 | } | 864 | } |
868 | } | 865 | } |
869 | 866 | ||
870 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 867 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
871 | switch ( e->key() ) { | 868 | switch ( e->key() ) { |
872 | ////////////////////////////// Zaurus keys | 869 | ////////////////////////////// Zaurus keys |
873 | case Key_F9: //activity | 870 | case Key_F9: //activity |
874 | // if(audioUI->isHidden()) | 871 | // if(audioUI->isHidden()) |
@@ -884,25 +881,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | |||
884 | // doBlank(); | 881 | // doBlank(); |
885 | break; | 882 | break; |
886 | case Key_F13: //mail | 883 | case Key_F13: //mail |
887 | // doUnblank(); | 884 | // doUnblank(); |
888 | break; | 885 | break; |
889 | case Key_Q: //add to playlist | 886 | case Key_Q: //add to playlist |
890 | addSelected(); | 887 | addSelected(); |
891 | break; | 888 | break; |
892 | case Key_R: //remove from playlist | 889 | case Key_R: //remove from playlist |
893 | removeSelected(); | 890 | removeSelected(); |
894 | break; | 891 | break; |
895 | // case Key_P: //play | 892 | // case Key_P: //play |
896 | // odebug << "Play" << oendl; | 893 | // odebug << "Play" << oendl; |
897 | // playSelected(); | 894 | // playSelected(); |
898 | // break; | 895 | // break; |
899 | case Key_Space: | 896 | case Key_Space: |
900 | // playSelected(); puh | 897 | // playSelected(); puh |
901 | break; | 898 | break; |
902 | case Key_1: | 899 | case Key_1: |
903 | tabWidget->setCurrentPage( 0 ); | 900 | tabWidget->setCurrentPage( 0 ); |
904 | break; | 901 | break; |
905 | case Key_2: | 902 | case Key_2: |
906 | tabWidget->setCurrentPage( 1 ); | 903 | tabWidget->setCurrentPage( 1 ); |
907 | break; | 904 | break; |
908 | case Key_3: | 905 | case Key_3: |
@@ -914,25 +911,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | |||
914 | case Key_Down: | 911 | case Key_Down: |
915 | if ( !d->selectedFiles->next() ) | 912 | if ( !d->selectedFiles->next() ) |
916 | d->selectedFiles->first(); | 913 | d->selectedFiles->first(); |
917 | break; | 914 | break; |
918 | case Key_Up: | 915 | case Key_Up: |
919 | if ( !d->selectedFiles->prev() ) | 916 | if ( !d->selectedFiles->prev() ) |
920 | // d->selectedFiles->last(); | 917 | // d->selectedFiles->last(); |
921 | break; | 918 | break; |
922 | } | 919 | } |
923 | } | 920 | } |
924 | 921 | ||
925 | void PlayListWidget::pmViewActivated(int index) { | 922 | void PlayListWidget::pmViewActivated(int index) { |
926 | // odebug << "" << index << "" << oendl; | 923 | // odebug << "" << index << "" << oendl; |
927 | switch(index) { | 924 | switch(index) { |
928 | case -16: | 925 | case -16: |
929 | { | 926 | { |
930 | mediaPlayerState->toggleFullscreen(); | 927 | mediaPlayerState->toggleFullscreen(); |
931 | bool b=mediaPlayerState->isFullscreen(); | 928 | bool b=mediaPlayerState->isFullscreen(); |
932 | pmView->setItemChecked( index, b); | 929 | pmView->setItemChecked( index, b); |
933 | Config cfg( "OpiePlayer" ); | 930 | Config cfg( "OpiePlayer" ); |
934 | cfg.writeEntry( "FullScreen", b ); | 931 | cfg.writeEntry( "FullScreen", b ); |
935 | } | 932 | } |
936 | break; | 933 | break; |
937 | }; | 934 | }; |
938 | } | 935 | } |
@@ -944,25 +941,25 @@ void PlayListWidget::populateSkinsMenu() { | |||
944 | Config cfg( "OpiePlayer" ); | 941 | Config cfg( "OpiePlayer" ); |
945 | cfg.setGroup("Options" ); | 942 | cfg.setGroup("Options" ); |
946 | QString skin = cfg.readEntry( "Skin", "default" ); | 943 | QString skin = cfg.readEntry( "Skin", "default" ); |
947 | 944 | ||
948 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 945 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
949 | skinsDir.setFilter( QDir::Dirs ); | 946 | skinsDir.setFilter( QDir::Dirs ); |
950 | skinsDir.setSorting(QDir::Name ); | 947 | skinsDir.setSorting(QDir::Name ); |
951 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 948 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
952 | QFileInfoListIterator it( *skinslist ); | 949 | QFileInfoListIterator it( *skinslist ); |
953 | QFileInfo *fi; | 950 | QFileInfo *fi; |
954 | while ( ( fi = it.current() ) ) { | 951 | while ( ( fi = it.current() ) ) { |
955 | skinName = fi->fileName(); | 952 | skinName = fi->fileName(); |
956 | // odebug << fi->fileName() << oendl; | 953 | // odebug << fi->fileName() << oendl; |
957 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 954 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
958 | item = skinsMenu->insertItem( fi->fileName() ) ; | 955 | item = skinsMenu->insertItem( fi->fileName() ) ; |
959 | } | 956 | } |
960 | if( skinName == "default" ) { | 957 | if( skinName == "default" ) { |
961 | defaultSkinIndex = item; | 958 | defaultSkinIndex = item; |
962 | } | 959 | } |
963 | if( skinName == skin ) { | 960 | if( skinName == skin ) { |
964 | skinsMenu->setItemChecked( item, TRUE ); | 961 | skinsMenu->setItemChecked( item, TRUE ); |
965 | } | 962 | } |
966 | ++it; | 963 | ++it; |
967 | } | 964 | } |
968 | } | 965 | } |
@@ -1000,25 +997,25 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const | |||
1000 | return Entry( lnk->name(), lnk->file() ); | 997 | return Entry( lnk->name(), lnk->file() ); |
1001 | } | 998 | } |
1002 | 999 | ||
1003 | return Entry( currentFileListPathName() ); | 1000 | return Entry( currentFileListPathName() ); |
1004 | } | 1001 | } |
1005 | 1002 | ||
1006 | QString PlayListWidget::currentFileListPathName() const { | 1003 | QString PlayListWidget::currentFileListPathName() const { |
1007 | return currentFileListView->currentItem()->text( 3 ); | 1004 | return currentFileListView->currentItem()->text( 3 ); |
1008 | } | 1005 | } |
1009 | 1006 | ||
1010 | 1007 | ||
1011 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | 1008 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { |
1012 | odebug << "qcop message "+msg << oendl; | 1009 | odebug << "qcop message "+msg << oendl; |
1013 | QDataStream stream ( data, IO_ReadOnly ); | 1010 | QDataStream stream ( data, IO_ReadOnly ); |
1014 | if ( msg == "play()" ) { //plays current selection | 1011 | if ( msg == "play()" ) { //plays current selection |
1015 | btnPlay( true); | 1012 | btnPlay( true); |
1016 | } else if ( msg == "stop()" ) { | 1013 | } else if ( msg == "stop()" ) { |
1017 | mediaPlayerState->setPlaying( false); | 1014 | mediaPlayerState->setPlaying( false); |
1018 | } else if ( msg == "togglePause()" ) { | 1015 | } else if ( msg == "togglePause()" ) { |
1019 | mediaPlayerState->togglePaused(); | 1016 | mediaPlayerState->togglePaused(); |
1020 | } else if ( msg == "next()" ) { //select next in list | 1017 | } else if ( msg == "next()" ) { //select next in list |
1021 | mediaPlayerState->setNext(); | 1018 | mediaPlayerState->setNext(); |
1022 | } else if ( msg == "prev()" ) { //select previous in list | 1019 | } else if ( msg == "prev()" ) { //select previous in list |
1023 | mediaPlayerState->setPrev(); | 1020 | mediaPlayerState->setPrev(); |
1024 | } else if ( msg == "toggleLooping()" ) { //loop or not loop | 1021 | } else if ( msg == "toggleLooping()" ) { //loop or not loop |