summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-19 12:15:24 (UTC)
committer llornkcor <llornkcor>2002-03-19 12:15:24 (UTC)
commit58a456b92ba8986d4ea2375ddcfd6dd1d84c8fe5 (patch) (unidiff)
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
@@ -217,26 +217,28 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
217 bool isOnButton = dist <= (radius * radius); 217 bool isOnButton = dist <= (radius * radius);
218// QRect r( x, y, 64 + 22*size, 64 + 22*size ); 218// QRect r( x, y, 64 + 22*size, 64 + 22*size );
219// bool isOnButton = r.contains( event->pos() ); // Rectangular Button code 219// bool isOnButton = r.contains( event->pos() ); // Rectangular Button code
220 if ( isOnButton && !audioButtons[i].isHeld ) { 220 if ( isOnButton && !audioButtons[i].isHeld ) {
221 audioButtons[i].isHeld = TRUE; 221 audioButtons[i].isHeld = TRUE;
222 toggleButton(i); 222 toggleButton(i);
223 qDebug("button toggled %d",i); 223 qDebug("button toggled1 %d",i);
224 switch (i) { 224 switch (i) {
225 case AudioVolumeUp: emit moreClicked(); return; 225 case AudioVolumeUp: emit moreClicked(); return;
226 case AudioVolumeDown: emit lessClicked(); return; 226 case AudioVolumeDown: emit lessClicked(); return;
227 } 227 }
228 } else if ( !isOnButton && audioButtons[i].isHeld ) { 228 } else if ( !isOnButton && audioButtons[i].isHeld ) {
229 audioButtons[i].isHeld = FALSE; 229 audioButtons[i].isHeld = FALSE;
230 toggleButton(i); 230 toggleButton(i);
231 qDebug("button toggled2 %d",i);
231 } 232 }
232 } else { 233 } else {
233 if ( audioButtons[i].isHeld ) { 234 if ( audioButtons[i].isHeld ) {
234 audioButtons[i].isHeld = FALSE; 235 audioButtons[i].isHeld = FALSE;
235 if ( !audioButtons[i].isToggle ) 236 if ( !audioButtons[i].isToggle )
236 setToggleButton( i, FALSE ); 237 setToggleButton( i, FALSE );
238 qDebug("button toggled3 %d",i);
237 switch (i) { 239 switch (i) {
238 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; 240 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
239 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 241 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
240 case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; 242 case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
241 case AudioNext: mediaPlayerState->setNext(); return; 243 case AudioNext: mediaPlayerState->setNext(); return;
242 case AudioPrevious: mediaPlayerState->setPrev(); return; 244 case AudioPrevious: mediaPlayerState->setPrev(); 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
@@ -14,12 +14,13 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20
20#ifndef AUDIO_WIDGET_H 21#ifndef AUDIO_WIDGET_H
21#define AUDIO_WIDGET_H 22#define AUDIO_WIDGET_H
22 23
23#include <qwidget.h> 24#include <qwidget.h>
24#include <qpainter.h> 25#include <qpainter.h>
25#include <qdrawutil.h> 26#include <qdrawutil.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
@@ -16,13 +16,12 @@
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// L.J.Potter added changes Fri 02-15-2002 20// L.J.Potter added changes Fri 02-15-2002
21 21
22
23#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
24 23
25#ifdef Q_WS_QWS 24#ifdef Q_WS_QWS
26#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
27#endif 26#endif
28#include <stdio.h> 27#include <stdio.h>
@@ -218,12 +217,13 @@ void LoopControl::startVideo() {
218 } 217 }
219} 218}
220 219
221 220
222void LoopControl::startAudio() { 221void LoopControl::startAudio() {
223 222
223//qDebug("start audio");
224 audioMutex->lock(); 224 audioMutex->lock();
225 if ( moreAudio ) { 225 if ( moreAudio ) {
226 226
227 if ( !isMuted && mediaPlayerState->curDecoder() ) { 227 if ( !isMuted && mediaPlayerState->curDecoder() ) {
228 228
229 currentSample = audioSampleCounter + 1; 229 currentSample = audioSampleCounter + 1;
@@ -233,20 +233,20 @@ void LoopControl::startAudio() {
233 233
234 long samplesRead = 0; 234 long samplesRead = 0;
235 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 235 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
236 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; 236 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
237 long sampleWaitTime = currentSample - sampleWeShouldBeAt; 237 long sampleWaitTime = currentSample - sampleWeShouldBeAt;
238 238
239// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { 239// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
240// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 240// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
241// } 241// }
242// else if ( sampleWaitTime <= -5000 ) { 242// else if ( sampleWaitTime <= -5000 ) {
243// // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 243// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
244// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 244// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
245// currentSample = sampleWeShouldBeAt; 245// currentSample = sampleWeShouldBeAt;
246// } 246// }
247 247
248 audioDevice->write( audioBuffer, samplesRead * 2 * channels ); 248 audioDevice->write( audioBuffer, samplesRead * 2 * channels );
249 audioSampleCounter = currentSample + samplesRead - 1; 249 audioSampleCounter = currentSample + samplesRead - 1;
250 250
251 moreAudio = readOk && (audioSampleCounter <= total_audio_samples); 251 moreAudio = readOk && (audioSampleCounter <= total_audio_samples);
252 252
@@ -375,33 +375,31 @@ bool LoopControl::init( const QString& filename ) {
375 hasVideoChannel = mediaPlayerState->curDecoder()->videoStreams() > 0; 375 hasVideoChannel = mediaPlayerState->curDecoder()->videoStreams() > 0;
376 376
377 if ( hasAudioChannel ) { 377 if ( hasAudioChannel ) {
378 int astream = 0; 378 int astream = 0;
379 379
380 channels = mediaPlayerState->curDecoder()->audioChannels( astream ); 380 channels = mediaPlayerState->curDecoder()->audioChannels( astream );
381// qDebug( "LC- channels = %d", channels ); 381 qDebug( "LC- channels = %d", channels );
382 382
383 if ( !total_audio_samples ) 383 if ( !total_audio_samples )
384 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); 384 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
385 385
386// total_audio_samples += 1000; 386// total_audio_samples += 1000;
387 387
388 mediaPlayerState->setLength( total_audio_samples ); 388 mediaPlayerState->setLength( total_audio_samples );
389 389
390 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 390 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
391// qDebug( "LC- frequency = %d", freq ); 391 qDebug( "LC- frequency = %d", freq );
392 392
393 audioSampleCounter = 0; 393 audioSampleCounter = 0;
394 int bits_per_sample; 394 int bits_per_sample;
395 if ( mediaPlayerState->curDecoder()->pluginName() == QString("WavPlugin") ) { 395 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
396 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); 396 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
397// qDebug("using stupid hack"); 397 qDebug("using stupid hack");
398 } else { 398 } else {
399 bits_per_sample=0; 399 bits_per_sample=0;
400// freq=44100;
401 channels=2;
402 } 400 }
403 401
404 audioDevice = new AudioDevice( freq, channels, bits_per_sample); 402 audioDevice = new AudioDevice( freq, channels, bits_per_sample);
405 audioBuffer = new char[ audioDevice->bufferSize() ]; 403 audioBuffer = new char[ audioDevice->bufferSize() ];
406 channels = audioDevice->channels(); 404 channels = audioDevice->channels();
407 405
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
@@ -19,8 +19,8 @@ LIBS += -lqpe -lpthread
19# LIBS += libmpeg3/libmpeg3.a -lpthread 19# LIBS += libmpeg3/libmpeg3.a -lpthread
20# LIBS += $(OPIEDIR)/plugins/codecs/liblibmadplugin.so 20# LIBS += $(OPIEDIR)/plugins/codecs/liblibmadplugin.so
21 21
22INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
23DEPENDPATH += $(OPIEDIR)/include 23DEPENDPATH += $(OPIEDIR)/include
24 24
25TRANSLATIONS = ../i18n/de/mpegplayer.ts 25TRANSLATIONS += ../i18n/de/mpegplayer.ts
26TRANSLATIONS += ../i18n/pt_BR/mpegplayer.ts 26TRANSLATIONS += ../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
@@ -52,13 +52,13 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
52{ 52{
53 qDebug("starting playlistselector"); 53 qDebug("starting playlistselector");
54// #ifdef USE_PLAYLIST_BACKGROUND 54// #ifdef USE_PLAYLIST_BACKGROUND
55// setStaticBackground( TRUE ); 55// setStaticBackground( TRUE );
56// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); 56// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) );
57 57
58 setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); 58// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
59// #endif 59// #endif
60// addColumn("Title",236); 60// addColumn("Title",236);
61// setAllColumnsShowFocus( TRUE ); 61// setAllColumnsShowFocus( TRUE );
62 addColumn( tr( "Playlist Selection" ) ); 62 addColumn( tr( "Playlist Selection" ) );
63 header()->hide(); 63 header()->hide();
64 setSorting( -1, FALSE ); 64 setSorting( -1, FALSE );
@@ -70,15 +70,15 @@ PlayListSelection::~PlayListSelection() {
70 70
71 71
72// #ifdef USE_PLAYLIST_BACKGROUND 72// #ifdef USE_PLAYLIST_BACKGROUND
73void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 73void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
74// qDebug("drawBackground"); 74// qDebug("drawBackground");
75 p->fillRect( r, QBrush( white ) ); 75 p->fillRect( r, QBrush( white ) );
76 QImage logo = Resource::loadImage( "launcher/opielogo" ); 76// QImage logo = Resource::loadImage( "launcher/opielogo" );
77 if ( !logo.isNull() ) 77// if ( !logo.isNull() )
78 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 78// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
79} 79}
80// #endif 80// #endif
81 81
82 82
83void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 83void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
84 if ( event->state() == QMouseEvent::LeftButton ) { 84 if ( event->state() == QMouseEvent::LeftButton ) {
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
@@ -103,12 +103,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
103 : QMainWindow( parent, name, fl ) { 103 : QMainWindow( parent, name, fl ) {
104 104
105 d = new PlayListWidgetPrivate; 105 d = new PlayListWidgetPrivate;
106 d->setDocumentUsed = FALSE; 106 d->setDocumentUsed = FALSE;
107 d->current = NULL; 107 d->current = NULL;
108 fromSetDocument = FALSE; 108 fromSetDocument = FALSE;
109 insanityBool=FALSE;
109// menuTimer = new QTimer( this ,"menu timer"), 110// menuTimer = new QTimer( this ,"menu timer"),
110// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 111// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
111 112
112 setBackgroundMode( PaletteButton ); 113 setBackgroundMode( PaletteButton );
113 114
114 setCaption( tr("OpiePlayer") ); 115 setCaption( tr("OpiePlayer") );
@@ -203,15 +204,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
203 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 204 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
204 205
205 QWidget *aTab; 206 QWidget *aTab;
206 aTab = new QWidget( tabWidget, "aTab" ); 207 aTab = new QWidget( tabWidget, "aTab" );
207 audioView = new QListView( aTab, "Audioview" ); 208 audioView = new QListView( aTab, "Audioview" );
208 audioView->setMinimumSize(233,260); 209 audioView->setMinimumSize(233,260);
209 audioView->addColumn( "Title",150); 210 audioView->addColumn( "Title",140);
210 audioView->addColumn("Size", 45); 211 audioView->addColumn("Size", -1);
211 audioView->addColumn("Media",35); 212 audioView->addColumn("Media",-1);
212 audioView->setColumnAlignment(1, Qt::AlignRight); 213 audioView->setColumnAlignment(1, Qt::AlignRight);
213 audioView->setColumnAlignment(2, Qt::AlignRight); 214 audioView->setColumnAlignment(2, Qt::AlignRight);
214 audioView->setAllColumnsShowFocus(TRUE); 215 audioView->setAllColumnsShowFocus(TRUE);
215 tabWidget->insertTab(aTab,"Audio"); 216 tabWidget->insertTab(aTab,"Audio");
216 217
217 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 218 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
@@ -238,15 +239,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
238 239
239 QWidget *vTab; 240 QWidget *vTab;
240 vTab = new QWidget( tabWidget, "vTab" ); 241 vTab = new QWidget( tabWidget, "vTab" );
241 videoView = new QListView( vTab, "Videoview" ); 242 videoView = new QListView( vTab, "Videoview" );
242 videoView->setMinimumSize(233,260); 243 videoView->setMinimumSize(233,260);
243 244
244 videoView->addColumn("Title",150); 245 videoView->addColumn("Title",140);
245 videoView->addColumn("Size",45); 246 videoView->addColumn("Size",-1);
246 videoView->addColumn("Media",35); 247 videoView->addColumn("Media",-1);
247 videoView->setColumnAlignment(1, Qt::AlignRight); 248 videoView->setColumnAlignment(1, Qt::AlignRight);
248 videoView->setColumnAlignment(2, Qt::AlignRight); 249 videoView->setColumnAlignment(2, Qt::AlignRight);
249 videoView->setAllColumnsShowFocus(TRUE); 250 videoView->setAllColumnsShowFocus(TRUE);
250 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 251 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
251 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 252 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
252 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 253 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
@@ -483,44 +484,56 @@ const DocLnk *PlayListWidget::current() { // this is fugly
483// if(dit.current()->linkFile() == setDocFileRef) { 484// if(dit.current()->linkFile() == setDocFileRef) {
484// qDebug(setDocFileRef); 485// qDebug(setDocFileRef);
485// return dit; 486// return dit;
486// } 487// }
487// } 488// }
488// } else 489// } else
489 switch (tabWidget->currentPageIndex()) { 490// qDebug("current");
490 case 0: //playlist 491// switch (tabWidget->currentPageIndex()) {
491 { 492// case 0: //playlist
492 if ( mediaPlayerState->playlist() ) { 493// {
493 return d->selectedFiles->current(); 494 qDebug("playlist");
494 } 495 if ( mediaPlayerState->playlist() ) {
495 else if ( d->setDocumentUsed && d->current ) { 496 return d->selectedFiles->current();
496 return d->current;
497 } else {
498 return d->files->selected();
499 }
500 } 497 }
501 break; 498 else if ( d->setDocumentUsed && d->current ) {
502 case 1: { //audio 499 return d->current;
503 Global::findDocuments(&files, "audio/*"); 500 } else {
504 QListIterator<DocLnk> dit( files.children() ); 501 return d->files->selected();
505 for ( ; dit.current(); ++dit ) {
506 if( dit.current()->name() == audioView->currentItem()->text(0))
507 return dit;
508 }
509 }
510 break;
511 case 2: { // video
512 Global::findDocuments(&vFiles, "video/*");
513 QListIterator<DocLnk> Vdit( vFiles.children() );
514 for ( ; Vdit.current(); ++Vdit ) {
515 if( Vdit.current()->name() == videoView->currentItem()->text(0))
516 return Vdit;
517 }
518 } 502 }
519 break; 503// }
520 }; 504// break;
505// case 1://audio
506// {
507// qDebug("audioView");
508// Global::findDocuments(&files, "audio/*");
509// QListIterator<DocLnk> dit( files.children() );
510// for ( ; dit.current(); ++dit ) {
511// if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
512// qDebug("here");
513// insanityBool=TRUE;
514// return dit;
515// }
516// }
517// }
518// break;
519// case 2: // video
520// {
521// qDebug("videoView");
522// Global::findDocuments(&vFiles, "video/*");
523// QListIterator<DocLnk> Vdit( vFiles.children() );
524// for ( ; Vdit.current(); ++Vdit ) {
525// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
526// insanityBool=TRUE;
527// return Vdit;
528// }
529// }
530// }
531// break;
532// };
533// return 0;
521} 534}
522 535
523bool PlayListWidget::prev() { 536bool PlayListWidget::prev() {
524 if ( mediaPlayerState->playlist() ) { 537 if ( mediaPlayerState->playlist() ) {
525 if ( mediaPlayerState->shuffled() ) { 538 if ( mediaPlayerState->shuffled() ) {
526 const DocLnk *cur = current(); 539 const DocLnk *cur = current();
@@ -651,24 +664,55 @@ void PlayListWidget::setView( char view ) {
651 else 664 else
652 hide(); 665 hide();
653} 666}
654 667
655void PlayListWidget::addSelected() { 668void PlayListWidget::addSelected() {
656 669
657 switch (tabWidget->currentPageIndex()) { 670 Config cfg( "MediaPlayer" );
658 case 0: //playlist 671 cfg.setGroup("PlayList");
659 break; 672 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
660 case 1: { //audio 673 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
661 addToSelection( audioView->selectedItem() ); 674
662 } 675 switch (tabWidget->currentPageIndex()) {
663 break; 676 case 0: //playlist
664 case 2: { // video 677 break;
665 addToSelection( videoView->selectedItem() ); 678 case 1: { //audio
666 } 679 for ( int i = 0; i < noOfFiles; i++ ) {
667 break; 680 QString entryName;
668 }; 681 entryName.sprintf( "File%i", i + 1 );
682 QString linkFile = cfg.readEntry( entryName );
683 if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) {
684 int result= QMessageBox::warning(this,"OpiePlayer",
685 tr("This is all ready in your playlist.\nContinue?"),
686 tr("Yes"),tr("No"),0,0,1);
687 if (result !=0)
688 return;
689 }
690 }
691 addToSelection( audioView->selectedItem() );
692 tabWidget->setCurrentPage(1);
693 }
694 break;
695 case 2: { // video
696 for ( int i = 0; i < noOfFiles; i++ ) {
697 QString entryName;
698 entryName.sprintf( "File%i", i + 1 );
699 QString linkFile = cfg.readEntry( entryName );
700 if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
701 int result= QMessageBox::warning(this,"OpiePlayer",
702 tr("This is all ready in your playlist.\nContinue?"),
703 tr("Yes"),tr("No"),0,0,1);
704 if (result !=0)
705 return;
706 }
707 }
708 addToSelection( videoView->selectedItem() );
709 tabWidget->setCurrentPage(2);
710 }
711 break;
712 };
669} 713}
670 714
671void PlayListWidget::removeSelected() { 715void PlayListWidget::removeSelected() {
672 d->selectedFiles->removeSelected( ); 716 d->selectedFiles->removeSelected( );
673} 717}
674 718
@@ -752,13 +796,44 @@ void PlayListWidget::tabChanged(QWidget *widg) {
752} 796}
753 797
754 798
755/* 799/*
756 play button is pressed*/ 800 play button is pressed*/
757void PlayListWidget::btnPlay(bool b) { 801void PlayListWidget::btnPlay(bool b) {
758 mediaPlayerState->setPlaying(b); 802// mediaPlayerState->setPlaying(b);
803 switch ( tabWidget->currentPageIndex()) {
804 case 0:
805 {
806 mediaPlayerState->setPlaying(b);
807 }
808 break;
809 case 1:
810 {
811 addToSelection( audioView->selectedItem() );
812 mediaPlayerState->setPlaying(b);
813// qApp->processEvents();
814 d->selectedFiles->removeSelected( );
815 tabWidget->setCurrentPage(1);
816// mediaPlayerState->setPlaying(FALSE);
817 }
818 break;
819 case 2:
820 {
821 addToSelection( videoView->selectedItem() );
822 mediaPlayerState->setPlaying(b);
823 qApp->processEvents();
824 d->selectedFiles->removeSelected( );
825 tabWidget->setCurrentPage(2);
826// mediaPlayerState->setPlaying(FALSE);
827 }
828 break;
829 };
830
831
832
833
759} 834}
760 835
761void PlayListWidget::deletePlaylist() { 836void PlayListWidget::deletePlaylist() {
762 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 837 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
763 (tr("You really want to delete\nthis playlist?")), 838 (tr("You really want to delete\nthis playlist?")),
764 (tr("Yes")), (tr("No")), 0 )){ 839 (tr("Yes")), (tr("No")), 0 )){
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
@@ -46,12 +46,13 @@ public:
46 QAction *fullScreenButton, *scaleButton; 46 QAction *fullScreenButton, *scaleButton;
47 DocLnkSet files; 47 DocLnkSet files;
48 DocLnkSet vFiles; 48 DocLnkSet vFiles;
49 QListView *audioView, *videoView, *playlistView; 49 QListView *audioView, *videoView, *playlistView;
50 QLabel *libString; 50 QLabel *libString;
51 bool fromSetDocument; 51 bool fromSetDocument;
52 bool insanityBool;
52 QString setDocFileRef; 53 QString setDocFileRef;
53 // retrieve the current playlist entry (media file link) 54 // retrieve the current playlist entry (media file link)
54 const DocLnk *current(); 55 const DocLnk *current();
55 void useSelectedDocument(); 56 void useSelectedDocument();
56/* QTimer * menuTimer; */ 57/* QTimer * menuTimer; */
57 FileSelector* playLists; 58 FileSelector* playLists;
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
@@ -200,23 +200,24 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
200 } 200 }
201 } else { 201 } else {
202 if ( videoButtons[i].isHeld ) { 202 if ( videoButtons[i].isHeld ) {
203 videoButtons[i].isHeld = FALSE; 203 videoButtons[i].isHeld = FALSE;
204 if ( !videoButtons[i].isToggle ) 204 if ( !videoButtons[i].isToggle )
205 setToggleButton( i, FALSE ); 205 setToggleButton( i, FALSE );
206 switch (i) {
207 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
208 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
209 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
210 case VideoNext: mediaPlayerState->setNext(); return;
211 case VideoPrevious: mediaPlayerState->setPrev(); return;
212 case VideoPlayList: mediaPlayerState->setList(); return;
213 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
214 }
215 } 206 }
216 } 207 }
208 switch (i) {
209 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
210 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
211 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
212 case VideoNext: mediaPlayerState->setNext(); return;
213 case VideoPrevious: mediaPlayerState->setPrev(); return;
214 case VideoPlayList: mediaPlayerState->setList(); return;
215 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
216 }
217
217 } 218 }
218} 219}
219 220
220 221
221void VideoWidget::mousePressEvent( QMouseEvent *event ) { 222void VideoWidget::mousePressEvent( QMouseEvent *event ) {
222 mouseMoveEvent( event ); 223 mouseMoveEvent( event );