author | llornkcor <llornkcor> | 2002-03-18 01:50:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-18 01:50:17 (UTC) |
commit | c09cb25eb6bbf31bed0d4a415802469cfd1efedf (patch) (unidiff) | |
tree | 86ced0fa482bd5fb244629f2baa1b1a4f25c9189 /core/multimedia/opieplayer/playlistwidget.cpp | |
parent | 848182342d81b4e6ab4ce6b75bdaa0b109828af3 (diff) | |
download | opie-c09cb25eb6bbf31bed0d4a415802469cfd1efedf.zip opie-c09cb25eb6bbf31bed0d4a415802469cfd1efedf.tar.gz opie-c09cb25eb6bbf31bed0d4a415802469cfd1efedf.tar.bz2 |
added stuff and fixed stuff that I dont remember- plays w/o going to playlist among other things
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 212 |
1 files changed, 121 insertions, 91 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 9969526..524747e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -105,6 +105,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
105 | d = new PlayListWidgetPrivate; | 105 | d = new PlayListWidgetPrivate; |
106 | d->setDocumentUsed = FALSE; | 106 | d->setDocumentUsed = FALSE; |
107 | d->current = NULL; | 107 | d->current = NULL; |
108 | fromSetDocument = FALSE; | ||
108 | // menuTimer = new QTimer( this ,"menu timer"), | 109 | // menuTimer = new QTimer( this ,"menu timer"), |
109 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 110 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
110 | 111 | ||
@@ -174,10 +175,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
174 | 175 | ||
175 | QWidget *pTab; | 176 | QWidget *pTab; |
176 | pTab = new QWidget( tabWidget, "pTab" ); | 177 | pTab = new QWidget( tabWidget, "pTab" ); |
177 | playlistView = new QListView( pTab, "Videoview" ); | 178 | // playlistView = new QListView( pTab, "playlistview" ); |
178 | playlistView->setMinimumSize(236,260); | 179 | // playlistView->setMinimumSize(236,260); |
179 | tabWidget->insertTab( pTab,"Playlist"); | 180 | tabWidget->insertTab( pTab,"Playlist"); |
180 | 181 | ||
182 | |||
181 | // Add the playlist area | 183 | // Add the playlist area |
182 | 184 | ||
183 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 185 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
@@ -189,6 +191,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
189 | d->selectedFiles = new PlayListSelection( hbox2); | 191 | d->selectedFiles = new PlayListSelection( hbox2); |
190 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 192 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
191 | 193 | ||
194 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | ||
195 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
196 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
197 | |||
198 | |||
192 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 199 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
193 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 200 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
194 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 201 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
@@ -204,7 +211,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
204 | audioView->addColumn("Media",35); | 211 | audioView->addColumn("Media",35); |
205 | audioView->setColumnAlignment(1, Qt::AlignRight); | 212 | audioView->setColumnAlignment(1, Qt::AlignRight); |
206 | audioView->setColumnAlignment(2, Qt::AlignRight); | 213 | audioView->setColumnAlignment(2, Qt::AlignRight); |
214 | audioView->setAllColumnsShowFocus(TRUE); | ||
207 | tabWidget->insertTab(aTab,"Audio"); | 215 | tabWidget->insertTab(aTab,"Audio"); |
216 | |||
217 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | ||
218 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
219 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
220 | |||
221 | |||
208 | // audioView | 222 | // audioView |
209 | Global::findDocuments(&files, "audio/*"); | 223 | Global::findDocuments(&files, "audio/*"); |
210 | QListIterator<DocLnk> dit( files.children() ); | 224 | QListIterator<DocLnk> dit( files.children() ); |
@@ -232,6 +246,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
232 | videoView->addColumn("Media",35); | 246 | videoView->addColumn("Media",35); |
233 | videoView->setColumnAlignment(1, Qt::AlignRight); | 247 | videoView->setColumnAlignment(1, Qt::AlignRight); |
234 | videoView->setColumnAlignment(2, Qt::AlignRight); | 248 | videoView->setColumnAlignment(2, Qt::AlignRight); |
249 | videoView->setAllColumnsShowFocus(TRUE); | ||
250 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | ||
251 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
252 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
235 | 253 | ||
236 | tabWidget->insertTab( vTab,"Video"); | 254 | tabWidget->insertTab( vTab,"Video"); |
237 | 255 | ||
@@ -261,8 +279,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
261 | 279 | ||
262 | 280 | ||
263 | // add the library area | 281 | // add the library area |
264 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | ||
265 | |||
266 | 282 | ||
267 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 283 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
268 | // this, SLOT( fauxPlay( QListViewItem *) ) ); | 284 | // this, SLOT( fauxPlay( QListViewItem *) ) ); |
@@ -419,25 +435,26 @@ void PlayListWidget::addAllVideoToList() { | |||
419 | 435 | ||
420 | 436 | ||
421 | void PlayListWidget::setDocument(const QString& fileref) { | 437 | void PlayListWidget::setDocument(const QString& fileref) { |
438 | fromSetDocument = TRUE; | ||
422 | if ( fileref.isNull() ) { | 439 | if ( fileref.isNull() ) { |
423 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 440 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
424 | return; | 441 | return; |
425 | } | 442 | } |
426 | // qDebug("setDocument"); | 443 | // qDebug("setDocument "+fileref); |
427 | if(fileref.find("playlist",0,TRUE) == -1) { | 444 | if(fileref.find("playlist",0,TRUE) == -1) { |
428 | addToSelection( DocLnk( fileref ) ); | 445 | clearList(); |
429 | d->setDocumentUsed = TRUE; | 446 | addToSelection( DocLnk( fileref ) ); |
430 | qApp->processEvents(); | 447 | d->setDocumentUsed = TRUE; |
431 | mediaPlayerState->setPlaying( FALSE ); | 448 | mediaPlayerState->setPlaying( FALSE ); |
432 | qApp->processEvents(); | 449 | qApp->processEvents(); |
433 | mediaPlayerState->setPlaying( TRUE ); | 450 | mediaPlayerState->setPlaying( TRUE ); |
434 | d->selectedFiles->removeSelected( ); | 451 | qApp->processEvents(); |
435 | } else { | 452 | setCaption("OpiePlayer"); |
453 | |||
454 | } else { //is playlist | ||
455 | clearList(); | ||
436 | loadList(DocLnk(fileref)); | 456 | loadList(DocLnk(fileref)); |
437 | d->selectedFiles->first(); | 457 | d->selectedFiles->first(); |
438 | // mediaPlayerState->setPlaying( TRUE ); | ||
439 | // mediaPlayerState->setPlaying( FALSE ); | ||
440 | |||
441 | } | 458 | } |
442 | } | 459 | } |
443 | 460 | ||
@@ -455,20 +472,54 @@ void PlayListWidget::useSelectedDocument() { | |||
455 | } | 472 | } |
456 | 473 | ||
457 | 474 | ||
458 | const DocLnk *PlayListWidget::current() { | 475 | const DocLnk *PlayListWidget::current() { // this is fugly |
459 | 476 | ||
460 | // qDebug("in Playlist widget ::current"); | 477 | // if( fromSetDocument) { |
461 | if ( mediaPlayerState->playlist() ) { | 478 | // qDebug("from setDoc"); |
462 | return d->selectedFiles->current(); | 479 | // DocLnkSet files; |
463 | } | 480 | // Global::findDocuments(&files, "video/*;audio/*"); |
464 | else if ( d->setDocumentUsed && d->current ) { | 481 | // QListIterator<DocLnk> dit( files.children() ); |
465 | return d->current; | 482 | // for ( ; dit.current(); ++dit ) { |
466 | } else { | 483 | // if(dit.current()->linkFile() == setDocFileRef) { |
467 | return d->files->selected(); | 484 | // qDebug(setDocFileRef); |
468 | } | 485 | // return dit; |
486 | // } | ||
487 | // } | ||
488 | // } else | ||
489 | switch (tabWidget->currentPageIndex()) { | ||
490 | case 0: //playlist | ||
491 | { | ||
492 | if ( mediaPlayerState->playlist() ) { | ||
493 | return d->selectedFiles->current(); | ||
494 | } | ||
495 | else if ( d->setDocumentUsed && d->current ) { | ||
496 | return d->current; | ||
497 | } else { | ||
498 | return d->files->selected(); | ||
499 | } | ||
500 | } | ||
501 | break; | ||
502 | case 1: { //audio | ||
503 | Global::findDocuments(&files, "audio/*"); | ||
504 | QListIterator<DocLnk> dit( files.children() ); | ||
505 | for ( ; dit.current(); ++dit ) { | ||
506 | if( dit.current()->name() == audioView->currentItem()->text(0)) | ||
507 | return dit; | ||
508 | } | ||
509 | } | ||
510 | break; | ||
511 | case 2: { // video | ||
512 | Global::findDocuments(&vFiles, "video/*"); | ||
513 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
514 | for ( ; Vdit.current(); ++Vdit ) { | ||
515 | if( Vdit.current()->name() == videoView->currentItem()->text(0)) | ||
516 | return Vdit; | ||
517 | } | ||
518 | } | ||
519 | break; | ||
520 | }; | ||
469 | } | 521 | } |
470 | 522 | ||
471 | |||
472 | bool PlayListWidget::prev() { | 523 | bool PlayListWidget::prev() { |
473 | if ( mediaPlayerState->playlist() ) { | 524 | if ( mediaPlayerState->playlist() ) { |
474 | if ( mediaPlayerState->shuffled() ) { | 525 | if ( mediaPlayerState->shuffled() ) { |
@@ -569,10 +620,8 @@ void PlayListWidget::saveList() { | |||
569 | d->selectedFiles->first(); | 620 | d->selectedFiles->first(); |
570 | if(fileDlg) | 621 | if(fileDlg) |
571 | delete fileDlg; | 622 | delete fileDlg; |
572 | |||
573 | } | 623 | } |
574 | 624 | ||
575 | |||
576 | void PlayListWidget::loadList( const DocLnk & lnk) { | 625 | void PlayListWidget::loadList( const DocLnk & lnk) { |
577 | QString name= lnk.name(); | 626 | QString name= lnk.name(); |
578 | // qDebug("currentList is "+name); | 627 | // qDebug("currentList is "+name); |
@@ -589,7 +638,6 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
589 | } | 638 | } |
590 | } | 639 | } |
591 | 640 | ||
592 | |||
593 | void PlayListWidget::setPlaylist( bool shown ) { | 641 | void PlayListWidget::setPlaylist( bool shown ) { |
594 | if ( shown ) | 642 | if ( shown ) |
595 | d->playListFrame->show(); | 643 | d->playListFrame->show(); |
@@ -597,7 +645,6 @@ void PlayListWidget::setPlaylist( bool shown ) { | |||
597 | d->playListFrame->hide(); | 645 | d->playListFrame->hide(); |
598 | } | 646 | } |
599 | 647 | ||
600 | |||
601 | void PlayListWidget::setView( char view ) { | 648 | void PlayListWidget::setView( char view ) { |
602 | if ( view == 'l' ) | 649 | if ( view == 'l' ) |
603 | showMaximized(); | 650 | showMaximized(); |
@@ -704,68 +751,11 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
704 | }; | 751 | }; |
705 | } | 752 | } |
706 | 753 | ||
707 | /* | ||
708 | list is right clicked*/ | ||
709 | void PlayListWidget::fauxPlay(QListViewItem *it) { | ||
710 | |||
711 | switch (tabWidget->currentPageIndex()) { | ||
712 | case 0: //playlist | ||
713 | break; | ||
714 | case 1: { //audio | ||
715 | QListIterator<DocLnk> dit( files.children() ); | ||
716 | for ( ; dit.current(); ++dit ) { | ||
717 | // qDebug(dit.current()->name()); | ||
718 | if( dit.current()->name() == it->text(0)) { | ||
719 | d->selectedFiles->addToSelection( **dit ); | ||
720 | } | ||
721 | } | ||
722 | } | ||
723 | break; | ||
724 | case 2: { // video | ||
725 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
726 | for ( ; dit.current(); ++dit ) { | ||
727 | // qDebug(dit.current()->name()); | ||
728 | if( dit.current()->name() == it->text(0)) { | ||
729 | d->selectedFiles->addToSelection( **dit ); | ||
730 | } | ||
731 | } | ||
732 | } | ||
733 | break; | ||
734 | }; | ||
735 | mediaPlayerState->setPlaying( TRUE ); | ||
736 | // tabWidget->setCurrentPage(0); | ||
737 | d->selectedFiles->removeSelected(); | ||
738 | } | ||
739 | 754 | ||
740 | /* | 755 | /* |
741 | play button is pressed*/ | 756 | play button is pressed*/ |
742 | void PlayListWidget::btnPlay(bool b) { // this is fugly | 757 | void PlayListWidget::btnPlay(bool b) { |
743 | switch ( tabWidget->currentPageIndex()) { | 758 | mediaPlayerState->setPlaying(b); |
744 | case 0: | ||
745 | { | ||
746 | mediaPlayerState->setPlaying(b); | ||
747 | } | ||
748 | break; | ||
749 | case 1: | ||
750 | { | ||
751 | addToSelection( audioView->selectedItem() ); | ||
752 | mediaPlayerState->setPlaying(b); | ||
753 | qApp->processEvents(); | ||
754 | d->selectedFiles->removeSelected( ); | ||
755 | tabWidget->setCurrentPage(1); | ||
756 | } | ||
757 | break; | ||
758 | case 2: | ||
759 | { | ||
760 | addToSelection( videoView->selectedItem() ); | ||
761 | mediaPlayerState->setPlaying(b); | ||
762 | qApp->processEvents(); | ||
763 | d->selectedFiles->removeSelected( ); | ||
764 | tabWidget->setCurrentPage(2); | ||
765 | } | ||
766 | break; | ||
767 | }; | ||
768 | |||
769 | } | 759 | } |
770 | 760 | ||
771 | void PlayListWidget::deletePlaylist() { | 761 | void PlayListWidget::deletePlaylist() { |
@@ -782,3 +772,43 @@ void PlayListWidget::deletePlaylist() { | |||
782 | }; | 772 | }; |
783 | 773 | ||
784 | } | 774 | } |
775 | |||
776 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | ||
777 | { | ||
778 | switch (mouse) { | ||
779 | case 1: | ||
780 | break; | ||
781 | case 2:{ | ||
782 | QPopupMenu m; | ||
783 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | ||
784 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | ||
785 | // m.insertSeparator(); | ||
786 | // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | ||
787 | m.exec( QCursor::pos() ); | ||
788 | } | ||
789 | break; | ||
790 | }; | ||
791 | |||
792 | } | ||
793 | |||
794 | void PlayListWidget::playSelected() | ||
795 | { | ||
796 | btnPlay( TRUE); | ||
797 | } | ||
798 | |||
799 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | ||
800 | { | ||
801 | switch (mouse) { | ||
802 | case 1: | ||
803 | break; | ||
804 | case 2:{ | ||
805 | QPopupMenu m; | ||
806 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | ||
807 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | ||
808 | // m.insertSeparator(); | ||
809 | m.exec( QCursor::pos() ); | ||
810 | } | ||
811 | break; | ||
812 | }; | ||
813 | |||
814 | } | ||