-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 133 |
1 files changed, 55 insertions, 78 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 15c70c3..2b58402 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -229,7 +229,7 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , in | |||
229 | case 2: | 229 | case 2: |
230 | { | 230 | { |
231 | QPopupMenu m; | 231 | QPopupMenu m; |
232 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 232 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
233 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 233 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
234 | m.exec( QCursor::pos() ); | 234 | m.exec( QCursor::pos() ); |
235 | } | 235 | } |
@@ -245,7 +245,7 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi | |||
245 | case 2: | 245 | case 2: |
246 | { | 246 | { |
247 | QPopupMenu m; | 247 | QPopupMenu m; |
248 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 248 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
249 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 249 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
250 | m.exec( QCursor::pos() ); | 250 | m.exec( QCursor::pos() ); |
251 | } | 251 | } |
@@ -322,42 +322,18 @@ void PlayListWidget::useSelectedDocument() { | |||
322 | 322 | ||
323 | const DocLnk *PlayListWidget::current() { // this is fugly | 323 | const DocLnk *PlayListWidget::current() { // this is fugly |
324 | switch ( whichList() ) { | 324 | switch ( whichList() ) { |
325 | case 0: //playlist | 325 | case 0: //playlist |
326 | { | 326 | { |
327 | // qDebug("playlist"); | 327 | // qDebug("playlist"); |
328 | if ( mediaPlayerState->playlist() ) { | 328 | if ( mediaPlayerState->playlist() ) { |
329 | return d->selectedFiles->current(); | 329 | return d->selectedFiles->current(); |
330 | } else if ( d->setDocumentUsed && d->current ) { | 330 | } else if ( d->setDocumentUsed && d->current ) { |
331 | return d->current; | 331 | return d->current; |
332 | } else { | 332 | } else { |
333 | return d->files->selected(); | 333 | return d->files->selected(); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | break; | 336 | break; |
337 | case 1://audio | ||
338 | { | ||
339 | // qDebug("audioView"); | ||
340 | QListIterator<DocLnk> dit( files.children() ); | ||
341 | for ( ; dit.current(); ++dit ) { | ||
342 | if( dit.current()->name() == audioView->currentItem()->text( 0 ) && !insanityBool ) { | ||
343 | insanityBool = TRUE; | ||
344 | return dit; | ||
345 | } | ||
346 | } | ||
347 | } | ||
348 | break; | ||
349 | case 2: // video | ||
350 | { | ||
351 | // qDebug("videoView"); | ||
352 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
353 | for ( ; Vdit.current(); ++Vdit ) { | ||
354 | if( Vdit.current()->name() == videoView->currentItem()->text( 0 ) && !insanityBool) { | ||
355 | insanityBool = TRUE; | ||
356 | return Vdit; | ||
357 | } | ||
358 | } | ||
359 | } | ||
360 | break; | ||
361 | }; | 337 | }; |
362 | return 0; | 338 | return 0; |
363 | } | 339 | } |
@@ -496,47 +472,47 @@ void PlayListWidget::addSelected() { | |||
496 | Config cfg( "OpiePlayer" ); | 472 | Config cfg( "OpiePlayer" ); |
497 | cfg.setGroup("PlayList"); | 473 | cfg.setGroup("PlayList"); |
498 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 474 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
499 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 475 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
500 | 476 | ||
501 | switch (whichList()) { | 477 | switch (whichList()) { |
502 | case 0: //playlist | 478 | case 0: //playlist |
503 | break; | 479 | break; |
504 | case 1: { //audio | 480 | case 1: { //audio |
505 | QListViewItemIterator it( audioView ); | 481 | QListViewItemIterator it( audioView ); |
506 | // iterate through all items of the listview | 482 | // iterate through all items of the listview |
507 | for ( ; it.current(); ++it ) { | 483 | for ( ; it.current(); ++it ) { |
508 | if ( it.current()->isSelected() ) { | 484 | if ( it.current()->isSelected() ) { |
509 | QListIterator<DocLnk> dit( files.children() ); | 485 | QListIterator<DocLnk> dit( files.children() ); |
510 | for ( ; dit.current(); ++dit ) { | 486 | for ( ; dit.current(); ++dit ) { |
511 | if( dit.current()->name() == it.current()->text(0) ) { | 487 | if( dit.current()->name() == it.current()->text(0) ) { |
512 | if(QFileInfo( dit.current()->file()).exists()) | 488 | if(QFileInfo( dit.current()->file()).exists()) |
513 | d->selectedFiles->addToSelection( **dit ); | 489 | d->selectedFiles->addToSelection( **dit ); |
514 | } | 490 | } |
515 | } | 491 | } |
516 | audioView->setSelected( it.current(),FALSE); | 492 | audioView->setSelected( it.current(),FALSE); |
517 | } | 493 | } |
518 | } | 494 | } |
519 | tabWidget->setCurrentPage(0); | 495 | tabWidget->setCurrentPage(0); |
520 | } | 496 | } |
521 | break; | 497 | break; |
522 | case 2: { // video | 498 | case 2: { // video |
523 | QListViewItemIterator it( videoView ); | 499 | QListViewItemIterator it( videoView ); |
524 | // iterate through all items of the listview | 500 | // iterate through all items of the listview |
525 | for ( ; it.current(); ++it ) { | 501 | for ( ; it.current(); ++it ) { |
526 | if ( it.current()->isSelected() ) { | 502 | if ( it.current()->isSelected() ) { |
527 | QListIterator<DocLnk> dit( vFiles.children() ); | 503 | QListIterator<DocLnk> dit( vFiles.children() ); |
528 | for ( ; dit.current(); ++dit ) { | 504 | for ( ; dit.current(); ++dit ) { |
529 | if( dit.current()->name() == it.current()->text(0) ) { | 505 | if( dit.current()->name() == it.current()->text(0) ) { |
530 | if(QFileInfo( dit.current()->file()).exists()) | 506 | if(QFileInfo( dit.current()->file()).exists()) |
531 | d->selectedFiles->addToSelection( **dit ); | 507 | d->selectedFiles->addToSelection( **dit ); |
532 | } | 508 | } |
533 | } | 509 | } |
534 | videoView->setSelected( it.current(),FALSE); | 510 | videoView->setSelected( it.current(),FALSE); |
535 | } | 511 | } |
536 | } | 512 | } |
537 | tabWidget->setCurrentPage(0); | 513 | tabWidget->setCurrentPage(0); |
538 | } | 514 | } |
539 | break; | 515 | break; |
540 | }; | 516 | }; |
541 | } | 517 | } |
542 | 518 | ||
@@ -635,6 +611,7 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
635 | 611 | ||
636 | 612 | ||
637 | void PlayListWidget::btnPlay(bool b) { | 613 | void PlayListWidget::btnPlay(bool b) { |
614 | // mediaPlayerState->setPlaying(false); | ||
638 | mediaPlayerState->setPlaying(b); | 615 | mediaPlayerState->setPlaying(b); |
639 | qApp->processEvents(); | 616 | qApp->processEvents(); |
640 | insanityBool=FALSE; | 617 | insanityBool=FALSE; |
@@ -1040,7 +1017,7 @@ void PlayListWidget::populateSkinsMenu() { | |||
1040 | QFileInfo *fi; | 1017 | QFileInfo *fi; |
1041 | while ( ( fi = it.current() ) ) { | 1018 | while ( ( fi = it.current() ) ) { |
1042 | skinName = fi->fileName(); | 1019 | skinName = fi->fileName(); |
1043 | qDebug( fi->fileName() ); | 1020 | // qDebug( fi->fileName() ); |
1044 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1021 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1045 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1022 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1046 | } | 1023 | } |
@@ -1055,7 +1032,7 @@ void PlayListWidget::populateSkinsMenu() { | |||
1055 | } | 1032 | } |
1056 | 1033 | ||
1057 | void PlayListWidget::skinsMenuActivated( int item ) { | 1034 | void PlayListWidget::skinsMenuActivated( int item ) { |
1058 | for( uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1035 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1059 | skinsMenu->setItemChecked( i, FALSE ); | 1036 | skinsMenu->setItemChecked( i, FALSE ); |
1060 | } | 1037 | } |
1061 | skinsMenu->setItemChecked( item, TRUE ); | 1038 | skinsMenu->setItemChecked( item, TRUE ); |