-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 14 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mpegplayer.pro | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 8 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 135 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 5 |
8 files changed, 124 insertions, 46 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 3901446..cda3f77 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp @@ -220,7 +220,7 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { if ( isOnButton && !audioButtons[i].isHeld ) { audioButtons[i].isHeld = TRUE; toggleButton(i); - qDebug("button toggled %d",i); + qDebug("button toggled1 %d",i); switch (i) { case AudioVolumeUp: emit moreClicked(); return; case AudioVolumeDown: emit lessClicked(); return; @@ -228,12 +228,14 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { } else if ( !isOnButton && audioButtons[i].isHeld ) { audioButtons[i].isHeld = FALSE; toggleButton(i); + qDebug("button toggled2 %d",i); } } else { if ( audioButtons[i].isHeld ) { audioButtons[i].isHeld = FALSE; if ( !audioButtons[i].isToggle ) setToggleButton( i, FALSE ); + qDebug("button toggled3 %d",i); switch (i) { case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; case AudioStop: mediaPlayerState->setPlaying(FALSE); return; diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index a2850aa..d1d72b6 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h @@ -17,6 +17,7 @@ ** not clear to you. ** **********************************************************************/ + #ifndef AUDIO_WIDGET_H #define AUDIO_WIDGET_H diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 4b2827e..b9f96de 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -19,7 +19,6 @@ **********************************************************************/ // L.J.Potter added changes Fri 02-15-2002 - #include <qpe/qpeapplication.h> #ifdef Q_WS_QWS @@ -221,6 +220,7 @@ void LoopControl::startVideo() { void LoopControl::startAudio() { +//qDebug("start audio"); audioMutex->lock(); if ( moreAudio ) { @@ -240,7 +240,7 @@ void LoopControl::startAudio() { // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); // } // else if ( sampleWaitTime <= -5000 ) { -// // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); +// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); // currentSample = sampleWeShouldBeAt; // } @@ -378,7 +378,7 @@ bool LoopControl::init( const QString& filename ) { int astream = 0; channels = mediaPlayerState->curDecoder()->audioChannels( astream ); -// qDebug( "LC- channels = %d", channels ); + qDebug( "LC- channels = %d", channels ); if ( !total_audio_samples ) total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); @@ -388,17 +388,15 @@ bool LoopControl::init( const QString& filename ) { mediaPlayerState->setLength( total_audio_samples ); freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); -// qDebug( "LC- frequency = %d", freq ); + qDebug( "LC- frequency = %d", freq ); audioSampleCounter = 0; int bits_per_sample; - if ( mediaPlayerState->curDecoder()->pluginName() == QString("WavPlugin") ) { + if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); -// qDebug("using stupid hack"); + qDebug("using stupid hack"); } else { bits_per_sample=0; -// freq=44100; - channels=2; } audioDevice = new AudioDevice( freq, channels, bits_per_sample); diff --git a/core/multimedia/opieplayer/mpegplayer.pro b/core/multimedia/opieplayer/mpegplayer.pro index b9e9ffe..241e29e 100644 --- a/core/multimedia/opieplayer/mpegplayer.pro +++ b/core/multimedia/opieplayer/mpegplayer.pro @@ -22,5 +22,5 @@ LIBS += -lqpe -lpthread INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -TRANSLATIONS = ../i18n/de/mpegplayer.ts +TRANSLATIONS += ../i18n/de/mpegplayer.ts TRANSLATIONS += ../i18n/pt_BR/mpegplayer.ts diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 991301a..756e3b4 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp @@ -55,7 +55,7 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) // setStaticBackground( TRUE ); // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); - setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); +// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); // #endif // addColumn("Title",236); // setAllColumnsShowFocus( TRUE ); @@ -73,9 +73,9 @@ PlayListSelection::~PlayListSelection() { void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { // qDebug("drawBackground"); p->fillRect( r, QBrush( white ) ); - QImage logo = Resource::loadImage( "launcher/opielogo" ); - if ( !logo.isNull() ) - p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); +// QImage logo = Resource::loadImage( "launcher/opielogo" ); +// if ( !logo.isNull() ) +// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); } // #endif diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 524747e..cf665c8 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -106,6 +106,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) d->setDocumentUsed = FALSE; d->current = NULL; fromSetDocument = FALSE; + insanityBool=FALSE; // menuTimer = new QTimer( this ,"menu timer"), // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); @@ -206,9 +207,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) aTab = new QWidget( tabWidget, "aTab" ); audioView = new QListView( aTab, "Audioview" ); audioView->setMinimumSize(233,260); - audioView->addColumn( "Title",150); - audioView->addColumn("Size", 45); - audioView->addColumn("Media",35); + audioView->addColumn( "Title",140); + audioView->addColumn("Size", -1); + audioView->addColumn("Media",-1); audioView->setColumnAlignment(1, Qt::AlignRight); audioView->setColumnAlignment(2, Qt::AlignRight); audioView->setAllColumnsShowFocus(TRUE); @@ -241,9 +242,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) videoView = new QListView( vTab, "Videoview" ); videoView->setMinimumSize(233,260); - videoView->addColumn("Title",150); - videoView->addColumn("Size",45); - videoView->addColumn("Media",35); + videoView->addColumn("Title",140); + videoView->addColumn("Size",-1); + videoView->addColumn("Media",-1); videoView->setColumnAlignment(1, Qt::AlignRight); videoView->setColumnAlignment(2, Qt::AlignRight); videoView->setAllColumnsShowFocus(TRUE); @@ -486,9 +487,11 @@ const DocLnk *PlayListWidget::current() { // this is fugly // } // } // } else - switch (tabWidget->currentPageIndex()) { - case 0: //playlist - { +// qDebug("current"); +// switch (tabWidget->currentPageIndex()) { +// case 0: //playlist +// { + qDebug("playlist"); if ( mediaPlayerState->playlist() ) { return d->selectedFiles->current(); } @@ -497,27 +500,37 @@ const DocLnk *PlayListWidget::current() { // this is fugly } else { return d->files->selected(); } - } - break; - case 1: { //audio - Global::findDocuments(&files, "audio/*"); - QListIterator<DocLnk> dit( files.children() ); - for ( ; dit.current(); ++dit ) { - if( dit.current()->name() == audioView->currentItem()->text(0)) - return dit; - } - } - break; - case 2: { // video - Global::findDocuments(&vFiles, "video/*"); - QListIterator<DocLnk> Vdit( vFiles.children() ); - for ( ; Vdit.current(); ++Vdit ) { - if( Vdit.current()->name() == videoView->currentItem()->text(0)) - return Vdit; - } - } - break; - }; +// } +// break; +// case 1://audio +// { +// qDebug("audioView"); +// Global::findDocuments(&files, "audio/*"); +// QListIterator<DocLnk> dit( files.children() ); +// for ( ; dit.current(); ++dit ) { +// if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { +// qDebug("here"); +// insanityBool=TRUE; +// return dit; +// } +// } +// } +// break; +// case 2: // video +// { +// qDebug("videoView"); +// Global::findDocuments(&vFiles, "video/*"); +// QListIterator<DocLnk> Vdit( vFiles.children() ); +// for ( ; Vdit.current(); ++Vdit ) { +// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { +// insanityBool=TRUE; +// return Vdit; +// } +// } +// } +// break; +// }; +// return 0; } bool PlayListWidget::prev() { @@ -654,15 +667,46 @@ void PlayListWidget::setView( char view ) { void PlayListWidget::addSelected() { + Config cfg( "MediaPlayer" ); + cfg.setGroup("PlayList"); + QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); + int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); + switch (tabWidget->currentPageIndex()) { case 0: //playlist break; case 1: { //audio + for ( int i = 0; i < noOfFiles; i++ ) { + QString entryName; + entryName.sprintf( "File%i", i + 1 ); + QString linkFile = cfg.readEntry( entryName ); + if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { + int result= QMessageBox::warning(this,"OpiePlayer", + tr("This is all ready in your playlist.\nContinue?"), + tr("Yes"),tr("No"),0,0,1); + if (result !=0) + return; + } + } addToSelection( audioView->selectedItem() ); + tabWidget->setCurrentPage(1); } break; case 2: { // video + for ( int i = 0; i < noOfFiles; i++ ) { + QString entryName; + entryName.sprintf( "File%i", i + 1 ); + QString linkFile = cfg.readEntry( entryName ); + if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { + int result= QMessageBox::warning(this,"OpiePlayer", + tr("This is all ready in your playlist.\nContinue?"), + tr("Yes"),tr("No"),0,0,1); + if (result !=0) + return; + } + } addToSelection( videoView->selectedItem() ); + tabWidget->setCurrentPage(2); } break; }; @@ -755,8 +799,39 @@ void PlayListWidget::tabChanged(QWidget *widg) { /* play button is pressed*/ void PlayListWidget::btnPlay(bool b) { +// mediaPlayerState->setPlaying(b); + switch ( tabWidget->currentPageIndex()) { + case 0: + { mediaPlayerState->setPlaying(b); } + break; + case 1: + { + addToSelection( audioView->selectedItem() ); + mediaPlayerState->setPlaying(b); +// qApp->processEvents(); + d->selectedFiles->removeSelected( ); + tabWidget->setCurrentPage(1); +// mediaPlayerState->setPlaying(FALSE); + } + break; + case 2: + { + addToSelection( videoView->selectedItem() ); + mediaPlayerState->setPlaying(b); + qApp->processEvents(); + d->selectedFiles->removeSelected( ); + tabWidget->setCurrentPage(2); +// mediaPlayerState->setPlaying(FALSE); + } + break; + }; + + + + +} void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index effc600..10a42df 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -49,6 +49,7 @@ public: QListView *audioView, *videoView, *playlistView; QLabel *libString; bool fromSetDocument; + bool insanityBool; QString setDocFileRef; // retrieve the current playlist entry (media file link) const DocLnk *current(); diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index bb5f9e8..23b36e5 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp @@ -203,6 +203,8 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { videoButtons[i].isHeld = FALSE; if ( !videoButtons[i].isToggle ) setToggleButton( i, FALSE ); + } + } switch (i) { case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; case VideoStop: mediaPlayerState->setPlaying(FALSE); return; @@ -212,8 +214,7 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoPlayList: mediaPlayerState->setList(); return; case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; } - } - } + } } |