summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-06-11 03:25:10 (UTC)
committer llornkcor <llornkcor>2003-06-11 03:25:10 (UTC)
commitbb6afc95ea64329f8fb9b7af8727b0c13747dde0 (patch) (unidiff)
treecd9285a4860ce024a2f126da4b843c18cdeb533b
parentd47a08d2f8944deb1ee0945075c3443de82442ea (diff)
downloadopie-bb6afc95ea64329f8fb9b7af8727b0c13747dde0.zip
opie-bb6afc95ea64329f8fb9b7af8727b0c13747dde0.tar.gz
opie-bb6afc95ea64329f8fb9b7af8727b0c13747dde0.tar.bz2
fix setDocument handling
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
@@ -362,18 +362,19 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
362 loadList(DocLnk( currentPlaylist)); 362 loadList(DocLnk( currentPlaylist));
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
369PlayListWidget::~PlayListWidget() { 370PlayListWidget::~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
379void PlayListWidget::initializeStates() { 380void PlayListWidget::initializeStates() {
@@ -493,17 +494,24 @@ void PlayListWidget::addAllVideoToList() {
493} 494}
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);
509 } 517 }
@@ -529,9 +537,9 @@ void PlayListWidget::setDocument(const QString& fileref) {
529 d->setDocumentUsed = TRUE; 537 d->setDocumentUsed = TRUE;
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}
537 545
@@ -758,9 +766,9 @@ void PlayListWidget::removeSelected() {
758void PlayListWidget::playIt( QListViewItem *) { 766void 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}
766 774
@@ -781,9 +789,10 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
781 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name 789 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
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 }
789} 798}
@@ -830,9 +839,9 @@ void PlayListWidget::tabChanged(QWidget *) {
830 }; 839 };
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:
838 { 847 {
@@ -851,9 +860,9 @@ void PlayListWidget::btnPlay(bool b) {
851 { 860 {
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);
859 insanityBool=FALSE; 868 insanityBool=FALSE;
@@ -863,9 +872,9 @@ void PlayListWidget::btnPlay(bool b) {
863 { 872 {
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();
871 tabWidget->setCurrentPage(2); 880 tabWidget->setCurrentPage(2);
@@ -1458,9 +1467,9 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1458 } else if ( msg == "stop()" ) { 1467 } else if ( msg == "stop()" ) {
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();
1466 } else if ( msg == "toggleLooping()" ) { //loop or not loop 1475 } else if ( msg == "toggleLooping()" ) { //loop or not loop
@@ -1475,9 +1484,9 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1475// emit lessReleased(); 1484// emit lessReleased();
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;
1483 QFileInfo fileInfo(file); 1492 QFileInfo fileInfo(file);
@@ -1488,7 +1497,9 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1488 } else if ( msg == "rem(QString)" ) { //remove from playlist 1497 } else if ( msg == "rem(QString)" ) { //remove from playlist
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
@@ -101,8 +101,9 @@ private slots:
101 void scanForAudio(); 101 void scanForAudio();
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
108 void setPlaylist( bool ); // Show/Hide the playlist 109 void setPlaylist( bool ); // Show/Hide the playlist