author | harlekin <harlekin> | 2002-08-19 21:11:10 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-19 21:11:10 (UTC) |
commit | 0d336f310b310ba18af70185eed58be6e07c26d8 (patch) (unidiff) | |
tree | 4084cce27741e5e3ae1bc309d539b7db2ecc8e99 /noncore/multimedia/opieplayer2/playlistwidget.cpp | |
parent | 7f1a7e9b3272f7848423583ea5fc04eb67d97f14 (diff) | |
download | opie-0d336f310b310ba18af70185eed58be6e07c26d8.zip opie-0d336f310b310ba18af70185eed58be6e07c26d8.tar.gz opie-0d336f310b310ba18af70185eed58be6e07c26d8.tar.bz2 |
fixes
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 10f1792..251c2e5 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -568,49 +568,49 @@ bool PlayListWidget::first() { | |||
568 | if ( mediaPlayerState->playlist() ) | 568 | if ( mediaPlayerState->playlist() ) |
569 | return d->selectedFiles->first(); | 569 | return d->selectedFiles->first(); |
570 | else | 570 | else |
571 | return mediaPlayerState->looping(); | 571 | return mediaPlayerState->looping(); |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | bool PlayListWidget::last() { | 575 | bool PlayListWidget::last() { |
576 | if ( mediaPlayerState->playlist() ) | 576 | if ( mediaPlayerState->playlist() ) |
577 | return d->selectedFiles->last(); | 577 | return d->selectedFiles->last(); |
578 | else | 578 | else |
579 | return mediaPlayerState->looping(); | 579 | return mediaPlayerState->looping(); |
580 | } | 580 | } |
581 | 581 | ||
582 | 582 | ||
583 | void PlayListWidget::saveList() { | 583 | void PlayListWidget::saveList() { |
584 | 584 | ||
585 | QString filename; | 585 | QString filename; |
586 | InputDialog *fileDlg = 0l; | 586 | InputDialog *fileDlg = 0l; |
587 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); | 587 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); |
588 | fileDlg->exec(); | 588 | fileDlg->exec(); |
589 | if( fileDlg->result() == 1 ) { | 589 | if( fileDlg->result() == 1 ) { |
590 | if ( d->current ) | 590 | if ( d->current ) |
591 | delete d->current; | 591 | delete d->current; |
592 | filename = fileDlg->LineEdit1->text();//+".playlist"; | 592 | filename = fileDlg->text();//+".playlist"; |
593 | // qDebug("saving playlist "+filename+".playlist"); | 593 | // qDebug("saving playlist "+filename+".playlist"); |
594 | Config cfg( filename +".playlist"); | 594 | Config cfg( filename +".playlist"); |
595 | writeConfig( cfg ); | 595 | writeConfig( cfg ); |
596 | 596 | ||
597 | DocLnk lnk; | 597 | DocLnk lnk; |
598 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 598 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
599 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 599 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
600 | lnk.setIcon("opieplayer2/playlist2"); | 600 | lnk.setIcon("opieplayer2/playlist2"); |
601 | lnk.setName( filename); //sets file name | 601 | lnk.setName( filename); //sets file name |
602 | // qDebug(filename); | 602 | // qDebug(filename); |
603 | if(!lnk.writeLink()) { | 603 | if(!lnk.writeLink()) { |
604 | qDebug("Writing doclink did not work"); | 604 | qDebug("Writing doclink did not work"); |
605 | } | 605 | } |
606 | } | 606 | } |
607 | Config config( "OpiePlayer" ); | 607 | Config config( "OpiePlayer" ); |
608 | config.writeEntry("CurrentPlaylist",filename); | 608 | config.writeEntry("CurrentPlaylist",filename); |
609 | setCaption(tr("OpiePlayer: ")+filename); | 609 | setCaption(tr("OpiePlayer: ")+filename); |
610 | d->selectedFiles->first(); | 610 | d->selectedFiles->first(); |
611 | if(fileDlg) { | 611 | if(fileDlg) { |
612 | delete fileDlg; | 612 | delete fileDlg; |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | void PlayListWidget::loadList( const DocLnk & lnk) { | 616 | void PlayListWidget::loadList( const DocLnk & lnk) { |
@@ -927,49 +927,49 @@ void PlayListWidget::populateVideoView() { | |||
927 | videoView->clear(); | 927 | videoView->clear(); |
928 | QString storage; | 928 | QString storage; |
929 | for ( ; Vdit.current(); ++Vdit ) { | 929 | for ( ; Vdit.current(); ++Vdit ) { |
930 | for( ; it.current(); ++it ){ | 930 | for( ; it.current(); ++it ){ |
931 | const QString name = (*it)->name(); | 931 | const QString name = (*it)->name(); |
932 | const QString path = (*it)->path(); | 932 | const QString path = (*it)->path(); |
933 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 933 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
934 | } | 934 | } |
935 | 935 | ||
936 | QListViewItem * newItem; | 936 | QListViewItem * newItem; |
937 | if ( QFile( Vdit.current()->file()).exists() ) { | 937 | if ( QFile( Vdit.current()->file()).exists() ) { |
938 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 938 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
939 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | 939 | QString::number( QFile( Vdit.current()->file()).size() ), storage); |
940 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); | 940 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); |
941 | } | 941 | } |
942 | } | 942 | } |
943 | } | 943 | } |
944 | 944 | ||
945 | void PlayListWidget::openFile() { | 945 | void PlayListWidget::openFile() { |
946 | QString filename, name; | 946 | QString filename, name; |
947 | InputDialog *fileDlg; | 947 | InputDialog *fileDlg; |
948 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 948 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
949 | fileDlg->exec(); | 949 | fileDlg->exec(); |
950 | if( fileDlg->result() == 1 ) { | 950 | if( fileDlg->result() == 1 ) { |
951 | filename = fileDlg->LineEdit1->text(); | 951 | filename = fileDlg->text(); |
952 | 952 | ||
953 | qDebug("Selected filename is "+filename); | 953 | qDebug("Selected filename is "+filename); |
954 | if(filename.right(3) == "m3u") { | 954 | if(filename.right(3) == "m3u") { |
955 | readm3u( filename ); | 955 | readm3u( filename ); |
956 | } else if(filename.right(3) == "pls") { | 956 | } else if(filename.right(3) == "pls") { |
957 | readPls( filename ); | 957 | readPls( filename ); |
958 | } else { | 958 | } else { |
959 | DocLnk lnk; | 959 | DocLnk lnk; |
960 | 960 | ||
961 | lnk.setName(filename); //sets file name | 961 | lnk.setName(filename); //sets file name |
962 | lnk.setFile(filename); //sets File property | 962 | lnk.setFile(filename); //sets File property |
963 | lnk.setType("audio/x-mpegurl"); | 963 | lnk.setType("audio/x-mpegurl"); |
964 | lnk.setExec("opieplayer"); | 964 | lnk.setExec("opieplayer"); |
965 | lnk.setIcon("opieplayer2/MPEGPlayer"); | 965 | lnk.setIcon("opieplayer2/MPEGPlayer"); |
966 | 966 | ||
967 | if(!lnk.writeLink()) { | 967 | if(!lnk.writeLink()) { |
968 | qDebug("Writing doclink did not work"); | 968 | qDebug("Writing doclink did not work"); |
969 | } | 969 | } |
970 | d->selectedFiles->addToSelection( lnk); | 970 | d->selectedFiles->addToSelection( lnk); |
971 | } | 971 | } |
972 | } | 972 | } |
973 | if(fileDlg) { | 973 | if(fileDlg) { |
974 | delete fileDlg; | 974 | delete fileDlg; |
975 | } | 975 | } |
@@ -1102,49 +1102,49 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
1102 | if(s.at(s.length()-4) == '.') { | 1102 | if(s.at(s.length()-4) == '.') { |
1103 | lnk.setFile( s); | 1103 | lnk.setFile( s); |
1104 | } else { | 1104 | } else { |
1105 | lnk.setFile( s+"/"); | 1105 | lnk.setFile( s+"/"); |
1106 | } | 1106 | } |
1107 | lnk.setType("audio/x-mpegurl"); | 1107 | lnk.setType("audio/x-mpegurl"); |
1108 | lnk.writeLink(); | 1108 | lnk.writeLink(); |
1109 | d->selectedFiles->addToSelection( lnk); | 1109 | d->selectedFiles->addToSelection( lnk); |
1110 | } | 1110 | } |
1111 | i++; | 1111 | i++; |
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | f.close(); | 1116 | f.close(); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | void PlayListWidget::writem3u() { | 1119 | void PlayListWidget::writem3u() { |
1120 | 1120 | ||
1121 | InputDialog *fileDlg; | 1121 | InputDialog *fileDlg; |
1122 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); | 1122 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); |
1123 | fileDlg->exec(); | 1123 | fileDlg->exec(); |
1124 | QString filename,list; | 1124 | QString filename,list; |
1125 | if( fileDlg->result() == 1 ) { | 1125 | if( fileDlg->result() == 1 ) { |
1126 | filename = fileDlg->LineEdit1->text(); | 1126 | filename = fileDlg->text(); |
1127 | qDebug(filename); | 1127 | qDebug(filename); |
1128 | int noOfFiles = 0; | 1128 | int noOfFiles = 0; |
1129 | d->selectedFiles->first(); | 1129 | d->selectedFiles->first(); |
1130 | do { | 1130 | do { |
1131 | // we dont check for existance because of url's | 1131 | // we dont check for existance because of url's |
1132 | // qDebug(d->selectedFiles->current()->file()); | 1132 | // qDebug(d->selectedFiles->current()->file()); |
1133 | list += d->selectedFiles->current()->file()+"\n"; | 1133 | list += d->selectedFiles->current()->file()+"\n"; |
1134 | noOfFiles++; | 1134 | noOfFiles++; |
1135 | } | 1135 | } |
1136 | while ( d->selectedFiles->next() ); | 1136 | while ( d->selectedFiles->next() ); |
1137 | qDebug(list); | 1137 | qDebug(list); |
1138 | if(filename.left(1) != "/") | 1138 | if(filename.left(1) != "/") |
1139 | filename=QPEApplication::documentDir()+"/"+filename; | 1139 | filename=QPEApplication::documentDir()+"/"+filename; |
1140 | if(filename.right(3) != "m3u") | 1140 | if(filename.right(3) != "m3u") |
1141 | filename=filename+".m3u"; | 1141 | filename=filename+".m3u"; |
1142 | 1142 | ||
1143 | QFile f(filename); | 1143 | QFile f(filename); |
1144 | f.open(IO_WriteOnly); | 1144 | f.open(IO_WriteOnly); |
1145 | f.writeBlock(list, list.length()); | 1145 | f.writeBlock(list, list.length()); |
1146 | f.close(); | 1146 | f.close(); |
1147 | } | 1147 | } |
1148 | if(fileDlg) delete fileDlg; | 1148 | if(fileDlg) delete fileDlg; |
1149 | } | 1149 | } |
1150 | 1150 | ||