-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 5c804f5..404e1fe 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -71,65 +71,65 @@ public: | |||
71 | setFocusPolicy( QWidget::NoFocus ); | 71 | setFocusPolicy( QWidget::NoFocus ); |
72 | setToggleButton( t ); | 72 | setToggleButton( t ); |
73 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 73 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
74 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 74 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
75 | } | 75 | } |
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | class MenuItem : public QAction { | 79 | class MenuItem : public QAction { |
80 | public: | 80 | public: |
81 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 81 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
82 | : QAction( text, QString::null, 0, 0 ) { | 82 | : QAction( text, QString::null, 0, 0 ) { |
83 | connect( this, SIGNAL( activated() ), handler, slot ); | 83 | connect( this, SIGNAL( activated() ), handler, slot ); |
84 | addTo( parent ); | 84 | addTo( parent ); |
85 | } | 85 | } |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 89 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
90 | : QMainWindow( parent, name, fl ) { | 90 | : QMainWindow( parent, name, fl ) { |
91 | 91 | ||
92 | d = new PlayListWidgetPrivate; | 92 | d = new PlayListWidgetPrivate; |
93 | d->setDocumentUsed = FALSE; | 93 | d->setDocumentUsed = FALSE; |
94 | d->current = NULL; | 94 | d->current = NULL; |
95 | fromSetDocument = FALSE; | 95 | fromSetDocument = FALSE; |
96 | insanityBool=FALSE; | 96 | insanityBool=FALSE; |
97 | audioScan = FALSE; | 97 | audioScan = FALSE; |
98 | videoScan = FALSE; | 98 | videoScan = FALSE; |
99 | 99 | ||
100 | setBackgroundMode( PaletteButton ); | 100 | setBackgroundMode( PaletteButton ); |
101 | 101 | ||
102 | // setCaption( tr("OpiePlayer") ); | 102 | // setCaption( tr("OpiePlayer") ); |
103 | setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); | 103 | // setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); |
104 | 104 | ||
105 | setToolBarsMovable( FALSE ); | 105 | setToolBarsMovable( FALSE ); |
106 | 106 | ||
107 | // Create Toolbar | 107 | // Create Toolbar |
108 | QPEToolBar *toolbar = new QPEToolBar( this ); | 108 | QPEToolBar *toolbar = new QPEToolBar( this ); |
109 | toolbar->setHorizontalStretchable( TRUE ); | 109 | toolbar->setHorizontalStretchable( TRUE ); |
110 | 110 | ||
111 | // Create Menubar | 111 | // Create Menubar |
112 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 112 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
113 | menu->setMargin( 0 ); | 113 | menu->setMargin( 0 ); |
114 | 114 | ||
115 | QPEToolBar *bar = new QPEToolBar( this ); | 115 | QPEToolBar *bar = new QPEToolBar( this ); |
116 | bar->setLabel( tr( "Play Operations" ) ); | 116 | bar->setLabel( tr( "Play Operations" ) ); |
117 | 117 | ||
118 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 118 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
119 | tbDeletePlaylist->setFlat(TRUE); | 119 | tbDeletePlaylist->setFlat(TRUE); |
120 | tbDeletePlaylist->setFixedSize(20,20); | 120 | tbDeletePlaylist->setFixedSize(20,20); |
121 | 121 | ||
122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", | 122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", |
123 | this , SLOT(addSelected()) ); | 123 | this , SLOT(addSelected()) ); |
124 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", | 124 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", |
125 | this , SLOT(removeSelected()) ); | 125 | this , SLOT(removeSelected()) ); |
126 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 126 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
127 | this , SLOT( btnPlay(bool) ), TRUE ); | 127 | this , SLOT( btnPlay(bool) ), TRUE ); |
128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", | 130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", |
131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
132 | tbDeletePlaylist->hide(); | 132 | tbDeletePlaylist->hide(); |
133 | 133 | ||
134 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 134 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
135 | menu->insertItem( tr( "File" ), pmPlayList ); | 135 | menu->insertItem( tr( "File" ), pmPlayList ); |
@@ -429,108 +429,107 @@ void PlayListWidget::addAllVideoToList() { | |||
429 | 429 | ||
430 | 430 | ||
431 | void PlayListWidget::setDocument(const QString& fileref) { | 431 | void PlayListWidget::setDocument(const QString& fileref) { |
432 | qDebug(fileref); | 432 | qDebug(fileref); |
433 | fromSetDocument = TRUE; | 433 | fromSetDocument = TRUE; |
434 | if ( fileref.isNull() ) { | 434 | if ( fileref.isNull() ) { |
435 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 435 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
436 | return; | 436 | return; |
437 | } | 437 | } |
438 | 438 | ||
439 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 439 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
440 | readm3u( fileref); | 440 | readm3u( fileref); |
441 | } else if(fileref.find("pls",0,TRUE) != -1) { //is pls | 441 | } else if(fileref.find("pls",0,TRUE) != -1) { //is pls |
442 | readPls( fileref); | 442 | readPls( fileref); |
443 | } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | 443 | } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist |
444 | clearList(); | 444 | clearList(); |
445 | loadList(DocLnk(fileref)); | 445 | loadList(DocLnk(fileref)); |
446 | d->selectedFiles->first(); | 446 | d->selectedFiles->first(); |
447 | } else { | 447 | } else { |
448 | clearList(); | 448 | clearList(); |
449 | addToSelection( DocLnk( fileref ) ); | 449 | addToSelection( DocLnk( fileref ) ); |
450 | d->setDocumentUsed = TRUE; | 450 | d->setDocumentUsed = TRUE; |
451 | mediaPlayerState->setPlaying( FALSE ); | 451 | mediaPlayerState->setPlaying( FALSE ); |
452 | qApp->processEvents(); | 452 | qApp->processEvents(); |
453 | mediaPlayerState->setPlaying( TRUE ); | 453 | mediaPlayerState->setPlaying( TRUE ); |
454 | qApp->processEvents(); | 454 | qApp->processEvents(); |
455 | setCaption(tr("OpiePlayer")); | 455 | setCaption(tr("OpiePlayer")); |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | void PlayListWidget::setActiveWindow() { | 460 | void PlayListWidget::setActiveWindow() { |
461 | qDebug("SETTING active window"); | 461 | // qDebug("SETTING active window"); |
462 | // When we get raised we need to ensure that it switches views | 462 | // When we get raised we need to ensure that it switches views |
463 | char origView = mediaPlayerState->view(); | 463 | char origView = mediaPlayerState->view(); |
464 | mediaPlayerState->setView( 'l' ); // invalidate | 464 | mediaPlayerState->setView( 'l' ); // invalidate |
465 | mediaPlayerState->setView( origView ); // now switch back | 465 | mediaPlayerState->setView( origView ); // now switch back |
466 | } | 466 | } |
467 | 467 | ||
468 | 468 | ||
469 | void PlayListWidget::useSelectedDocument() { | 469 | void PlayListWidget::useSelectedDocument() { |
470 | d->setDocumentUsed = FALSE; | 470 | d->setDocumentUsed = FALSE; |
471 | } | 471 | } |
472 | 472 | ||
473 | 473 | ||
474 | const DocLnk *PlayListWidget::current() { // this is fugly | 474 | const DocLnk *PlayListWidget::current() { // this is fugly |
475 | 475 | ||
476 | switch (tabWidget->currentPageIndex()) { | 476 | switch (tabWidget->currentPageIndex()) { |
477 | case 0: //playlist | 477 | case 0: //playlist |
478 | { | 478 | { |
479 | qDebug("playlist"); | 479 | // qDebug("playlist"); |
480 | if ( mediaPlayerState->playlist() ) { | 480 | if ( mediaPlayerState->playlist() ) { |
481 | return d->selectedFiles->current(); | 481 | return d->selectedFiles->current(); |
482 | } else if ( d->setDocumentUsed && d->current ) { | 482 | } else if ( d->setDocumentUsed && d->current ) { |
483 | return d->current; | 483 | return d->current; |
484 | } else { | 484 | } else { |
485 | return d->files->selected(); | 485 | return d->files->selected(); |
486 | } | 486 | } |
487 | } | 487 | } |
488 | break; | 488 | break; |
489 | case 1://audio | 489 | case 1://audio |
490 | { | 490 | { |
491 | qDebug("audioView"); | 491 | // qDebug("audioView"); |
492 | QListIterator<DocLnk> dit( files.children() ); | 492 | QListIterator<DocLnk> dit( files.children() ); |
493 | for ( ; dit.current(); ++dit ) { | 493 | for ( ; dit.current(); ++dit ) { |
494 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 494 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
495 | qDebug("here"); | ||
496 | insanityBool=TRUE; | 495 | insanityBool=TRUE; |
497 | return dit; | 496 | return dit; |
498 | } | 497 | } |
499 | } | 498 | } |
500 | } | 499 | } |
501 | break; | 500 | break; |
502 | case 2: // video | 501 | case 2: // video |
503 | { | 502 | { |
504 | qDebug("videoView"); | 503 | // qDebug("videoView"); |
505 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 504 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
506 | for ( ; Vdit.current(); ++Vdit ) { | 505 | for ( ; Vdit.current(); ++Vdit ) { |
507 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { | 506 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { |
508 | insanityBool=TRUE; | 507 | insanityBool=TRUE; |
509 | return Vdit; | 508 | return Vdit; |
510 | } | 509 | } |
511 | } | 510 | } |
512 | } | 511 | } |
513 | break; | 512 | break; |
514 | }; | 513 | }; |
515 | return 0; | 514 | return 0; |
516 | } | 515 | } |
517 | 516 | ||
518 | bool PlayListWidget::prev() { | 517 | bool PlayListWidget::prev() { |
519 | if ( mediaPlayerState->playlist() ) { | 518 | if ( mediaPlayerState->playlist() ) { |
520 | if ( mediaPlayerState->shuffled() ) { | 519 | if ( mediaPlayerState->shuffled() ) { |
521 | const DocLnk *cur = current(); | 520 | const DocLnk *cur = current(); |
522 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 521 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
523 | for ( int i = 0; i < j; i++ ) { | 522 | for ( int i = 0; i < j; i++ ) { |
524 | if ( !d->selectedFiles->next() ) | 523 | if ( !d->selectedFiles->next() ) |
525 | d->selectedFiles->first(); | 524 | d->selectedFiles->first(); |
526 | } | 525 | } |
527 | if ( cur == current() ) | 526 | if ( cur == current() ) |
528 | if ( !d->selectedFiles->next() ) | 527 | if ( !d->selectedFiles->next() ) |
529 | d->selectedFiles->first(); | 528 | d->selectedFiles->first(); |
530 | return TRUE; | 529 | return TRUE; |
531 | } else { | 530 | } else { |
532 | if ( !d->selectedFiles->prev() ) { | 531 | if ( !d->selectedFiles->prev() ) { |
533 | if ( mediaPlayerState->looping() ) { | 532 | if ( mediaPlayerState->looping() ) { |
534 | return d->selectedFiles->last(); | 533 | return d->selectedFiles->last(); |
535 | } else { | 534 | } else { |
536 | return FALSE; | 535 | return FALSE; |
@@ -836,76 +835,76 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , in | |||
836 | case 2:{ | 835 | case 2:{ |
837 | QPopupMenu m; | 836 | QPopupMenu m; |
838 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 837 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
839 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 838 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
840 | m.exec( QCursor::pos() ); | 839 | m.exec( QCursor::pos() ); |
841 | } | 840 | } |
842 | break; | 841 | break; |
843 | }; | 842 | }; |
844 | } | 843 | } |
845 | 844 | ||
846 | void PlayListWidget::playSelected() { | 845 | void PlayListWidget::playSelected() { |
847 | btnPlay( TRUE); | 846 | btnPlay( TRUE); |
848 | } | 847 | } |
849 | 848 | ||
850 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 849 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
851 | switch (mouse) { | 850 | switch (mouse) { |
852 | case 1: | 851 | case 1: |
853 | 852 | ||
854 | break; | 853 | break; |
855 | case 2: | 854 | case 2: |
856 | { | 855 | { |
857 | QPopupMenu m; | 856 | QPopupMenu m; |
858 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 857 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
859 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 858 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
860 | m.exec( QCursor::pos() ); | 859 | m.exec( QCursor::pos() ); |
861 | } | 860 | } |
862 | break; | 861 | break; |
863 | }; | 862 | }; |
864 | } | 863 | } |
865 | 864 | ||
866 | 865 | ||
867 | void PlayListWidget::scanForAudio() { | 866 | void PlayListWidget::scanForAudio() { |
868 | qDebug("scan for audio"); | 867 | // qDebug("scan for audio"); |
869 | files.detachChildren(); | 868 | files.detachChildren(); |
870 | QListIterator<DocLnk> sdit( files.children() ); | 869 | QListIterator<DocLnk> sdit( files.children() ); |
871 | for ( ; sdit.current(); ++sdit ) { | 870 | for ( ; sdit.current(); ++sdit ) { |
872 | delete sdit.current(); | 871 | delete sdit.current(); |
873 | } | 872 | } |
874 | Global::findDocuments(&files, "audio/*"); | 873 | Global::findDocuments(&files, "audio/*"); |
875 | audioScan = TRUE; | 874 | audioScan = TRUE; |
876 | } | 875 | } |
877 | 876 | ||
878 | void PlayListWidget::scanForVideo() { | 877 | void PlayListWidget::scanForVideo() { |
879 | qDebug("scan for video"); | 878 | // qDebug("scan for video"); |
880 | vFiles.detachChildren(); | 879 | vFiles.detachChildren(); |
881 | QListIterator<DocLnk> sdit( vFiles.children() ); | 880 | QListIterator<DocLnk> sdit( vFiles.children() ); |
882 | for ( ; sdit.current(); ++sdit ) { | 881 | for ( ; sdit.current(); ++sdit ) { |
883 | delete sdit.current(); | 882 | delete sdit.current(); |
884 | } | 883 | } |
885 | Global::findDocuments(&vFiles, "video/*"); | 884 | Global::findDocuments(&vFiles, "video/*"); |
886 | videoScan = TRUE; | 885 | videoScan = TRUE; |
887 | } | 886 | } |
888 | 887 | ||
889 | void PlayListWidget::populateAudioView() { | 888 | void PlayListWidget::populateAudioView() { |
890 | 889 | ||
891 | audioView->clear(); | 890 | audioView->clear(); |
892 | StorageInfo storageInfo; | 891 | StorageInfo storageInfo; |
893 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 892 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
894 | if(!audioScan) scanForAudio(); | 893 | if(!audioScan) scanForAudio(); |
895 | 894 | ||
896 | QListIterator<DocLnk> dit( files.children() ); | 895 | QListIterator<DocLnk> dit( files.children() ); |
897 | QListIterator<FileSystem> it ( fs ); | 896 | QListIterator<FileSystem> it ( fs ); |
898 | 897 | ||
899 | QString storage; | 898 | QString storage; |
900 | for ( ; dit.current(); ++dit ) { | 899 | for ( ; dit.current(); ++dit ) { |
901 | for( ; it.current(); ++it ){ | 900 | for( ; it.current(); ++it ){ |
902 | const QString name = (*it)->name(); | 901 | const QString name = (*it)->name(); |
903 | const QString path = (*it)->path(); | 902 | const QString path = (*it)->path(); |
904 | if(dit.current()->file().find(path) != -1 ) storage=name; | 903 | if(dit.current()->file().find(path) != -1 ) storage=name; |
905 | } | 904 | } |
906 | 905 | ||
907 | QListViewItem * newItem; | 906 | QListViewItem * newItem; |
908 | if ( QFile( dit.current()->file()).exists() ) { | 907 | if ( QFile( dit.current()->file()).exists() ) { |
909 | // qDebug(dit.current()->name()); | 908 | // qDebug(dit.current()->name()); |
910 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 909 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
911 | QString::number( QFile( dit.current()->file()).size() ), storage); | 910 | QString::number( QFile( dit.current()->file()).size() ), storage); |
@@ -967,76 +966,74 @@ void PlayListWidget::openFile() { | |||
967 | if(!lnk.writeLink()) { | 966 | if(!lnk.writeLink()) { |
968 | qDebug("Writing doclink did not work"); | 967 | qDebug("Writing doclink did not work"); |
969 | } | 968 | } |
970 | d->selectedFiles->addToSelection( lnk); | 969 | d->selectedFiles->addToSelection( lnk); |
971 | } | 970 | } |
972 | } | 971 | } |
973 | if(fileDlg) { | 972 | if(fileDlg) { |
974 | delete fileDlg; | 973 | delete fileDlg; |
975 | } | 974 | } |
976 | } | 975 | } |
977 | 976 | ||
978 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 977 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
979 | { | 978 | { |
980 | switch ( e->key() ) { | 979 | switch ( e->key() ) { |
981 | ////////////////////////////// Zaurus keys | 980 | ////////////////////////////// Zaurus keys |
982 | case Key_F9: //activity | 981 | case Key_F9: //activity |
983 | // if(audioUI->isHidden()) | 982 | // if(audioUI->isHidden()) |
984 | // audioUI->showMaximized(); | 983 | // audioUI->showMaximized(); |
985 | break; | 984 | break; |
986 | case Key_F10: //contacts | 985 | case Key_F10: //contacts |
987 | // if( videoUI->isHidden()) | 986 | // if( videoUI->isHidden()) |
988 | // videoUI->showMaximized(); | 987 | // videoUI->showMaximized(); |
989 | break; | 988 | break; |
990 | case Key_F11: //menu | 989 | case Key_F11: //menu |
991 | break; | 990 | break; |
992 | case Key_F12: //home | 991 | case Key_F12: //home |
993 | // doBlank(); | 992 | // doBlank(); |
994 | break; | 993 | break; |
995 | case Key_F13: //mail | 994 | case Key_F13: //mail |
996 | // doUnblank(); | 995 | // doUnblank(); |
997 | break; | 996 | break; |
998 | case Key_Q: //add to playlist | 997 | case Key_Q: //add to playlist |
999 | qDebug("Add"); | ||
1000 | addSelected(); | 998 | addSelected(); |
1001 | break; | 999 | break; |
1002 | case Key_R: //remove from playlist | 1000 | case Key_R: //remove from playlist |
1003 | removeSelected(); | 1001 | removeSelected(); |
1004 | break; | 1002 | break; |
1005 | // case Key_P: //play | 1003 | // case Key_P: //play |
1006 | // qDebug("Play"); | 1004 | // qDebug("Play"); |
1007 | // playSelected(); | 1005 | // playSelected(); |
1008 | // break; | 1006 | // break; |
1009 | case Key_Space: | 1007 | case Key_Space: |
1010 | qDebug("Play"); | ||
1011 | // playSelected(); puh | 1008 | // playSelected(); puh |
1012 | break; | 1009 | break; |
1013 | case Key_1: | 1010 | case Key_1: |
1014 | tabWidget->setCurrentPage(0); | 1011 | tabWidget->setCurrentPage(0); |
1015 | break; | 1012 | break; |
1016 | case Key_2: | 1013 | case Key_2: |
1017 | tabWidget->setCurrentPage(1); | 1014 | tabWidget->setCurrentPage(1); |
1018 | break; | 1015 | break; |
1019 | case Key_3: | 1016 | case Key_3: |
1020 | tabWidget->setCurrentPage(2); | 1017 | tabWidget->setCurrentPage(2); |
1021 | break; | 1018 | break; |
1022 | case Key_4: | 1019 | case Key_4: |
1023 | tabWidget->setCurrentPage(3); | 1020 | tabWidget->setCurrentPage(3); |
1024 | break; | 1021 | break; |
1025 | case Key_Down: | 1022 | case Key_Down: |
1026 | if ( !d->selectedFiles->next() ) | 1023 | if ( !d->selectedFiles->next() ) |
1027 | d->selectedFiles->first(); | 1024 | d->selectedFiles->first(); |
1028 | 1025 | ||
1029 | break; | 1026 | break; |
1030 | case Key_Up: | 1027 | case Key_Up: |
1031 | if ( !d->selectedFiles->prev() ) | 1028 | if ( !d->selectedFiles->prev() ) |
1032 | // d->selectedFiles->last(); | 1029 | // d->selectedFiles->last(); |
1033 | 1030 | ||
1034 | break; | 1031 | break; |
1035 | 1032 | ||
1036 | } | 1033 | } |
1037 | } | 1034 | } |
1038 | 1035 | ||
1039 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1036 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1040 | { | 1037 | { |
1041 | // qDebug("Key press"); | 1038 | // qDebug("Key press"); |
1042 | // switch ( e->key() ) { | 1039 | // switch ( e->key() ) { |
@@ -1168,65 +1165,65 @@ void PlayListWidget::readPls(const QString &filename) { | |||
1168 | // Title | 1165 | // Title |
1169 | // Length | 1166 | // Length |
1170 | // Version | 1167 | // Version |
1171 | // File2=http | 1168 | // File2=http |
1172 | s=s.replace( QRegExp("\\"),"/"); | 1169 | s=s.replace( QRegExp("\\"),"/"); |
1173 | DocLnk lnk( s ); | 1170 | DocLnk lnk( s ); |
1174 | QFileInfo f(s); | 1171 | QFileInfo f(s); |
1175 | QString name = f.baseName(); | 1172 | QString name = f.baseName(); |
1176 | if(name.left(4)=="http") | 1173 | if(name.left(4)=="http") |
1177 | name = s.right( s.length() - 7); | 1174 | name = s.right( s.length() - 7); |
1178 | else | 1175 | else |
1179 | name=s; | 1176 | name=s; |
1180 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1177 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1181 | lnk.setName( name); | 1178 | lnk.setName( name); |
1182 | if(s.at(s.length()-4) == '.') // if this is probably a file | 1179 | if(s.at(s.length()-4) == '.') // if this is probably a file |
1183 | lnk.setFile( s); | 1180 | lnk.setFile( s); |
1184 | else { //if its a url | 1181 | else { //if its a url |
1185 | if( name.right(1).find('/') == -1) | 1182 | if( name.right(1).find('/') == -1) |
1186 | s+="/"; | 1183 | s+="/"; |
1187 | lnk.setFile( s); | 1184 | lnk.setFile( s); |
1188 | } | 1185 | } |
1189 | lnk.setType("audio/x-mpegurl"); | 1186 | lnk.setType("audio/x-mpegurl"); |
1190 | 1187 | ||
1191 | qDebug("DocLnk add "+name); | 1188 | qDebug("DocLnk add "+name); |
1192 | d->selectedFiles->addToSelection( lnk); | 1189 | d->selectedFiles->addToSelection( lnk); |
1193 | } | 1190 | } |
1194 | } | 1191 | } |
1195 | i++; | 1192 | i++; |
1196 | } | 1193 | } |
1197 | } | 1194 | } |
1198 | 1195 | ||
1199 | void PlayListWidget::pmViewActivated(int index) { | 1196 | void PlayListWidget::pmViewActivated(int index) { |
1200 | qDebug("%d", index); | 1197 | // qDebug("%d", index); |
1201 | switch(index) { | 1198 | switch(index) { |
1202 | case -16: | 1199 | case -16: |
1203 | { | 1200 | { |
1204 | 1201 | ||
1205 | mediaPlayerState->toggleFullscreen(); | 1202 | mediaPlayerState->toggleFullscreen(); |
1206 | bool b=mediaPlayerState->fullscreen(); | 1203 | bool b=mediaPlayerState->fullscreen(); |
1207 | pmView->setItemChecked( index,b); | 1204 | pmView->setItemChecked( index,b); |
1208 | Config cfg( "OpiePlayer" ); | 1205 | Config cfg( "OpiePlayer" ); |
1209 | cfg.writeEntry("FullScreen", b); | 1206 | cfg.writeEntry("FullScreen", b); |
1210 | 1207 | ||
1211 | } | 1208 | } |
1212 | break; | 1209 | break; |
1213 | }; | 1210 | }; |
1214 | } | 1211 | } |
1215 | 1212 | ||
1216 | void PlayListWidget::populateSkinsMenu() { | 1213 | void PlayListWidget::populateSkinsMenu() { |
1217 | int item=0; | 1214 | int item=0; |
1218 | defaultSkinIndex=0; | 1215 | defaultSkinIndex=0; |
1219 | QString skinName; | 1216 | QString skinName; |
1220 | Config cfg( "OpiePlayer" ); | 1217 | Config cfg( "OpiePlayer" ); |
1221 | cfg.setGroup("Options"); | 1218 | cfg.setGroup("Options"); |
1222 | QString skin = cfg.readEntry("Skin","default"); | 1219 | QString skin = cfg.readEntry("Skin","default"); |
1223 | 1220 | ||
1224 | QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); | 1221 | QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); |
1225 | skinsDir.setFilter( QDir::Dirs); | 1222 | skinsDir.setFilter( QDir::Dirs); |
1226 | skinsDir.setSorting(QDir::Name); | 1223 | skinsDir.setSorting(QDir::Name); |
1227 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1224 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1228 | QFileInfoListIterator it( *skinslist ); | 1225 | QFileInfoListIterator it( *skinslist ); |
1229 | QFileInfo *fi; | 1226 | QFileInfo *fi; |
1230 | while ( (fi=it.current()) ) { | 1227 | while ( (fi=it.current()) ) { |
1231 | skinName = fi->fileName(); | 1228 | skinName = fi->fileName(); |
1232 | qDebug( fi->fileName()); | 1229 | qDebug( fi->fileName()); |