Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 27a3286..cba7b6d 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -184,48 +184,52 @@ void PlayListWidget::writeDefaultPlaylist() { | |||
184 | while ( d->selectedFiles->next() ); | 184 | while ( d->selectedFiles->next() ); |
185 | 185 | ||
186 | m3uList->write(); | 186 | m3uList->write(); |
187 | m3uList->close(); | 187 | m3uList->close(); |
188 | delete m3uList; | 188 | delete m3uList; |
189 | 189 | ||
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 194 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
195 | d->setDocumentUsed = FALSE; | 195 | d->setDocumentUsed = FALSE; |
196 | if( QFileInfo( lnk.file() ).exists() || | 196 | if( QFileInfo( lnk.file() ).exists() || |
197 | lnk.file().left(4) == "http" ) { | 197 | lnk.file().left(4) == "http" ) { |
198 | d->selectedFiles->addToSelection( lnk ); | 198 | d->selectedFiles->addToSelection( lnk ); |
199 | } | 199 | } |
200 | // writeCurrentM3u(); | 200 | // writeCurrentM3u(); |
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | void PlayListWidget::clearList() { | 204 | void PlayListWidget::clearList() { |
205 | while ( first() ) { | 205 | while ( first() ) { |
206 | d->selectedFiles->removeSelected(); | 206 | d->selectedFiles->removeSelected(); |
207 | } | 207 | } |
208 | Config cfg( "OpiePlayer" ); | ||
209 | cfg.setGroup("PlayList"); | ||
210 | cfg.writeEntry("CurrentPlaylist","default"); | ||
211 | setCaption("OpiePlayer"); | ||
208 | } | 212 | } |
209 | 213 | ||
210 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 214 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
211 | switch (mouse) { | 215 | switch (mouse) { |
212 | case LeftButton: | 216 | case LeftButton: |
213 | break; | 217 | break; |
214 | case RightButton: | 218 | case RightButton: |
215 | { | 219 | { |
216 | QPopupMenu m; | 220 | QPopupMenu m; |
217 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 221 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
218 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 222 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
219 | m.exec( QCursor::pos() ); | 223 | m.exec( QCursor::pos() ); |
220 | } | 224 | } |
221 | break; | 225 | break; |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
225 | 229 | ||
226 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 230 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
227 | switch (mouse) { | 231 | switch (mouse) { |
228 | case LeftButton: | 232 | case LeftButton: |
229 | break; | 233 | break; |
230 | case RightButton: | 234 | case RightButton: |
231 | { | 235 | { |
@@ -471,84 +475,84 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
471 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 475 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
472 | clearList(); | 476 | clearList(); |
473 | readm3u(lnk.file()); | 477 | readm3u(lnk.file()); |
474 | tabWidget->setCurrentPage(0); | 478 | tabWidget->setCurrentPage(0); |
475 | } | 479 | } |
476 | } | 480 | } |
477 | 481 | ||
478 | void PlayListWidget::addSelected() { | 482 | void PlayListWidget::addSelected() { |
479 | assert( inFileListMode() ); | 483 | assert( inFileListMode() ); |
480 | 484 | ||
481 | QListViewItemIterator it( currentFileListView ); | 485 | QListViewItemIterator it( currentFileListView ); |
482 | for ( ; it.current(); ++it ) | 486 | for ( ; it.current(); ++it ) |
483 | if ( it.current()->isSelected() ) { | 487 | if ( it.current()->isSelected() ) { |
484 | QString filename = it.current()->text(3); | 488 | QString filename = it.current()->text(3); |
485 | 489 | ||
486 | DocLnk lnk; | 490 | DocLnk lnk; |
487 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name | 491 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name |
488 | lnk.setFile( filename ); //sets file name | 492 | lnk.setFile( filename ); //sets file name |
489 | 493 | ||
490 | d->selectedFiles->addToSelection( lnk ); | 494 | d->selectedFiles->addToSelection( lnk ); |
491 | } | 495 | } |
492 | 496 | ||
493 | currentFileListView->clearSelection(); | 497 | currentFileListView->clearSelection(); |
494 | 498 | ||
495 | tabWidget->setCurrentPage( 0 ); | 499 | // tabWidget->setCurrentPage( 0 ); |
496 | writeCurrentM3u(); | 500 | writeCurrentM3u(); |
497 | } | 501 | } |
498 | 502 | ||
499 | 503 | ||
500 | void PlayListWidget::removeSelected() { | 504 | void PlayListWidget::removeSelected() { |
501 | d->selectedFiles->removeSelected( ); | 505 | d->selectedFiles->removeSelected( ); |
502 | writeCurrentM3u(); | 506 | writeCurrentM3u(); |
503 | } | 507 | } |
504 | 508 | ||
505 | 509 | ||
506 | void PlayListWidget::playIt( QListViewItem *it) { | 510 | void PlayListWidget::playIt( QListViewItem *it) { |
507 | if(!it) return; | 511 | if(!it) return; |
508 | mediaPlayerState.setPlaying(FALSE); | 512 | mediaPlayerState.setPlaying(FALSE); |
509 | mediaPlayerState.setPlaying(TRUE); | 513 | mediaPlayerState.setPlaying(TRUE); |
510 | d->selectedFiles->unSelect(); | 514 | d->selectedFiles->unSelect(); |
511 | } | 515 | } |
512 | 516 | ||
513 | 517 | ||
514 | void PlayListWidget::addToSelection( QListViewItem *it) { | 518 | void PlayListWidget::addToSelection( QListViewItem *it) { |
515 | d->setDocumentUsed = FALSE; | 519 | d->setDocumentUsed = FALSE; |
516 | 520 | ||
517 | if(it) { | 521 | if(it) { |
518 | if ( currentTab() == CurrentPlayList ) | 522 | if ( currentTab() == CurrentPlayList ) |
519 | return; | 523 | return; |
520 | // case 1: { | 524 | // case 1: { |
521 | DocLnk lnk; | 525 | DocLnk lnk; |
522 | QString filename; | 526 | QString filename; |
523 | 527 | ||
524 | filename=it->text(3); | 528 | filename=it->text(3); |
525 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 529 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
526 | lnk.setFile( filename ); //sets file name | 530 | lnk.setFile( filename ); //sets file name |
527 | d->selectedFiles->addToSelection( lnk); | 531 | d->selectedFiles->addToSelection( lnk); |
528 | 532 | ||
529 | writeCurrentM3u(); | 533 | writeCurrentM3u(); |
530 | tabWidget->setCurrentPage(0); | 534 | // tabWidget->setCurrentPage(0); |
531 | 535 | ||
532 | } | 536 | } |
533 | } | 537 | } |
534 | 538 | ||
535 | 539 | ||
536 | void PlayListWidget::tabChanged(QWidget *) { | 540 | void PlayListWidget::tabChanged(QWidget *) { |
537 | 541 | ||
538 | d->tbPlay->setEnabled( true ); | 542 | d->tbPlay->setEnabled( true ); |
539 | 543 | ||
540 | disconnect( audioView, SIGNAL( itemsSelected( bool ) ), | 544 | disconnect( audioView, SIGNAL( itemsSelected( bool ) ), |
541 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 545 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
542 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), | 546 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), |
543 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 547 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
544 | 548 | ||
545 | currentFileListView = 0; | 549 | currentFileListView = 0; |
546 | 550 | ||
547 | switch ( currentTab() ) { | 551 | switch ( currentTab() ) { |
548 | case CurrentPlayList: | 552 | case CurrentPlayList: |
549 | { | 553 | { |
550 | if( !tbDeletePlaylist->isHidden() ) { | 554 | if( !tbDeletePlaylist->isHidden() ) { |
551 | tbDeletePlaylist->hide(); | 555 | tbDeletePlaylist->hide(); |
552 | } | 556 | } |
553 | d->tbRemoveFromList->setEnabled(TRUE); | 557 | d->tbRemoveFromList->setEnabled(TRUE); |
554 | d->tbAddToList->setEnabled(FALSE); | 558 | d->tbAddToList->setEnabled(FALSE); |