summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp103
1 files changed, 36 insertions, 67 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 8e88e9b..a6a9eca 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -209,8 +209,9 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
209 d->setDocumentUsed = FALSE; 209 d->setDocumentUsed = FALSE;
210 if ( mediaPlayerState->playlist() ) { 210 if ( mediaPlayerState->playlist() ) {
211 if( QFileInfo( lnk.file() ).exists() || 211 if( QFileInfo( lnk.file() ).exists() ||
212 lnk.file().left(4) == "http" ) 212 lnk.file().left(4) == "http" ) {
213 d->selectedFiles->addToSelection( lnk ); 213 d->selectedFiles->addToSelection( lnk );
214 }
214// writeCurrentM3u(); 215// writeCurrentM3u();
215 } 216 }
216 else 217 else
@@ -265,7 +266,10 @@ void PlayListWidget::addAllToList() {
265 d->selectedFiles->addToSelection( **Adit ); 266 d->selectedFiles->addToSelection( **Adit );
266 } 267 }
267 } 268 }
269 tabWidget->setCurrentPage(0);
270
268 writeCurrentM3u(); 271 writeCurrentM3u();
272 d->selectedFiles->first();
269} 273}
270 274
271 275
@@ -278,7 +282,9 @@ void PlayListWidget::addAllMusicToList() {
278 d->selectedFiles->addToSelection( **dit ); 282 d->selectedFiles->addToSelection( **dit );
279 } 283 }
280 } 284 }
285 tabWidget->setCurrentPage(0);
281 writeCurrentM3u(); 286 writeCurrentM3u();
287 d->selectedFiles->first();
282} 288}
283 289
284 290
@@ -291,7 +297,9 @@ void PlayListWidget::addAllVideoToList() {
291 d->selectedFiles->addToSelection( **dit ); 297 d->selectedFiles->addToSelection( **dit );
292 } 298 }
293 } 299 }
300 tabWidget->setCurrentPage(0);
294 writeCurrentM3u(); 301 writeCurrentM3u();
302 d->selectedFiles->first();
295} 303}
296 304
297 305
@@ -423,11 +431,11 @@ bool PlayListWidget::last() {
423 431
424void PlayListWidget::loadList( const DocLnk & lnk) { 432void PlayListWidget::loadList( const DocLnk & lnk) {
425 QString name = lnk.name(); 433 QString name = lnk.name();
426 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 434 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
427 435
428 if( name.length()>0) { 436 if( name.length()>0) {
429 setCaption("OpiePlayer: "+name); 437 setCaption("OpiePlayer: "+name);
430 qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 438// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
431 clearList(); 439 clearList();
432 readm3u(lnk.file()); 440 readm3u(lnk.file());
433 tabWidget->setCurrentPage(0); 441 tabWidget->setCurrentPage(0);
@@ -446,52 +454,31 @@ void PlayListWidget::setPlaylist( bool shown ) {
446 454
447void PlayListWidget::addSelected() { 455void PlayListWidget::addSelected() {
448 qDebug("addSelected"); 456 qDebug("addSelected");
457 DocLnk lnk;
458 QString filename;
449 switch (whichList()) { 459 switch (whichList()) {
460
450 case 0: //playlist 461 case 0: //playlist
462 return;
451 break; 463 break;
452 case 1: { //audio 464 case 1: { //audio
453 QListViewItemIterator it( audioView ); 465 filename=audioView->currentItem()->text(3);
454 // iterate through all items of the listview 466 // d->selectedFiles->next();
455 for ( ; it.current(); ++it ) {
456 if ( it.current()->isSelected() ) {
457 QListIterator<DocLnk> dit( files.children() );
458 for ( ; dit.current(); ++dit ) {
459 if( dit.current()->name() == it.current()->text(0) ) {
460 if( QFileInfo( dit.current()->file()).exists()) {
461 d->selectedFiles->addToSelection( **dit );
462 audioView->setSelected( it.current(),FALSE);
463 }
464 }
465 }
466 }
467 }
468// tabWidget->setCurrentPage(0);
469 writeCurrentM3u();
470 d->selectedFiles->next();
471 } 467 }
472 break; 468 break;
469
473 case 2: { // video 470 case 2: { // video
474 QListViewItemIterator it( videoView ); 471 filename=videoView->currentItem()->text(3);
475 // iterate through all items of the listview
476 for ( ; it.current(); ++it ) {
477 if ( it.current()->isSelected() ) {
478 QListIterator<DocLnk> dit( vFiles.children() );
479 for ( ; dit.current(); ++dit ) {
480 if( dit.current()->name() == it.current()->text(0) ) {
481 if(QFileInfo( dit.current()->file()).exists()) {
482 d->selectedFiles->addToSelection( **dit );
483 videoView->setSelected( it.current(),FALSE);
484 }
485 }
486 }
487 }
488 }
489// tabWidget->setCurrentPage(0); 472// tabWidget->setCurrentPage(0);
490 writeCurrentM3u();
491 473
492 } 474 }
493 break; 475 break;
494 }; 476 };
477 lnk.setName( QFileInfo(filename).baseName() ); //sets name
478 lnk.setFile( filename ); //sets file name
479 d->selectedFiles->addToSelection( lnk);
480 tabWidget->setCurrentPage(0);
481 writeCurrentM3u();
495} 482}
496 483
497 484
@@ -514,38 +501,20 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
514 501
515 if(it) { 502 if(it) {
516 switch ( whichList()) { 503 switch ( whichList()) {
517 case 1: { 504 case 0: //playlist
518 QListIterator<DocLnk> dit( files.children() ); 505 return;
519 for ( ; dit.current(); ++dit ) {
520 if( dit.current()->name() == it->text(0)) {
521 if(QFileInfo( dit.current()->file()).exists()) {
522 d->selectedFiles->addToSelection( **dit );
523// qDebug("blah "+ dit.current()->name());
524// d->selectedFiles->setSelectedItem( dit.current()->name());
525 }
526 }
527 }
528 writeCurrentM3u();
529 }
530 break;
531 case 2: {
532 QListIterator<DocLnk> dit( vFiles.children() );
533 for ( ; dit.current(); ++dit ) {
534 if( dit.current()->name() == it->text(0)) {
535 if( QFileInfo( dit.current()->file()).exists() ) {
536 d->selectedFiles->addToSelection( **dit );
537// qDebug("blah "+ dit.current()->name());
538// d->selectedFiles->setSelectedItem( dit.current()->name());
539 }
540 }
541 }
542 writeCurrentM3u();
543
544 }
545 break;
546 case 0:
547 break; 506 break;
548 }; 507 };
508 // case 1: {
509 DocLnk lnk;
510 QString filename;
511
512 filename=it->text(3);
513 lnk.setName( QFileInfo(filename).baseName() ); //sets name
514 lnk.setFile( filename ); //sets file name
515 d->selectedFiles->addToSelection( lnk);
516
517 writeCurrentM3u();
549 tabWidget->setCurrentPage(0); 518 tabWidget->setCurrentPage(0);
550 519
551 } 520 }