summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-10 15:26:11 (UTC)
committer llornkcor <llornkcor>2002-11-10 15:26:11 (UTC)
commit804e08f4642353af836bab921d8f732709051de0 (patch) (unidiff)
tree8e3ee2f1e519ef018a51cc32436ca24ff9d47da9
parent1486b6f940adde3cd80592e436e8e025045d7f8e (diff)
downloadopie-804e08f4642353af836bab921d8f732709051de0.zip
opie-804e08f4642353af836bab921d8f732709051de0.tar.gz
opie-804e08f4642353af836bab921d8f732709051de0.tar.bz2
no extras here either
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 75c7332..b15f95e 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -212,824 +212,826 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
212// writeCurrentM3u(); 212// writeCurrentM3u();
213 } 213 }
214 else 214 else
215 mediaPlayerState->setPlaying( TRUE ); 215 mediaPlayerState->setPlaying( TRUE );
216} 216}
217 217
218 218
219void PlayListWidget::clearList() { 219void PlayListWidget::clearList() {
220 while ( first() ) { 220 while ( first() ) {
221 d->selectedFiles->removeSelected(); 221 d->selectedFiles->removeSelected();
222 } 222 }
223} 223}
224 224
225void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 225void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
226 switch (mouse) { 226 switch (mouse) {
227 case 1: 227 case 1:
228 break; 228 break;
229 case 2: 229 case 2:
230 { 230 {
231 QPopupMenu m; 231 QPopupMenu m;
232 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 232 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
233 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 233 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
234 m.exec( QCursor::pos() ); 234 m.exec( QCursor::pos() );
235 } 235 }
236 break; 236 break;
237 } 237 }
238} 238}
239 239
240 240
241void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 241void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
242 switch (mouse) { 242 switch (mouse) {
243 case 1: 243 case 1:
244 break; 244 break;
245 case 2: 245 case 2:
246 { 246 {
247 QPopupMenu m; 247 QPopupMenu m;
248 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 248 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
249 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 249 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
250 m.exec( QCursor::pos() ); 250 m.exec( QCursor::pos() );
251 } 251 }
252 break; 252 break;
253 } 253 }
254} 254}
255 255
256 256
257void PlayListWidget::addAllToList() { 257void PlayListWidget::addAllToList() {
258 DocLnkSet filesAll; 258 DocLnkSet filesAll;
259 Global::findDocuments(&filesAll, "video/*;"+audioMimes); 259 Global::findDocuments(&filesAll, "video/*;"+audioMimes);
260 QListIterator<DocLnk> Adit( filesAll.children() ); 260 QListIterator<DocLnk> Adit( filesAll.children() );
261 for ( ; Adit.current(); ++Adit ) { 261 for ( ; Adit.current(); ++Adit ) {
262 if( QFileInfo( Adit.current()->file() ).exists() ) { 262 if( QFileInfo( Adit.current()->file() ).exists() ) {
263 d->selectedFiles->addToSelection( **Adit ); 263 d->selectedFiles->addToSelection( **Adit );
264 } 264 }
265 } 265 }
266 writeCurrentM3u(); 266 writeCurrentM3u();
267} 267}
268 268
269 269
270void PlayListWidget::addAllMusicToList() { 270void PlayListWidget::addAllMusicToList() {
271 if(!audioScan) 271 if(!audioScan)
272 scanForAudio(); 272 scanForAudio();
273 QListIterator<DocLnk> dit( files.children() ); 273 QListIterator<DocLnk> dit( files.children() );
274 for ( ; dit.current(); ++dit ) { 274 for ( ; dit.current(); ++dit ) {
275 if( QFileInfo(dit.current()->file() ).exists() ) { 275 if( QFileInfo(dit.current()->file() ).exists() ) {
276 d->selectedFiles->addToSelection( **dit ); 276 d->selectedFiles->addToSelection( **dit );
277 } 277 }
278 } 278 }
279 writeCurrentM3u(); 279 writeCurrentM3u();
280} 280}
281 281
282 282
283void PlayListWidget::addAllVideoToList() { 283void PlayListWidget::addAllVideoToList() {
284 if(!videoScan) 284 if(!videoScan)
285 scanForVideo(); 285 scanForVideo();
286 QListIterator<DocLnk> dit( vFiles.children() ); 286 QListIterator<DocLnk> dit( vFiles.children() );
287 for ( ; dit.current(); ++dit ) { 287 for ( ; dit.current(); ++dit ) {
288 if( QFileInfo( dit.current()->file() ).exists() ) { 288 if( QFileInfo( dit.current()->file() ).exists() ) {
289 d->selectedFiles->addToSelection( **dit ); 289 d->selectedFiles->addToSelection( **dit );
290 } 290 }
291 } 291 }
292 writeCurrentM3u(); 292 writeCurrentM3u();
293} 293}
294 294
295 295
296void PlayListWidget::setDocument( const QString& fileref ) { 296void PlayListWidget::setDocument( const QString& fileref ) {
297 qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 297 qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
298 fromSetDocument = TRUE; 298 fromSetDocument = TRUE;
299 if ( fileref.isNull() ) { 299 if ( fileref.isNull() ) {
300 QMessageBox::critical( 0, tr( "Invalid File" ), 300 QMessageBox::critical( 0, tr( "Invalid File" ),
301 tr( "There was a problem in getting the file." ) ); 301 tr( "There was a problem in getting the file." ) );
302 return; 302 return;
303 } 303 }
304 304
305 clearList(); 305 clearList();
306 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 306 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
307 readm3u( fileref ); 307 readm3u( fileref );
308 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 308 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
309 readm3u( DocLnk( fileref).file() ); 309 readm3u( DocLnk( fileref).file() );
310 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 310 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
311 readPls( fileref ); 311 readPls( fileref );
312 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 312 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
313 readPls( DocLnk( fileref).file() ); 313 readPls( DocLnk( fileref).file() );
314 } else { 314 } else {
315 clearList(); 315 clearList();
316 addToSelection( DocLnk( fileref ) ); 316 addToSelection( DocLnk( fileref ) );
317 writeCurrentM3u(); 317 writeCurrentM3u();
318 318
319 d->setDocumentUsed = TRUE; 319 d->setDocumentUsed = TRUE;
320 mediaPlayerState->setPlaying( FALSE ); 320 mediaPlayerState->setPlaying( FALSE );
321 mediaPlayerState->setPlaying( TRUE ); 321 mediaPlayerState->setPlaying( TRUE );
322 } 322 }
323} 323}
324 324
325 325
326void PlayListWidget::useSelectedDocument() { 326void PlayListWidget::useSelectedDocument() {
327 d->setDocumentUsed = FALSE; 327 d->setDocumentUsed = FALSE;
328} 328}
329 329
330 330
331const DocLnk *PlayListWidget::current() { // this is fugly 331const DocLnk *PlayListWidget::current() { // this is fugly
332 switch ( whichList() ) { 332 switch ( whichList() ) {
333 case 0: //playlist 333 case 0: //playlist
334 { 334 {
335// qDebug("playlist"); 335// qDebug("playlist");
336 if ( mediaPlayerState->playlist() ) { 336 if ( mediaPlayerState->playlist() ) {
337 return d->selectedFiles->current(); 337 return d->selectedFiles->current();
338 } else if ( d->setDocumentUsed && d->current ) { 338 } else if ( d->setDocumentUsed && d->current ) {
339 return d->current; 339 return d->current;
340 } else { 340 } else {
341 return &(d->files->selectedDocument()); 341 return &(d->files->selectedDocument());
342 } 342 }
343 } 343 }
344 break; 344 break;
345 }; 345 };
346 return 0; 346 return 0;
347} 347}
348 348
349 349
350bool PlayListWidget::prev() { 350bool PlayListWidget::prev() {
351 if ( mediaPlayerState->playlist() ) { 351 if ( mediaPlayerState->playlist() ) {
352 if ( mediaPlayerState->shuffled() ) { 352 if ( mediaPlayerState->shuffled() ) {
353 const DocLnk *cur = current(); 353 const DocLnk *cur = current();
354 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 354 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
355 for ( int i = 0; i < j; i++ ) { 355 for ( int i = 0; i < j; i++ ) {
356 if ( !d->selectedFiles->next() ) 356 if ( !d->selectedFiles->next() )
357 d->selectedFiles->first(); 357 d->selectedFiles->first();
358 } 358 }
359 if ( cur == current() ) 359 if ( cur == current() )
360 if ( !d->selectedFiles->next() ) { 360 if ( !d->selectedFiles->next() ) {
361 d->selectedFiles->first(); 361 d->selectedFiles->first();
362 } 362 }
363 return TRUE; 363 return TRUE;
364 } else { 364 } else {
365 if ( !d->selectedFiles->prev() ) { 365 if ( !d->selectedFiles->prev() ) {
366 if ( mediaPlayerState->looping() ) { 366 if ( mediaPlayerState->looping() ) {
367 return d->selectedFiles->last(); 367 return d->selectedFiles->last();
368 } else { 368 } else {
369 return FALSE; 369 return FALSE;
370 } 370 }
371 } 371 }
372 return TRUE; 372 return TRUE;
373 } 373 }
374 } else { 374 } else {
375 return mediaPlayerState->looping(); 375 return mediaPlayerState->looping();
376 } 376 }
377} 377}
378 378
379 379
380bool PlayListWidget::next() { 380bool PlayListWidget::next() {
381//qDebug("<<<<<<<<<<<<next()"); 381//qDebug("<<<<<<<<<<<<next()");
382 if ( mediaPlayerState->playlist() ) { 382 if ( mediaPlayerState->playlist() ) {
383 if ( mediaPlayerState->shuffled() ) { 383 if ( mediaPlayerState->shuffled() ) {
384 return prev(); 384 return prev();
385 } else { 385 } else {
386 if ( !d->selectedFiles->next() ) { 386 if ( !d->selectedFiles->next() ) {
387 if ( mediaPlayerState->looping() ) { 387 if ( mediaPlayerState->looping() ) {
388 return d->selectedFiles->first(); 388 return d->selectedFiles->first();
389 } else { 389 } else {
390 return FALSE; 390 return FALSE;
391 } 391 }
392 } 392 }
393 return TRUE; 393 return TRUE;
394 } 394 }
395 } else { 395 } else {
396 return mediaPlayerState->looping(); 396 return mediaPlayerState->looping();
397 } 397 }
398} 398}
399 399
400 400
401bool PlayListWidget::first() { 401bool PlayListWidget::first() {
402 if ( mediaPlayerState->playlist() ) 402 if ( mediaPlayerState->playlist() )
403 return d->selectedFiles->first(); 403 return d->selectedFiles->first();
404 else 404 else
405 return mediaPlayerState->looping(); 405 return mediaPlayerState->looping();
406} 406}
407 407
408 408
409bool PlayListWidget::last() { 409bool PlayListWidget::last() {
410 if ( mediaPlayerState->playlist() ) 410 if ( mediaPlayerState->playlist() )
411 return d->selectedFiles->last(); 411 return d->selectedFiles->last();
412 else 412 else
413 return mediaPlayerState->looping(); 413 return mediaPlayerState->looping();
414} 414}
415 415
416 416
417 void PlayListWidget::saveList() { 417 void PlayListWidget::saveList() {
418 writem3u(); 418 writem3u();
419 } 419 }
420 420
421 421
422void PlayListWidget::loadList( const DocLnk & lnk) { 422void PlayListWidget::loadList( const DocLnk & lnk) {
423 QString name = lnk.name(); 423 QString name = lnk.name();
424 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 424 qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
425 425
426 if( name.length()>0) { 426 if( name.length()>0) {
427 setCaption("OpiePlayer: "+name); 427 setCaption("OpiePlayer: "+name);
428 qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 428 qDebug("<<<<<<<<<<<<load list "+ lnk.file());
429 clearList(); 429 clearList();
430 readm3u(lnk.file()); 430 readm3u(lnk.file());
431 tabWidget->setCurrentPage(0); 431 tabWidget->setCurrentPage(0);
432 } 432 }
433} 433}
434 434
435 435
436void PlayListWidget::setPlaylist( bool shown ) { 436void PlayListWidget::setPlaylist( bool shown ) {
437 if ( shown ) { 437 if ( shown ) {
438 d->playListFrame->show(); 438 d->playListFrame->show();
439 } else { 439 } else {
440 d->playListFrame->hide(); 440 d->playListFrame->hide();
441 } 441 }
442} 442}
443 443
444 444
445void PlayListWidget::addSelected() { 445void PlayListWidget::addSelected() {
446 qDebug("addSelected"); 446 qDebug("addSelected");
447 switch (whichList()) { 447 switch (whichList()) {
448 case 0: //playlist 448 case 0: //playlist
449 break; 449 break;
450 case 1: { //audio 450 case 1: { //audio
451 QListViewItemIterator it( audioView ); 451 QListViewItemIterator it( audioView );
452 // iterate through all items of the listview 452 // iterate through all items of the listview
453 for ( ; it.current(); ++it ) { 453 for ( ; it.current(); ++it ) {
454 if ( it.current()->isSelected() ) { 454 if ( it.current()->isSelected() ) {
455 QListIterator<DocLnk> dit( files.children() ); 455 QListIterator<DocLnk> dit( files.children() );
456 for ( ; dit.current(); ++dit ) { 456 for ( ; dit.current(); ++dit ) {
457 if( dit.current()->name() == it.current()->text(0) ) { 457 if( dit.current()->name() == it.current()->text(0) ) {
458 if( QFileInfo( dit.current()->file()).exists()) { 458 if( QFileInfo( dit.current()->file()).exists()) {
459 d->selectedFiles->addToSelection( **dit ); 459 d->selectedFiles->addToSelection( **dit );
460 audioView->setSelected( it.current(),FALSE); 460 audioView->setSelected( it.current(),FALSE);
461 } 461 }
462 } 462 }
463 } 463 }
464 } 464 }
465 } 465 }
466// tabWidget->setCurrentPage(0); 466// tabWidget->setCurrentPage(0);
467 writeCurrentM3u(); 467 writeCurrentM3u();
468 d->selectedFiles->next();
468 } 469 }
469 break; 470 break;
470 case 2: { // video 471 case 2: { // video
471 QListViewItemIterator it( videoView ); 472 QListViewItemIterator it( videoView );
472 // iterate through all items of the listview 473 // iterate through all items of the listview
473 for ( ; it.current(); ++it ) { 474 for ( ; it.current(); ++it ) {
474 if ( it.current()->isSelected() ) { 475 if ( it.current()->isSelected() ) {
475 QListIterator<DocLnk> dit( vFiles.children() ); 476 QListIterator<DocLnk> dit( vFiles.children() );
476 for ( ; dit.current(); ++dit ) { 477 for ( ; dit.current(); ++dit ) {
477 if( dit.current()->name() == it.current()->text(0) ) { 478 if( dit.current()->name() == it.current()->text(0) ) {
478 if(QFileInfo( dit.current()->file()).exists()) { 479 if(QFileInfo( dit.current()->file()).exists()) {
479 d->selectedFiles->addToSelection( **dit ); 480 d->selectedFiles->addToSelection( **dit );
480 videoView->setSelected( it.current(),FALSE); 481 videoView->setSelected( it.current(),FALSE);
481 } 482 }
482 } 483 }
483 } 484 }
484 } 485 }
485 } 486 }
486// tabWidget->setCurrentPage(0); 487// tabWidget->setCurrentPage(0);
487 writeCurrentM3u(); 488 writeCurrentM3u();
489
488 } 490 }
489 break; 491 break;
490 }; 492 };
491} 493}
492 494
493 495
494void PlayListWidget::removeSelected() { 496void PlayListWidget::removeSelected() {
495 d->selectedFiles->removeSelected( ); 497 d->selectedFiles->removeSelected( );
496 writeCurrentM3u(); 498 writeCurrentM3u();
497} 499}
498 500
499 501
500void PlayListWidget::playIt( QListViewItem *it) { 502void PlayListWidget::playIt( QListViewItem *it) {
501 if(!it) return; 503 if(!it) return;
502 mediaPlayerState->setPlaying(FALSE); 504 mediaPlayerState->setPlaying(FALSE);
503 mediaPlayerState->setPlaying(TRUE); 505 mediaPlayerState->setPlaying(TRUE);
504 d->selectedFiles->unSelect(); 506 d->selectedFiles->unSelect();
505} 507}
506 508
507 509
508void PlayListWidget::addToSelection( QListViewItem *it) { 510void PlayListWidget::addToSelection( QListViewItem *it) {
509 d->setDocumentUsed = FALSE; 511 d->setDocumentUsed = FALSE;
510 512
511 if(it) { 513 if(it) {
512 switch ( whichList()) { 514 switch ( whichList()) {
513 case 1: { 515 case 1: {
514 QListIterator<DocLnk> dit( files.children() ); 516 QListIterator<DocLnk> dit( files.children() );
515 for ( ; dit.current(); ++dit ) { 517 for ( ; dit.current(); ++dit ) {
516 if( dit.current()->name() == it->text(0)) { 518 if( dit.current()->name() == it->text(0)) {
517 if(QFileInfo( dit.current()->file()).exists()) 519 if(QFileInfo( dit.current()->file()).exists())
518 d->selectedFiles->addToSelection( **dit ); 520 d->selectedFiles->addToSelection( **dit );
519 } 521 }
520 } 522 }
521 writeCurrentM3u(); 523 writeCurrentM3u();
522 } 524 }
523 break; 525 break;
524 case 2: { 526 case 2: {
525 QListIterator<DocLnk> dit( vFiles.children() ); 527 QListIterator<DocLnk> dit( vFiles.children() );
526 for ( ; dit.current(); ++dit ) { 528 for ( ; dit.current(); ++dit ) {
527 if( dit.current()->name() == it->text(0)) { 529 if( dit.current()->name() == it->text(0)) {
528 if( QFileInfo( dit.current()->file()).exists() ) 530 if( QFileInfo( dit.current()->file()).exists() )
529 d->selectedFiles->addToSelection( **dit ); 531 d->selectedFiles->addToSelection( **dit );
530 } 532 }
531 } 533 }
532 writeCurrentM3u(); 534 writeCurrentM3u();
533 535
534 } 536 }
535 break; 537 break;
536 case 0: 538 case 0:
537 break; 539 break;
538 }; 540 };
539 tabWidget->setCurrentPage(0); 541 tabWidget->setCurrentPage(0);
540 } 542 }
541} 543}
542 544
543 545
544void PlayListWidget::tabChanged(QWidget *) { 546void PlayListWidget::tabChanged(QWidget *) {
545 547
546 switch ( whichList()) { 548 switch ( whichList()) {
547 case 0: 549 case 0:
548 { 550 {
549 if( !tbDeletePlaylist->isHidden() ) { 551 if( !tbDeletePlaylist->isHidden() ) {
550 tbDeletePlaylist->hide(); 552 tbDeletePlaylist->hide();
551 } 553 }
552 d->tbRemoveFromList->setEnabled(TRUE); 554 d->tbRemoveFromList->setEnabled(TRUE);
553 d->tbAddToList->setEnabled(FALSE); 555 d->tbAddToList->setEnabled(FALSE);
554 } 556 }
555 break; 557 break;
556 case 1: 558 case 1:
557 { 559 {
558 audioView->clear(); 560 audioView->clear();
559 populateAudioView(); 561 populateAudioView();
560 562
561 if( !tbDeletePlaylist->isHidden() ) { 563 if( !tbDeletePlaylist->isHidden() ) {
562 tbDeletePlaylist->hide(); 564 tbDeletePlaylist->hide();
563 } 565 }
564 d->tbRemoveFromList->setEnabled(FALSE); 566 d->tbRemoveFromList->setEnabled(FALSE);
565 d->tbAddToList->setEnabled(TRUE); 567 d->tbAddToList->setEnabled(TRUE);
566 } 568 }
567 break; 569 break;
568 case 2: 570 case 2:
569 { 571 {
570 videoView->clear(); 572 videoView->clear();
571 populateVideoView(); 573 populateVideoView();
572 if( !tbDeletePlaylist->isHidden() ) { 574 if( !tbDeletePlaylist->isHidden() ) {
573 tbDeletePlaylist->hide(); 575 tbDeletePlaylist->hide();
574 } 576 }
575 d->tbRemoveFromList->setEnabled(FALSE); 577 d->tbRemoveFromList->setEnabled(FALSE);
576 d->tbAddToList->setEnabled(TRUE); 578 d->tbAddToList->setEnabled(TRUE);
577 } 579 }
578 break; 580 break;
579 case 3: 581 case 3:
580 { 582 {
581 if( tbDeletePlaylist->isHidden() ) { 583 if( tbDeletePlaylist->isHidden() ) {
582 tbDeletePlaylist->show(); 584 tbDeletePlaylist->show();
583 } 585 }
584 playLists->reread(); 586 playLists->reread();
585 } 587 }
586 break; 588 break;
587 }; 589 };
588} 590}
589 591
590 592
591void PlayListWidget::btnPlay(bool b) { 593void PlayListWidget::btnPlay(bool b) {
592// mediaPlayerState->setPlaying(false); 594// mediaPlayerState->setPlaying(false);
593 mediaPlayerState->setPlaying(b); 595 mediaPlayerState->setPlaying(b);
594 insanityBool=FALSE; 596 insanityBool=FALSE;
595} 597}
596 598
597void PlayListWidget::deletePlaylist() { 599void PlayListWidget::deletePlaylist() {
598 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 600 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
599 (tr("You really want to delete\nthis playlist?")), 601 (tr("You really want to delete\nthis playlist?")),
600 (tr("Yes")), (tr("No")), 0 )){ 602 (tr("Yes")), (tr("No")), 0 )){
601 case 0: // Yes clicked, 603 case 0: // Yes clicked,
602 QFile().remove(playLists->selectedDocument().file()); 604 QFile().remove(playLists->selectedDocument().file());
603 QFile().remove(playLists->selectedDocument().linkFile()); 605 QFile().remove(playLists->selectedDocument().linkFile());
604 playLists->reread(); 606 playLists->reread();
605 break; 607 break;
606 case 1: // Cancel 608 case 1: // Cancel
607 break; 609 break;
608 }; 610 };
609} 611}
610 612
611 613
612void PlayListWidget::playSelected() { 614void PlayListWidget::playSelected() {
613 btnPlay( TRUE); 615 btnPlay( TRUE);
614} 616}
615 617
616 618
617void PlayListWidget::scanForAudio() { 619void PlayListWidget::scanForAudio() {
618// qDebug("scan for audio"); 620// qDebug("scan for audio");
619 files.detachChildren(); 621 files.detachChildren();
620 QListIterator<DocLnk> sdit( files.children() ); 622 QListIterator<DocLnk> sdit( files.children() );
621 for ( ; sdit.current(); ++sdit ) { 623 for ( ; sdit.current(); ++sdit ) {
622 delete sdit.current(); 624 delete sdit.current();
623 } 625 }
624// Global::findDocuments( &files, "audio/*"); 626// Global::findDocuments( &files, "audio/*");
625 Global::findDocuments( &files, audioMimes); 627 Global::findDocuments( &files, audioMimes);
626 audioScan = TRUE; 628 audioScan = TRUE;
627} 629}
628 630
629void PlayListWidget::scanForVideo() { 631void PlayListWidget::scanForVideo() {
630// qDebug("scan for video"); 632// qDebug("scan for video");
631 vFiles.detachChildren(); 633 vFiles.detachChildren();
632 QListIterator<DocLnk> sdit( vFiles.children() ); 634 QListIterator<DocLnk> sdit( vFiles.children() );
633 for ( ; sdit.current(); ++sdit ) { 635 for ( ; sdit.current(); ++sdit ) {
634 delete sdit.current(); 636 delete sdit.current();
635 } 637 }
636 Global::findDocuments(&vFiles, "video/*"); 638 Global::findDocuments(&vFiles, "video/*");
637 videoScan = TRUE; 639 videoScan = TRUE;
638} 640}
639 641
640void PlayListWidget::populateAudioView() { 642void PlayListWidget::populateAudioView() {
641 audioView->clear(); 643 audioView->clear();
642 StorageInfo storageInfo; 644 StorageInfo storageInfo;
643 const QList<FileSystem> &fs = storageInfo.fileSystems(); 645 const QList<FileSystem> &fs = storageInfo.fileSystems();
644 if(!audioScan) { 646 if(!audioScan) {
645 scanForAudio(); 647 scanForAudio();
646 } 648 }
647 649
648 QListIterator<DocLnk> dit( files.children() ); 650 QListIterator<DocLnk> dit( files.children() );
649 QListIterator<FileSystem> it ( fs ); 651 QListIterator<FileSystem> it ( fs );
650 652
651 QString storage; 653 QString storage;
652 for ( ; dit.current(); ++dit ) { 654 for ( ; dit.current(); ++dit ) {
653 for( ; it.current(); ++it ){ 655 for( ; it.current(); ++it ){
654 const QString name = (*it)->name(); 656 const QString name = (*it)->name();
655 const QString path = (*it)->path(); 657 const QString path = (*it)->path();
656 if(dit.current()->file().find(path) != -1 ) { 658 if(dit.current()->file().find(path) != -1 ) {
657 storage = name; 659 storage = name;
658 } 660 }
659 } 661 }
660 662
661 QListViewItem * newItem; 663 QListViewItem * newItem;
662 if ( QFile( dit.current()->file()).exists() || 664 if ( QFile( dit.current()->file()).exists() ||
663 dit.current()->file().left(4) == "http" ) { 665 dit.current()->file().left(4) == "http" ) {
664 long size; 666 long size;
665 if( dit.current()->file().left(4) == "http" ) 667 if( dit.current()->file().left(4) == "http" )
666 size=0; 668 size=0;
667 else 669 else
668 size = QFile( dit.current()->file() ).size(); 670 size = QFile( dit.current()->file() ).size();
669 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 671 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
670 QString::number(size ), storage, dit.current()->file()); 672 QString::number(size ), storage, dit.current()->file());
671 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 673 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
672 } 674 }
673 } 675 }
674} 676}
675 677
676 678
677void PlayListWidget::populateVideoView() { 679void PlayListWidget::populateVideoView() {
678 videoView->clear(); 680 videoView->clear();
679 StorageInfo storageInfo; 681 StorageInfo storageInfo;
680 const QList<FileSystem> &fs = storageInfo.fileSystems(); 682 const QList<FileSystem> &fs = storageInfo.fileSystems();
681 683
682 if(!videoScan ) { 684 if(!videoScan ) {
683 scanForVideo(); 685 scanForVideo();
684 } 686 }
685 687
686 QListIterator<DocLnk> Vdit( vFiles.children() ); 688 QListIterator<DocLnk> Vdit( vFiles.children() );
687 QListIterator<FileSystem> it ( fs ); 689 QListIterator<FileSystem> it ( fs );
688 videoView->clear(); 690 videoView->clear();
689 QString storage, pathName; 691 QString storage, pathName;
690 for ( ; Vdit.current(); ++Vdit ) { 692 for ( ; Vdit.current(); ++Vdit ) {
691 for( ; it.current(); ++it ) { 693 for( ; it.current(); ++it ) {
692 const QString name = (*it)->name(); 694 const QString name = (*it)->name();
693 const QString path = (*it)->path(); 695 const QString path = (*it)->path();
694 if( Vdit.current()->file().find(path) != -1 ) { 696 if( Vdit.current()->file().find(path) != -1 ) {
695 storage=name; 697 storage=name;
696 pathName=path; 698 pathName=path;
697 } 699 }
698 } 700 }
699 701
700 QListViewItem * newItem; 702 QListViewItem * newItem;
701 if ( QFile( Vdit.current()->file() ).exists() ) { 703 if ( QFile( Vdit.current()->file() ).exists() ) {
702 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 704 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
703 QString::number( QFile( Vdit.current()->file() ).size() ), 705 QString::number( QFile( Vdit.current()->file() ).size() ),
704 storage, Vdit.current()->file()); 706 storage, Vdit.current()->file());
705 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 707 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
706 } 708 }
707 } 709 }
708} 710}
709 711
710 712
711void PlayListWidget::openFile() { 713void PlayListWidget::openFile() {
712 // http://66.28.164.33:2080 714 // http://66.28.164.33:2080
713 // http://somafm.com/star0242.m3u 715 // http://somafm.com/star0242.m3u
714 QString filename, name; 716 QString filename, name;
715 InputDialog *fileDlg; 717 InputDialog *fileDlg;
716 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 718 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
717 fileDlg->exec(); 719 fileDlg->exec();
718 if( fileDlg->result() == 1 ) { 720 if( fileDlg->result() == 1 ) {
719 filename = fileDlg->text(); 721 filename = fileDlg->text();
720 qDebug( "Selected filename is " + filename ); 722 qDebug( "Selected filename is " + filename );
721 Om3u *m3uList; 723 Om3u *m3uList;
722 DocLnk lnk; 724 DocLnk lnk;
723 Config cfg( "OpiePlayer" ); 725 Config cfg( "OpiePlayer" );
724 cfg.setGroup("PlayList"); 726 cfg.setGroup("PlayList");
725 727
726 if(filename.left(4) == "http") { 728 if(filename.left(4) == "http") {
727 QString m3uFile, m3uFilePath; 729 QString m3uFile, m3uFilePath;
728 if(filename.find(":",8,TRUE) != -1) { //found a port 730 if(filename.find(":",8,TRUE) != -1) { //found a port
729 m3uFile = filename.left( filename.find( ":",8,TRUE)); 731 m3uFile = filename.left( filename.find( ":",8,TRUE));
730 m3uFile = m3uFile.right( 7); 732 m3uFile = m3uFile.right( 7);
731 } else if(filename.left(4) == "http"){ 733 } else if(filename.left(4) == "http"){
732 m3uFile=filename; 734 m3uFile=filename;
733 m3uFile = m3uFile.right( m3uFile.length() - 7); 735 m3uFile = m3uFile.right( m3uFile.length() - 7);
734 } else{ 736 } else{
735 m3uFile=filename; 737 m3uFile=filename;
736 } 738 }
737 739
738// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 740// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
739 lnk.setName( filename ); //sets name 741 lnk.setName( filename ); //sets name
740 lnk.setFile( filename ); //sets file name 742 lnk.setFile( filename ); //sets file name
741 lnk.setIcon("opieplayer2/musicfile"); 743 lnk.setIcon("opieplayer2/musicfile");
742 d->selectedFiles->addToSelection( lnk ); 744 d->selectedFiles->addToSelection( lnk );
743 writeCurrentM3u(); 745 writeCurrentM3u();
744 } 746 }
745 else if( filename.right( 3) == "m3u" ) { 747 else if( filename.right( 3) == "m3u" ) {
746 readm3u( filename ); 748 readm3u( filename );
747 749
748 } else if( filename.right(3) == "pls" ) { 750 } else if( filename.right(3) == "pls" ) {
749 readPls( filename ); 751 readPls( filename );
750 } else { 752 } else {
751 d->selectedFiles->addToSelection( DocLnk(filename) ); 753 d->selectedFiles->addToSelection( DocLnk(filename) );
752 writeCurrentM3u(); 754 writeCurrentM3u();
753 } 755 }
754 } 756 }
755 757
756 if( fileDlg ) { 758 if( fileDlg ) {
757 delete fileDlg; 759 delete fileDlg;
758 } 760 }
759} 761}
760 762
761/* 763/*
762reads m3u and shows files/urls to playlist widget */ 764reads m3u and shows files/urls to playlist widget */
763void PlayListWidget::readm3u( const QString &filename ) { 765void PlayListWidget::readm3u( const QString &filename ) {
764 qDebug( "read m3u filename " + filename ); 766 qDebug( "read m3u filename " + filename );
765 767
766 Om3u *m3uList; 768 Om3u *m3uList;
767 QString s, name; 769 QString s, name;
768 m3uList = new Om3u( filename, IO_ReadOnly ); 770 m3uList = new Om3u( filename, IO_ReadOnly );
769 m3uList->readM3u(); 771 m3uList->readM3u();
770 DocLnk lnk; 772 DocLnk lnk;
771 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 773 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
772 s = *it; 774 s = *it;
773// qDebug("reading "+ s); 775// qDebug("reading "+ s);
774 if(s.left(4)=="http") { 776 if(s.left(4)=="http") {
775 lnk.setName( s ); //sets file name 777 lnk.setName( s ); //sets file name
776 lnk.setIcon("opieplayer2/musicfile"); 778 lnk.setIcon("opieplayer2/musicfile");
777 if(s.right(4) != '.' || s.right(5) != '.') 779// if(s.right(4) != '.' || s.right(5) != '.')
778 lnk.setFile( s+"/"); //if url with no extension 780// lnk.setFile( s+"/"); //if url with no extension
779 else 781// else
780 lnk.setFile( s ); //sets file name 782 lnk.setFile( s ); //sets file name
781 783
782 } else { 784 } else {
783 // if( QFileInfo( s ).exists() ) { 785 // if( QFileInfo( s ).exists() ) {
784 lnk.setName( QFileInfo(s).baseName()); 786 lnk.setName( QFileInfo(s).baseName());
785 // if(s.right(4) == '.') {//if regular file 787 // if(s.right(4) == '.') {//if regular file
786 if(s.left(1) != "/") { 788 if(s.left(1) != "/") {
787 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 789 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
788 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 790 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
789 lnk.setIcon("SoundPlayer"); 791 lnk.setIcon("SoundPlayer");
790 } else { 792 } else {
791 // qDebug("set link2 "+s); 793 // qDebug("set link2 "+s);
792 lnk.setFile( s); 794 lnk.setFile( s);
793 lnk.setIcon("SoundPlayer"); 795 lnk.setIcon("SoundPlayer");
794 } 796 }
795 } 797 }
796 d->selectedFiles->addToSelection( lnk ); 798 d->selectedFiles->addToSelection( lnk );
797 } 799 }
798 Config config( "OpiePlayer" ); 800 Config config( "OpiePlayer" );
799 config.setGroup( "PlayList" ); 801 config.setGroup( "PlayList" );
800 802
801 config.writeEntry("CurrentPlaylist",filename); 803 config.writeEntry("CurrentPlaylist",filename);
802 config.write(); 804 config.write();
803 currentPlayList=filename; 805 currentPlayList=filename;
804 806
805// m3uList->write(); 807// m3uList->write();
806 m3uList->close(); 808 m3uList->close();
807 if(m3uList) delete m3uList; 809 if(m3uList) delete m3uList;
808 810
809 d->selectedFiles->setSelectedItem( s); 811 d->selectedFiles->setSelectedItem( s);
810 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 812 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
811 813
812} 814}
813 815
814/* 816/*
815reads pls and adds files/urls to playlist */ 817reads pls and adds files/urls to playlist */
816void PlayListWidget::readPls( const QString &filename ) { 818void PlayListWidget::readPls( const QString &filename ) {
817 819
818 qDebug( "pls filename is " + filename ); 820 qDebug( "pls filename is " + filename );
819 Om3u *m3uList; 821 Om3u *m3uList;
820 QString s, name; 822 QString s, name;
821 m3uList = new Om3u( filename, IO_ReadOnly ); 823 m3uList = new Om3u( filename, IO_ReadOnly );
822 m3uList->readPls(); 824 m3uList->readPls();
823 825
824 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 826 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
825 s = *it; 827 s = *it;
826 // s.replace( QRegExp( "%20" )," " ); 828 // s.replace( QRegExp( "%20" )," " );
827 DocLnk lnk( s ); 829 DocLnk lnk( s );
828 QFileInfo f( s ); 830 QFileInfo f( s );
829 QString name = f.baseName(); 831 QString name = f.baseName();
830 832
831 if( name.left( 4 ) == "http" ) { 833 if( name.left( 4 ) == "http" ) {
832 name = s.right( s.length() - 7); 834 name = s.right( s.length() - 7);
833 } else { 835 } else {
834 name = s; 836 name = s;
835 } 837 }
836 838
837 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 839 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
838 840
839 lnk.setName( name ); 841 lnk.setName( name );
840 if( s.at( s.length() - 4) == '.') {// if this is probably a file 842 if( s.at( s.length() - 4) == '.') {// if this is probably a file
841 lnk.setFile( s ); 843 lnk.setFile( s );
842 } else { //if its a url 844 } else { //if its a url
843 if( name.right( 1 ).find( '/' ) == -1) { 845 if( name.right( 1 ).find( '/' ) == -1) {
844 s += "/"; 846 s += "/";
845 } 847 }
846 lnk.setFile( s ); 848 lnk.setFile( s );
847 } 849 }
848 lnk.setType( "audio/x-mpegurl" ); 850 lnk.setType( "audio/x-mpegurl" );
849 851
850 lnk.writeLink(); 852 lnk.writeLink();
851 d->selectedFiles->addToSelection( lnk ); 853 d->selectedFiles->addToSelection( lnk );
852 } 854 }
853 855
854 m3uList->close(); 856 m3uList->close();
855 if(m3uList) delete m3uList; 857 if(m3uList) delete m3uList;
856} 858}
857 859
858/* 860/*
859 writes current playlist to current m3u file */ 861 writes current playlist to current m3u file */
860void PlayListWidget::writeCurrentM3u() { 862void PlayListWidget::writeCurrentM3u() {
861 qDebug("writing to current m3u"); 863 qDebug("writing to current m3u");
862 Config cfg( "OpiePlayer" ); 864 Config cfg( "OpiePlayer" );
863 cfg.setGroup("PlayList"); 865 cfg.setGroup("PlayList");
864 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 866 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
865 867
866 if( d->selectedFiles->first()) { 868 if( d->selectedFiles->first()) {
867 Om3u *m3uList; 869 Om3u *m3uList;
868 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 870 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
869 871
870 do { 872 do {
871 qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); 873 qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file());
872 m3uList->add( d->selectedFiles->current()->file() ); 874 m3uList->add( d->selectedFiles->current()->file() );
873 } 875 }
874 while ( d->selectedFiles->next() ); 876 while ( d->selectedFiles->next() );
875 qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 877 qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
876 m3uList->write(); 878 m3uList->write();
877 m3uList->close(); 879 m3uList->close();
878 880
879 if(m3uList) delete m3uList; 881 if(m3uList) delete m3uList;
880 } 882 }
881} 883}
882 884
883 /* 885 /*
884 writes current playlist to m3u file */ 886 writes current playlist to m3u file */
885void PlayListWidget::writem3u() { 887void PlayListWidget::writem3u() {
886 InputDialog *fileDlg; 888 InputDialog *fileDlg;
887 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 889 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
888 fileDlg->exec(); 890 fileDlg->exec();
889 QString name, filename, list; 891 QString name, filename, list;
890 Om3u *m3uList; 892 Om3u *m3uList;
891 893
892 if( fileDlg->result() == 1 ) { 894 if( fileDlg->result() == 1 ) {
893 name = fileDlg->text(); 895 name = fileDlg->text();
894// qDebug( filename ); 896// qDebug( filename );
895 897
896 if( name.left( 1) != "/" ) { 898 if( name.left( 1) != "/" ) {
897 filename = QPEApplication::documentDir() + "/" + name; 899 filename = QPEApplication::documentDir() + "/" + name;
898 } 900 }
899 901
900 if( name.right( 3 ) != "m3u" ) { 902 if( name.right( 3 ) != "m3u" ) {
901 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 903 filename = QPEApplication::documentDir() + "/" +name+".m3u";
902 } 904 }
903 905
904 if( d->selectedFiles->first()) { 906 if( d->selectedFiles->first()) {
905 m3uList = new Om3u(filename, IO_ReadWrite); 907 m3uList = new Om3u(filename, IO_ReadWrite);
906 908
907 do { 909 do {
908 m3uList->add( d->selectedFiles->current()->file()); 910 m3uList->add( d->selectedFiles->current()->file());
909 } 911 }
910 while ( d->selectedFiles->next() ); 912 while ( d->selectedFiles->next() );
911 // qDebug( list ); 913 // qDebug( list );
912 m3uList->write(); 914 m3uList->write();
913 m3uList->close(); 915 m3uList->close();
914 if(m3uList) delete m3uList; 916 if(m3uList) delete m3uList;
915 917
916 if(fileDlg) delete fileDlg; 918 if(fileDlg) delete fileDlg;
917 919
918 DocLnk lnk; 920 DocLnk lnk;
919 lnk.setFile( filename); 921 lnk.setFile( filename);
920 lnk.setIcon("opieplayer2/playlist2"); 922 lnk.setIcon("opieplayer2/playlist2");
921 lnk.setName( name); //sets file name 923 lnk.setName( name); //sets file name
922 924
923 // qDebug(filename); 925 // qDebug(filename);
924 Config config( "OpiePlayer" ); 926 Config config( "OpiePlayer" );
925 config.setGroup( "PlayList" ); 927 config.setGroup( "PlayList" );
926 928
927 config.writeEntry("CurrentPlaylist",filename); 929 config.writeEntry("CurrentPlaylist",filename);
928 currentPlayList=filename; 930 currentPlayList=filename;
929 931
930 if(!lnk.writeLink()) { 932 if(!lnk.writeLink()) {
931 qDebug("Writing doclink did not work"); 933 qDebug("Writing doclink did not work");
932 } 934 }
933 935
934 setCaption(tr("OpiePlayer: ") + name); 936 setCaption(tr("OpiePlayer: ") + name);
935 } 937 }
936 } 938 }
937} 939}
938 940
939void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 941void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
940 switch ( e->key() ) { 942 switch ( e->key() ) {
941 ////////////////////////////// Zaurus keys 943 ////////////////////////////// Zaurus keys
942 case Key_F9: //activity 944 case Key_F9: //activity
943 // if(audioUI->isHidden()) 945 // if(audioUI->isHidden())
944 // audioUI->showMaximized(); 946 // audioUI->showMaximized();
945 break; 947 break;
946 case Key_F10: //contacts 948 case Key_F10: //contacts
947 // if( videoUI->isHidden()) 949 // if( videoUI->isHidden())
948 // videoUI->showMaximized(); 950 // videoUI->showMaximized();
949 break; 951 break;
950 case Key_F11: //menu 952 case Key_F11: //menu
951 break; 953 break;
952 case Key_F12: //home 954 case Key_F12: //home
953 // doBlank(); 955 // doBlank();
954 break; 956 break;
955 case Key_F13: //mail 957 case Key_F13: //mail
956 // doUnblank(); 958 // doUnblank();
957 break; 959 break;
958 case Key_Q: //add to playlist 960 case Key_Q: //add to playlist
959 addSelected(); 961 addSelected();
960 break; 962 break;
961 case Key_R: //remove from playlist 963 case Key_R: //remove from playlist
962 removeSelected(); 964 removeSelected();
963 break; 965 break;
964 // case Key_P: //play 966 // case Key_P: //play
965 // qDebug("Play"); 967 // qDebug("Play");
966 // playSelected(); 968 // playSelected();
967 // break; 969 // break;
968 case Key_Space: 970 case Key_Space:
969 // playSelected(); puh 971 // playSelected(); puh
970 break; 972 break;
971 case Key_1: 973 case Key_1:
972 tabWidget->setCurrentPage( 0 ); 974 tabWidget->setCurrentPage( 0 );
973 break; 975 break;
974 case Key_2: 976 case Key_2:
975 tabWidget->setCurrentPage( 1 ); 977 tabWidget->setCurrentPage( 1 );
976 break; 978 break;
977 case Key_3: 979 case Key_3:
978 tabWidget->setCurrentPage( 2 ); 980 tabWidget->setCurrentPage( 2 );
979 break; 981 break;
980 case Key_4: 982 case Key_4:
981 tabWidget->setCurrentPage( 3 ); 983 tabWidget->setCurrentPage( 3 );
982 break; 984 break;
983 case Key_Down: 985 case Key_Down:
984 if ( !d->selectedFiles->next() ) 986 if ( !d->selectedFiles->next() )
985 d->selectedFiles->first(); 987 d->selectedFiles->first();
986 break; 988 break;
987 case Key_Up: 989 case Key_Up:
988 if ( !d->selectedFiles->prev() ) 990 if ( !d->selectedFiles->prev() )
989 // d->selectedFiles->last(); 991 // d->selectedFiles->last();
990 break; 992 break;
991 } 993 }
992} 994}
993 995
994void PlayListWidget::pmViewActivated(int index) { 996void PlayListWidget::pmViewActivated(int index) {
995// qDebug("%d", index); 997// qDebug("%d", index);
996 switch(index) { 998 switch(index) {
997 case -16: 999 case -16:
998 { 1000 {
999 mediaPlayerState->toggleFullscreen(); 1001 mediaPlayerState->toggleFullscreen();
1000 bool b=mediaPlayerState->fullscreen(); 1002 bool b=mediaPlayerState->fullscreen();
1001 pmView->setItemChecked( index, b); 1003 pmView->setItemChecked( index, b);
1002 Config cfg( "OpiePlayer" ); 1004 Config cfg( "OpiePlayer" );
1003 cfg.writeEntry( "FullScreen", b ); 1005 cfg.writeEntry( "FullScreen", b );
1004 } 1006 }
1005 break; 1007 break;
1006 }; 1008 };
1007} 1009}
1008 1010
1009void PlayListWidget::populateSkinsMenu() { 1011void PlayListWidget::populateSkinsMenu() {
1010 int item = 0; 1012 int item = 0;
1011 defaultSkinIndex = 0; 1013 defaultSkinIndex = 0;
1012 QString skinName; 1014 QString skinName;
1013 Config cfg( "OpiePlayer" ); 1015 Config cfg( "OpiePlayer" );
1014 cfg.setGroup("Options" ); 1016 cfg.setGroup("Options" );
1015 QString skin = cfg.readEntry( "Skin", "default" ); 1017 QString skin = cfg.readEntry( "Skin", "default" );
1016 1018
1017 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1019 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1018 skinsDir.setFilter( QDir::Dirs ); 1020 skinsDir.setFilter( QDir::Dirs );
1019 skinsDir.setSorting(QDir::Name ); 1021 skinsDir.setSorting(QDir::Name );
1020 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1022 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1021 QFileInfoListIterator it( *skinslist ); 1023 QFileInfoListIterator it( *skinslist );
1022 QFileInfo *fi; 1024 QFileInfo *fi;
1023 while ( ( fi = it.current() ) ) { 1025 while ( ( fi = it.current() ) ) {
1024 skinName = fi->fileName(); 1026 skinName = fi->fileName();
1025// qDebug( fi->fileName() ); 1027// qDebug( fi->fileName() );
1026 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1028 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1027 item = skinsMenu->insertItem( fi->fileName() ) ; 1029 item = skinsMenu->insertItem( fi->fileName() ) ;
1028 } 1030 }
1029 if( skinName == "default" ) { 1031 if( skinName == "default" ) {
1030 defaultSkinIndex = item; 1032 defaultSkinIndex = item;
1031 } 1033 }
1032 if( skinName == skin ) { 1034 if( skinName == skin ) {
1033 skinsMenu->setItemChecked( item, TRUE ); 1035 skinsMenu->setItemChecked( item, TRUE );
1034 } 1036 }
1035 ++it; 1037 ++it;