-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 | 30 | ||||
-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 | 173 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 19 |
8 files changed, 158 insertions, 80 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 @@ -222,3 +222,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { toggleButton(i); - qDebug("button toggled %d",i); + qDebug("button toggled1 %d",i); switch (i) { @@ -230,2 +230,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { toggleButton(i); + qDebug("button toggled2 %d",i); } @@ -236,2 +237,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { setToggleButton( i, FALSE ); + qDebug("button toggled3 %d",i); switch (i) { 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 @@ -19,2 +19,3 @@ **********************************************************************/ + #ifndef 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 @@ -21,3 +21,2 @@ - #include <qpe/qpeapplication.h> @@ -223,2 +222,3 @@ void LoopControl::startAudio() { +//qDebug("start audio"); audioMutex->lock(); @@ -238,10 +238,10 @@ void LoopControl::startAudio() { -// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { -// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); -// } -// else if ( sampleWaitTime <= -5000 ) { -// // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); -// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); -// currentSample = sampleWeShouldBeAt; -// } +// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { +// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); +// } +// else if ( sampleWaitTime <= -5000 ) { +// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); +// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); +// currentSample = sampleWeShouldBeAt; +// } @@ -380,3 +380,3 @@ bool LoopControl::init( const QString& filename ) { channels = mediaPlayerState->curDecoder()->audioChannels( astream ); -// qDebug( "LC- channels = %d", channels ); + qDebug( "LC- channels = %d", channels ); @@ -390,3 +390,3 @@ bool LoopControl::init( const QString& filename ) { freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); -// qDebug( "LC- frequency = %d", freq ); + qDebug( "LC- frequency = %d", freq ); @@ -394,9 +394,7 @@ bool LoopControl::init( const QString& filename ) { 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; + bits_per_sample=0; } 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 @@ -24,3 +24,3 @@ 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 @@ -57,3 +57,3 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) - setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); +// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); // #endif @@ -75,5 +75,5 @@ void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 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 ); } 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 @@ -108,2 +108,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) fromSetDocument = FALSE; + insanityBool=FALSE; // menuTimer = new QTimer( this ,"menu timer"), @@ -208,5 +209,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 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); @@ -243,5 +244,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) - 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); @@ -488,34 +489,46 @@ const DocLnk *PlayListWidget::current() { // this is fugly // } else - switch (tabWidget->currentPageIndex()) { - case 0: //playlist - { - if ( mediaPlayerState->playlist() ) { - return d->selectedFiles->current(); - } - else if ( d->setDocumentUsed && d->current ) { - return d->current; - } else { - return d->files->selected(); - } +// qDebug("current"); +// switch (tabWidget->currentPageIndex()) { +// case 0: //playlist +// { + qDebug("playlist"); + if ( mediaPlayerState->playlist() ) { + return d->selectedFiles->current(); } - 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; - } + else if ( d->setDocumentUsed && d->current ) { + return d->current; + } else { + return d->files->selected(); } - 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; } @@ -656,14 +669,45 @@ void PlayListWidget::addSelected() { - switch (tabWidget->currentPageIndex()) { - case 0: //playlist - break; - case 1: { //audio - addToSelection( audioView->selectedItem() ); - } - break; - case 2: { // video - addToSelection( videoView->selectedItem() ); - } - break; - }; + 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; + }; } @@ -757,3 +801,34 @@ void PlayListWidget::tabChanged(QWidget *widg) { void PlayListWidget::btnPlay(bool b) { - mediaPlayerState->setPlaying(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; + }; + + + + } 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 @@ -51,2 +51,3 @@ public: bool fromSetDocument; + bool insanityBool; QString setDocFileRef; 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 @@ -205,13 +205,14 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { setToggleButton( i, FALSE ); - switch (i) { - case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; - case VideoStop: mediaPlayerState->setPlaying(FALSE); return; - case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; - case VideoNext: mediaPlayerState->setNext(); return; - case VideoPrevious: mediaPlayerState->setPrev(); return; - case VideoPlayList: mediaPlayerState->setList(); return; - case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; - } } } + switch (i) { + case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; + case VideoStop: mediaPlayerState->setPlaying(FALSE); return; + case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; + case VideoNext: mediaPlayerState->setNext(); return; + case VideoPrevious: mediaPlayerState->setPrev(); return; + case VideoPlayList: mediaPlayerState->setList(); return; + case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; + } + } |