summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 2bc7f45f0b..a9691f3a6a 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -456,6 +456,9 @@ int settings_save( void )
456 456
457 config_block[0xf4]=((unsigned char)global_settings.rec_prerecord_time | 457 config_block[0xf4]=((unsigned char)global_settings.rec_prerecord_time |
458 ((unsigned char)global_settings.rec_directory << 5)); 458 ((unsigned char)global_settings.rec_directory << 5));
459 config_block[0xf5] = (global_settings.talk_dir & 7) |
460 ((global_settings.talk_file & 3) << 3) |
461 ((global_settings.talk_menu & 1) << 5);
459 462
460 if(save_config_buffer()) 463 if(save_config_buffer())
461 { 464 {
@@ -793,6 +796,11 @@ void settings_load(void)
793 global_settings.rec_prerecord_time = config_block[0xf4] & 0x1f; 796 global_settings.rec_prerecord_time = config_block[0xf4] & 0x1f;
794 global_settings.rec_directory = (config_block[0xf4] >> 5) & 3; 797 global_settings.rec_directory = (config_block[0xf4] >> 5) & 3;
795 } 798 }
799 if (config_block[0xf5] != 0xff) {
800 global_settings.talk_dir = config_block[0xf5] & 7;
801 global_settings.talk_file = (config_block[0xf5] >> 3) & 3;
802 global_settings.talk_menu = (config_block[0xf5] >> 5) & 1;
803 }
796 804
797#ifdef HAVE_LCD_CHARCELLS 805#ifdef HAVE_LCD_CHARCELLS
798 if (config_block[0xa8] != 0xff) 806 if (config_block[0xa8] != 0xff)
@@ -1193,6 +1201,20 @@ bool settings_load_config(char* file)
1193 set_cfg_option(&global_settings.playlist_viewer_track_display, 1201 set_cfg_option(&global_settings.playlist_viewer_track_display,
1194 value, options, 2); 1202 value, options, 2);
1195 } 1203 }
1204 else if (!strcasecmp(name, "talk dir"))
1205 {
1206 static char* options[] = {"off", "number", "enter", "hover"};
1207 set_cfg_option(&global_settings.talk_dir, value, options, 4);
1208 }
1209 else if (!strcasecmp(name, "talk file"))
1210 {
1211 static char* options[] = {"off", "number"};
1212 set_cfg_option(&global_settings.talk_dir, value, options, 2);
1213 }
1214 else if (!strcasecmp(name, "talk menu"))
1215 {
1216 set_cfg_bool(&global_settings.talk_menu, value);
1217 }
1196 } 1218 }
1197 1219
1198 close(fd); 1220 close(fd);
@@ -1539,6 +1561,16 @@ bool settings_save_config(void)
1539 options[global_settings.playlist_viewer_track_display]); 1561 options[global_settings.playlist_viewer_track_display]);
1540 } 1562 }
1541 } 1563 }
1564 fprintf(fd, "#\r\n# Voice\r\n#\r\n");
1565 {
1566 static char* options[] = {"off", "number", "enter", "hover"};
1567 fprintf(fd, "talk dir: %s\r\n",
1568 options[global_settings.talk_dir]);
1569 fprintf(fd, "talk file: %s\r\n", /* recycle the options, */
1570 options[global_settings.talk_file]); /* first 2 are alike */
1571 fprintf(fd, "talk menu: %s\r\n",
1572 boolopt[global_settings.talk_menu]);
1573 }
1542 1574
1543 close(fd); 1575 close(fd);
1544 1576
@@ -1646,6 +1678,10 @@ void settings_reset(void) {
1646 global_settings.playlist_viewer_icons = true; 1678 global_settings.playlist_viewer_icons = true;
1647 global_settings.playlist_viewer_indices = true; 1679 global_settings.playlist_viewer_indices = true;
1648 global_settings.playlist_viewer_track_display = 0; 1680 global_settings.playlist_viewer_track_display = 0;
1681 /* talking menu on by default, to help the blind (if voice file present) */
1682 global_settings.talk_menu = 1;
1683 global_settings.talk_dir = 0;
1684 global_settings.talk_file = 0;
1649} 1685}
1650 1686
1651bool set_bool(char* string, bool* variable ) 1687bool set_bool(char* string, bool* variable )
@@ -1713,7 +1749,7 @@ bool set_int(char* string,
1713#endif 1749#endif
1714 lcd_update(); 1750 lcd_update();
1715 1751
1716 if (*variable != last_value) 1752 if (global_settings.talk_menu && *variable != last_value)
1717 { 1753 {
1718 if (voice_unit < UNIT_LAST) 1754 if (voice_unit < UNIT_LAST)
1719 { /* use the available unit definition */ 1755 { /* use the available unit definition */
@@ -1829,7 +1865,7 @@ bool set_option(char* string, void* variable, enum optiontype type,
1829 while ( !done ) { 1865 while ( !done ) {
1830 index = type==INT ? *intvar : (int)*boolvar; 1866 index = type==INT ? *intvar : (int)*boolvar;
1831 lcd_puts(0, 1, options[index].string); 1867 lcd_puts(0, 1, options[index].string);
1832 if (index != oldindex) 1868 if (global_settings.talk_menu && index != oldindex)
1833 { 1869 {
1834 talk_id(options[index].voice_id, false); 1870 talk_id(options[index].voice_id, false);
1835 oldindex = index; 1871 oldindex = index;