-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 26103c3..65dc5fb 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -452,96 +452,98 @@ void PlayListWidget::addAllToList() { | |||
452 | void PlayListWidget::addAllMusicToList() { | 452 | void PlayListWidget::addAllMusicToList() { |
453 | QListIterator<DocLnk> dit( files.children() ); | 453 | QListIterator<DocLnk> dit( files.children() ); |
454 | for ( ; dit.current(); ++dit ) | 454 | for ( ; dit.current(); ++dit ) |
455 | if(QFileInfo(dit.current()->file()).exists()) | 455 | if(QFileInfo(dit.current()->file()).exists()) |
456 | d->selectedFiles->addToSelection( **dit ); | 456 | d->selectedFiles->addToSelection( **dit ); |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | void PlayListWidget::addAllVideoToList() { | 460 | void PlayListWidget::addAllVideoToList() { |
461 | QListIterator<DocLnk> dit( vFiles.children() ); | 461 | QListIterator<DocLnk> dit( vFiles.children() ); |
462 | for ( ; dit.current(); ++dit ) | 462 | for ( ; dit.current(); ++dit ) |
463 | if(QFileInfo( dit.current()->file()).exists()) | 463 | if(QFileInfo( dit.current()->file()).exists()) |
464 | d->selectedFiles->addToSelection( **dit ); | 464 | d->selectedFiles->addToSelection( **dit ); |
465 | } | 465 | } |
466 | 466 | ||
467 | 467 | ||
468 | void PlayListWidget::setDocument(const QString& fileref) { | 468 | void PlayListWidget::setDocument(const QString& fileref) { |
469 | qDebug(fileref); | 469 | qDebug(fileref); |
470 | fromSetDocument = TRUE; | 470 | fromSetDocument = TRUE; |
471 | if ( fileref.isNull() ) { | 471 | if ( fileref.isNull() ) { |
472 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 472 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | // qDebug("setDocument "+fileref); | 475 | // qDebug("setDocument "+fileref); |
476 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 476 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
477 | readm3u( fileref); | 477 | readm3u( fileref); |
478 | } | 478 | } |
479 | else if(fileref.find("pls",0,TRUE) != -1) { //is pls | 479 | else if(fileref.find("pls",0,TRUE) != -1) { //is pls |
480 | readPls( fileref); | 480 | readPls( fileref); |
481 | } | 481 | } |
482 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | 482 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist |
483 | clearList(); | 483 | clearList(); |
484 | loadList(DocLnk(fileref)); | 484 | loadList(DocLnk(fileref)); |
485 | d->selectedFiles->first(); | 485 | d->selectedFiles->first(); |
486 | } else { | 486 | } else { |
487 | clearList(); | 487 | clearList(); |
488 | addToSelection( DocLnk( fileref ) ); | 488 | addToSelection( DocLnk( fileref ) ); |
489 | d->setDocumentUsed = TRUE; | 489 | d->setDocumentUsed = TRUE; |
490 | mediaPlayerState->setPlaying( FALSE ); | 490 | mediaPlayerState->setPlaying( FALSE ); |
491 | qApp->processEvents(); | 491 | qApp->processEvents(); |
492 | mediaPlayerState->setPlaying( TRUE ); | 492 | mediaPlayerState->setPlaying( TRUE ); |
493 | qApp->processEvents(); | 493 | qApp->processEvents(); |
494 | setCaption(tr("OpiePlayer")); | 494 | setCaption(tr("OpiePlayer")); |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | 498 | ||
499 | void PlayListWidget::setActiveWindow() { | 499 | void PlayListWidget::setActiveWindow() { |
500 | qDebug("SETTING active window"); | ||
501 | |||
500 | // When we get raised we need to ensure that it switches views | 502 | // When we get raised we need to ensure that it switches views |
501 | char origView = mediaPlayerState->view(); | 503 | char origView = mediaPlayerState->view(); |
502 | mediaPlayerState->setView( 'l' ); // invalidate | 504 | mediaPlayerState->setView( 'l' ); // invalidate |
503 | mediaPlayerState->setView( origView ); // now switch back | 505 | mediaPlayerState->setView( origView ); // now switch back |
504 | } | 506 | } |
505 | 507 | ||
506 | 508 | ||
507 | void PlayListWidget::useSelectedDocument() { | 509 | void PlayListWidget::useSelectedDocument() { |
508 | d->setDocumentUsed = FALSE; | 510 | d->setDocumentUsed = FALSE; |
509 | } | 511 | } |
510 | 512 | ||
511 | 513 | ||
512 | const DocLnk *PlayListWidget::current() { // this is fugly | 514 | const DocLnk *PlayListWidget::current() { // this is fugly |
513 | 515 | ||
514 | // if( fromSetDocument) { | 516 | // if( fromSetDocument) { |
515 | // qDebug("from setDoc"); | 517 | // qDebug("from setDoc"); |
516 | // DocLnkSet files; | 518 | // DocLnkSet files; |
517 | // Global::findDocuments(&files, "video/*;audio/*"); | 519 | // Global::findDocuments(&files, "video/*;audio/*"); |
518 | // QListIterator<DocLnk> dit( files.children() ); | 520 | // QListIterator<DocLnk> dit( files.children() ); |
519 | // for ( ; dit.current(); ++dit ) { | 521 | // for ( ; dit.current(); ++dit ) { |
520 | // if(dit.current()->linkFile() == setDocFileRef) { | 522 | // if(dit.current()->linkFile() == setDocFileRef) { |
521 | // qDebug(setDocFileRef); | 523 | // qDebug(setDocFileRef); |
522 | // return dit; | 524 | // return dit; |
523 | // } | 525 | // } |
524 | // } | 526 | // } |
525 | // } else | 527 | // } else |
526 | 528 | ||
527 | 529 | ||
528 | switch (tabWidget->currentPageIndex()) { | 530 | switch (tabWidget->currentPageIndex()) { |
529 | case 0: //playlist | 531 | case 0: //playlist |
530 | { | 532 | { |
531 | qDebug("playlist"); | 533 | qDebug("playlist"); |
532 | if ( mediaPlayerState->playlist() ) { | 534 | if ( mediaPlayerState->playlist() ) { |
533 | return d->selectedFiles->current(); | 535 | return d->selectedFiles->current(); |
534 | } | 536 | } |
535 | else if ( d->setDocumentUsed && d->current ) { | 537 | else if ( d->setDocumentUsed && d->current ) { |
536 | return d->current; | 538 | return d->current; |
537 | } else { | 539 | } else { |
538 | return d->files->selected(); | 540 | return d->files->selected(); |
539 | } | 541 | } |
540 | } | 542 | } |
541 | break; | 543 | break; |
542 | case 1://audio | 544 | case 1://audio |
543 | { | 545 | { |
544 | qDebug("audioView"); | 546 | qDebug("audioView"); |
545 | QListIterator<DocLnk> dit( files.children() ); | 547 | QListIterator<DocLnk> dit( files.children() ); |
546 | for ( ; dit.current(); ++dit ) { | 548 | for ( ; dit.current(); ++dit ) { |
547 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 549 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
@@ -911,105 +913,101 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& | |||
911 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 913 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
912 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 914 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
913 | m.insertSeparator(); | 915 | m.insertSeparator(); |
914 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) | 916 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) |
915 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 917 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
916 | 918 | ||
917 | m.exec( QCursor::pos() ); | 919 | m.exec( QCursor::pos() ); |
918 | } | 920 | } |
919 | break; | 921 | break; |
920 | }; | 922 | }; |
921 | } | 923 | } |
922 | 924 | ||
923 | void PlayListWidget::playSelected() | 925 | void PlayListWidget::playSelected() |
924 | { | 926 | { |
925 | btnPlay( TRUE); | 927 | btnPlay( TRUE); |
926 | // d->selectedFiles->unSelect(); | 928 | // d->selectedFiles->unSelect(); |
927 | } | 929 | } |
928 | 930 | ||
929 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 931 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
930 | { | 932 | { |
931 | switch (mouse) { | 933 | switch (mouse) { |
932 | case 1: | 934 | case 1: |
933 | 935 | ||
934 | break; | 936 | break; |
935 | case 2:{ | 937 | case 2:{ |
936 | QPopupMenu m; | 938 | QPopupMenu m; |
937 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 939 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
938 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 940 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
939 | // m.insertSeparator(); | 941 | // m.insertSeparator(); |
940 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 942 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
941 | m.exec( QCursor::pos() ); | 943 | m.exec( QCursor::pos() ); |
942 | } | 944 | } |
943 | break; | 945 | break; |
944 | }; | 946 | }; |
945 | 947 | ||
946 | } | 948 | } |
947 | 949 | ||
948 | void PlayListWidget::listDelete() { | 950 | void PlayListWidget::listDelete() { |
949 | Config cfg( "OpiePlayer" ); | 951 | Config cfg( "OpiePlayer" ); |
950 | cfg.setGroup("PlayList"); | 952 | cfg.setGroup("PlayList"); |
951 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 953 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
952 | QString file; | 954 | QString file; |
953 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 955 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
954 | switch ( tabWidget->currentPageIndex()) { | 956 | switch ( tabWidget->currentPageIndex()) { |
955 | case 0: | 957 | case 0: |
956 | break; | 958 | break; |
957 | case 1: | 959 | case 1: |
958 | { | 960 | { |
959 | file = audioView->selectedItem()->text(0); | 961 | file = audioView->currentItem()->text(0); |
960 | // Global::findDocuments(&files, "audio/*"); | 962 | QListIterator<DocLnk> Pdit( files.children() ); |
961 | // AppLnkSet appFiles; | 963 | for ( ; Pdit.current(); ++Pdit ) { |
962 | QListIterator<DocLnk> dit( files.children() ); | 964 | if( Pdit.current()->name() == file) { |
963 | for ( ; dit.current(); ++dit ) { | 965 | LnkProperties prop( Pdit.current() ); |
964 | if( dit.current()->name() == file) { | ||
965 | // qDebug(file); | ||
966 | LnkProperties prop( dit.current() ); | ||
967 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | ||
968 | prop.showMaximized(); | 966 | prop.showMaximized(); |
969 | prop.exec(); | 967 | prop.exec(); |
970 | } | 968 | } |
971 | } | 969 | } |
972 | populateAudioView(); | 970 | populateAudioView(); |
973 | } | 971 | } |
974 | break; | 972 | break; |
975 | case 2: | 973 | case 2: |
976 | { | 974 | { |
977 | // file = videoView->selectedItem()->text(0); | 975 | // file = videoView->selectedItem()->text(0); |
978 | // for ( int i = 0; i < noOfFiles; i++ ) { | 976 | // for ( int i = 0; i < noOfFiles; i++ ) { |
979 | // QString entryName; | 977 | // QString entryName; |
980 | // entryName.sprintf( "File%i", i + 1 ); | 978 | // entryName.sprintf( "File%i", i + 1 ); |
981 | // QString linkFile = cfg.readEntry( entryName ); | 979 | // QString linkFile = cfg.readEntry( entryName ); |
982 | // AppLnk lnk( AppLnk(linkFile)); | 980 | // AppLnk lnk( AppLnk(linkFile)); |
983 | // if( lnk.name() == file ) { | 981 | // if( lnk.name() == file ) { |
984 | // LnkProperties prop( &lnk); | 982 | // LnkProperties prop( &lnk); |
985 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 983 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
986 | // prop.showMaximized(); | 984 | // prop.showMaximized(); |
987 | // prop.exec(); | 985 | // prop.exec(); |
988 | // } | 986 | // } |
989 | // } | 987 | // } |
990 | } | 988 | } |
991 | break; | 989 | break; |
992 | }; | 990 | }; |
993 | } | 991 | } |
994 | 992 | ||
995 | void PlayListWidget::scanForAudio() { | 993 | void PlayListWidget::scanForAudio() { |
996 | qDebug("scan for audio"); | 994 | qDebug("scan for audio"); |
997 | files.detachChildren(); | 995 | files.detachChildren(); |
998 | QListIterator<DocLnk> sdit( files.children() ); | 996 | QListIterator<DocLnk> sdit( files.children() ); |
999 | for ( ; sdit.current(); ++sdit ) { | 997 | for ( ; sdit.current(); ++sdit ) { |
1000 | delete sdit.current(); | 998 | delete sdit.current(); |
1001 | } | 999 | } |
1002 | Global::findDocuments(&files, "audio/*"); | 1000 | Global::findDocuments(&files, "audio/*"); |
1003 | audioScan = TRUE; | 1001 | audioScan = TRUE; |
1004 | } | 1002 | } |
1005 | void PlayListWidget::scanForVideo() { | 1003 | void PlayListWidget::scanForVideo() { |
1006 | qDebug("scan for video"); | 1004 | qDebug("scan for video"); |
1007 | vFiles.detachChildren(); | 1005 | vFiles.detachChildren(); |
1008 | QListIterator<DocLnk> sdit( vFiles.children() ); | 1006 | QListIterator<DocLnk> sdit( vFiles.children() ); |
1009 | for ( ; sdit.current(); ++sdit ) { | 1007 | for ( ; sdit.current(); ++sdit ) { |
1010 | delete sdit.current(); | 1008 | delete sdit.current(); |
1011 | } | 1009 | } |
1012 | Global::findDocuments(&vFiles, "video/*"); | 1010 | Global::findDocuments(&vFiles, "video/*"); |
1013 | videoScan = TRUE; | 1011 | videoScan = TRUE; |
1014 | } | 1012 | } |
1015 | 1013 | ||
@@ -1034,124 +1032,119 @@ void PlayListWidget::populateAudioView() { | |||
1034 | QListViewItem * newItem; | 1032 | QListViewItem * newItem; |
1035 | if ( QFile( dit.current()->file()).exists() ) { | 1033 | if ( QFile( dit.current()->file()).exists() ) { |
1036 | // qDebug(dit.current()->name()); | 1034 | // qDebug(dit.current()->name()); |
1037 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1035 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1038 | QString::number( QFile( dit.current()->file()).size() ), storage); | 1036 | QString::number( QFile( dit.current()->file()).size() ), storage); |
1039 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1037 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1040 | } | 1038 | } |
1041 | } | 1039 | } |
1042 | 1040 | ||
1043 | } | 1041 | } |
1044 | 1042 | ||
1045 | void PlayListWidget::populateVideoView() { | 1043 | void PlayListWidget::populateVideoView() { |
1046 | videoView->clear(); | 1044 | videoView->clear(); |
1047 | StorageInfo storageInfo; | 1045 | StorageInfo storageInfo; |
1048 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1046 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1049 | 1047 | ||
1050 | if(!videoScan ) scanForVideo(); | 1048 | if(!videoScan ) scanForVideo(); |
1051 | 1049 | ||
1052 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1050 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
1053 | QListIterator<FileSystem> it ( fs ); | 1051 | QListIterator<FileSystem> it ( fs ); |
1054 | videoView->clear(); | 1052 | videoView->clear(); |
1055 | QString storage; | 1053 | QString storage; |
1056 | for ( ; Vdit.current(); ++Vdit ) { | 1054 | for ( ; Vdit.current(); ++Vdit ) { |
1057 | for( ; it.current(); ++it ){ | 1055 | for( ; it.current(); ++it ){ |
1058 | const QString name = (*it)->name(); | 1056 | const QString name = (*it)->name(); |
1059 | const QString path = (*it)->path(); | 1057 | const QString path = (*it)->path(); |
1060 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1058 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1061 | } | 1059 | } |
1062 | 1060 | ||
1063 | QListViewItem * newItem; | 1061 | QListViewItem * newItem; |
1064 | if ( QFile( Vdit.current()->file()).exists() ) { | 1062 | if ( QFile( Vdit.current()->file()).exists() ) { |
1065 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1063 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1066 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | 1064 | QString::number( QFile( Vdit.current()->file()).size() ), storage); |
1067 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1065 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1068 | } | 1066 | } |
1069 | } | 1067 | } |
1070 | } | 1068 | } |
1071 | 1069 | ||
1072 | void PlayListWidget::openFile() { | 1070 | void PlayListWidget::openFile() { |
1073 | QString filename, name; | 1071 | QString filename, name; |
1074 | InputDialog *fileDlg; | 1072 | InputDialog *fileDlg; |
1075 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1073 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1076 | fileDlg->exec(); | 1074 | fileDlg->exec(); |
1077 | if( fileDlg->result() == 1 ) { | 1075 | if( fileDlg->result() == 1 ) { |
1078 | filename = fileDlg->LineEdit1->text(); | 1076 | filename = fileDlg->LineEdit1->text(); |
1079 | // http://205.188.234.129:8030 | 1077 | // http://205.188.234.129:8030 |
1080 | // http://66.28.68.70:8000 | 1078 | // http://66.28.68.70:8000 |
1081 | // filename.replace(QRegExp("%20")," "); | 1079 | // filename.replace(QRegExp("%20")," "); |
1082 | if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { | ||
1083 | QMessageBox::message("Note","Spaces in urls are not allowed."); | ||
1084 | return; | ||
1085 | } else { | ||
1086 | qDebug("Selected filename is "+filename); | 1080 | qDebug("Selected filename is "+filename); |
1087 | if(filename.right(3) == "m3u") | 1081 | if(filename.right(3) == "m3u") |
1088 | readm3u( filename); | 1082 | readm3u( filename); |
1089 | else if(filename.right(3) == "pls") | 1083 | else if(filename.right(3) == "pls") |
1090 | readPls( filename); | 1084 | readPls( filename); |
1091 | else { | 1085 | else { |
1092 | DocLnk lnk; | 1086 | DocLnk lnk; |
1093 | 1087 | ||
1094 | lnk.setName(filename); //sets file name | 1088 | lnk.setName(filename); //sets file name |
1095 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | 1089 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") |
1096 | filename += "/"; | 1090 | filename += "/"; |
1097 | lnk.setFile(filename); //sets File property | 1091 | lnk.setFile(filename); //sets File property |
1098 | 1092 | ||
1099 | lnk.setType("audio/x-mpegurl"); | 1093 | lnk.setType("audio/x-mpegurl"); |
1100 | lnk.setExec("opieplayer"); | 1094 | lnk.setExec("opieplayer"); |
1101 | lnk.setIcon("opieplayer/MPEGPlayer"); | 1095 | lnk.setIcon("opieplayer/MPEGPlayer"); |
1102 | 1096 | ||
1103 | if(!lnk.writeLink()) | 1097 | if(!lnk.writeLink()) |
1104 | qDebug("Writing doclink did not work"); | 1098 | qDebug("Writing doclink did not work"); |
1105 | d->selectedFiles->addToSelection( lnk); | 1099 | d->selectedFiles->addToSelection( lnk); |
1106 | // if(fileDlg2) | 1100 | // if(fileDlg2) |
1107 | // delete fileDlg2; | 1101 | // delete fileDlg2; |
1108 | } | 1102 | } |
1109 | } | ||
1110 | } | 1103 | } |
1111 | if(fileDlg) | 1104 | if(fileDlg) |
1112 | delete fileDlg; | 1105 | delete fileDlg; |
1113 | } | 1106 | } |
1114 | 1107 | ||
1115 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 1108 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
1116 | { | 1109 | { |
1117 | switch ( e->key() ) { | 1110 | switch ( e->key() ) { |
1118 | ////////////////////////////// Zaurus keys | 1111 | ////////////////////////////// Zaurus keys |
1119 | case Key_F9: //activity | 1112 | case Key_F9: //activity |
1120 | // if(audioUI->isHidden()) | 1113 | // if(audioUI->isHidden()) |
1121 | // audioUI->showMaximized(); | 1114 | // audioUI->showMaximized(); |
1122 | break; | 1115 | break; |
1123 | case Key_F10: //contacts | 1116 | case Key_F10: //contacts |
1124 | // if( videoUI->isHidden()) | 1117 | // if( videoUI->isHidden()) |
1125 | // videoUI->showMaximized(); | 1118 | // videoUI->showMaximized(); |
1126 | break; | 1119 | break; |
1127 | case Key_F11: //menu | 1120 | case Key_F11: //menu |
1128 | break; | 1121 | break; |
1129 | case Key_F12: //home | 1122 | case Key_F12: //home |
1130 | // doBlank(); | 1123 | // doBlank(); |
1131 | break; | 1124 | break; |
1132 | case Key_F13: //mail | 1125 | case Key_F13: //mail |
1133 | // doUnblank(); | 1126 | // doUnblank(); |
1134 | break; | 1127 | break; |
1135 | case Key_Q: //add to playlist | 1128 | case Key_Q: //add to playlist |
1136 | qDebug("Add"); | 1129 | qDebug("Add"); |
1137 | addSelected(); | 1130 | addSelected(); |
1138 | break; | 1131 | break; |
1139 | case Key_R: //remove from playlist | 1132 | case Key_R: //remove from playlist |
1140 | removeSelected(); | 1133 | removeSelected(); |
1141 | break; | 1134 | break; |
1142 | // case Key_P: //play | 1135 | // case Key_P: //play |
1143 | // qDebug("Play"); | 1136 | // qDebug("Play"); |
1144 | // playSelected(); | 1137 | // playSelected(); |
1145 | // break; | 1138 | // break; |
1146 | case Key_Space: | 1139 | case Key_Space: |
1147 | qDebug("Play"); | 1140 | qDebug("Play"); |
1148 | // playSelected(); puh | 1141 | // playSelected(); puh |
1149 | break; | 1142 | break; |
1150 | case Key_1: | 1143 | case Key_1: |
1151 | tabWidget->setCurrentPage(0); | 1144 | tabWidget->setCurrentPage(0); |
1152 | break; | 1145 | break; |
1153 | case Key_2: | 1146 | case Key_2: |
1154 | tabWidget->setCurrentPage(1); | 1147 | tabWidget->setCurrentPage(1); |
1155 | break; | 1148 | break; |
1156 | case Key_3: | 1149 | case Key_3: |
1157 | tabWidget->setCurrentPage(2); | 1150 | tabWidget->setCurrentPage(2); |
@@ -1185,100 +1178,98 @@ void PlayListWidget::keyPressEvent( QKeyEvent *e) | |||
1185 | // case Key_R: //remove from playlist | 1178 | // case Key_R: //remove from playlist |
1186 | // removeSelected(); | 1179 | // removeSelected(); |
1187 | // break; | 1180 | // break; |
1188 | // case Key_P: //play | 1181 | // case Key_P: //play |
1189 | // qDebug("Play"); | 1182 | // qDebug("Play"); |
1190 | // playSelected(); | 1183 | // playSelected(); |
1191 | // break; | 1184 | // break; |
1192 | // case Key_Space: | 1185 | // case Key_Space: |
1193 | // qDebug("Play"); | 1186 | // qDebug("Play"); |
1194 | // playSelected(); | 1187 | // playSelected(); |
1195 | // break; | 1188 | // break; |
1196 | // } | 1189 | // } |
1197 | } | 1190 | } |
1198 | 1191 | ||
1199 | void PlayListWidget::doBlank() { | 1192 | void PlayListWidget::doBlank() { |
1200 | qDebug("do blanking"); | 1193 | qDebug("do blanking"); |
1201 | fd=open("/dev/fb0",O_RDWR); | 1194 | fd=open("/dev/fb0",O_RDWR); |
1202 | if (fd != -1) { | 1195 | if (fd != -1) { |
1203 | ioctl(fd,FBIOBLANK,1); | 1196 | ioctl(fd,FBIOBLANK,1); |
1204 | // close(fd); | 1197 | // close(fd); |
1205 | } | 1198 | } |
1206 | } | 1199 | } |
1207 | 1200 | ||
1208 | void PlayListWidget::doUnblank() { | 1201 | void PlayListWidget::doUnblank() { |
1209 | // this crashes opieplayer with a segfault | 1202 | // this crashes opieplayer with a segfault |
1210 | // int fd; | 1203 | // int fd; |
1211 | // fd=open("/dev/fb0",O_RDWR); | 1204 | // fd=open("/dev/fb0",O_RDWR); |
1212 | qDebug("do unblanking"); | 1205 | qDebug("do unblanking"); |
1213 | if (fd != -1) { | 1206 | if (fd != -1) { |
1214 | ioctl(fd,FBIOBLANK,0); | 1207 | ioctl(fd,FBIOBLANK,0); |
1215 | close(fd); | 1208 | close(fd); |
1216 | } | 1209 | } |
1217 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1210 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1218 | h <<-3;// v[1]; // -3 Force on | 1211 | h <<-3;// v[1]; // -3 Force on |
1219 | } | 1212 | } |
1220 | 1213 | ||
1221 | void PlayListWidget::readm3u(const QString &filename) { | 1214 | void PlayListWidget::readm3u(const QString &filename) { |
1222 | 1215 | ||
1223 | qDebug("m3u filename is "+filename); | 1216 | qDebug("m3u filename is "+filename); |
1224 | QFile f(filename); | 1217 | QFile f(filename); |
1225 | 1218 | ||
1226 | if(f.open(IO_ReadOnly)) { | 1219 | if(f.open(IO_ReadOnly)) { |
1227 | QTextStream t(&f); | 1220 | QTextStream t(&f); |
1228 | QString s;//, first, second; | 1221 | QString s;//, first, second; |
1229 | int i=0; | 1222 | int i=0; |
1230 | while ( !t.atEnd()) { | 1223 | while ( !t.atEnd()) { |
1231 | // Lview->insertLine(t.readLine(),-1); | 1224 | // Lview->insertLine(t.readLine(),-1); |
1232 | s=t.readLine(); | 1225 | s=t.readLine(); |
1233 | if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { | 1226 | |
1234 | QMessageBox::message("Note","Spaces in urls are not allowed."); | 1227 | if(s.find("#",0,TRUE) == -1) { |
1235 | } | ||
1236 | else if(s.find("#",0,TRUE) == -1) { | ||
1237 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1228 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1238 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1229 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1239 | s=s.right(s.length()-2); | 1230 | s=s.right(s.length()-2); |
1240 | DocLnk lnk( s ); | 1231 | DocLnk lnk( s ); |
1241 | QFileInfo f(s); | 1232 | QFileInfo f(s); |
1242 | QString name = f.baseName(); | 1233 | QString name = f.baseName(); |
1243 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1234 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1244 | lnk.setName( name); | 1235 | lnk.setName( name); |
1245 | s=s.replace( QRegExp("\\"),"/"); | 1236 | s=s.replace( QRegExp("\\"),"/"); |
1246 | lnk.setFile( s); | 1237 | lnk.setFile( s); |
1247 | lnk.writeLink(); | 1238 | lnk.writeLink(); |
1248 | // lnk.setIcon(opieplayer/MPEGPlayer); | 1239 | // lnk.setIcon(opieplayer/MPEGPlayer); |
1249 | qDebug("add "+name); | 1240 | qDebug("add "+name); |
1250 | d->selectedFiles->addToSelection( lnk); | 1241 | d->selectedFiles->addToSelection( lnk); |
1251 | } else { // is url | 1242 | } else { // is url |
1252 | 1243 | ||
1253 | s.replace(QRegExp("%20")," "); | 1244 | s.replace(QRegExp("%20")," "); |
1254 | DocLnk lnk( s); | 1245 | DocLnk lnk( s); |
1255 | QString name; | 1246 | QString name; |
1256 | if(name.left(4)=="http") | 1247 | if(name.left(4)=="http") |
1257 | name = s.right( s.length() - 7); | 1248 | name = s.right( s.length() - 7); |
1258 | else | 1249 | else |
1259 | name=s; | 1250 | name=s; |
1260 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1251 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1261 | lnk.setName(name); | 1252 | lnk.setName(name); |
1262 | if(s.at(s.length()-4) == '.') | 1253 | if(s.at(s.length()-4) == '.') |
1263 | lnk.setFile( s); | 1254 | lnk.setFile( s); |
1264 | else | 1255 | else |
1265 | lnk.setFile( s+"/"); | 1256 | lnk.setFile( s+"/"); |
1266 | // lnk.setFile( filename); | 1257 | // lnk.setFile( filename); |
1267 | // lnk.setComment( s+"/"); | 1258 | // lnk.setComment( s+"/"); |
1268 | lnk.setType("audio/x-mpegurl"); | 1259 | lnk.setType("audio/x-mpegurl"); |
1269 | lnk.writeLink(); | 1260 | lnk.writeLink(); |
1270 | // lnk.setIcon( "opieplayer/MPEGPlayer"); | 1261 | // lnk.setIcon( "opieplayer/MPEGPlayer"); |
1271 | // qDebug("add "+s); | 1262 | // qDebug("add "+s); |
1272 | d->selectedFiles->addToSelection( lnk); | 1263 | d->selectedFiles->addToSelection( lnk); |
1273 | } | 1264 | } |
1274 | i++; | 1265 | i++; |
1275 | } | 1266 | } |
1276 | } | 1267 | } |
1277 | } | 1268 | } |
1278 | } | 1269 | } |
1279 | f.close(); | 1270 | f.close(); |
1280 | } | 1271 | } |
1281 | 1272 | ||
1282 | void PlayListWidget::writem3u() { | 1273 | void PlayListWidget::writem3u() { |
1283 | 1274 | ||
1284 | InputDialog *fileDlg; | 1275 | InputDialog *fileDlg; |