summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp17
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h8
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp15
3 files changed, 40 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index cb16415..3ef4d03 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -1,78 +1,95 @@
1 1
2#include "playlistfileview.h" 2#include "playlistfileview.h"
3 3
4#include <qfile.h> 4#include <qfile.h>
5#include <qpe/global.h> 5#include <qpe/global.h>
6#include <qpe/resource.h> 6#include <qpe/resource.h>
7 7
8PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name ) 8PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name )
9 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ), 9 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ),
10 m_viewPopulated( false ) 10 m_viewPopulated( false )
11{ 11{
12 addColumn( tr( "Title" ), 140); 12 addColumn( tr( "Title" ), 140);
13 addColumn( tr( "Size" ), -1 ); 13 addColumn( tr( "Size" ), -1 );
14 addColumn(tr( "Media" ), 0 ); 14 addColumn(tr( "Media" ), 0 );
15 addColumn(tr( "Path" ), -1 ); 15 addColumn(tr( "Path" ), -1 );
16 setColumnAlignment( 1, Qt::AlignRight ); 16 setColumnAlignment( 1, Qt::AlignRight );
17 setColumnAlignment( 2, Qt::AlignRight ); 17 setColumnAlignment( 2, Qt::AlignRight );
18 setAllColumnsShowFocus( TRUE ); 18 setAllColumnsShowFocus( TRUE );
19 setSorting( 3, TRUE ); 19 setSorting( 3, TRUE );
20 setMultiSelection( TRUE ); 20 setMultiSelection( TRUE );
21 setSelectionMode( QListView::Extended ); 21 setSelectionMode( QListView::Extended );
22
23 connect( this, SIGNAL( selectionChanged() ),
24 this, SLOT( checkSelection() ) );
22} 25}
23 26
24PlayListFileView::~PlayListFileView() 27PlayListFileView::~PlayListFileView()
25{ 28{
26} 29}
27 30
31bool PlayListFileView::hasSelection() const
32{
33 for ( QListViewItemIterator it( const_cast<PlayListFileView *>( this ) ); it.current(); ++it )
34 if ( it.current()->isSelected() )
35 return true;
36
37 return false;
38}
39
28void PlayListFileView::scanFiles() 40void PlayListFileView::scanFiles()
29{ 41{
30 m_files.detachChildren(); 42 m_files.detachChildren();
31 QListIterator<DocLnk> sdit( m_files.children() ); 43 QListIterator<DocLnk> sdit( m_files.children() );
32 for ( ; sdit.current(); ++sdit ) 44 for ( ; sdit.current(); ++sdit )
33 delete sdit.current(); 45 delete sdit.current();
34 46
35 Global::findDocuments( &m_files, m_mimeTypePattern ); 47 Global::findDocuments( &m_files, m_mimeTypePattern );
36 48
37 if ( m_viewPopulated ) { 49 if ( m_viewPopulated ) {
38 m_viewPopulated = false; 50 m_viewPopulated = false;
39 populateView(); 51 populateView();
40 } 52 }
41} 53}
42 54
43void PlayListFileView::populateView() 55void PlayListFileView::populateView()
44{ 56{
45 if ( m_viewPopulated ) 57 if ( m_viewPopulated )
46 return; 58 return;
47 59
48 clear(); 60 clear();
49 61
50 if( !m_scannedFiles ) { 62 if( !m_scannedFiles ) {
51 m_viewPopulated = false; // avoid a recursion :) 63 m_viewPopulated = false; // avoid a recursion :)
52 scanFiles(); 64 scanFiles();
53 m_scannedFiles = true; 65 m_scannedFiles = true;
54 } 66 }
55 67
56 m_viewPopulated = true; 68 m_viewPopulated = true;
57 69
58 QString storage; 70 QString storage;
59 QListIterator<DocLnk> dit( m_files.children() ); 71 QListIterator<DocLnk> dit( m_files.children() );
60 for ( ; dit.current(); ++dit ) { 72 for ( ; dit.current(); ++dit ) {
61 73
62 QListViewItem *newItem; 74 QListViewItem *newItem;
63 75
64 if ( QFile::exists( dit.current()->file() ) || 76 if ( QFile::exists( dit.current()->file() ) ||
65 dit.current()->file().left( 4 ) == "http" ) { 77 dit.current()->file().left( 4 ) == "http" ) {
66 78
67 unsigned long size = QFile( dit.current()->file() ).size(); 79 unsigned long size = QFile( dit.current()->file() ).size();
68 80
69 newItem = new QListViewItem( this, dit.current()->name(), 81 newItem = new QListViewItem( this, dit.current()->name(),
70 QString::number( size ), "" /*storage*/, 82 QString::number( size ), "" /*storage*/,
71 dit.current()->file() ); 83 dit.current()->file() );
72 newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) ); 84 newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) );
73 } 85 }
74 } 86 }
75} 87}
76 88
89void PlayListFileView::checkSelection()
90{
91 emit itemsSelected( hasSelection() );
92}
93
77/* vim: et sw=4 ts=4 94/* vim: et sw=4 ts=4
78 */ 95 */
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 6eea2fc..5b15526 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -1,29 +1,37 @@
1#ifndef PLAYLISTFILEVIEW_H 1#ifndef PLAYLISTFILEVIEW_H
2#define PLAYLISTFILEVIEW_H 2#define PLAYLISTFILEVIEW_H
3 3
4#include "playlistview.h" 4#include "playlistview.h"
5 5
6#include <qpe/applnk.h> 6#include <qpe/applnk.h>
7 7
8class PlayListFileView : public PlayListView 8class PlayListFileView : public PlayListView
9{ 9{
10 Q_OBJECT 10 Q_OBJECT
11public: 11public:
12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 ); 12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
13 virtual ~PlayListFileView(); 13 virtual ~PlayListFileView();
14 14
15 bool hasSelection() const;
16
15public slots: 17public slots:
16 void scanFiles(); 18 void scanFiles();
17 void populateView(); 19 void populateView();
18 20
21signals:
22 void itemsSelected( bool selected );
23
24private slots:
25 void checkSelection();
26
19private: 27private:
20 QString m_mimeTypePattern; 28 QString m_mimeTypePattern;
21 QString m_itemPixmapName; 29 QString m_itemPixmapName;
22 DocLnkSet m_files; 30 DocLnkSet m_files;
23 bool m_scannedFiles; 31 bool m_scannedFiles;
24 bool m_viewPopulated; 32 bool m_viewPopulated;
25}; 33};
26 34
27#endif // PLAYLISTFILEVIEW_H 35#endif // PLAYLISTFILEVIEW_H
28/* vim: et sw=4 ts=4 36/* vim: et sw=4 ts=4
29 */ 37 */
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 2df7f27..c05096a 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -419,287 +419,302 @@ bool PlayListWidget::prev() {
419 d->selectedFiles->first(); 419 d->selectedFiles->first();
420 } 420 }
421 if ( cur == current() ) 421 if ( cur == current() )
422 if ( !d->selectedFiles->next() ) { 422 if ( !d->selectedFiles->next() ) {
423 d->selectedFiles->first(); 423 d->selectedFiles->first();
424 } 424 }
425 return TRUE; 425 return TRUE;
426 } else { 426 } else {
427 if ( !d->selectedFiles->prev() ) { 427 if ( !d->selectedFiles->prev() ) {
428 if ( mediaPlayerState.isLooping() ) { 428 if ( mediaPlayerState.isLooping() ) {
429 return d->selectedFiles->last(); 429 return d->selectedFiles->last();
430 } else { 430 } else {
431 return FALSE; 431 return FALSE;
432 } 432 }
433 } 433 }
434 return TRUE; 434 return TRUE;
435 } 435 }
436} 436}
437 437
438 438
439bool PlayListWidget::next() { 439bool PlayListWidget::next() {
440//qDebug("<<<<<<<<<<<<next()"); 440//qDebug("<<<<<<<<<<<<next()");
441 if ( mediaPlayerState.isShuffled() ) { 441 if ( mediaPlayerState.isShuffled() ) {
442 return prev(); 442 return prev();
443 } else { 443 } else {
444 if ( !d->selectedFiles->next() ) { 444 if ( !d->selectedFiles->next() ) {
445 if ( mediaPlayerState.isLooping() ) { 445 if ( mediaPlayerState.isLooping() ) {
446 return d->selectedFiles->first(); 446 return d->selectedFiles->first();
447 } else { 447 } else {
448 return FALSE; 448 return FALSE;
449 } 449 }
450 } 450 }
451 return TRUE; 451 return TRUE;
452 } 452 }
453} 453}
454 454
455 455
456bool PlayListWidget::first() { 456bool PlayListWidget::first() {
457 return d->selectedFiles->first(); 457 return d->selectedFiles->first();
458} 458}
459 459
460 460
461bool PlayListWidget::last() { 461bool PlayListWidget::last() {
462 return d->selectedFiles->last(); 462 return d->selectedFiles->last();
463} 463}
464 464
465 465
466 void PlayListWidget::saveList() { 466 void PlayListWidget::saveList() {
467 writem3u(); 467 writem3u();
468 } 468 }
469 469
470 470
471void PlayListWidget::loadList( const DocLnk & lnk) { 471void PlayListWidget::loadList( const DocLnk & lnk) {
472 QString name = lnk.name(); 472 QString name = lnk.name();
473 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 473 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
474 474
475 if( name.length()>0) { 475 if( name.length()>0) {
476 setCaption("OpiePlayer: "+name); 476 setCaption("OpiePlayer: "+name);
477// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 477// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
478 clearList(); 478 clearList();
479 readm3u(lnk.file()); 479 readm3u(lnk.file());
480 tabWidget->setCurrentPage(0); 480 tabWidget->setCurrentPage(0);
481 } 481 }
482} 482}
483 483
484void PlayListWidget::addSelected() { 484void PlayListWidget::addSelected() {
485 assert( inFileListMode() ); 485 assert( inFileListMode() );
486 486
487 QListView *fileListView = currentFileListView(); 487 QListView *fileListView = currentFileListView();
488 QListViewItemIterator it( fileListView ); 488 QListViewItemIterator it( fileListView );
489 for ( ; it.current(); ++it ) 489 for ( ; it.current(); ++it )
490 if ( it.current()->isSelected() ) { 490 if ( it.current()->isSelected() ) {
491 QString filename = it.current()->text(3); 491 QString filename = it.current()->text(3);
492 492
493 DocLnk lnk; 493 DocLnk lnk;
494 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 494 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
495 lnk.setFile( filename ); //sets file name 495 lnk.setFile( filename ); //sets file name
496 496
497 d->selectedFiles->addToSelection( lnk ); 497 d->selectedFiles->addToSelection( lnk );
498 } 498 }
499 499
500 fileListView->clearSelection(); 500 fileListView->clearSelection();
501 501
502 tabWidget->setCurrentPage( 0 ); 502 tabWidget->setCurrentPage( 0 );
503 writeCurrentM3u(); 503 writeCurrentM3u();
504} 504}
505 505
506 506
507void PlayListWidget::removeSelected() { 507void PlayListWidget::removeSelected() {
508 d->selectedFiles->removeSelected( ); 508 d->selectedFiles->removeSelected( );
509 writeCurrentM3u(); 509 writeCurrentM3u();
510} 510}
511 511
512 512
513void PlayListWidget::playIt( QListViewItem *it) { 513void PlayListWidget::playIt( QListViewItem *it) {
514 if(!it) return; 514 if(!it) return;
515 mediaPlayerState.setPlaying(FALSE); 515 mediaPlayerState.setPlaying(FALSE);
516 mediaPlayerState.setPlaying(TRUE); 516 mediaPlayerState.setPlaying(TRUE);
517 d->selectedFiles->unSelect(); 517 d->selectedFiles->unSelect();
518} 518}
519 519
520 520
521void PlayListWidget::addToSelection( QListViewItem *it) { 521void PlayListWidget::addToSelection( QListViewItem *it) {
522 d->setDocumentUsed = FALSE; 522 d->setDocumentUsed = FALSE;
523 523
524 if(it) { 524 if(it) {
525 if ( currentTab() == CurrentPlayList ) 525 if ( currentTab() == CurrentPlayList )
526 return; 526 return;
527 // case 1: { 527 // case 1: {
528 DocLnk lnk; 528 DocLnk lnk;
529 QString filename; 529 QString filename;
530 530
531 filename=it->text(3); 531 filename=it->text(3);
532 lnk.setName( QFileInfo(filename).baseName() ); //sets name 532 lnk.setName( QFileInfo(filename).baseName() ); //sets name
533 lnk.setFile( filename ); //sets file name 533 lnk.setFile( filename ); //sets file name
534 d->selectedFiles->addToSelection( lnk); 534 d->selectedFiles->addToSelection( lnk);
535 535
536 writeCurrentM3u(); 536 writeCurrentM3u();
537 tabWidget->setCurrentPage(0); 537 tabWidget->setCurrentPage(0);
538 538
539 } 539 }
540} 540}
541 541
542 542
543void PlayListWidget::tabChanged(QWidget *) { 543void PlayListWidget::tabChanged(QWidget *) {
544 544
545 d->tbPlay->setEnabled( true ); 545 d->tbPlay->setEnabled( true );
546 546
547 disconnect( audioView, SIGNAL( itemsSelected( bool ) ),
548 d->tbPlay, SLOT( setEnabled( bool ) ) );
549 disconnect( videoView, SIGNAL( itemsSelected( bool ) ),
550 d->tbPlay, SLOT( setEnabled( bool ) ) );
551
547 switch ( currentTab() ) { 552 switch ( currentTab() ) {
548 case CurrentPlayList: 553 case CurrentPlayList:
549 { 554 {
550 if( !tbDeletePlaylist->isHidden() ) { 555 if( !tbDeletePlaylist->isHidden() ) {
551 tbDeletePlaylist->hide(); 556 tbDeletePlaylist->hide();
552 } 557 }
553 d->tbRemoveFromList->setEnabled(TRUE); 558 d->tbRemoveFromList->setEnabled(TRUE);
554 d->tbAddToList->setEnabled(FALSE); 559 d->tbAddToList->setEnabled(FALSE);
555 560
556 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 561 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
557 } 562 }
558 break; 563 break;
559 case AudioFiles: 564 case AudioFiles:
560 { 565 {
561 audioView->populateView(); 566 audioView->populateView();
562 567
563 if( !tbDeletePlaylist->isHidden() ) { 568 if( !tbDeletePlaylist->isHidden() ) {
564 tbDeletePlaylist->hide(); 569 tbDeletePlaylist->hide();
565 } 570 }
566 d->tbRemoveFromList->setEnabled(FALSE); 571 d->tbRemoveFromList->setEnabled(FALSE);
567 d->tbAddToList->setEnabled(TRUE); 572 d->tbAddToList->setEnabled(TRUE);
573
574 connect( audioView, SIGNAL( itemsSelected( bool ) ),
575 d->tbPlay, SLOT( setEnabled( bool ) ) );
576
577 d->tbPlay->setEnabled( audioView->hasSelection() );
568 } 578 }
569 break; 579 break;
570 case VideoFiles: 580 case VideoFiles:
571 { 581 {
572 videoView->populateView(); 582 videoView->populateView();
573 if( !tbDeletePlaylist->isHidden() ) { 583 if( !tbDeletePlaylist->isHidden() ) {
574 tbDeletePlaylist->hide(); 584 tbDeletePlaylist->hide();
575 } 585 }
576 d->tbRemoveFromList->setEnabled(FALSE); 586 d->tbRemoveFromList->setEnabled(FALSE);
577 d->tbAddToList->setEnabled(TRUE); 587 d->tbAddToList->setEnabled(TRUE);
588
589 connect( videoView, SIGNAL( itemsSelected( bool ) ),
590 d->tbPlay, SLOT( setEnabled( bool ) ) );
591
592 d->tbPlay->setEnabled( videoView->hasSelection() );
578 } 593 }
579 break; 594 break;
580 case PlayLists: 595 case PlayLists:
581 { 596 {
582 if( tbDeletePlaylist->isHidden() ) { 597 if( tbDeletePlaylist->isHidden() ) {
583 tbDeletePlaylist->show(); 598 tbDeletePlaylist->show();
584 } 599 }
585 playLists->reread(); 600 playLists->reread();
586 d->tbAddToList->setEnabled(FALSE); 601 d->tbAddToList->setEnabled(FALSE);
587 602
588 d->tbPlay->setEnabled( false ); 603 d->tbPlay->setEnabled( false );
589 } 604 }
590 break; 605 break;
591 }; 606 };
592} 607}
593 608
594 609
595void PlayListWidget::btnPlay(bool b) { 610void PlayListWidget::btnPlay(bool b) {
596// mediaPlayerState->setPlaying(false); 611// mediaPlayerState->setPlaying(false);
597 mediaPlayerState.setPlaying(b); 612 mediaPlayerState.setPlaying(b);
598 insanityBool=FALSE; 613 insanityBool=FALSE;
599} 614}
600 615
601void PlayListWidget::deletePlaylist() { 616void PlayListWidget::deletePlaylist() {
602 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 617 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
603 (tr("You really want to delete\nthis playlist?")), 618 (tr("You really want to delete\nthis playlist?")),
604 (tr("Yes")), (tr("No")), 0 )){ 619 (tr("Yes")), (tr("No")), 0 )){
605 case 0: // Yes clicked, 620 case 0: // Yes clicked,
606 QFile().remove(playLists->selectedDocument().file()); 621 QFile().remove(playLists->selectedDocument().file());
607 QFile().remove(playLists->selectedDocument().linkFile()); 622 QFile().remove(playLists->selectedDocument().linkFile());
608 playLists->reread(); 623 playLists->reread();
609 break; 624 break;
610 case 1: // Cancel 625 case 1: // Cancel
611 break; 626 break;
612 }; 627 };
613} 628}
614 629
615 630
616void PlayListWidget::playSelected() { 631void PlayListWidget::playSelected() {
617 btnPlay( TRUE); 632 btnPlay( TRUE);
618} 633}
619 634
620QListView *PlayListWidget::currentFileListView() const 635QListView *PlayListWidget::currentFileListView() const
621{ 636{
622 switch ( currentTab() ) { 637 switch ( currentTab() ) {
623 case AudioFiles: return audioView; 638 case AudioFiles: return audioView;
624 case VideoFiles: return videoView; 639 case VideoFiles: return videoView;
625 default: assert( false ); 640 default: assert( false );
626 } 641 }
627 return 0; 642 return 0;
628} 643}
629 644
630bool PlayListWidget::inFileListMode() const 645bool PlayListWidget::inFileListMode() const
631{ 646{
632 TabType tab = currentTab(); 647 TabType tab = currentTab();
633 return tab == AudioFiles || tab == VideoFiles; 648 return tab == AudioFiles || tab == VideoFiles;
634} 649}
635 650
636void PlayListWidget::openFile() { 651void PlayListWidget::openFile() {
637 // http://66.28.164.33:2080 652 // http://66.28.164.33:2080
638 // http://somafm.com/star0242.m3u 653 // http://somafm.com/star0242.m3u
639 QString filename, name; 654 QString filename, name;
640 InputDialog *fileDlg; 655 InputDialog *fileDlg;
641 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 656 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
642 fileDlg->exec(); 657 fileDlg->exec();
643 if( fileDlg->result() == 1 ) { 658 if( fileDlg->result() == 1 ) {
644 filename = fileDlg->text(); 659 filename = fileDlg->text();
645 qDebug( "Selected filename is " + filename ); 660 qDebug( "Selected filename is " + filename );
646 // Om3u *m3uList; 661 // Om3u *m3uList;
647 DocLnk lnk; 662 DocLnk lnk;
648 Config cfg( "OpiePlayer" ); 663 Config cfg( "OpiePlayer" );
649 cfg.setGroup("PlayList"); 664 cfg.setGroup("PlayList");
650 665
651 if(filename.left(4) == "http") { 666 if(filename.left(4) == "http") {
652 QString m3uFile, m3uFilePath; 667 QString m3uFile, m3uFilePath;
653 if(filename.find(":",8,TRUE) != -1) { //found a port 668 if(filename.find(":",8,TRUE) != -1) { //found a port
654 m3uFile = filename.left( filename.find( ":",8,TRUE)); 669 m3uFile = filename.left( filename.find( ":",8,TRUE));
655 m3uFile = m3uFile.right( 7); 670 m3uFile = m3uFile.right( 7);
656 } else if(filename.left(4) == "http"){ 671 } else if(filename.left(4) == "http"){
657 m3uFile=filename; 672 m3uFile=filename;
658 m3uFile = m3uFile.right( m3uFile.length() - 7); 673 m3uFile = m3uFile.right( m3uFile.length() - 7);
659 } else{ 674 } else{
660 m3uFile=filename; 675 m3uFile=filename;
661 } 676 }
662 677
663// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 678// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
664 lnk.setName( filename ); //sets name 679 lnk.setName( filename ); //sets name
665 lnk.setFile( filename ); //sets file name 680 lnk.setFile( filename ); //sets file name
666 681
667// lnk.setIcon("opieplayer2/musicfile"); 682// lnk.setIcon("opieplayer2/musicfile");
668 683
669 d->selectedFiles->addToSelection( lnk ); 684 d->selectedFiles->addToSelection( lnk );
670 writeCurrentM3u(); 685 writeCurrentM3u();
671 d->selectedFiles->setSelectedItem( lnk.name()); 686 d->selectedFiles->setSelectedItem( lnk.name());
672 } 687 }
673 else if( filename.right( 3) == "m3u" ) { 688 else if( filename.right( 3) == "m3u" ) {
674 readm3u( filename ); 689 readm3u( filename );
675 690
676 } else if( filename.right(3) == "pls" ) { 691 } else if( filename.right(3) == "pls" ) {
677 readPls( filename ); 692 readPls( filename );
678 } else { 693 } else {
679 lnk.setName( QFileInfo(filename).baseName() ); //sets name 694 lnk.setName( QFileInfo(filename).baseName() ); //sets name
680 lnk.setFile( filename ); //sets file name 695 lnk.setFile( filename ); //sets file name
681 d->selectedFiles->addToSelection( lnk); 696 d->selectedFiles->addToSelection( lnk);
682 writeCurrentM3u(); 697 writeCurrentM3u();
683 d->selectedFiles->setSelectedItem( lnk.name()); 698 d->selectedFiles->setSelectedItem( lnk.name());
684 } 699 }
685 } 700 }
686 701
687 delete fileDlg; 702 delete fileDlg;
688} 703}
689 704
690/* 705/*
691reads m3u and shows files/urls to playlist widget */ 706reads m3u and shows files/urls to playlist widget */
692void PlayListWidget::readm3u( const QString &filename ) { 707void PlayListWidget::readm3u( const QString &filename ) {
693 qDebug( "read m3u filename " + filename ); 708 qDebug( "read m3u filename " + filename );
694 709
695 Om3u *m3uList; 710 Om3u *m3uList;
696 QString s, name; 711 QString s, name;
697 m3uList = new Om3u( filename, IO_ReadOnly ); 712 m3uList = new Om3u( filename, IO_ReadOnly );
698 m3uList->readM3u(); 713 m3uList->readM3u();
699 DocLnk lnk; 714 DocLnk lnk;
700 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 715 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
701 s = *it; 716 s = *it;
702// qDebug("reading "+ s); 717// qDebug("reading "+ s);
703 if(s.left(4)=="http") { 718 if(s.left(4)=="http") {
704 lnk.setName( s ); //sets file name 719 lnk.setName( s ); //sets file name
705 lnk.setIcon("opieplayer2/musicfile"); 720 lnk.setIcon("opieplayer2/musicfile");