summaryrefslogtreecommitdiff
path: root/apps/settings_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings_list.c')
-rw-r--r--apps/settings_list.c140
1 files changed, 95 insertions, 45 deletions
diff --git a/apps/settings_list.c b/apps/settings_list.c
index b43276775b..c40cf09b2e 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -20,6 +20,7 @@
20#include "config.h" 20#include "config.h"
21#include <stdbool.h> 21#include <stdbool.h>
22#include <string.h> 22#include <string.h>
23#include "ata.h"
23#include "lang.h" 24#include "lang.h"
24#include "talk.h" 25#include "talk.h"
25#include "lcd.h" 26#include "lcd.h"
@@ -31,6 +32,7 @@
31#include "mpeg.h" 32#include "mpeg.h"
32#include "audio.h" 33#include "audio.h"
33#include "power.h" 34#include "power.h"
35#include "powermgmt.h"
34 36
35/* some sets of values which are used more than once, to save memory */ 37/* some sets of values which are used more than once, to save memory */
36static const char off_on[] = "off,on"; 38static const char off_on[] = "off,on";
@@ -107,7 +109,23 @@ static void scanaccel_formatter(char *buffer, int buffer_size,
107 else 109 else
108 snprintf(buffer, buffer_size, "2x/%ds", val); 110 snprintf(buffer, buffer_size, "2x/%ds", val);
109} 111}
110 112
113static int poweroff_idle_timer_times[] = {0,1,2,3,4,5,6,7,8,9,10,15,30,45,60};
114static long poweroff_idle_timer_getlang(int value)
115{
116 if (value == 0)
117 return LANG_OFF;
118 return TALK_ID(poweroff_idle_timer_times[value], UNIT_MIN);
119}
120static void poweroff_idle_timer_formatter(char *buffer, int buffer_size,
121 int val, const char *unit)
122{
123 (void)unit;
124 if (val == 0)
125 strcpy(buffer, str(LANG_OFF));
126 else
127 snprintf(buffer, buffer_size, "%dm", poweroff_idle_timer_times[val]);
128}
111 129
112#define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT) 130#define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT)
113/** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h 131/** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h
@@ -316,32 +334,43 @@ const struct settings_list settings[] = {
316 "volume display",graphic_numeric,UNUSED}, 334 "volume display",graphic_numeric,UNUSED},
317 {F_T_INT,&global_settings.battery_display, LANG_BATTERY_DISPLAY, INT(0), 335 {F_T_INT,&global_settings.battery_display, LANG_BATTERY_DISPLAY, INT(0),
318 "battery display",graphic_numeric,UNUSED}, 336 "battery display",graphic_numeric,UNUSED},
319 {F_T_INT,&global_settings.timeformat, LANG_TIMEFORMAT, INT(0), 337 CHOICE_SETTING(0, timeformat, LANG_TIMEFORMAT, 0,
320 "time format","24hour,12hour",UNUSED}, 338 "time format", "24hour,12hour", NULL, 2,
339 ID2P(LANG_24_HOUR_CLOCK), ID2P(LANG_12_HOUR_CLOCK)),
321#endif /* HAVE_LCD_BITMAP */ 340#endif /* HAVE_LCD_BITMAP */
322 OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL), 341 OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL),
323 /* system */ 342 /* system */
324 {F_T_INT,&global_settings.poweroff,LANG_POWEROFF_IDLE, INT(10),"idle poweroff", 343 INT_SETTING_W_CFGVALS(0, poweroff, LANG_POWEROFF_IDLE, 10, "idle poweroff",
325 "off,1,2,3,4,5,6,7,8,9,10,15,30,45,60",UNUSED}, 344 "off,1,2,3,4,5,6,7,8,9,10,15,30,45,60", UNIT_MIN,
345 0, 14, 1, poweroff_idle_timer_formatter,
346 poweroff_idle_timer_getlang, set_poweroff_timeout),
326 SYSTEM_SETTING(NVRAM(4),runtime,0), 347 SYSTEM_SETTING(NVRAM(4),runtime,0),
327 SYSTEM_SETTING(NVRAM(4),topruntime,0), 348 SYSTEM_SETTING(NVRAM(4),topruntime,0),
349
350 INT_SETTING(0,max_files_in_playlist,LANG_MAX_FILES_IN_PLAYLIST,
351#if MEM > 1
352 10000,
353#else
354 400,
355#endif
356 "max files in playlist", UNIT_INT,1000,20000,1000,NULL,NULL,NULL),
357 INT_SETTING(0,max_files_in_dir,LANG_MAX_FILES_IN_DIR,
328#if MEM > 1 358#if MEM > 1
329 INT_SETTING(0,max_files_in_playlist,LANG_MAX_FILES_IN_PLAYLIST,10000, 359 1000,
330 "max files in playlist", UNIT_INT,1000,20000,1000,NULL,NULL,NULL),
331 {F_T_INT,&global_settings.max_files_in_dir,LANG_MAX_FILES_IN_DIR,
332 INT(400),"max files in dir",NULL,UNUSED},
333#else 360#else
334 {F_T_INT,&global_settings.max_files_in_playlist,LANG_MAX_FILES_IN_PLAYLIST, 361 200,
335 INT(1000),"max files in playlist",NULL,UNUSED}, 362#endif
336 {F_T_INT,&global_settings.max_files_in_dir,LANG_MAX_FILES_IN_DIR, 363 "max files in dir", UNIT_INT,50,10000,50,NULL,NULL,NULL),
337 INT(200),"max files in dir",NULL,UNUSED}, 364#ifndef SIMULATOR
338#endif 365
339 {F_T_INT,&global_settings.battery_capacity,LANG_BATTERY_CAPACITY, 366 INT_SETTING(0, battery_capacity, LANG_BATTERY_CAPACITY, BATTERY_CAPACITY_DEFAULT,
340 INT(BATTERY_CAPACITY_DEFAULT), 367 "battery capacity", UNIT_MAH,
341 "battery capacity",NULL,UNUSED}, 368 BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, BATTERY_CAPACITY_INC,
369 NULL, NULL, NULL),
370#endif
342#ifdef CONFIG_CHARGING 371#ifdef CONFIG_CHARGING
343 OFFON_SETTING(NVRAM(1), car_adapter_mode, 372 OFFON_SETTING(NVRAM(1), car_adapter_mode,
344 LANG_CAR_ADAPTER_MODE,false,"car adapter mode", NULL), 373 LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
345#endif 374#endif
346 /* tuner */ 375 /* tuner */
347#ifdef CONFIG_TUNER 376#ifdef CONFIG_TUNER
@@ -351,8 +380,9 @@ const struct settings_list settings[] = {
351#endif 380#endif
352 381
353#if BATTERY_TYPES_COUNT > 1 382#if BATTERY_TYPES_COUNT > 1
354 {F_T_INT,&global_settings.battery_type, LANG_BATTERY_TYPE, INT(0), 383 CHOICE_SETTING(0, battery_type, LANG_BATTERY_TYPE, 0,
355 "battery type","alkaline,nimh",UNUSED}, 384 "battery type","alkaline,nimh", NULL, 2,
385 ID2P(LANG_BATTERY_TYPE_ALKALINE), ID2P(LANG_BATTERY_TYPE_NIMH)),
356#endif 386#endif
357#ifdef HAVE_REMOTE_LCD 387#ifdef HAVE_REMOTE_LCD
358 /* remote lcd */ 388 /* remote lcd */
@@ -461,20 +491,26 @@ const struct settings_list settings[] = {
461 TALK_ID(30, UNIT_SEC), TALK_ID(1, UNIT_MIN), TALK_ID(2, UNIT_MIN), 491 TALK_ID(30, UNIT_SEC), TALK_ID(1, UNIT_MIN), TALK_ID(2, UNIT_MIN),
462 TALK_ID(3, UNIT_MIN), TALK_ID(5, UNIT_MIN), TALK_ID(10, UNIT_MIN)), 492 TALK_ID(3, UNIT_MIN), TALK_ID(5, UNIT_MIN), TALK_ID(10, UNIT_MIN)),
463#else 493#else
464 INT_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0, "antiskip", \ 494 INT_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0, "antiskip",
465 UNIT_SEC, 0, 7, 1, NULL, NULL, audio_set_buffer_margin), 495 UNIT_SEC, 0, 7, 1, NULL, NULL, audio_set_buffer_margin),
466#endif 496#endif
467 /* disk */ 497 /* disk */
468#ifndef HAVE_MMC 498#ifndef HAVE_MMC
499 INT_SETTING(0, disk_spindown, LANG_SPINDOWN, 5, "disk spindown",
500 UNIT_SEC, 3, 254, 1, NULL, NULL, ata_spindown),
469 {F_T_INT,&global_settings.disk_spindown,LANG_SPINDOWN,INT(5),"disk spindown",NULL,UNUSED}, 501 {F_T_INT,&global_settings.disk_spindown,LANG_SPINDOWN,INT(5),"disk spindown",NULL,UNUSED},
470#endif /* HAVE_MMC */ 502#endif /* HAVE_MMC */
471 /* browser */ 503 /* browser */
472 {F_T_INT,&global_settings.dirfilter,LANG_FILTER,INT(SHOW_SUPPORTED),"show files", 504 CHOICE_SETTING(0, dirfilter, LANG_FILTER, SHOW_SUPPORTED, "show files",
473 "all,supported,music,playlists" 505#ifndef HAVE_TAGCACHE
474#ifdef HAVE_TAGCACHE 506 "all,supported,music,playlists", NULL, 4, ID2P(LANG_FILTER_ALL),
475 ",id3 database" 507 ID2P(LANG_FILTER_SUPPORTED), ID2P(LANG_FILTER_MUSIC), ID2P(LANG_FILTER_PLAYLIST)
508#else
509 "all,supported,music,playlists,id3 database", NULL, 5, ID2P(LANG_FILTER_ALL),
510 ID2P(LANG_FILTER_SUPPORTED), ID2P(LANG_FILTER_MUSIC),
511 ID2P(LANG_FILTER_PLAYLIST), ID2P(LANG_FILTER_ID3DB)
476#endif 512#endif
477 ,UNUSED}, 513 ),
478 OFFON_SETTING(0,sort_case,LANG_SORT_CASE,false,"sort case",NULL), 514 OFFON_SETTING(0,sort_case,LANG_SORT_CASE,false,"sort case",NULL),
479 OFFON_SETTING(0,browse_current,LANG_FOLLOW,false,"follow playlist",NULL), 515 OFFON_SETTING(0,browse_current,LANG_FOLLOW,false,"follow playlist",NULL),
480 OFFON_SETTING(0,playlist_viewer_icons,LANG_SHOW_ICONS,true, 516 OFFON_SETTING(0,playlist_viewer_icons,LANG_SHOW_ICONS,true,
@@ -487,14 +523,19 @@ const struct settings_list settings[] = {
487 "recursive directory insert", off_on_ask, NULL , 3 , 523 "recursive directory insert", off_on_ask, NULL , 3 ,
488 ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_RESUME_SETTING_ASK)), 524 ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_RESUME_SETTING_ASK)),
489 /* bookmarks */ 525 /* bookmarks */
490 {F_T_INT,&global_settings.autocreatebookmark,LANG_BOOKMARK_SETTINGS_AUTOCREATE, 526 CHOICE_SETTING(0, autocreatebookmark, LANG_BOOKMARK_SETTINGS_AUTOCREATE,
491 INT(BOOKMARK_NO),"autocreate bookmarks", 527 BOOKMARK_NO, "autocreate bookmarks",
492 "off,on,ask,recent only - on,recent only - ask",UNUSED}, 528 "off,on,ask,recent only - on,recent only - ask", NULL, 5,
493 {F_T_INT,&global_settings.autoloadbookmark,LANG_BOOKMARK_SETTINGS_AUTOLOAD, 529 ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES),
494 INT(BOOKMARK_NO), "autoload bookmarks",off_on_ask,UNUSED}, 530 ID2P(LANG_RESUME_SETTING_ASK), ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES),
495 {F_T_INT,&global_settings.usemrb,LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS, 531 ID2P(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK)),
496 INT(BOOKMARK_NO), 532 CHOICE_SETTING(0, autoloadbookmark, LANG_BOOKMARK_SETTINGS_AUTOLOAD,
497 "use most-recent-bookmarks","off,on,unique only",UNUSED}, 533 BOOKMARK_NO, "autoload bookmarks", off_on_ask, NULL, 3,
534 ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES), ID2P(LANG_RESUME_SETTING_ASK)),
535 CHOICE_SETTING(0, usemrb, LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS,
536 BOOKMARK_NO, "use most-recent-bookmarks", "off,on,unique only", NULL, 3,
537 ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES),
538 ID2P(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY)),
498#ifdef HAVE_LCD_BITMAP 539#ifdef HAVE_LCD_BITMAP
499 /* peak meter */ 540 /* peak meter */
500 {F_T_INT, &global_settings.peak_meter_clip_hold, LANG_PM_CLIP_HOLD, 541 {F_T_INT, &global_settings.peak_meter_clip_hold, LANG_PM_CLIP_HOLD,
@@ -526,17 +567,25 @@ const struct settings_list settings[] = {
526 OFFON_SETTING(0,line_in,LANG_LINE_IN,false,"line in",NULL), 567 OFFON_SETTING(0,line_in,LANG_LINE_IN,false,"line in",NULL),
527#endif 568#endif
528 /* voice */ 569 /* voice */
529 {F_T_INT,&global_settings.talk_dir,LANG_VOICE_DIR,INT(0), 570 CHOICE_SETTING(0, talk_dir, LANG_VOICE_DIR, 0,
530 "talk dir",off_number_spell_hover,UNUSED}, 571 "talk dir", off_number_spell_hover, NULL, 4,
531 {F_T_INT,&global_settings.talk_file,LANG_VOICE_FILE,INT(0), 572 ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
532 "talk file",off_number_spell_hover,UNUSED}, 573 ID2P(LANG_VOICE_SPELL), ID2P(LANG_VOICE_DIR_HOVER)),
533 OFFON_SETTING(0,talk_menu,LANG_VOICE_MENU,true,"talk menu",NULL), 574 CHOICE_SETTING(0, talk_file, LANG_VOICE_FILE, 0,
575 "talk file", off_number_spell_hover, NULL, 4,
576 ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
577 ID2P(LANG_VOICE_SPELL), ID2P(LANG_VOICE_DIR_HOVER)),
578 OFFON_SETTING(F_TEMPVAR, talk_menu, LANG_VOICE_MENU, true, "talk menu", NULL),
534 579
535 /* file sorting */ 580 /* file sorting */
536 {F_T_INT,&global_settings.sort_file,LANG_SORT_FILE,INT(0), 581 CHOICE_SETTING(0, sort_file, LANG_SORT_FILE, 0 ,
537 "sort files","alpha,oldest,newest,type",UNUSED}, 582 "sort files", "alpha,oldest,newest,type", NULL, 4,
538 {F_T_INT,&global_settings.sort_dir,LANG_SORT_DIR,INT(0), 583 ID2P(LANG_SORT_ALPHA), ID2P(LANG_SORT_DATE),
539 "sort dirs","alpha,oldest,newest",UNUSED}, 584 ID2P(LANG_SORT_DATE_REVERSE) , ID2P(LANG_SORT_TYPE)),
585 CHOICE_SETTING(0, sort_dir, LANG_SORT_DIR, 0 ,
586 "sort dirs", "alpha,oldest,newest", NULL, 3,
587 ID2P(LANG_SORT_ALPHA), ID2P(LANG_SORT_DATE),
588 ID2P(LANG_SORT_DATE_REVERSE)),
540 BOOL_SETTING(0, id3_v1_first, LANG_ID3_ORDER, false, 589 BOOL_SETTING(0, id3_v1_first, LANG_ID3_ORDER, false,
541 "id3 tag priority", "v2-v1,v1-v2", 590 "id3 tag priority", "v2-v1,v1-v2",
542 LANG_ID3_V2_FIRST, LANG_ID3_V1_FIRST, mpeg_id3_options), 591 LANG_ID3_V2_FIRST, LANG_ID3_V1_FIRST, mpeg_id3_options),
@@ -798,8 +847,9 @@ const struct settings_list settings[] = {
798 847
799 OFFON_SETTING(0,hold_lr_for_scroll_in_list,-1,true, 848 OFFON_SETTING(0,hold_lr_for_scroll_in_list,-1,true,
800 "hold_lr_for_scroll_in_list",NULL), 849 "hold_lr_for_scroll_in_list",NULL),
801 {F_T_INT,&global_settings.show_path_in_browser,LANG_SHOW_PATH,INT(SHOW_PATH_OFF), 850 CHOICE_SETTING(0, show_path_in_browser, LANG_SHOW_PATH, SHOW_PATH_OFF,
802 "show path in browser","off,current directory,full path",UNUSED}, 851 "show path in browser", "off,current directory,full path", NULL, 3,
852 ID2P(LANG_OFF), ID2P(LANG_SHOW_PATH_CURRENT), ID2P(LANG_SHOW_PATH_FULL)),
803 853
804#ifdef HAVE_AGC 854#ifdef HAVE_AGC
805 {F_T_INT,&global_settings.rec_agc_preset_mic,LANG_RECORD_AGC_PRESET,INT(1), 855 {F_T_INT,&global_settings.rec_agc_preset_mic,LANG_RECORD_AGC_PRESET,INT(1),