summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp14
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp78
2 files changed, 55 insertions, 37 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
index 6793773..7de4282 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
@@ -489,102 +489,102 @@ bool LibMadPlugin::close() {
489 free(d->input.data); 489 free(d->input.data);
490 d->input.data = 0; 490 d->input.data = 0;
491 } 491 }
492 492
493 if (::close(d->input.fd) == -1) { 493 if (::close(d->input.fd) == -1) {
494 qDebug("error closing file %s", d->input.path); 494 qDebug("error closing file %s", d->input.path);
495 result = FALSE; 495 result = FALSE;
496 } 496 }
497 497
498 d->input.fd = 0; 498 d->input.fd = 0;
499 499
500 return result; 500 return result;
501} 501}
502 502
503 503
504bool LibMadPlugin::isOpen() { 504bool LibMadPlugin::isOpen() {
505 debugMsg( "LibMadPlugin::isOpen" ); 505 debugMsg( "LibMadPlugin::isOpen" );
506 return ( d->input.fd != 0 ); 506 return ( d->input.fd != 0 );
507} 507}
508 508
509 509
510int LibMadPlugin::audioStreams() { 510int LibMadPlugin::audioStreams() {
511 debugMsg( "LibMadPlugin::audioStreams" ); 511 debugMsg( "LibMadPlugin::audioStreams" );
512 return 1; 512 return 1;
513} 513}
514 514
515 515
516int LibMadPlugin::audioChannels( int ) { 516int LibMadPlugin::audioChannels( int ) {
517 debugMsg( "LibMadPlugin::audioChannels" ); 517 debugMsg( "LibMadPlugin::audioChannels" );
518/* 518/*
519 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); 519 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 );
520 qDebug( "LibMadPlugin::audioChannels: %i", d->frame.header.mode > 0 ? 2 : 1 ); 520 qDebug( "LibMadPlugin::audioChannels: %i", d->frame.header.mode > 0 ? 2 : 1 );
521 return d->frame.header.mode > 0 ? 2 : 1; 521 return d->frame.header.mode > 0 ? 2 : 1;
522*/ 522*/
523 return 2; 523 return 2;
524} 524}
525 525
526 526
527int LibMadPlugin::audioFrequency( int ) { 527int LibMadPlugin::audioFrequency( int ) {
528 debugMsg( "LibMadPlugin::audioFrequency" ); 528 debugMsg( "LibMadPlugin::audioFrequency" );
529 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); 529 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 );
530 qDebug( "LibMadPlugin::audioFrequency: %i", d->frame.header.samplerate ); 530 qDebug( "LibMadPlugin::audioFrequency: %i", d->frame.header.samplerate );
531 return d->frame.header.samplerate; 531 return d->frame.header.samplerate;
532} 532}
533 533
534 534
535int LibMadPlugin::audioSamples( int ) { 535int LibMadPlugin::audioSamples( int ) {
536 debugMsg( "LibMadPlugin::audioSamples" ); 536 debugMsg( "LibMadPlugin::audioSamples" );
537/* 537
538 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); 538 // long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 );
539 mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); 539// mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream );
540 qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, d->frame.header.samplerate ); 540// qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, d->frame.header.samplerate );
541 return d->frame.header.duration.seconds * d->frame.header.samplerate; 541// return d->frame.header.duration.seconds * d->frame.header.samplerate;
542*/ 542
543 return 10000000; 543 return 10000000;
544} 544}
545 545
546 546
547bool LibMadPlugin::audioSetSample( long, int ) { 547bool LibMadPlugin::audioSetSample( long, int ) {
548 debugMsg( "LibMadPlugin::audioSetSample" ); 548 debugMsg( "LibMadPlugin::audioSetSample" );
549 return FALSE; 549 return FALSE;
550} 550}
551 551
552 552
553long LibMadPlugin::audioGetSample( int ) { 553long LibMadPlugin::audioGetSample( int ) {
554 debugMsg( "LibMadPlugin::audioGetSample" ); 554 debugMsg( "LibMadPlugin::audioGetSample" );
555 return 0; 555 return 0;
556} 556}
557 557
558/* 558/*
559bool LibMadPlugin::audioReadSamples( short *, int, long, int ) { 559bool LibMadPlugin::audioReadSamples( short *, int, long, int ) {
560 debugMsg( "LibMadPlugin::audioReadSamples" ); 560 debugMsg( "LibMadPlugin::audioReadSamples" );
561 return FALSE; 561 return FALSE;
562} 562}
563 563
564 564
565bool LibMadPlugin::audioReReadSamples( short *, int, long, int ) { 565bool LibMadPlugin::audioReReadSamples( short *, int, long, int ) {
566 debugMsg( "LibMadPlugin::audioReReadSamples" ); 566 debugMsg( "LibMadPlugin::audioReReadSamples" );
567 return FALSE; 567 return FALSE;
568} 568}
569*/ 569*/
570 570
571bool LibMadPlugin::read() { 571bool LibMadPlugin::read() {
572 debugMsg( "LibMadPlugin::read" ); 572 debugMsg( "LibMadPlugin::read" );
573 int len; 573 int len;
574 574
575 if (d->input.eof) 575 if (d->input.eof)
576 return FALSE; 576 return FALSE;
577 577
578#if defined(HAVE_MMAP) 578#if defined(HAVE_MMAP)
579 if (d->input.fdm) { 579 if (d->input.fdm) {
580 unsigned long skip = 0; 580 unsigned long skip = 0;
581 581
582 if (d->stream.next_frame) { 582 if (d->stream.next_frame) {
583 struct stat stat; 583 struct stat stat;
584 584
585 if (fstat(d->input.fd, &stat) == -1) 585 if (fstat(d->input.fd, &stat) == -1)
586 return FALSE; 586 return FALSE;
587 587
588 if (stat.st_size + MAD_BUFFER_GUARD <= (signed)d->input.length) 588 if (stat.st_size + MAD_BUFFER_GUARD <= (signed)d->input.length)
589 return FALSE; 589 return FALSE;
590 590
@@ -737,92 +737,92 @@ bool LibMadPlugin::audioReadMonoSamples( short *, long, long&, int ) {
737 737
738bool LibMadPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { 738bool LibMadPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) {
739*/ 739*/
740bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long samples, long& samplesMade, int ) { 740bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long samples, long& samplesMade, int ) {
741 debugMsg( "LibMadPlugin::audioReadStereoSamples" ); 741 debugMsg( "LibMadPlugin::audioReadStereoSamples" );
742 742
743 static bool needInput = TRUE; 743 static bool needInput = TRUE;
744 744
745 if ( samples == 0 ) 745 if ( samples == 0 )
746 return FALSE; 746 return FALSE;
747 747
748 do { 748 do {
749 if ( needInput ) 749 if ( needInput )
750 if ( !read() ) { 750 if ( !read() ) {
751// if ( d->input.eof ) 751// if ( d->input.eof )
752// needInput = FALSE; 752// needInput = FALSE;
753// else 753// else
754 return FALSE; 754 return FALSE;
755 } 755 }
756 756
757 needInput = FALSE; 757 needInput = FALSE;
758 758
759 if ( decode( output, samples, samplesMade ) ) 759 if ( decode( output, samples, samplesMade ) )
760 return TRUE; 760 return TRUE;
761 else 761 else
762 needInput = TRUE; 762 needInput = TRUE;
763 } 763 }
764 while ( ( samplesMade < samples ) && ( !d->input.eof ) ); 764 while ( ( samplesMade < samples ) && ( !d->input.eof ) );
765/* 765/*
766 static bool firstTimeThru = TRUE; 766 static bool firstTimeThru = TRUE;
767 767
768 if ( firstTimeThru ) { 768 if ( firstTimeThru ) {
769 firstTimeThru = FALSE; 769 firstTimeThru = FALSE;
770 decode( output, samples, samplesMade ); 770 decode( output, samples, samplesMade );
771 return FALSE; 771 return FALSE;
772 } else 772 } else
773*/ 773*/
774 return FALSE; 774 return FALSE;
775} 775}
776 776
777 777
778double LibMadPlugin::getTime() { 778double LibMadPlugin::getTime() {
779 debugMsg( "LibMadPlugin::getTime" ); 779 debugMsg( "LibMadPlugin::getTime" );
780 return 0.0; 780 return 0.0;
781} 781}
782 782
783 783
784void LibMadPlugin::printID3Tags() { 784void LibMadPlugin::printID3Tags() {
785 debugMsg( "LibMadPlugin::printID3Tags" ); 785 qDebug( "LibMadPlugin::printID3Tags" );
786 786
787 char id3v1[128 + 1]; 787 char id3v1[128 + 1];
788 788
789 if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { 789 if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) {
790 qDebug( "error seeking to id3 tags" ); 790 qDebug( "error seeking to id3 tags" );
791 return; 791 return;
792 } 792 }
793 793
794 if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { 794 if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) {
795 qDebug( "error reading in id3 tags" ); 795 qDebug( "error reading in id3 tags" );
796 return; 796 return;
797 } 797 }
798 798
799 if ( ::strncmp( (const char *)id3v1, "TAG", 3 ) != 0 ) { 799 if ( ::strncmp( (const char *)id3v1, "TAG", 3 ) != 0 ) {
800 debugMsg( "sorry, no id3 tags" ); 800 debugMsg( "sorry, no id3 tags" );
801 } else { 801 } else {
802 int len[5] = { 30, 30, 30, 4, 30 }; 802 int len[5] = { 30, 30, 30, 4, 30 };
803 QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) }; 803 QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) };
804 char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; 804 char *ptr = id3v1 + 3, *ptr2 = ptr + len[0];
805 qDebug( "ID3 tags in file:" ); 805 qDebug( "ID3 tags in file:" );
806 info = ""; 806 info = "";
807 for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) { 807 for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) {
808 char push = *ptr2; 808 char push = *ptr2;
809 *ptr2 = '\0'; 809 *ptr2 = '\0';
810 char *ptr3 = ptr2; 810 char *ptr3 = ptr2;
811 while ( ptr3-1 >= ptr && isspace(ptr3[-1]) ) ptr3--; 811 while ( ptr3-1 >= ptr && isspace(ptr3[-1]) ) ptr3--;
812 char push2 = *ptr3; *ptr3 = '\0'; 812 char push2 = *ptr3; *ptr3 = '\0';
813 if ( strcmp( ptr, "" ) ) 813 if ( strcmp( ptr, "" ) )
814 info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr; 814 info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr;
815 //qDebug( info.latin1() ); 815 //qDebug( info.latin1() );
816 *ptr3 = push2; 816 *ptr3 = push2;
817 *ptr2 = push; 817 *ptr2 = push;
818 } 818 }
819 if (id3v1[126] == 0 && id3v1[127] != 0) 819 if (id3v1[126] == 0 && id3v1[127] != 0)
820 info += tr( ", Track: " ) + id3v1[127]; 820 info += tr( ", Track: " ) + id3v1[127];
821 } 821 }
822 822
823 if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { 823 if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) {
824 qDebug( "error seeking back to beginning" ); 824 qDebug( "error seeking back to beginning" );
825 return; 825 return;
826 } 826 }
827} 827}
828 828
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index ff156f8..7c76400 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -176,123 +176,124 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
176 176
177 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 177 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
178 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 178 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
179 179
180 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 180 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
181 181
182 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 182 tabWidget = new QTabWidget( hbox6, "tabWidget" );
183 tabWidget->setTabShape(QTabWidget::Triangular); 183 tabWidget->setTabShape(QTabWidget::Triangular);
184 184
185 QWidget *pTab; 185 QWidget *pTab;
186 pTab = new QWidget( tabWidget, "pTab" ); 186 pTab = new QWidget( tabWidget, "pTab" );
187// playlistView = new QListView( pTab, "playlistview" ); 187// playlistView = new QListView( pTab, "playlistview" );
188// playlistView->setMinimumSize(236,260); 188// playlistView->setMinimumSize(236,260);
189 tabWidget->insertTab( pTab,"Playlist"); 189 tabWidget->insertTab( pTab,"Playlist");
190 190
191 191
192 // Add the playlist area 192 // Add the playlist area
193 193
194 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 194 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
195 d->playListFrame = vbox3; 195 d->playListFrame = vbox3;
196 d->playListFrame ->setMinimumSize(235,260); 196 d->playListFrame ->setMinimumSize(235,260);
197 197
198 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 198 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
199 199
200 d->selectedFiles = new PlayListSelection( hbox2); 200 d->selectedFiles = new PlayListSelection( hbox2);
201 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 201 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
202 202
203 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 203 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
204 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 204 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
205 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 205 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
206 206
207 207
208 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 208 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
209 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 209 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
210 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 210 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
211 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 211 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
212 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 212 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
213 213
214 QWidget *aTab; 214 QWidget *aTab;
215 aTab = new QWidget( tabWidget, "aTab" ); 215 aTab = new QWidget( tabWidget, "aTab" );
216 audioView = new QListView( aTab, "Audioview" ); 216 audioView = new QListView( aTab, "Audioview" );
217 audioView->setMinimumSize(233,260); 217 audioView->setMinimumSize(233,260);
218 audioView->addColumn( tr("Title"),140); 218 audioView->addColumn( tr("Title"),140);
219 audioView->addColumn(tr("Size"), -1); 219 audioView->addColumn(tr("Size"), -1);
220 audioView->addColumn(tr("Media"),-1); 220 audioView->addColumn(tr("Media"),-1);
221 audioView->setColumnAlignment(1, Qt::AlignRight); 221 audioView->setColumnAlignment(1, Qt::AlignRight);
222 audioView->setColumnAlignment(2, Qt::AlignRight); 222 audioView->setColumnAlignment(2, Qt::AlignRight);
223 audioView->setAllColumnsShowFocus(TRUE); 223 audioView->setAllColumnsShowFocus(TRUE);
224// audioView->setMultiSelection( TRUE ); 224
225// audioView->setSelectionMode( QListView::Extended); 225 audioView->setMultiSelection( TRUE );
226 audioView->setSelectionMode( QListView::Extended);
226 227
227 tabWidget->insertTab(aTab,tr("Audio")); 228 tabWidget->insertTab(aTab,tr("Audio"));
228 229
229 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 230 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
230 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 231 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
231 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 232 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
232 233
233 234
234// audioView 235// audioView
235 populateAudioView(); 236 populateAudioView();
236// videowidget 237// videowidget
237 238
238 QWidget *vTab; 239 QWidget *vTab;
239 vTab = new QWidget( tabWidget, "vTab" ); 240 vTab = new QWidget( tabWidget, "vTab" );
240 videoView = new QListView( vTab, "Videoview" ); 241 videoView = new QListView( vTab, "Videoview" );
241 videoView->setMinimumSize(233,260); 242 videoView->setMinimumSize(233,260);
242 243
243 videoView->addColumn(tr("Title"),140); 244 videoView->addColumn(tr("Title"),140);
244 videoView->addColumn(tr("Size"),-1); 245 videoView->addColumn(tr("Size"),-1);
245 videoView->addColumn(tr("Media"),-1); 246 videoView->addColumn(tr("Media"),-1);
246 videoView->setColumnAlignment(1, Qt::AlignRight); 247 videoView->setColumnAlignment(1, Qt::AlignRight);
247 videoView->setColumnAlignment(2, Qt::AlignRight); 248 videoView->setColumnAlignment(2, Qt::AlignRight);
248 videoView->setAllColumnsShowFocus(TRUE); 249 videoView->setAllColumnsShowFocus(TRUE);
249// videoView->setMultiSelection( TRUE ); 250 videoView->setMultiSelection( TRUE );
250// videoView->setSelectionMode( QListView::Extended); 251 videoView->setSelectionMode( QListView::Extended);
251 252
252 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 253 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
253 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 254 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
254 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 255 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
255 256
256 tabWidget->insertTab( vTab,tr("Video")); 257 tabWidget->insertTab( vTab,tr("Video"));
257populateVideoView(); 258populateVideoView();
258 259
259//playlists list 260//playlists list
260 QWidget *LTab; 261 QWidget *LTab;
261 LTab = new QWidget( tabWidget, "LTab" ); 262 LTab = new QWidget( tabWidget, "LTab" );
262 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 263 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
263 playLists->setMinimumSize(233,260);; 264 playLists->setMinimumSize(233,260);;
264 tabWidget->insertTab(LTab,tr("Lists")); 265 tabWidget->insertTab(LTab,tr("Lists"));
265 266
266 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 267 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
267// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 268// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
268 269
269 270
270// add the library area 271// add the library area
271 272
272// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 273// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
273// this, SLOT( fauxPlay( QListViewItem *) ) ); 274// this, SLOT( fauxPlay( QListViewItem *) ) );
274// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 275// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
275// this, SLOT( fauxPlay( QListViewItem *)) ); 276// this, SLOT( fauxPlay( QListViewItem *)) );
276 277
277// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 278// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
278// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 279// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
279 280
280 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 281 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
281 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 282 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
282 283
283 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 284 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
284 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 285 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
285 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 286 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
286 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 287 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
287 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 288 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
288 289
289 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 290 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
290// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 291// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
291 292
292 setCentralWidget( vbox5 ); 293 setCentralWidget( vbox5 );
293 294
294 Config cfg( "OpiePlayer" ); 295 Config cfg( "OpiePlayer" );
295 readConfig( cfg ); 296 readConfig( cfg );
296 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 297 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
297// qDebug("currentList is "+currentPlaylist); 298// qDebug("currentList is "+currentPlaylist);
298 loadList(DocLnk( currentPlaylist)); 299 loadList(DocLnk( currentPlaylist));
@@ -635,127 +636,144 @@ void PlayListWidget::saveList() {
635 if(fileDlg) 636 if(fileDlg)
636 delete fileDlg; 637 delete fileDlg;
637} 638}
638 639
639void PlayListWidget::loadList( const DocLnk & lnk) { 640void PlayListWidget::loadList( const DocLnk & lnk) {
640 QString name= lnk.name(); 641 QString name= lnk.name();
641// qDebug("currentList is "+name); 642// qDebug("currentList is "+name);
642 if( name.length()>1) { 643 if( name.length()>1) {
643 setCaption("OpiePlayer: "+name); 644 setCaption("OpiePlayer: "+name);
644// qDebug("load list "+ name+".playlist"); 645// qDebug("load list "+ name+".playlist");
645 clearList(); 646 clearList();
646 Config cfg( name+".playlist"); 647 Config cfg( name+".playlist");
647 readConfig(cfg); 648 readConfig(cfg);
648 649
649 tabWidget->setCurrentPage(0); 650 tabWidget->setCurrentPage(0);
650 651
651 Config config( "OpiePlayer" ); 652 Config config( "OpiePlayer" );
652 config.writeEntry("CurrentPlaylist", name); 653 config.writeEntry("CurrentPlaylist", name);
653// d->selectedFiles->first(); 654// d->selectedFiles->first();
654 } 655 }
655 656
656} 657}
657 658
658void PlayListWidget::setPlaylist( bool shown ) { 659void PlayListWidget::setPlaylist( bool shown ) {
659 if ( shown ) 660 if ( shown )
660 d->playListFrame->show(); 661 d->playListFrame->show();
661 else 662 else
662 d->playListFrame->hide(); 663 d->playListFrame->hide();
663} 664}
664 665
665void PlayListWidget::setView( char view ) { 666void PlayListWidget::setView( char view ) {
666 if ( view == 'l' ) 667 if ( view == 'l' )
667 showMaximized(); 668 showMaximized();
668 else 669 else
669 hide(); 670 hide();
670} 671}
671 672
672void PlayListWidget::addSelected() { 673void PlayListWidget::addSelected() {
673 674
674 Config cfg( "OpiePlayer" ); 675 Config cfg( "OpiePlayer" );
675 cfg.setGroup("PlayList"); 676 cfg.setGroup("PlayList");
676 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 677 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
677 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 678 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
678 679
679 switch (tabWidget->currentPageIndex()) { 680 switch (tabWidget->currentPageIndex()) {
680 case 0: //playlist 681 case 0: //playlist
681 break; 682 break;
682 case 1: { //audio 683 case 1: { //audio
683 for ( int i = 0; i < noOfFiles; i++ ) { 684// QString entryName;
684 QString entryName; 685// entryName.sprintf( "File%i", i + 1 );
685 entryName.sprintf( "File%i", i + 1 ); 686// QString linkFile = cfg.readEntry( entryName );
686 QString linkFile = cfg.readEntry( entryName ); 687 QListViewItemIterator it( audioView );
687 if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { 688 // iterate through all items of the listview
688 int result= QMessageBox::warning(this,tr("OpiePlayer"), 689 for ( ; it.current(); ++it ) {
689 tr("This is all ready in your playlist.\nContinue?"), 690 if ( it.current()->isSelected() ) {
690 tr("Yes"),tr("No"),0,0,1); 691 QListIterator<DocLnk> dit( files.children() );
691 if (result !=0) 692 for ( ; dit.current(); ++dit ) {
692 return; 693 if( dit.current()->name() == it.current()->text(0) ) {
693 } 694 d->selectedFiles->addToSelection( **dit );
695 }
696 }
697 audioView->setSelected( it.current(),FALSE);
698 }
694 } 699 }
695 addToSelection( audioView->selectedItem() ); 700 tabWidget->setCurrentPage(0);
696 tabWidget->setCurrentPage(1);
697 } 701 }
698 break; 702 break;
699 case 2: { // video 703 case 2: { // video
700 for ( int i = 0; i < noOfFiles; i++ ) { 704 QListViewItemIterator it( videoView );
701 QString entryName; 705 // iterate through all items of the listview
702 entryName.sprintf( "File%i", i + 1 ); 706 for ( ; it.current(); ++it ) {
703 QString linkFile = cfg.readEntry( entryName ); 707 if ( it.current()->isSelected() ) {
704 if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { 708 QListIterator<DocLnk> dit( vFiles.children() );
705 int result= QMessageBox::warning(this,tr("OpiePlayer"), 709 for ( ; dit.current(); ++dit ) {
706 tr("This is all ready in your playlist.\nContinue?"), 710 if( dit.current()->name() == it.current()->text(0) ) {
707 tr("Yes"),tr("No"),0,0,1); 711 d->selectedFiles->addToSelection( **dit );
708 if (result !=0) 712 }
709 return; 713 }
710 } 714
715 videoView->setSelected( it.current(),FALSE);
716 }
711 } 717 }
712 addToSelection( videoView->selectedItem() ); 718// for ( int i = 0; i < noOfFiles; i++ ) {
713 tabWidget->setCurrentPage(2); 719// QString entryName;
720// entryName.sprintf( "File%i", i + 1 );
721// QString linkFile = cfg.readEntry( entryName );
722// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
723// int result= QMessageBox::warning(this,tr("OpiePlayer"),
724// tr("This is all ready in your playlist.\nContinue?"),
725// tr("Yes"),tr("No"),0,0,1);
726// if (result !=0)
727// return;
728// }
729// }
730// addToSelection( videoView->selectedItem() );
731 tabWidget->setCurrentPage(0);
714 } 732 }
715 break; 733 break;
716 }; 734 };
717} 735}
718 736
719void PlayListWidget::removeSelected() { 737void PlayListWidget::removeSelected() {
720 d->selectedFiles->removeSelected( ); 738 d->selectedFiles->removeSelected( );
721} 739}
722 740
723void PlayListWidget::playIt( QListViewItem *it) { 741void PlayListWidget::playIt( QListViewItem *it) {
724// d->setDocumentUsed = FALSE; 742// d->setDocumentUsed = FALSE;
725 mediaPlayerState->setPlaying(TRUE); 743 mediaPlayerState->setPlaying(TRUE);
726} 744}
727 745
728void PlayListWidget::addToSelection( QListViewItem *it) { 746void PlayListWidget::addToSelection( QListViewItem *it) {
729 d->setDocumentUsed = FALSE; 747 d->setDocumentUsed = FALSE;
730 748
731 if(it) { 749 if(it) {
732 switch (tabWidget->currentPageIndex()) { 750 switch (tabWidget->currentPageIndex()) {
733 case 1: { 751 case 1: {
734 QListIterator<DocLnk> dit( files.children() ); 752 QListIterator<DocLnk> dit( files.children() );
735 for ( ; dit.current(); ++dit ) { 753 for ( ; dit.current(); ++dit ) {
736 if( dit.current()->name() == it->text(0)) { 754 if( dit.current()->name() == it->text(0)) {
737 d->selectedFiles->addToSelection( **dit ); 755 d->selectedFiles->addToSelection( **dit );
738 } 756 }
739 } 757 }
740 } 758 }
741 break; 759 break;
742 case 2: { 760 case 2: {
743 QListIterator<DocLnk> dit( vFiles.children() ); 761 QListIterator<DocLnk> dit( vFiles.children() );
744 for ( ; dit.current(); ++dit ) { 762 for ( ; dit.current(); ++dit ) {
745 if( dit.current()->name() == it->text(0)) { 763 if( dit.current()->name() == it->text(0)) {
746 d->selectedFiles->addToSelection( **dit ); 764 d->selectedFiles->addToSelection( **dit );
747 } 765 }
748 } 766 }
749 } 767 }
750 break; 768 break;
751 case 0: 769 case 0:
752 break; 770 break;
753 }; 771 };
754 tabWidget->setCurrentPage(0); 772 tabWidget->setCurrentPage(0);
755 } 773 }
756} 774}
757 775
758void PlayListWidget::tabChanged(QWidget *widg) { 776void PlayListWidget::tabChanged(QWidget *widg) {
759 777
760 switch ( tabWidget->currentPageIndex()) { 778 switch ( tabWidget->currentPageIndex()) {
761 case 0: 779 case 0: