author | llornkcor <llornkcor> | 2002-03-19 12:15:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-19 12:15:24 (UTC) |
commit | 58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5 (patch) (side-by-side diff) | |
tree | 6f58918f36e66d026d4bbb67574f2d195f15b6ad | |
parent | 7a4ff15ff356a484a498249f01354dce549eaec2 (diff) | |
download | opie-58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5.zip opie-58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5.tar.gz opie-58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5.tar.bz2 |
reverted back till I figure out
-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 @@ -219,22 +219,24 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code 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; } } 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; case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); 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 @@ -16,8 +16,9 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ + #ifndef AUDIO_WIDGET_H #define AUDIO_WIDGET_H #include <qwidget.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 @@ -18,9 +18,8 @@ ** **********************************************************************/ // L.J.Potter added changes Fri 02-15-2002 - #include <qpe/qpeapplication.h> #ifdef Q_WS_QWS #include <qpe/qcopenvelope_qws.h> @@ -220,8 +219,9 @@ void LoopControl::startVideo() { void LoopControl::startAudio() { +//qDebug("start audio"); audioMutex->lock(); if ( moreAudio ) { if ( !isMuted && mediaPlayerState->curDecoder() ) { @@ -239,9 +239,9 @@ 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 ); +// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); // currentSample = sampleWeShouldBeAt; // } @@ -377,9 +377,9 @@ bool LoopControl::init( const QString& filename ) { if ( hasAudioChannel ) { 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 ); @@ -387,19 +387,17 @@ 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); audioBuffer = new char[ audioDevice->bufferSize() ]; 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 @@ -21,6 +21,6 @@ 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 @@ -54,9 +54,9 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) // #ifdef USE_PLAYLIST_BACKGROUND // setStaticBackground( TRUE ); // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); - setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); +// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); // #endif // addColumn("Title",236); // setAllColumnsShowFocus( TRUE ); addColumn( tr( "Playlist Selection" ) ); @@ -72,11 +72,11 @@ PlayListSelection::~PlayListSelection() { // #ifdef USE_PLAYLIST_BACKGROUND 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 @@ -105,8 +105,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) d = new PlayListWidgetPrivate; d->setDocumentUsed = FALSE; d->current = NULL; fromSetDocument = FALSE; + insanityBool=FALSE; // menuTimer = new QTimer( this ,"menu timer"), // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); setBackgroundMode( PaletteButton ); @@ -205,11 +206,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) QWidget *aTab; 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); tabWidget->insertTab(aTab,"Audio"); @@ -240,11 +241,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) vTab = new QWidget( tabWidget, "vTab" ); 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); QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); @@ -485,40 +486,52 @@ const DocLnk *PlayListWidget::current() { // this is fugly // return dit; // } // } // } else - switch (tabWidget->currentPageIndex()) { - case 0: //playlist - { +// qDebug("current"); +// switch (tabWidget->currentPageIndex()) { +// case 0: //playlist +// { + qDebug("playlist"); if ( mediaPlayerState->playlist() ) { return d->selectedFiles->current(); } else if ( d->setDocumentUsed && d->current ) { return d->current; } 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() { if ( mediaPlayerState->playlist() ) { @@ -653,17 +666,48 @@ 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; }; } @@ -754,10 +798,41 @@ 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?")), (tr("You really want to delete\nthis 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 @@ -48,8 +48,9 @@ public: DocLnkSet vFiles; QListView *audioView, *videoView, *playlistView; QLabel *libString; bool fromSetDocument; + bool insanityBool; QString setDocFileRef; // retrieve the current playlist entry (media file link) const DocLnk *current(); void useSelectedDocument(); 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 @@ -202,8 +202,10 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { if ( videoButtons[i].isHeld ) { 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; case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; @@ -211,10 +213,9 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoPrevious: mediaPlayerState->setPrev(); return; case VideoPlayList: mediaPlayerState->setList(); return; case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; } - } - } + } } |