summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-19 12:15:24 (UTC)
committer llornkcor <llornkcor>2002-03-19 12:15:24 (UTC)
commit58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5 (patch) (side-by-side diff)
tree6f58918f36e66d026d4bbb67574f2d195f15b6ad
parent7a4ff15ff356a484a498249f01354dce549eaec2 (diff)
downloadopie-58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5.zip
opie-58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5.tar.gz
opie-58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5.tar.bz2
reverted back till I figure out
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp4
-rw-r--r--core/multimedia/opieplayer/audiowidget.h1
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp30
-rw-r--r--core/multimedia/opieplayer/mpegplayer.pro2
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp8
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp173
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h1
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp19
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
@@ -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 ) {
@@ -236,14 +236,14 @@ void LoopControl::startAudio() {
long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
long sampleWaitTime = 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;
-// }
+// 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;
+// }
audioDevice->write( audioBuffer, samplesRead * 2 * channels );
audioSampleCounter = currentSample + samplesRead - 1;
@@ -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;
+ bits_per_sample=0;
}
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,38 +487,50 @@ 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;
}
bool PlayListWidget::prev() {
@@ -654,18 +667,49 @@ void PlayListWidget::setView( char view ) {
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;
+ };
}
void PlayListWidget::removeSelected() {
@@ -755,7 +799,38 @@ void PlayListWidget::tabChanged(QWidget *widg) {
/*
play button is pressed*/
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;
+ };
+
+
+
+
}
void PlayListWidget::deletePlaylist() {
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,17 +203,18 @@ 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;
- 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;
+ }
+
}
}