summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp2
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp62
-rw-r--r--core/multimedia/opieplayer/audiowidget.h1
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp13
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp9
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp180
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h7
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp50
-rw-r--r--core/multimedia/opieplayer/videowidget.h1
9 files changed, 234 insertions, 91 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 5fef792..2087c7f 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -199,3 +199,2 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
199 else format = AFMT_S16_LE; 199 else format = AFMT_S16_LE;
200
201 qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); 200 qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
@@ -203,3 +202,2 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
203 202
204
205 int fragments = 0x10000 * 8 + sound_fragment_shift; 203 int fragments = 0x10000 * 8 + sound_fragment_shift;
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 582660c..3901446 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -19,2 +19,5 @@
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/qpeapplication.h>
21#include <qpe/resource.h>
22
20#include <qwidget.h> 23#include <qwidget.h>
@@ -24,3 +27,3 @@
24#include <qframe.h> 27#include <qframe.h>
25#include <qpe/resource.h> 28
26#include "audiowidget.h" 29#include "audiowidget.h"
@@ -62,2 +65,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
62{ 65{
66// QPEApplication::grabKeyboard();
63 setCaption( tr("OpiePlayer") ); 67 setCaption( tr("OpiePlayer") );
@@ -218,2 +222,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
218 toggleButton(i); 222 toggleButton(i);
223 qDebug("button toggled %d",i);
219 switch (i) { 224 switch (i) {
@@ -276 +281,56 @@ void AudioWidget::paintEvent( QPaintEvent * ) {
276 281
282void AudioWidget::keyReleaseEvent( QKeyEvent *e)
283{
284 switch ( e->key() ) {
285////////////////////////////// Zaurus keys
286 case Key_Home:
287 break;
288 case Key_F9: //activity
289 break;
290 case Key_F10: //contacts
291 break;
292 case Key_F11: //menu
293 break;
294 case Key_F12: //home
295 break;
296 case Key_F13: //mail
297 break;
298 case Key_Space: {
299 if(mediaPlayerState->playing()) {
300// toggleButton(1);
301 mediaPlayerState->setPlaying(FALSE);
302// toggleButton(1);
303 } else {
304// toggleButton(0);
305 mediaPlayerState->setPlaying(TRUE);
306// toggleButton(0);
307 }
308 }
309 break;
310 case Key_Down:
311 toggleButton(6);
312 emit lessClicked();
313 emit lessReleased();
314 toggleButton(6);
315 break;
316 case Key_Up:
317 toggleButton(5);
318 emit moreClicked();
319 emit moreReleased();
320 toggleButton(5);
321 break;
322 case Key_Right:
323// toggleButton(3);
324 mediaPlayerState->setNext();
325// toggleButton(3);
326 break;
327 case Key_Left:
328// toggleButton(4);
329 mediaPlayerState->setPrev();
330// toggleButton(4);
331 break;
332 case Key_Escape:
333 break;
334
335 };
336}
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h
index 53e84b3..a2850aa 100644
--- a/core/multimedia/opieplayer/audiowidget.h
+++ b/core/multimedia/opieplayer/audiowidget.h
@@ -130,2 +130,3 @@ protected:
130 void closeEvent( QCloseEvent *event ); 130 void closeEvent( QCloseEvent *event );
131 void keyReleaseEvent( QKeyEvent *e);
131 132
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index cb8de8a..4b2827e 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -223,3 +223,2 @@ void LoopControl::startAudio() {
223 223
224//qDebug("start audio");
225 audioMutex->lock(); 224 audioMutex->lock();
@@ -243,3 +242,3 @@ void LoopControl::startAudio() {
243// else if ( sampleWaitTime <= -5000 ) { 242// else if ( sampleWaitTime <= -5000 ) {
244// 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 );
245// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 244// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
@@ -381,3 +380,3 @@ bool LoopControl::init( const QString& filename ) {
381 channels = mediaPlayerState->curDecoder()->audioChannels( astream ); 380 channels = mediaPlayerState->curDecoder()->audioChannels( astream );
382 qDebug( "LC- channels = %d", channels ); 381// qDebug( "LC- channels = %d", channels );
383 382
@@ -391,3 +390,3 @@ bool LoopControl::init( const QString& filename ) {
391 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 390 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
392 qDebug( "LC- frequency = %d", freq ); 391// qDebug( "LC- frequency = %d", freq );
393 392
@@ -395,7 +394,9 @@ bool LoopControl::init( const QString& filename ) {
395 int bits_per_sample; 394 int bits_per_sample;
396 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { 395 if ( mediaPlayerState->curDecoder()->pluginName() == QString("WavPlugin") ) {
397 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); 396 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
398 qDebug("using stupid hack"); 397// qDebug("using stupid hack");
399 } else { 398 } else {
400 bits_per_sample=0; 399 bits_per_sample=0;
400// freq=44100;
401 channels=2;
401 } 402 }
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 4019d12..47fc731 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -57,3 +57,3 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
57 57
58// setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) ); 58 setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) );
59// #endif 59// #endif
@@ -75,6 +75,5 @@ void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
75 p->fillRect( r, QBrush( white ) ); 75 p->fillRect( r, QBrush( white ) );
76// QImage logo = Resource::loadImage( "mpegplayer/background" ); 76 QImage logo = Resource::loadImage( "opielogo" );
77// // QImage logo = Resource::loadImage( "opielogo" ); 77 if ( !logo.isNull() )
78// if ( !logo.isNull() ) 78 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
79// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
80} 79}
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 9969526..524747e 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -107,2 +107,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
107 d->current = NULL; 107 d->current = NULL;
108 fromSetDocument = FALSE;
108// menuTimer = new QTimer( this ,"menu timer"), 109// menuTimer = new QTimer( this ,"menu timer"),
@@ -176,6 +177,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
176 pTab = new QWidget( tabWidget, "pTab" ); 177 pTab = new QWidget( tabWidget, "pTab" );
177 playlistView = new QListView( pTab, "Videoview" ); 178// playlistView = new QListView( pTab, "playlistview" );
178 playlistView->setMinimumSize(236,260); 179// playlistView->setMinimumSize(236,260);
179 tabWidget->insertTab( pTab,"Playlist"); 180 tabWidget->insertTab( pTab,"Playlist");
180 181
182
181 // Add the playlist area 183 // Add the playlist area
@@ -191,2 +193,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
191 193
194 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
195 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
196 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
197
198
192 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 199 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
@@ -206,3 +213,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
206 audioView->setColumnAlignment(2, Qt::AlignRight); 213 audioView->setColumnAlignment(2, Qt::AlignRight);
214 audioView->setAllColumnsShowFocus(TRUE);
207 tabWidget->insertTab(aTab,"Audio"); 215 tabWidget->insertTab(aTab,"Audio");
216
217 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
218 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
219 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
220
221
208// audioView 222// audioView
@@ -234,2 +248,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
234 videoView->setColumnAlignment(2, Qt::AlignRight); 248 videoView->setColumnAlignment(2, Qt::AlignRight);
249 videoView->setAllColumnsShowFocus(TRUE);
250 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
251 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
252 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
235 253
@@ -263,4 +281,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
263// add the library area 281// add the library area
264 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
265
266 282
@@ -421,2 +437,3 @@ void PlayListWidget::addAllVideoToList() {
421void PlayListWidget::setDocument(const QString& fileref) { 437void PlayListWidget::setDocument(const QString& fileref) {
438 fromSetDocument = TRUE;
422 if ( fileref.isNull() ) { 439 if ( fileref.isNull() ) {
@@ -425,7 +442,7 @@ void PlayListWidget::setDocument(const QString& fileref) {
425 } 442 }
426// qDebug("setDocument"); 443// qDebug("setDocument "+fileref);
427 if(fileref.find("playlist",0,TRUE) == -1) { 444 if(fileref.find("playlist",0,TRUE) == -1) {
445 clearList();
428 addToSelection( DocLnk( fileref ) ); 446 addToSelection( DocLnk( fileref ) );
429 d->setDocumentUsed = TRUE; 447 d->setDocumentUsed = TRUE;
430 qApp->processEvents();
431 mediaPlayerState->setPlaying( FALSE ); 448 mediaPlayerState->setPlaying( FALSE );
@@ -433,9 +450,9 @@ void PlayListWidget::setDocument(const QString& fileref) {
433 mediaPlayerState->setPlaying( TRUE ); 450 mediaPlayerState->setPlaying( TRUE );
434 d->selectedFiles->removeSelected( ); 451 qApp->processEvents();
435 } else { 452 setCaption("OpiePlayer");
453
454 } else { //is playlist
455 clearList();
436 loadList(DocLnk(fileref)); 456 loadList(DocLnk(fileref));
437 d->selectedFiles->first(); 457 d->selectedFiles->first();
438// mediaPlayerState->setPlaying( TRUE );
439// mediaPlayerState->setPlaying( FALSE );
440
441 } 458 }
@@ -457,5 +474,19 @@ void PlayListWidget::useSelectedDocument() {
457 474
458const DocLnk *PlayListWidget::current() { 475const DocLnk *PlayListWidget::current() { // this is fugly
459 476
460// qDebug("in Playlist widget ::current"); 477// if( fromSetDocument) {
478// qDebug("from setDoc");
479// DocLnkSet files;
480// Global::findDocuments(&files, "video/*;audio/*");
481// QListIterator<DocLnk> dit( files.children() );
482// for ( ; dit.current(); ++dit ) {
483// if(dit.current()->linkFile() == setDocFileRef) {
484// qDebug(setDocFileRef);
485// return dit;
486// }
487// }
488// } else
489 switch (tabWidget->currentPageIndex()) {
490 case 0: //playlist
491 {
461 if ( mediaPlayerState->playlist() ) { 492 if ( mediaPlayerState->playlist() ) {
@@ -469,3 +500,23 @@ const DocLnk *PlayListWidget::current() {
469} 500}
470 501 break;
502 case 1: { //audio
503 Global::findDocuments(&files, "audio/*");
504 QListIterator<DocLnk> dit( files.children() );
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 }
519 break;
520 };
521}
471 522
@@ -571,6 +622,4 @@ void PlayListWidget::saveList() {
571 delete fileDlg; 622 delete fileDlg;
572
573} 623}
574 624
575
576void PlayListWidget::loadList( const DocLnk & lnk) { 625void PlayListWidget::loadList( const DocLnk & lnk) {
@@ -591,3 +640,2 @@ void PlayListWidget::loadList( const DocLnk & lnk) {
591 640
592
593void PlayListWidget::setPlaylist( bool shown ) { 641void PlayListWidget::setPlaylist( bool shown ) {
@@ -599,3 +647,2 @@ void PlayListWidget::setPlaylist( bool shown ) {
599 647
600
601void PlayListWidget::setView( char view ) { 648void PlayListWidget::setView( char view ) {
@@ -706,60 +753,36 @@ void PlayListWidget::tabChanged(QWidget *widg) {
706 753
707/*
708 list is right clicked*/
709void PlayListWidget::fauxPlay(QListViewItem *it) {
710 754
711 switch (tabWidget->currentPageIndex()) { 755/*
712 case 0: //playlist 756 play button is pressed*/
713 break; 757void PlayListWidget::btnPlay(bool b) {
714 case 1: { //audio 758 mediaPlayerState->setPlaying(b);
715 QListIterator<DocLnk> dit( files.children() );
716 for ( ; dit.current(); ++dit ) {
717// qDebug(dit.current()->name());
718 if( dit.current()->name() == it->text(0)) {
719 d->selectedFiles->addToSelection( **dit );
720 }
721 }
722 } 759 }
760
761void PlayListWidget::deletePlaylist() {
762 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
763 (tr("You really want to delete\nthis playlist?")),
764 (tr("Yes")), (tr("No")), 0 )){
765 case 0: // Yes clicked,
766 QFile().remove(playLists->selected()->file());
767 QFile().remove(playLists->selected()->linkFile());
768 playLists->reread();
723 break; 769 break;
724 case 2: { // video 770 case 1: // Cancel
725 QListIterator<DocLnk> dit( vFiles.children() );
726 for ( ; dit.current(); ++dit ) {
727// qDebug(dit.current()->name());
728 if( dit.current()->name() == it->text(0)) {
729 d->selectedFiles->addToSelection( **dit );
730 }
731 }
732 }
733 break; 771 break;
734 }; 772 };
735 mediaPlayerState->setPlaying( TRUE ); 773
736// tabWidget->setCurrentPage(0);
737 d->selectedFiles->removeSelected();
738} 774}
739 775
740/* 776void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
741 play button is pressed*/
742void PlayListWidget::btnPlay(bool b) { // this is fugly
743 switch ( tabWidget->currentPageIndex()) {
744 case 0:
745 { 777 {
746 mediaPlayerState->setPlaying(b); 778 switch (mouse) {
747 }
748 break;
749 case 1: 779 case 1:
750 {
751 addToSelection( audioView->selectedItem() );
752 mediaPlayerState->setPlaying(b);
753 qApp->processEvents();
754 d->selectedFiles->removeSelected( );
755 tabWidget->setCurrentPage(1);
756 }
757 break; 780 break;
758 case 2: 781 case 2:{
759 { 782 QPopupMenu m;
760 addToSelection( videoView->selectedItem() ); 783 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
761 mediaPlayerState->setPlaying(b); 784 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
762 qApp->processEvents(); 785// m.insertSeparator();
763 d->selectedFiles->removeSelected( ); 786// m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
764 tabWidget->setCurrentPage(2); 787 m.exec( QCursor::pos() );
765 } 788 }
@@ -770,12 +793,19 @@ void PlayListWidget::btnPlay(bool b) { // this is fugly
770 793
771void PlayListWidget::deletePlaylist() { 794void PlayListWidget::playSelected()
772 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 795{
773 (tr("You really want to delete\nthis playlist?")), 796 btnPlay( TRUE);
774 (tr("Yes")), (tr("No")), 0 )){ 797}
775 case 0: // Yes clicked, 798
776 QFile().remove(playLists->selected()->file()); 799void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
777 QFile().remove(playLists->selected()->linkFile()); 800{
778 playLists->reread(); 801 switch (mouse) {
802 case 1:
779 break; 803 break;
780 case 1: // Cancel 804 case 2:{
805 QPopupMenu m;
806 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
807 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
808// m.insertSeparator();
809 m.exec( QCursor::pos() );
810 }
781 break; 811 break;
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index e72551b..effc600 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -50,2 +50,4 @@ public:
50 QLabel *libString; 50 QLabel *libString;
51 bool fromSetDocument;
52 QString setDocFileRef;
51 // retrieve the current playlist entry (media file link) 53 // retrieve the current playlist entry (media file link)
@@ -70,3 +72,3 @@ public slots:
70 void playIt( QListViewItem *); 72 void playIt( QListViewItem *);
71 void fauxPlay(QListViewItem *); 73
72 void btnPlay(bool); 74 void btnPlay(bool);
@@ -80,2 +82,5 @@ public slots:
80 void tabChanged(QWidget*); 82 void tabChanged(QWidget*);
83 void viewPressed( int, QListViewItem *, const QPoint&, int);
84 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
85 void playSelected();
81/* void setFullScreen(); */ 86/* void setFullScreen(); */
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index be838c4..bb5f9e8 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -229,3 +229,3 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
229 makeVisible(); 229 makeVisible();
230 } else { 230
231 mouseMoveEvent( event ); 231 mouseMoveEvent( event );
@@ -423 +423,49 @@ bool VideoWidget::playVideo() {
423 423
424
425void VideoWidget::keyReleaseEvent( QKeyEvent *e)
426{
427 switch ( e->key() ) {
428////////////////////////////// Zaurus keys
429 case Key_Home:
430 break;
431 case Key_F9: //activity
432 break;
433 case Key_F10: //contacts
434 break;
435 case Key_F11: //menu
436 break;
437 case Key_F12: //home
438 break;
439 case Key_F13: //mail
440 break;
441 case Key_Space: {
442 if(mediaPlayerState->playing()) {
443 mediaPlayerState->setPlaying(FALSE);
444 } else {
445 mediaPlayerState->setPlaying(TRUE);
446 }
447 }
448 break;
449 case Key_Down:
450// toggleButton(6);
451// emit lessClicked();
452// emit lessReleased();
453// toggleButton(6);
454 break;
455 case Key_Up:
456// toggleButton(5);
457// emit moreClicked();
458// emit moreReleased();
459// toggleButton(5);
460 break;
461 case Key_Right:
462 mediaPlayerState->setNext();
463 break;
464 case Key_Left:
465 mediaPlayerState->setPrev();
466 break;
467 case Key_Escape:
468 break;
469
470 };
471}
diff --git a/core/multimedia/opieplayer/videowidget.h b/core/multimedia/opieplayer/videowidget.h
index cf13743..fe56ca1 100644
--- a/core/multimedia/opieplayer/videowidget.h
+++ b/core/multimedia/opieplayer/videowidget.h
@@ -69,2 +69,3 @@ protected:
69 void closeEvent( QCloseEvent *event ); 69 void closeEvent( QCloseEvent *event );
70 void keyReleaseEvent( QKeyEvent *e);
70 71