-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 195 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 5 |
3 files changed, 101 insertions, 102 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 235d973..841d950 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -81,33 +81,34 @@ void Om3u::readM3u() { | |||
81 | // } else { | 81 | // } else { |
82 | name = s; | 82 | name = s; |
83 | // } | 83 | // } |
84 | append(name); | 84 | append(name); |
85 | // qDebug(name); | 85 | // qDebug(name); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void Om3u::readPls() { //it's a pls file | 91 | void Om3u::readPls() { //it's a pls file |
92 | QTextStream t( &f ); | 92 | QTextStream t( &f ); |
93 | QString s; | 93 | QString s; |
94 | while ( !t.atEnd() ) { | 94 | while ( !t.atEnd() ) { |
95 | s = t.readLine(); | 95 | s = t.readLine(); |
96 | if( s.left(4) == "File" ) { | 96 | if( s.left(4) == "File" ) { |
97 | s = s.right( s.length() - 6 ); | 97 | s = s.right( s.length() - s.find("=",0,true)-1 ); |
98 | s = s.stripWhiteSpace(); | ||
98 | s.replace( QRegExp( "%20" )," "); | 99 | s.replace( QRegExp( "%20" )," "); |
99 | // qDebug( "adding " + s + " to playlist" ); | 100 | // qDebug( "adding " + s + " to playlist" ); |
100 | // numberofentries=2 | 101 | // numberofentries=2 |
101 | // File1=http | 102 | // File1=http |
102 | // Title | 103 | // Title |
103 | // Length | 104 | // Length |
104 | // Version | 105 | // Version |
105 | // File2=http | 106 | // File2=http |
106 | s = s.replace( QRegExp( "\\" ), "/" ); | 107 | s = s.replace( QRegExp( "\\" ), "/" ); |
107 | QFileInfo f( s ); | 108 | QFileInfo f( s ); |
108 | QString name = f.baseName(); | 109 | QString name = f.baseName(); |
109 | if( name.left( 4 ) == "http" ) { | 110 | if( name.left( 4 ) == "http" ) { |
110 | name = s.right( s.length() - 7); | 111 | name = s.right( s.length() - 7); |
111 | } else { | 112 | } else { |
112 | name = s; | 113 | name = s; |
113 | } | 114 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index a65495e..6e2457f 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -94,33 +94,33 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
94 | videoView, SLOT( scanFiles() ) ); | 94 | videoView, SLOT( scanFiles() ) ); |
95 | 95 | ||
96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), | 96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), |
97 | &mediaPlayerState, SLOT( toggleFullscreen() ) ); | 97 | &mediaPlayerState, SLOT( toggleFullscreen() ) ); |
98 | 98 | ||
99 | Config cfg( "OpiePlayer" ); | 99 | Config cfg( "OpiePlayer" ); |
100 | bool b= cfg.readBoolEntry("FullScreen", 0); | 100 | bool b= cfg.readBoolEntry("FullScreen", 0); |
101 | mediaPlayerState.setFullscreen( b ); | 101 | mediaPlayerState.setFullscreen( b ); |
102 | pmView->setItemChecked( -16, b ); | 102 | pmView->setItemChecked( -16, b ); |
103 | 103 | ||
104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
107 | d->selectedFiles, SLOT(removeSelected() ) ); | 107 | d->selectedFiles, SLOT(removeSelected() ) ); |
108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
110 | QVBox *stretch2 = new QVBox( vbox1 ); | 110 | // QVBox *stretch2 = new QVBox( vbox1 ); |
111 | 111 | ||
112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
113 | SLOT( deletePlaylist() ) ); | 113 | SLOT( deletePlaylist() ) ); |
114 | connect( pmView, SIGNAL( activated( int ) ), | 114 | connect( pmView, SIGNAL( activated( int ) ), |
115 | this, SLOT( pmViewActivated( int ) ) ); | 115 | this, SLOT( pmViewActivated( int ) ) ); |
116 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 116 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
117 | this, SLOT( skinsMenuActivated( int ) ) ); | 117 | this, SLOT( skinsMenuActivated( int ) ) ); |
118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
119 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 119 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
120 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 120 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), |
121 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 121 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
122 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 122 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
123 | this,SLOT( playIt( QListViewItem *) ) ); | 123 | this,SLOT( playIt( QListViewItem *) ) ); |
124 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 124 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
125 | this, SLOT( addToSelection( QListViewItem *) ) ); | 125 | this, SLOT( addToSelection( QListViewItem *) ) ); |
126 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 126 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
@@ -352,50 +352,52 @@ void PlayListWidget::addAllVideoToList() { | |||
352 | QListIterator<DocLnk> dit( vFiles.children() ); | 352 | QListIterator<DocLnk> dit( vFiles.children() ); |
353 | for ( ; dit.current(); ++dit ) { | 353 | for ( ; dit.current(); ++dit ) { |
354 | if( QFileInfo( dit.current()->file() ).exists() ) { | 354 | if( QFileInfo( dit.current()->file() ).exists() ) { |
355 | d->selectedFiles->addToSelection( **dit ); | 355 | d->selectedFiles->addToSelection( **dit ); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | */ | 358 | */ |
359 | tabWidget->setCurrentPage(0); | 359 | tabWidget->setCurrentPage(0); |
360 | writeCurrentM3u(); | 360 | writeCurrentM3u(); |
361 | d->selectedFiles->first(); | 361 | d->selectedFiles->first(); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | void PlayListWidget::setDocument( const QString& fileref ) { | 365 | void PlayListWidget::setDocument( const QString& fileref ) { |
366 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 366 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
367 | fromSetDocument = TRUE; | 367 | fromSetDocument = TRUE; |
368 | if ( fileref.isNull() ) { | 368 | QFileInfo fileInfo(fileref); |
369 | |||
370 | if ( !fileInfo.exists() ) { | ||
369 | QMessageBox::warning( this, tr( "Invalid File" ), | 371 | QMessageBox::warning( this, tr( "Invalid File" ), |
370 | tr( "There was a problem in getting the file." ) ); | 372 | tr( "There was a problem in getting the file." ) ); |
371 | return; | 373 | return; |
372 | } | 374 | } |
373 | 375 | ||
374 | clearList(); | 376 | clearList(); |
375 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 377 | QString extension = fileInfo.extension(false); |
376 | readm3u( fileref ); | 378 | |
377 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 379 | if( extension.find( "m3u", 0, false) != -1 |
378 | readm3u( DocLnk( fileref).file() ); | 380 | || extension.find( "pls", 0, false) != -1 ) { |
379 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 381 | readListFromFile( fileref ); |
380 | readPls( fileref ); | ||
381 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | ||
382 | readPls( DocLnk( fileref).file() ); | ||
383 | } else { | 382 | } else { |
384 | clearList(); | 383 | clearList(); |
385 | addToSelection( DocLnk( fileref ) ); | 384 | DocLnk lnk; |
385 | lnk.setName( fileInfo.baseName() ); //sets name | ||
386 | lnk.setFile( fileref ); //sets file name | ||
387 | addToSelection( lnk ); | ||
386 | writeCurrentM3u(); | 388 | writeCurrentM3u(); |
387 | 389 | ||
388 | d->setDocumentUsed = TRUE; | 390 | d->setDocumentUsed = TRUE; |
389 | mediaPlayerState.setPlaying( FALSE ); | 391 | mediaPlayerState.setPlaying( FALSE ); |
390 | mediaPlayerState.setPlaying( TRUE ); | 392 | mediaPlayerState.setPlaying( TRUE ); |
391 | } | 393 | } |
392 | } | 394 | } |
393 | 395 | ||
394 | 396 | ||
395 | void PlayListWidget::useSelectedDocument() { | 397 | void PlayListWidget::useSelectedDocument() { |
396 | d->setDocumentUsed = FALSE; | 398 | d->setDocumentUsed = FALSE; |
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | ||
400 | const DocLnk *PlayListWidget::current() const { // this is fugly | 402 | const DocLnk *PlayListWidget::current() const { // this is fugly |
401 | assert( currentTab() == CurrentPlayList ); | 403 | assert( currentTab() == CurrentPlayList ); |
@@ -463,33 +465,34 @@ bool PlayListWidget::last() { | |||
463 | } | 465 | } |
464 | 466 | ||
465 | 467 | ||
466 | void PlayListWidget::saveList() { | 468 | void PlayListWidget::saveList() { |
467 | writem3u(); | 469 | writem3u(); |
468 | } | 470 | } |
469 | 471 | ||
470 | 472 | ||
471 | void PlayListWidget::loadList( const DocLnk & lnk) { | 473 | void PlayListWidget::loadList( const DocLnk & lnk) { |
472 | QString name = lnk.name(); | 474 | QString name = lnk.name(); |
473 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 475 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); |
474 | 476 | ||
475 | if( name.length()>0) { | 477 | if( name.length()>0) { |
476 | setCaption("OpiePlayer: "+name); | 478 | setCaption("OpiePlayer: "+name); |
477 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 479 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
478 | clearList(); | 480 | clearList(); |
479 | readm3u(lnk.file()); | 481 | // readm3u(lnk.file()); |
482 | readListFromFile(lnk.file()); | ||
480 | tabWidget->setCurrentPage(0); | 483 | tabWidget->setCurrentPage(0); |
481 | } | 484 | } |
482 | } | 485 | } |
483 | 486 | ||
484 | void PlayListWidget::addSelected() { | 487 | void PlayListWidget::addSelected() { |
485 | assert( inFileListMode() ); | 488 | assert( inFileListMode() ); |
486 | 489 | ||
487 | QListViewItemIterator it( currentFileListView ); | 490 | QListViewItemIterator it( currentFileListView ); |
488 | for ( ; it.current(); ++it ) | 491 | for ( ; it.current(); ++it ) |
489 | if ( it.current()->isSelected() ) { | 492 | if ( it.current()->isSelected() ) { |
490 | QString filename = it.current()->text(3); | 493 | QString filename = it.current()->text(3); |
491 | 494 | ||
492 | DocLnk lnk; | 495 | DocLnk lnk; |
493 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name | 496 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name |
494 | lnk.setFile( filename ); //sets file name | 497 | lnk.setFile( filename ); //sets file name |
495 | 498 | ||
@@ -667,169 +670,163 @@ void PlayListWidget::openFile() { | |||
667 | m3uFile=filename; | 670 | m3uFile=filename; |
668 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 671 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
669 | } else{ | 672 | } else{ |
670 | m3uFile=filename; | 673 | m3uFile=filename; |
671 | } | 674 | } |
672 | 675 | ||
673 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 676 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
674 | lnk.setName( filename ); //sets name | 677 | lnk.setName( filename ); //sets name |
675 | lnk.setFile( filename ); //sets file name | 678 | lnk.setFile( filename ); //sets file name |
676 | 679 | ||
677 | // lnk.setIcon("opieplayer2/musicfile"); | 680 | // lnk.setIcon("opieplayer2/musicfile"); |
678 | 681 | ||
679 | d->selectedFiles->addToSelection( lnk ); | 682 | d->selectedFiles->addToSelection( lnk ); |
680 | writeCurrentM3u(); | 683 | writeCurrentM3u(); |
681 | d->selectedFiles->setSelectedItem( lnk.name()); | 684 | d->selectedFiles->setSelectedItem( lnk.name()); |
682 | } | 685 | } |
683 | else if( filename.right( 3) == "m3u" ) { | 686 | else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { |
684 | readm3u( filename ); | 687 | readListFromFile( filename ); |
685 | 688 | // readPls( filename ); | |
686 | } else if( filename.right(3) == "pls" ) { | ||
687 | readPls( filename ); | ||
688 | } else { | 689 | } else { |
689 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 690 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
690 | lnk.setFile( filename ); //sets file name | 691 | lnk.setFile( filename ); //sets file name |
691 | d->selectedFiles->addToSelection( lnk); | 692 | d->selectedFiles->addToSelection( lnk); |
692 | writeCurrentM3u(); | 693 | writeCurrentM3u(); |
693 | d->selectedFiles->setSelectedItem( lnk.name()); | 694 | d->selectedFiles->setSelectedItem( lnk.name()); |
694 | } | 695 | } |
695 | } | 696 | } |
696 | 697 | ||
698 | |||
697 | delete fileDlg; | 699 | delete fileDlg; |
698 | } | 700 | } |
699 | 701 | ||
700 | /* | 702 | void PlayListWidget::readListFromFile( const QString &filename ) { |
701 | reads m3u and shows files/urls to playlist widget */ | 703 | qDebug( "read list filename " + filename ); |
702 | void PlayListWidget::readm3u( const QString &filename ) { | 704 | QFileInfo fi(filename); |
703 | qDebug( "read m3u filename " + filename ); | ||
704 | |||
705 | Om3u *m3uList; | 705 | Om3u *m3uList; |
706 | QString s, name; | 706 | QString s, name; |
707 | m3uList = new Om3u( filename, IO_ReadOnly ); | 707 | m3uList = new Om3u( filename, IO_ReadOnly ); |
708 | m3uList->readM3u(); | 708 | if(fi.extension(false).find("m3u",0,false) != -1 ) |
709 | m3uList->readM3u(); | ||
710 | else if(fi.extension(false).find("pls",0,false) != -1 ) | ||
711 | m3uList->readPls(); | ||
712 | |||
709 | DocLnk lnk; | 713 | DocLnk lnk; |
710 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 714 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
711 | s = *it; | 715 | s = *it; |
712 | // qDebug("reading "+ s); | 716 | // qDebug(s); |
713 | if(s.left(4)=="http") { | 717 | if(s.left(4)=="http") { |
714 | lnk.setName( s ); //sets file name | 718 | lnk.setName( s ); //sets file name |
715 | lnk.setIcon("opieplayer2/musicfile"); | 719 | lnk.setIcon("opieplayer2/musicfile"); |
716 | lnk.setFile( s ); //sets file name | 720 | lnk.setFile( s ); //sets file name |
717 | 721 | ||
718 | } else { | 722 | } else { //is file |
719 | // if( QFileInfo( s ).exists() ) { | ||
720 | lnk.setName( QFileInfo(s).baseName()); | 723 | lnk.setName( QFileInfo(s).baseName()); |
721 | // if(s.right(4) == '.') {//if regular file | ||
722 | if(s.left(1) != "/") { | 724 | if(s.left(1) != "/") { |
723 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 725 | |
724 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 726 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
725 | // lnk.setIcon(MimeType(s).pixmap() ); | ||
726 | // lnk.setIcon("SoundPlayer"); | ||
727 | } else { | 727 | } else { |
728 | // qDebug("set link2 "+s); | ||
729 | lnk.setFile( s); | 728 | lnk.setFile( s); |
730 | // lnk.setIcon(MimeType(s).pixmap() ); | ||
731 | // lnk.setIcon("SoundPlayer"); | ||
732 | } | 729 | } |
733 | } | 730 | } |
734 | d->selectedFiles->addToSelection( lnk ); | 731 | d->selectedFiles->addToSelection( lnk ); |
735 | } | 732 | } |
736 | Config config( "OpiePlayer" ); | 733 | Config config( "OpiePlayer" ); |
737 | config.setGroup( "PlayList" ); | 734 | config.setGroup( "PlayList" ); |
738 | 735 | ||
739 | config.writeEntry("CurrentPlaylist",filename); | 736 | config.writeEntry("CurrentPlaylist",filename); |
740 | config.write(); | 737 | config.write(); |
741 | currentPlayList=filename; | 738 | currentPlayList=filename; |
742 | 739 | ||
743 | // m3uList->write(); | 740 | // m3uList->write(); |
744 | m3uList->close(); | 741 | m3uList->close(); |
745 | delete m3uList; | 742 | delete m3uList; |
746 | 743 | ||
747 | d->selectedFiles->setSelectedItem( s); | 744 | d->selectedFiles->setSelectedItem( s); |
748 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 745 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
749 | 746 | ||
750 | } | 747 | } |
751 | 748 | ||
752 | /* | 749 | // /* |
753 | reads pls and adds files/urls to playlist */ | 750 | // reads pls and adds files/urls to playlist */ |
754 | void PlayListWidget::readPls( const QString &filename ) { | 751 | // void PlayListWidget::readPls( const QString &filename ) { |
755 | 752 | ||
756 | qDebug( "pls filename is " + filename ); | 753 | // qDebug( "pls filename is " + filename ); |
757 | Om3u *m3uList; | 754 | // Om3u *m3uList; |
758 | QString s, name; | 755 | // QString s, name; |
759 | m3uList = new Om3u( filename, IO_ReadOnly ); | 756 | // m3uList = new Om3u( filename, IO_ReadOnly ); |
760 | m3uList->readPls(); | 757 | // m3uList->readPls(); |
761 | 758 | ||
762 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 759 | // for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
763 | s = *it; | 760 | // s = *it; |
764 | // s.replace( QRegExp( "%20" )," " ); | 761 | // // s.replace( QRegExp( "%20" )," " ); |
765 | DocLnk lnk( s ); | 762 | // DocLnk lnk( s ); |
766 | QFileInfo f( s ); | 763 | // QFileInfo f( s ); |
767 | QString name = f.baseName(); | 764 | // QString name = f.baseName(); |
768 | 765 | ||
769 | if( name.left( 4 ) == "http" ) { | 766 | // if( name.left( 4 ) == "http" ) { |
770 | name = s.right( s.length() - 7); | 767 | // name = s.right( s.length() - 7); |
771 | } else { | 768 | // } else { |
772 | name = s; | 769 | // name = s; |
773 | } | 770 | // } |
774 | 771 | ||
775 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 772 | // name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
776 | 773 | ||
777 | lnk.setName( name ); | 774 | // lnk.setName( name ); |
778 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | 775 | // if( s.at( s.length() - 4) == '.') {// if this is probably a file |
779 | lnk.setFile( s ); | 776 | // lnk.setFile( s ); |
780 | } else { //if its a url | 777 | // } else { //if its a url |
781 | // if( name.right( 1 ).find( '/' ) == -1) { | 778 | // // if( name.right( 1 ).find( '/' ) == -1) { |
782 | // s += "/"; | 779 | // // s += "/"; |
783 | // } | 780 | // // } |
784 | lnk.setFile( s ); | 781 | // lnk.setFile( s ); |
785 | } | 782 | // } |
786 | lnk.setType( "audio/x-mpegurl" ); | 783 | // lnk.setType( "audio/x-mpegurl" ); |
787 | 784 | ||
788 | lnk.writeLink(); | 785 | // lnk.writeLink(); |
789 | d->selectedFiles->addToSelection( lnk ); | 786 | // d->selectedFiles->addToSelection( lnk ); |
790 | } | 787 | // } |
791 | 788 | ||
792 | m3uList->close(); | 789 | // m3uList->close(); |
793 | delete m3uList; | 790 | // delete m3uList; |
794 | } | 791 | // } |
795 | 792 | ||
796 | /* | 793 | // /* |
797 | writes current playlist to current m3u file */ | 794 | // writes current playlist to current m3u file */ |
798 | void PlayListWidget::writeCurrentM3u() { | 795 | void PlayListWidget::writeCurrentM3u() { |
799 | qDebug("writing to current m3u"); | 796 | qDebug("writing to current m3u"); |
800 | Config cfg( "OpiePlayer" ); | 797 | Config cfg( "OpiePlayer" ); |
801 | cfg.setGroup("PlayList"); | 798 | cfg.setGroup("PlayList"); |
802 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 799 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
803 | 800 | ||
804 | Om3u *m3uList; | 801 | Om3u *m3uList; |
805 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 802 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
806 | if( d->selectedFiles->first()) { | 803 | if( d->selectedFiles->first()) { |
807 | 804 | ||
808 | do { | 805 | do { |
809 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 806 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
810 | m3uList->add( d->selectedFiles->current()->file() ); | 807 | m3uList->add( d->selectedFiles->current()->file() ); |
811 | } | 808 | } |
812 | while ( d->selectedFiles->next() ); | 809 | while ( d->selectedFiles->next() ); |
813 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 810 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
814 | m3uList->write(); | 811 | m3uList->write(); |
815 | m3uList->close(); | 812 | m3uList->close(); |
816 | } | 813 | } |
817 | delete m3uList; | 814 | delete m3uList; |
818 | 815 | ||
819 | } | 816 | } |
820 | 817 | ||
821 | /* | 818 | /* |
822 | writes current playlist to m3u file */ | 819 | writes current playlist to m3u file */ |
823 | void PlayListWidget::writem3u() { | 820 | void PlayListWidget::writem3u() { |
824 | InputDialog *fileDlg; | 821 | InputDialog *fileDlg; |
825 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 822 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
826 | fileDlg->exec(); | 823 | fileDlg->exec(); |
827 | QString name, filename, list; | 824 | QString name, filename, list; |
828 | Om3u *m3uList; | 825 | Om3u *m3uList; |
829 | 826 | ||
830 | if( fileDlg->result() == 1 ) { | 827 | if( fileDlg->result() == 1 ) { |
831 | name = fileDlg->text(); | 828 | name = fileDlg->text(); |
832 | // qDebug( filename ); | 829 | // qDebug( filename ); |
833 | 830 | ||
834 | if( name.left( 1) != "/" ) { | 831 | if( name.left( 1) != "/" ) { |
835 | filename = QPEApplication::documentDir() + "/" + name; | 832 | filename = QPEApplication::documentDir() + "/" + name; |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index e8bf211..cb65d5c 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -81,34 +81,35 @@ public: | |||
81 | 81 | ||
82 | public slots: | 82 | public slots: |
83 | bool first(); | 83 | bool first(); |
84 | bool last(); | 84 | bool last(); |
85 | bool next(); | 85 | bool next(); |
86 | bool prev(); | 86 | bool prev(); |
87 | void writeDefaultPlaylist( ); | 87 | void writeDefaultPlaylist( ); |
88 | QString currentFileListPathName() const; | 88 | QString currentFileListPathName() const; |
89 | protected: | 89 | protected: |
90 | void keyReleaseEvent( QKeyEvent *e); | 90 | void keyReleaseEvent( QKeyEvent *e); |
91 | 91 | ||
92 | signals: | 92 | signals: |
93 | void skinSelected(); | 93 | void skinSelected(); |
94 | 94 | ||
95 | private: | 95 | private: |
96 | int defaultSkinIndex; | 96 | int defaultSkinIndex; |
97 | void readm3u(const QString &); | 97 | /* void readm3u(const QString &); */ |
98 | void readPls(const QString &); | 98 | /* void readPls(const QString &); */ |
99 | void readListFromFile(const QString &); | ||
99 | void initializeStates(); | 100 | void initializeStates(); |
100 | 101 | ||
101 | bool inFileListMode() const; | 102 | bool inFileListMode() const; |
102 | 103 | ||
103 | private slots: | 104 | private slots: |
104 | void populateSkinsMenu(); | 105 | void populateSkinsMenu(); |
105 | void skinsMenuActivated(int); | 106 | void skinsMenuActivated(int); |
106 | void pmViewActivated(int); | 107 | void pmViewActivated(int); |
107 | void writem3u(); | 108 | void writem3u(); |
108 | void writeCurrentM3u(); | 109 | void writeCurrentM3u(); |
109 | void openFile(); | 110 | void openFile(); |
110 | void setDocument( const QString& fileref ); | 111 | void setDocument( const QString& fileref ); |
111 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 112 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
112 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 113 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
113 | void clearList(); | 114 | void clearList(); |
114 | void addAllToList(); | 115 | void addAllToList(); |