summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c88
1 files changed, 71 insertions, 17 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 03de011255..37a791c13c 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -452,6 +452,36 @@ static int showdir(char *path, int start)
452 return filesindir; 452 return filesindir;
453} 453}
454 454
455static void show_queue_display(int queue_count, char *filename)
456{
457#ifdef HAVE_LCD_CHARCELLS
458 lcd_double_height(false);
459#endif
460
461#ifdef HAVE_LCD_BITMAP
462 lcd_setmargins(0,0);
463#endif
464
465 lcd_clear_display();
466 if (queue_count > 0)
467 {
468 char s[32];
469
470 snprintf(s, sizeof(s), str(LANG_QUEUE_QUEUED), filename);
471 lcd_puts(0,0,s);
472
473 snprintf(s, sizeof(s), str(LANG_QUEUE_TOTAL), queue_count);
474 lcd_puts(0,1,s);
475 }
476 else
477 {
478 lcd_puts(0,0,str(LANG_QUEUE_FULL));
479 }
480 lcd_update();
481 sleep(HZ);
482 lcd_clear_display();
483}
484
455bool ask_resume(void) 485bool ask_resume(void)
456{ 486{
457#ifdef HAVE_LCD_CHARCELLS 487#ifdef HAVE_LCD_CHARCELLS
@@ -518,7 +548,9 @@ void start_resume(void)
518 true, /* the index is AFTER shuffle */ 548 true, /* the index is AFTER shuffle */
519 global_settings.resume_offset, 549 global_settings.resume_offset,
520 global_settings.resume_seed, 550 global_settings.resume_seed,
521 global_settings.resume_first_index); 551 global_settings.resume_first_index,
552 global_settings.queue_resume,
553 global_settings.queue_resume_index);
522 *slash='/'; 554 *slash='/';
523 } 555 }
524 else { 556 else {
@@ -537,7 +569,9 @@ void start_resume(void)
537 true, 569 true,
538 global_settings.resume_offset, 570 global_settings.resume_offset,
539 global_settings.resume_seed, 571 global_settings.resume_seed,
540 global_settings.resume_first_index); 572 global_settings.resume_first_index,
573 global_settings.queue_resume,
574 global_settings.queue_resume_index);
541 } 575 }
542 } 576 }
543 else { 577 else {
@@ -556,7 +590,9 @@ void start_resume(void)
556 true, 590 true,
557 global_settings.resume_offset, 591 global_settings.resume_offset,
558 global_settings.resume_seed, 592 global_settings.resume_seed,
559 global_settings.resume_first_index); 593 global_settings.resume_first_index,
594 global_settings.queue_resume,
595 global_settings.queue_resume_index);
560 } 596 }
561 597
562 status_set_playmode(STATUS_PLAY); 598 status_set_playmode(STATUS_PLAY);
@@ -774,10 +810,10 @@ bool dirbrowse(char *root)
774 break; 810 break;
775 811
776 812
777 case TREE_ENTER: 813 case TREE_ENTER | BUTTON_REL:
778 case TREE_ENTER | BUTTON_REPEAT: 814 case TREE_ENTER | BUTTON_REPEAT:
779#ifdef HAVE_RECORDER_KEYPAD 815#ifdef HAVE_RECORDER_KEYPAD
780 case BUTTON_PLAY: 816 case BUTTON_PLAY | BUTTON_REL:
781 case BUTTON_PLAY | BUTTON_REPEAT: 817 case BUTTON_PLAY | BUTTON_REPEAT:
782#endif 818#endif
783 if ( !numentries ) 819 if ( !numentries )
@@ -798,6 +834,7 @@ bool dirbrowse(char *root)
798 dircursor=0; 834 dircursor=0;
799 dirstart=0; 835 dirstart=0;
800 } else { 836 } else {
837 static int repeat_count = 0;
801 int seed = current_tick; 838 int seed = current_tick;
802 bool play = false; 839 bool play = false;
803 int start_index=0; 840 int start_index=0;
@@ -810,23 +847,40 @@ bool dirbrowse(char *root)
810 MAX_PATH, "%s/%s", 847 MAX_PATH, "%s/%s",
811 currdir, file->name); 848 currdir, file->name);
812 play_list(currdir, file->name, 0, false, 0, 849 play_list(currdir, file->name, 0, false, 0,
813 seed, 0); 850 seed, 0, 0, -1);
814 start_index = 0; 851 start_index = 0;
815 play = true; 852 play = true;
816 break; 853 break;
817 854
818 case TREE_ATTR_MPA: 855 case TREE_ATTR_MPA:
819 if ( global_settings.resume ) 856 if (button & BUTTON_REPEAT &&
820 strncpy(global_settings.resume_file, 857 mpeg_status() & MPEG_STATUS_PLAY)
821 currdir, MAX_PATH); 858 {
822 start_index = build_playlist(dircursor+dirstart); 859 int queue_count = queue_add(buf);
823 860 show_queue_display(queue_count,
824 /* it is important that we get back the index in 861 file->name);
825 the (shuffled) list and stor that */ 862
826 start_index = play_list(currdir, NULL, 863 while( !(button_get(true) & BUTTON_REL) ) ;
827 start_index, false, 864
828 0, seed, 0); 865 repeat_count = 0;
829 play = true; 866 restore = true;
867 }
868 else
869 {
870 repeat_count = 0;
871 if ( global_settings.resume )
872 strncpy(global_settings.resume_file,
873 currdir, MAX_PATH);
874 start_index =
875 build_playlist(dircursor+dirstart);
876
877 /* it is important that we get back the index
878 in the (shuffled) list and store that */
879 start_index = play_list(currdir, NULL,
880 start_index, false,
881 0, seed, 0, 0, -1);
882 play = true;
883 }
830 break; 884 break;
831 885
832 /* wps config file */ 886 /* wps config file */