summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp39
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h1
2 files changed, 26 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index c6de5e6..5d0f6de 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -363,6 +363,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
363 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); 363 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist)));
364 364
365 initializeStates(); 365 initializeStates();
366 // audioUI->setFocus();
366} 367}
367 368
368 369
@@ -370,9 +371,9 @@ PlayListWidget::~PlayListWidget() {
370 Config cfg( "OpiePlayer" ); 371 Config cfg( "OpiePlayer" );
371 writeConfig( cfg ); 372 writeConfig( cfg );
372 373
373 if ( d->current ) 374 if ( d->current )
374 delete d->current; 375 delete d->current;
375 delete d; 376 if(d) delete d;
376} 377}
377 378
378 379
@@ -494,15 +495,22 @@ void PlayListWidget::addAllVideoToList() {
494 495
495 496
496void PlayListWidget::setDocument(const QString& fileref) { 497void PlayListWidget::setDocument(const QString& fileref) {
497 qDebug(fileref); 498 fromSetDocument = true;
498 fromSetDocument = TRUE; 499 d->setDocumentUsed = TRUE;
500 mediaPlayerState->setPlaying( FALSE );
501 qApp->processEvents();
502 mediaPlayerState->setPlaying( TRUE );
503}
504
505void PlayListWidget::setDocumentEx(const QString& fileref) {
506
499 QFileInfo fileInfo(fileref); 507 QFileInfo fileInfo(fileref);
500 if ( !fileInfo.exists() ) { 508 if ( !fileInfo.exists() ) {
501 QMessageBox::critical( 0, tr( "Invalid File" ), 509 QMessageBox::critical( 0, tr( "Invalid File" ),
502 tr( "There was a problem in getting the file." ) ); 510 tr( "There was a problem in getting the file." ) );
503 return; 511 return;
504 } 512 }
505// qDebug("setDocument "+fileref); 513 qDebug("setDocument "+fileref);
506 QString extension = fileInfo.extension(false); 514 QString extension = fileInfo.extension(false);
507 if( extension.find( "m3u", 0, false) != -1) { //is m3u 515 if( extension.find( "m3u", 0, false) != -1) { //is m3u
508 readm3u( fileref); 516 readm3u( fileref);
@@ -530,7 +538,7 @@ void PlayListWidget::setDocument(const QString& fileref) {
530 mediaPlayerState->setPlaying( FALSE ); 538 mediaPlayerState->setPlaying( FALSE );
531 qApp->processEvents(); 539 qApp->processEvents();
532 mediaPlayerState->setPlaying( TRUE ); 540 mediaPlayerState->setPlaying( TRUE );
533 qApp->processEvents(); 541 // qApp->processEvents();
534 setCaption(tr("OpiePlayer")); 542 setCaption(tr("OpiePlayer"));
535 } 543 }
536} 544}
@@ -759,7 +767,7 @@ void PlayListWidget::playIt( QListViewItem *) {
759// d->setDocumentUsed = FALSE; 767// d->setDocumentUsed = FALSE;
760// mediaPlayerState->curPosition =0; 768// mediaPlayerState->curPosition =0;
761 qDebug("playIt"); 769 qDebug("playIt");
762 mediaPlayerState->setPlaying(FALSE); 770 // mediaPlayerState->setPlaying(FALSE);
763 mediaPlayerState->setPlaying(TRUE); 771 mediaPlayerState->setPlaying(TRUE);
764 d->selectedFiles->unSelect(); 772 d->selectedFiles->unSelect();
765} 773}
@@ -782,7 +790,8 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
782 lnk.setFile( filename ); //sets file name 790 lnk.setFile( filename ); //sets file name
783 d->selectedFiles->addToSelection( lnk); 791 d->selectedFiles->addToSelection( lnk);
784 792
785 writeCurrentM3u(); 793 if(tabWidget->currentPageIndex() == 0)
794 writeCurrentM3u();
786// tabWidget->setCurrentPage(0); 795// tabWidget->setCurrentPage(0);
787 796
788 } 797 }
@@ -831,7 +840,7 @@ void PlayListWidget::tabChanged(QWidget *) {
831} 840}
832 841
833void PlayListWidget::btnPlay(bool b) { 842void PlayListWidget::btnPlay(bool b) {
834 qDebug("<<<<<<<<<<<<<<<BtnPlay"); 843 qDebug("<<<<<<<<<<<<<<<BtnPlay %d", b);
835// mediaPlayerState->setPlaying(b); 844// mediaPlayerState->setPlaying(b);
836 switch ( tabWidget->currentPageIndex()) { 845 switch ( tabWidget->currentPageIndex()) {
837 case 0: 846 case 0:
@@ -852,7 +861,7 @@ void PlayListWidget::btnPlay(bool b) {
852 qDebug("2"); 861 qDebug("2");
853// d->selectedFiles->unSelect(); 862// d->selectedFiles->unSelect();
854 addToSelection( audioView->currentItem() ); 863 addToSelection( audioView->currentItem() );
855 mediaPlayerState->setPlaying(true); 864 mediaPlayerState->setPlaying( b);
856 d->selectedFiles->removeSelected( ); 865 d->selectedFiles->removeSelected( );
857 d->selectedFiles->unSelect(); 866 d->selectedFiles->unSelect();
858 tabWidget->setCurrentPage(1); 867 tabWidget->setCurrentPage(1);
@@ -864,7 +873,7 @@ void PlayListWidget::btnPlay(bool b) {
864 qDebug("3"); 873 qDebug("3");
865 874
866 addToSelection( videoView->currentItem() ); 875 addToSelection( videoView->currentItem() );
867 mediaPlayerState->setPlaying(true); 876 mediaPlayerState->setPlaying( b);
868// qApp->processEvents(); 877// qApp->processEvents();
869 d->selectedFiles->removeSelected( ); 878 d->selectedFiles->removeSelected( );
870 d->selectedFiles->unSelect(); 879 d->selectedFiles->unSelect();
@@ -1459,7 +1468,7 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1459 mediaPlayerState->setPlaying( false); 1468 mediaPlayerState->setPlaying( false);
1460 } else if ( msg == "togglePause()" ) { 1469 } else if ( msg == "togglePause()" ) {
1461 mediaPlayerState->togglePaused(); 1470 mediaPlayerState->togglePaused();
1462 } else if ( msg == "next()" ) { //select next in list 1471 } else if ( msg == "next()" ) { //select next in lis
1463 mediaPlayerState->setNext(); 1472 mediaPlayerState->setNext();
1464 } else if ( msg == "prev()" ) { //select previous in list 1473 } else if ( msg == "prev()" ) { //select previous in list
1465 mediaPlayerState->setPrev(); 1474 mediaPlayerState->setPrev();
@@ -1476,7 +1485,7 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1476 } else if ( msg == "play(QString)" ) { //play this now 1485 } else if ( msg == "play(QString)" ) { //play this now
1477 QString file; 1486 QString file;
1478 stream >> file; 1487 stream >> file;
1479 setDocument( (const QString &) file); 1488 setDocumentEx( (const QString &) file);
1480 } else if ( msg == "add(QString)" ) { //add to playlist 1489 } else if ( msg == "add(QString)" ) { //add to playlist
1481 QString file; 1490 QString file;
1482 stream >> file; 1491 stream >> file;
@@ -1489,6 +1498,8 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1489 QString file; 1498 QString file;
1490 stream >> file; 1499 stream >> file;
1491 1500
1501 } else if ( msg == "setDocument(QString)" ) { //loop or not loop
1502 QCopEnvelope h("QPE/Application/opieplayer", "raise()");
1492 } 1503 }
1493 1504
1494} 1505}
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index e66bcb9..0c0e367 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -102,6 +102,7 @@ private slots:
102 void scanForVideo(); 102 void scanForVideo();
103 void openFile(); 103 void openFile();
104 void setDocument( const QString& fileref ); 104 void setDocument( const QString& fileref );
105 void setDocumentEx( const QString& fileref );
105 void addToSelection( const DocLnk& ); // Add a media file to the playlist 106 void addToSelection( const DocLnk& ); // Add a media file to the playlist
106 void addToSelection( QListViewItem* ); // Add a media file to the playlist 107 void addToSelection( QListViewItem* ); // Add a media file to the playlist
107 void setActiveWindow(); // need to handle this to show the right view 108 void setActiveWindow(); // need to handle this to show the right view