summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/menus/settings_menu.c354
-rw-r--r--apps/settings_list.c140
-rw-r--r--apps/settings_menu.c648
3 files changed, 445 insertions, 697 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index ed83940d8f..df39dc20ad 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -1,4 +1,3 @@
1
2/*************************************************************************** 1/***************************************************************************
3 * __________ __ ___. 2 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
@@ -21,13 +20,360 @@
21#include <stdbool.h> 20#include <stdbool.h>
22#include <stddef.h> 21#include <stddef.h>
23#include <limits.h> 22#include <limits.h>
23#include <string.h>
24#include "config.h" 24#include "config.h"
25#include "lang.h" 25#include "lang.h"
26#include "action.h" 26#include "action.h"
27#include "settings.h" 27#include "settings.h"
28#include "menu.h" 28#include "menu.h"
29#include "sound_menu.h" 29#include "sound_menu.h"
30#include "exported_menus.h"
31#include "tree.h"
32#include "tagtree.h"
33#include "usb.h"
34#include "splash.h"
35#include "talk.h"
36#include "sprintf.h"
37#include "powermgmt.h"
38#ifdef HAVE_ALARM_MOD
39#include "alarm_menu.h"
40#endif
41
42/***********************************/
43/* TAGCACHE MENU */
44#ifdef HAVE_TAGCACHE
45#ifdef HAVE_TC_RAMCACHE
46MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL);
47#endif
48MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL);
49MENUITEM_FUNCTION(tc_init, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
50 (int(*)(void))tagcache_rebuild, NULL);
51MENUITEM_FUNCTION(tc_update, ID2P(LANG_TAGCACHE_UPDATE),
52 (int(*)(void))tagcache_update, NULL);
53MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL);
54MENUITEM_FUNCTION(tc_export, ID2P(LANG_TAGCACHE_EXPORT),
55 (int(*)(void))tagtree_export, NULL);
56MENUITEM_FUNCTION(tc_import, ID2P(LANG_TAGCACHE_IMPORT),
57 (int(*)(void))tagtree_import, NULL);
58MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0,
59#ifdef HAVE_TC_RAMCACHE
60 &tagcache_ram,
61#endif
62 &tagcache_autoupdate, &tc_init, &tc_update, &runtimedb,
63 &tc_export, &tc_import);
64#endif /* HAVE_TAGCACHE */
65/* TAGCACHE MENU */
66/***********************************/
67
68/***********************************/
69/* FILE VIEW MENU */
70static int fileview_callback(int action,const struct menu_item_ex *this_item);
71MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL);
72MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback);
73MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback);
74MENUITEM_SETTING(dirfilter, &global_settings.dirfilter, NULL);
75MENUITEM_SETTING(browse_current, &global_settings.browse_current, NULL);
76MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL);
77MENUITEM_SETTING(show_path_in_browser, &global_settings.show_path_in_browser, NULL);
78static int fileview_callback(int action,const struct menu_item_ex *this_item)
79{
80 static int oldval;
81 int *variable = this_item->variable;
82 switch (action)
83 {
84 case ACTION_ENTER_MENUITEM: /* on entering an item */
85 oldval = *variable;
86 break;
87 case ACTION_EXIT_MENUITEM: /* on exit */
88 if (*variable != oldval)
89 reload_directory(); /* force reload if this has changed */
90 break;
91 }
92 return action;
93}
94
95MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, &sort_case, &sort_dir, &sort_file,
96 &dirfilter, &browse_current, &show_icons, &show_path_in_browser,
97#ifdef HAVE_TAGCACHE
98 &tagcache_menu
99#endif
100 );
101/* FILE VIEW MENU */
102/***********************************/
103
104
105/***********************************/
106/* SYSTEM MENU */
107
108/* Battery */
109#ifndef SIMULATOR
110MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL);
111MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL);
112#ifdef HAVE_USB_POWER
113#ifdef CONFIG_CHARGING
114static int usbcharging_callback(int action,const struct menu_item_ex *this_item)
115{
116 (void)this_item;
117 switch (action)
118 {
119 case ACTION_EXIT_MENUITEM: /* on exit */
120 usb_charging_enable(global_settings.usb_charging);
121 break;
122 }
123 return action;
124}
125MENUITEM_SETTING(usb_charging, &global_settings.usb_charging, usbcharging_callback);
126#endif
127#endif
128MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0,
129 &battery_capacity,
130#if BATTERY_TYPES_COUNT > 1
131 &battery_type,
132#endif
133#ifdef HAVE_USB_POWER
134#ifdef CONFIG_CHARGING
135 &usb_charging,
136#endif
137#endif
138 );
139#endif /* SIMULATOR */
140/* Disk */
141#ifndef HAVE_MMC
142MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL);
143#ifdef HAVE_DIRCACHE
144static int dircache_callback(int action,const struct menu_item_ex *this_item)
145{
146 (void)this_item;
147 switch (action)
148 {
149 case ACTION_EXIT_MENUITEM: /* on exit */
150 switch (global_settings.dircache)
151 {
152 case true:
153 if (!dircache_is_enabled())
154 gui_syncsplash(HZ*2, true, str(LANG_PLEASE_REBOOT));
155 break;
156 case false:
157 if (dircache_is_enabled())
158 dircache_disable();
159 break;
160 }
161 break;
162 }
163 return action;
164}
165MENUITEM_SETTING(dircache, &global_settings.dircache, dircache_callback);
166#endif
167MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0,
168 &disk_spindown,
169#ifdef HAVE_DIRCACHE
170 &dircache,
171#endif
172 );
173#endif
174
175/* Time & Date */
176#ifdef CONFIG_RTC
177static int timedate_set(void)
178{
179 struct tm tm;
180 int result;
181
182 /* Make a local copy of the time struct */
183 memcpy(&tm, get_time(), sizeof(struct tm));
184
185 /* do some range checks */
186 /* This prevents problems with time/date setting after a power loss */
187 if (!valid_time(&tm))
188 {
189 /* hour */
190 tm.tm_hour = 0;
191 tm.tm_min = 0;
192 tm.tm_sec = 0;
193 tm.tm_mday = 1;
194 tm.tm_mon = 0;
195 tm.tm_wday = 1;
196 tm.tm_year = 100;
197 }
198
199 result = (int)set_time_screen(str(LANG_TIME), &tm);
200
201 if(tm.tm_year != -1) {
202 set_time(&tm);
203 }
204 return result;
205}
206
207MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL);
208MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
209MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, &time_set, &timeformat);
210#endif
211
212/* System menu */
213MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
214
215/* sleep Menu */
216static void sleep_timer_formatter(char* buffer, int buffer_size, int value,
217 const char* unit)
218{
219 int minutes, hours;
220
221 (void) unit;
222
223 if (value) {
224 hours = value / 60;
225 minutes = value - (hours * 60);
226 snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
227 } else {
228 snprintf(buffer, buffer_size, "%s", str(LANG_OFF));
229 }
230}
231
232static void sleep_timer_set(int minutes)
233{
234 set_sleep_timer(minutes * 60);
235}
236
237static int sleep_timer(void)
238{
239 int minutes = (get_sleep_timer() + 59) / 60; /* round up */
240 return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
241 &sleep_timer_set, 5, 0, 300, sleep_timer_formatter);
242}
243
244MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer, NULL);
245#ifdef HAVE_ALARM_MOD
246MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
247 (menu_function)alarm_screen, NULL);
248#endif
249
250/* Limits menu */
251MENUITEM_SETTING(max_files_in_dir, &global_settings.max_files_in_dir, NULL);
252MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL);
253MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0,
254 &max_files_in_dir, &max_files_in_playlist);
255
256#if CONFIG_CODEC == MAS3507D
257void dac_line_in(bool enable);
258static int linein_callback(int action,const struct menu_item_ex *this_item)
259{
260 (void)this_item;
261 switch (action)
262 {
263 case ACTION_EXIT_MENUITEM: /* on exit */
264#ifndef SIMULATOR
265 dac_line_in(global_settings.line_in);
266#endif
267 break;
268 }
269 return action;
270}
271MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback);
272#endif
273#ifdef CONFIG_CHARGING
274MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
275#endif
276
277MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), 0,
278#ifndef SIMULATOR
279 &battery_menu,
280#endif
281#ifndef HAVE_MMC
282 &disk_menu,
283#endif
284#ifdef CONFIG_RTC
285 &time_menu,
286#endif
287 &poweroff,
288 &sleep_timer_call,
289#ifdef HAVE_ALARM_MOD
290 &alarm_screen_call,
291#endif
292 &limits_menu,
293#if CONFIG_CODEC == MAS3507D
294 &line_in,
295#endif
296#ifdef CONFIG_CHARGING
297 &car_adapter_mode,
298#endif
299 );
300
301/* SYSTEM MENU */
302/***********************************/
303
304
305/***********************************/
306/* BOOKMARK MENU */
307static int bmark_callback(int action,const struct menu_item_ex *this_item)
308{
309 (void)this_item;
310 switch (action)
311 {
312 case ACTION_EXIT_MENUITEM: /* on exit */
313 if(global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_YES ||
314 global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK)
315 {
316 if(global_settings.usemrb == BOOKMARK_NO)
317 global_settings.usemrb = BOOKMARK_YES;
318
319 }
320 break;
321 }
322 return action;
323}
324MENUITEM_SETTING(autocreatebookmark,
325 &global_settings.autocreatebookmark, bmark_callback);
326MENUITEM_SETTING(autoloadbookmark, &global_settings.autoloadbookmark, NULL);
327MENUITEM_SETTING(usemrb, &global_settings.usemrb, NULL);
328MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
329 &autocreatebookmark, &autoloadbookmark, &usemrb);
330/* BOOKMARK MENU */
331/***********************************/
332
333/***********************************/
334/* VOICE MENU */
335static int talk_callback(int action,const struct menu_item_ex *this_item);
336MENUITEM_SETTING(talk_menu, &global_settings.talk_menu, NULL);
337MENUITEM_SETTING(talk_dir, &global_settings.talk_dir, talk_callback);
338MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, talk_callback);
339static int talk_callback(int action,const struct menu_item_ex *this_item)
340{
341 static int oldval = 0;
342 switch (action)
343 {
344 case ACTION_ENTER_MENUITEM:
345 oldval = global_settings.talk_file;
346 break;
347 case ACTION_EXIT_MENUITEM:
348#if CONFIG_CODEC == SWCODEC
349 audio_set_crossfade(global_settings.crossfade);
350#endif
351 if (this_item == &talk_dir)
352 break;
353 if (oldval != 3 && global_settings.talk_file == 3)
354 { /* force reload if newly talking thumbnails,
355 because the clip presence is cached only if enabled */
356 reload_directory();
357 }
358 break;
359 }
360 return action;
361}
362MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0,
363 &talk_menu, &talk_dir, &talk_file_item);
364/* VOICE MENU */
365/***********************************/
366
367/***********************************/
368/* SETTINGS MENU */
369static int language_browse(void)
370{
371 return (int)rockbox_browse(LANG_DIR, SHOW_LNG);
372}
373MENUITEM_FUNCTION(browse_langs, ID2P(LANG_LANGUAGE), language_browse, NULL);
30 374
31#include "settings_menu.h" 375MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
32MENUITEM_FUNCTION(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 376 &playback_menu_item, &file_menu, &display_menu, &system_menu,
33 (menu_function)settings_menu, NULL); 377 &bookmark_settings_menu, &browse_langs, &voice_settings_menu );
378/* SETTINGS MENU */
379/***********************************/
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),
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 79c4d9d6e5..67a5abaa67 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -66,9 +66,6 @@
66#if CONFIG_CODEC == MAS3507D 66#if CONFIG_CODEC == MAS3507D
67void dac_line_in(bool enable); 67void dac_line_in(bool enable);
68#endif 68#endif
69#ifdef HAVE_ALARM_MOD
70#include "alarm_menu.h"
71#endif
72 69
73#ifdef HAVE_REMOTE_LCD 70#ifdef HAVE_REMOTE_LCD
74#include "lcd-remote.h" 71#include "lcd-remote.h"
@@ -85,34 +82,6 @@ void dac_line_in(bool enable);
85#endif 82#endif
86#include "menus/exported_menus.h" 83#include "menus/exported_menus.h"
87 84
88#ifdef CONFIG_CHARGING
89static bool car_adapter_mode(void)
90{
91 return set_bool( str(LANG_CAR_ADAPTER_MODE),
92 &global_settings.car_adapter_mode );
93}
94#endif
95
96/**
97 * Menu to set icon visibility
98 */
99static bool show_icons(void)
100{
101 return set_bool( (char *)str(LANG_SHOW_ICONS), &global_settings.show_icons );
102}
103
104static bool show_path(void)
105{
106 static const struct opt_items names[3] = {
107 { STR(LANG_OFF) },
108 { STR(LANG_SHOW_PATH_CURRENT) },
109 { STR(LANG_SHOW_PATH_FULL) },
110 };
111
112 return set_option(str(LANG_SHOW_PATH),
113 &global_settings.show_path_in_browser,
114 INT, names, 3, NULL);
115}
116 85
117/** 86/**
118 * Menu to set the option to scroll paginated 87 * Menu to set the option to scroll paginated
@@ -451,22 +420,6 @@ static bool reset_color(void)
451} 420}
452#endif 421#endif
453 422
454#ifdef HAVE_USB_POWER
455#ifdef CONFIG_CHARGING
456/**
457 * Menu to switch the USB charging on or off
458 */
459static bool usb_charging(void)
460{
461 bool rc = set_bool(str(LANG_USB_CHARGING),
462 &global_settings.usb_charging);
463 /* if (usb_charging_enabled() != global_settings.usb_charging) */
464 usb_charging_enable(global_settings.usb_charging);
465 return rc;
466}
467#endif
468#endif
469
470/** 423/**
471 * Menu to configure the battery display on status bar 424 * Menu to configure the battery display on status bar
472 */ 425 */
@@ -734,164 +687,6 @@ static bool peak_meter_menu(void)
734} 687}
735#endif /* HAVE_LCD_BITMAP */ 688#endif /* HAVE_LCD_BITMAP */
736 689
737static bool dir_filter(void)
738{
739 static const struct opt_items names[] = {
740 { STR(LANG_FILTER_ALL) },
741 { STR(LANG_FILTER_SUPPORTED) },
742 { STR(LANG_FILTER_MUSIC) },
743 { STR(LANG_FILTER_PLAYLIST) },
744#ifdef HAVE_TAGCACHE
745 { STR(LANG_FILTER_ID3DB) }
746#endif
747 };
748#ifdef HAVE_TAGCACHE
749 return set_option( str(LANG_FILTER), &global_settings.dirfilter, INT,
750 names, 5, NULL );
751#else
752 return set_option( str(LANG_FILTER), &global_settings.dirfilter, INT,
753 names, 4, NULL );
754#endif
755}
756
757static bool sort_case(void)
758{
759 return set_bool( str(LANG_SORT_CASE), &global_settings.sort_case );
760}
761
762static bool sort_file(void)
763{
764 int oldval = global_settings.sort_file;
765 bool ret;
766 static const struct opt_items names[] = {
767 { STR(LANG_SORT_ALPHA) },
768 { STR(LANG_SORT_DATE) },
769 { STR(LANG_SORT_DATE_REVERSE) },
770 { STR(LANG_SORT_TYPE) }
771 };
772 ret = set_option( str(LANG_SORT_FILE), &global_settings.sort_file, INT,
773 names, 4, NULL );
774 if (global_settings.sort_file != oldval)
775 reload_directory(); /* force reload if this has changed */
776 return ret;
777}
778
779static bool sort_dir(void)
780{
781 int oldval = global_settings.sort_dir;
782 bool ret;
783 static const struct opt_items names[] = {
784 { STR(LANG_SORT_ALPHA) },
785 { STR(LANG_SORT_DATE) },
786 { STR(LANG_SORT_DATE_REVERSE) }
787 };
788 ret = set_option( str(LANG_SORT_DIR), &global_settings.sort_dir, INT,
789 names, 3, NULL );
790 if (global_settings.sort_dir != oldval)
791 reload_directory(); /* force reload if this has changed */
792 return ret;
793}
794
795static bool autocreatebookmark(void)
796{
797 bool retval = false;
798 static const struct opt_items names[] = {
799 { STR(LANG_SET_BOOL_NO) },
800 { STR(LANG_SET_BOOL_YES) },
801 { STR(LANG_RESUME_SETTING_ASK) },
802 { STR(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES) },
803 { STR(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK) }
804 };
805
806 retval = set_option( str(LANG_BOOKMARK_SETTINGS_AUTOCREATE),
807 &global_settings.autocreatebookmark, INT,
808 names, 5, NULL );
809 if(global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_YES ||
810 global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK)
811 {
812 if(global_settings.usemrb == BOOKMARK_NO)
813 global_settings.usemrb = BOOKMARK_YES;
814
815 }
816 return retval;
817}
818
819static bool autoloadbookmark(void)
820{
821 static const struct opt_items names[] = {
822 { STR(LANG_SET_BOOL_NO) },
823 { STR(LANG_SET_BOOL_YES) },
824 { STR(LANG_RESUME_SETTING_ASK) }
825 };
826 return set_option( str(LANG_BOOKMARK_SETTINGS_AUTOLOAD),
827 &global_settings.autoloadbookmark, INT,
828 names, 3, NULL );
829}
830
831static bool useMRB(void)
832{
833 static const struct opt_items names[] = {
834 { STR(LANG_SET_BOOL_NO) },
835 { STR(LANG_SET_BOOL_YES) },
836 { STR(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY) }
837 };
838 return set_option( str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS),
839 &global_settings.usemrb, INT,
840 names, 3, NULL );
841}
842
843static bool poweroff_idle_timer(void)
844{
845 static const struct opt_items names[] = {
846 { STR(LANG_OFF) },
847 { "1m ", TALK_ID(1, UNIT_MIN) },
848 { "2m ", TALK_ID(2, UNIT_MIN) },
849 { "3m ", TALK_ID(3, UNIT_MIN) },
850 { "4m ", TALK_ID(4, UNIT_MIN) },
851 { "5m ", TALK_ID(5, UNIT_MIN) },
852 { "6m ", TALK_ID(6, UNIT_MIN) },
853 { "7m ", TALK_ID(7, UNIT_MIN) },
854 { "8m ", TALK_ID(8, UNIT_MIN) },
855 { "9m ", TALK_ID(9, UNIT_MIN) },
856 { "10m", TALK_ID(10, UNIT_MIN) },
857 { "15m", TALK_ID(15, UNIT_MIN) },
858 { "30m", TALK_ID(30, UNIT_MIN) },
859 { "45m", TALK_ID(45, UNIT_MIN) },
860 { "60m", TALK_ID(60, UNIT_MIN) }
861 };
862 return set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff,
863 INT, names, 15, set_poweroff_timeout);
864}
865
866static void sleep_timer_formatter(char* buffer, int buffer_size, int value,
867 const char* unit)
868{
869 int minutes, hours;
870
871 (void) unit;
872
873 if (value) {
874 hours = value / 60;
875 minutes = value - (hours * 60);
876 snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
877 } else {
878 snprintf(buffer, buffer_size, "%s", str(LANG_OFF));
879 }
880}
881
882static void sleep_timer_set(int minutes)
883{
884 set_sleep_timer(minutes * 60);
885}
886
887static bool sleep_timer(void)
888{
889 int minutes = (get_sleep_timer() + 59) / 60; /* round up */
890
891 return set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
892 &sleep_timer_set, 5, 0, 300, sleep_timer_formatter);
893}
894
895static bool scroll_speed(void) 690static bool scroll_speed(void)
896{ 691{
897 return set_int(str(LANG_SCROLL), "", UNIT_INT, 692 return set_int(str(LANG_SCROLL), "", UNIT_INT,
@@ -1000,108 +795,6 @@ static bool jump_scroll_delay(void)
1000} 795}
1001#endif 796#endif
1002 797
1003#ifndef SIMULATOR
1004/**
1005 * Menu to set the battery capacity
1006 */
1007static bool battery_capacity(void)
1008{
1009 return set_int(str(LANG_BATTERY_CAPACITY), "mAh", UNIT_MAH,
1010 &global_settings.battery_capacity,
1011 &set_battery_capacity, BATTERY_CAPACITY_INC, BATTERY_CAPACITY_MIN,
1012 BATTERY_CAPACITY_MAX, NULL );
1013}
1014
1015#if BATTERY_TYPES_COUNT > 1
1016static bool battery_type(void)
1017{
1018 static const struct opt_items names[] = {
1019 { STR(LANG_BATTERY_TYPE_ALKALINE) },
1020 { STR(LANG_BATTERY_TYPE_NIMH) }
1021 };
1022
1023 return set_option(str(LANG_BATTERY_TYPE), &global_settings.battery_type,
1024 INT, names, 2, set_battery_type);
1025}
1026#endif
1027#endif
1028
1029#ifdef CONFIG_RTC
1030static bool timedate_set(void)
1031{
1032 struct tm tm;
1033 bool result;
1034
1035 /* Make a local copy of the time struct */
1036 memcpy(&tm, get_time(), sizeof(struct tm));
1037
1038 /* do some range checks */
1039 /* This prevents problems with time/date setting after a power loss */
1040 if (!valid_time(&tm))
1041 {
1042 /* hour */
1043 tm.tm_hour = 0;
1044 tm.tm_min = 0;
1045 tm.tm_sec = 0;
1046 tm.tm_mday = 1;
1047 tm.tm_mon = 0;
1048 tm.tm_wday = 1;
1049 tm.tm_year = 100;
1050 }
1051
1052 result = set_time_screen(str(LANG_TIME), &tm);
1053
1054 if(tm.tm_year != -1) {
1055 set_time(&tm);
1056 }
1057 return result;
1058}
1059
1060static bool timeformat_set(void)
1061{
1062 static const struct opt_items names[] = {
1063 { STR(LANG_24_HOUR_CLOCK) },
1064 { STR(LANG_12_HOUR_CLOCK) }
1065 };
1066 return set_option(str(LANG_TIMEFORMAT), &global_settings.timeformat,
1067 INT, names, 2, NULL);
1068}
1069#endif
1070
1071#ifndef HAVE_MMC
1072static bool spindown(void)
1073{
1074 return set_int(str(LANG_SPINDOWN), "s", UNIT_SEC,
1075 &global_settings.disk_spindown,
1076 ata_spindown, 1, 3, 254, NULL );
1077}
1078
1079#endif /* !HAVE_MMC */
1080
1081#if CONFIG_CODEC == MAS3507D
1082static bool line_in(void)
1083{
1084 bool rc = set_bool(str(LANG_LINE_IN), &global_settings.line_in);
1085#ifndef SIMULATOR
1086 dac_line_in(global_settings.line_in);
1087#endif
1088 return rc;
1089}
1090#endif
1091
1092static bool max_files_in_dir(void)
1093{
1094 return set_int(str(LANG_MAX_FILES_IN_DIR), "", UNIT_INT,
1095 &global_settings.max_files_in_dir,
1096 NULL, 50, 50, 10000, NULL );
1097}
1098
1099static bool max_files_in_playlist(void)
1100{
1101 return set_int(str(LANG_MAX_FILES_IN_PLAYLIST), "", UNIT_INT,
1102 &global_settings.max_files_in_playlist,
1103 NULL, 1000, 1000, 20000, NULL );
1104}
1105 798
1106#ifdef CONFIG_BACKLIGHT 799#ifdef CONFIG_BACKLIGHT
1107static bool set_bl_filter_first_keypress(void) 800static bool set_bl_filter_first_keypress(void)
@@ -1122,11 +815,6 @@ static bool set_remote_bl_filter_first_keypress(void)
1122#endif 815#endif
1123#endif 816#endif
1124 817
1125static bool browse_current(void)
1126{
1127 return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
1128}
1129
1130static bool custom_wps_browse(void) 818static bool custom_wps_browse(void)
1131{ 819{
1132 return rockbox_browse(WPS_DIR, SHOW_WPS); 820 return rockbox_browse(WPS_DIR, SHOW_WPS);
@@ -1144,75 +832,6 @@ static bool custom_cfg_browse(void)
1144 return rockbox_browse(ROCKBOX_DIR, SHOW_CFG); 832 return rockbox_browse(ROCKBOX_DIR, SHOW_CFG);
1145} 833}
1146 834
1147static bool language_browse(void)
1148{
1149 return rockbox_browse(LANG_DIR, SHOW_LNG);
1150}
1151
1152static bool voice_menus(void)
1153{
1154 bool ret;
1155 bool temp = global_settings.talk_menu;
1156 /* work on a temp variable first, avoid "life" disabling */
1157 ret = set_bool( str(LANG_VOICE_MENU), &temp );
1158 global_settings.talk_menu = temp;
1159 return ret;
1160}
1161
1162/* this is used 2 times below, so it saves memory to put it in global scope */
1163static const struct opt_items voice_names[] = {
1164 { STR(LANG_OFF) },
1165 { STR(LANG_VOICE_NUMBER) },
1166 { STR(LANG_VOICE_SPELL) },
1167 { STR(LANG_VOICE_DIR_HOVER) }
1168};
1169
1170static bool voice_dirs(void)
1171{
1172 bool ret = set_option( str(LANG_VOICE_DIR),
1173 &global_settings.talk_dir, INT, voice_names, 4, NULL);
1174#if CONFIG_CODEC == SWCODEC
1175 audio_set_crossfade(global_settings.crossfade);
1176#endif
1177 return ret;
1178}
1179
1180static bool voice_files(void)
1181{
1182 int oldval = global_settings.talk_file;
1183 bool ret;
1184
1185 ret = set_option( str(LANG_VOICE_FILE),
1186 &global_settings.talk_file, INT, voice_names, 4, NULL);
1187#if CONFIG_CODEC == SWCODEC
1188 audio_set_crossfade(global_settings.crossfade);
1189#endif
1190 if (oldval != 3 && global_settings.talk_file == 3)
1191 { /* force reload if newly talking thumbnails,
1192 because the clip presence is cached only if enabled */
1193 reload_directory();
1194 }
1195 return ret;
1196}
1197
1198static bool voice_menu(void)
1199{
1200 int m;
1201 bool result;
1202
1203 static const struct menu_item items[] = {
1204 { ID2P(LANG_VOICE_MENU), voice_menus },
1205 { ID2P(LANG_VOICE_DIR), voice_dirs },
1206 { ID2P(LANG_VOICE_FILE), voice_files }
1207 };
1208
1209 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1210 NULL, NULL, NULL);
1211 result = menu_run(m);
1212 menu_exit(m);
1213 return result;
1214}
1215
1216#ifdef HAVE_LCD_BITMAP 835#ifdef HAVE_LCD_BITMAP
1217static bool font_browse(void) 836static bool font_browse(void)
1218{ 837{
@@ -1259,107 +878,6 @@ static bool codepage_setting(void)
1259 INT, names, 13, set_codepage ); 878 INT, names, 13, set_codepage );
1260} 879}
1261 880
1262#ifdef HAVE_DIRCACHE
1263static bool dircache(void)
1264{
1265 bool result = set_bool_options(str(LANG_DIRCACHE_ENABLE),
1266 &global_settings.dircache,
1267 STR(LANG_ON),
1268 STR(LANG_OFF),
1269 NULL);
1270
1271 if (!dircache_is_enabled() && global_settings.dircache)
1272 gui_syncsplash(HZ*2, true, str(LANG_PLEASE_REBOOT));
1273
1274 if (!result)
1275 dircache_disable();
1276
1277 return result;
1278}
1279#endif /* HAVE_DIRCACHE */
1280
1281#ifdef HAVE_TAGCACHE
1282#ifdef HAVE_TC_RAMCACHE
1283static bool tagcache_ram(void)
1284{
1285 bool result = set_bool_options(str(LANG_TAGCACHE_RAM),
1286 &global_settings.tagcache_ram,
1287 STR(LANG_SET_BOOL_YES),
1288 STR(LANG_SET_BOOL_NO),
1289 NULL);
1290
1291 return result;
1292}
1293#endif
1294
1295static bool tagcache_autoupdate(void)
1296{
1297 bool rc = set_bool_options(str(LANG_TAGCACHE_AUTOUPDATE),
1298 &global_settings.tagcache_autoupdate,
1299 STR(LANG_ON),
1300 STR(LANG_OFF),
1301 NULL);
1302 return rc;
1303}
1304
1305static bool tagcache_runtimedb(void)
1306{
1307 bool rc = set_bool_options(str(LANG_RUNTIMEDB_ACTIVE),
1308 &global_settings.runtimedb,
1309 STR(LANG_ON),
1310 STR(LANG_OFF),
1311 NULL);
1312 return rc;
1313}
1314
1315static bool tagcache_settings_menu(void)
1316{
1317 int m;
1318 bool result;
1319
1320 static const struct menu_item items[] = {
1321#ifdef HAVE_TC_RAMCACHE
1322 { ID2P(LANG_TAGCACHE_RAM), tagcache_ram },
1323#endif
1324 { ID2P(LANG_TAGCACHE_AUTOUPDATE), tagcache_autoupdate },
1325 { ID2P(LANG_TAGCACHE_FORCE_UPDATE), tagcache_rebuild },
1326 { ID2P(LANG_TAGCACHE_UPDATE), tagcache_update },
1327 { ID2P(LANG_RUNTIMEDB_ACTIVE), tagcache_runtimedb },
1328 { ID2P(LANG_TAGCACHE_EXPORT), tagtree_export },
1329 { ID2P(LANG_TAGCACHE_IMPORT), tagtree_import },
1330 };
1331
1332 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1333 NULL, NULL, NULL);
1334 result = menu_run(m);
1335 menu_exit(m);
1336 return result;
1337}
1338#endif
1339
1340bool playback_settings_menu(void)
1341{
1342 return do_menu(&playback_menu_item);
1343}
1344
1345static bool bookmark_settings_menu(void)
1346{
1347 int m;
1348 bool result;
1349
1350 static const struct menu_item items[] = {
1351 { ID2P(LANG_BOOKMARK_SETTINGS_AUTOCREATE), autocreatebookmark},
1352 { ID2P(LANG_BOOKMARK_SETTINGS_AUTOLOAD), autoloadbookmark},
1353 { ID2P(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB},
1354 };
1355
1356 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1357 NULL, NULL, NULL);
1358 result = menu_run(m);
1359 menu_exit(m);
1360
1361 return result;
1362}
1363static bool reset_settings(void) 881static bool reset_settings(void)
1364{ 882{
1365 unsigned char *lines[]={str(LANG_RESET_ASK_RECORDER)}; 883 unsigned char *lines[]={str(LANG_RESET_ASK_RECORDER)};
@@ -1387,30 +905,6 @@ static bool reset_settings(void)
1387 return false; 905 return false;
1388} 906}
1389 907
1390static bool fileview_settings_menu(void)
1391{
1392 int m;
1393 bool result;
1394
1395 static const struct menu_item items[] = {
1396 { ID2P(LANG_SORT_CASE), sort_case },
1397 { ID2P(LANG_SORT_DIR), sort_dir },
1398 { ID2P(LANG_SORT_FILE), sort_file },
1399 { ID2P(LANG_FILTER), dir_filter },
1400 { ID2P(LANG_FOLLOW), browse_current },
1401 { ID2P(LANG_SHOW_ICONS), show_icons },
1402 { ID2P(LANG_SHOW_PATH), show_path },
1403#ifdef HAVE_TAGCACHE
1404 { ID2P(LANG_TAGCACHE), tagcache_settings_menu},
1405#endif
1406 };
1407
1408 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1409 NULL, NULL, NULL);
1410 result = menu_run(m);
1411 menu_exit(m);
1412 return result;
1413}
1414 908
1415#ifdef HAVE_REMOTE_LCD 909#ifdef HAVE_REMOTE_LCD
1416static bool remote_scroll_sets(void) 910static bool remote_scroll_sets(void)
@@ -1611,75 +1105,6 @@ bool display_settings_menu(void)
1611 menu_exit(m); 1105 menu_exit(m);
1612 return result; 1106 return result;
1613} 1107}
1614
1615
1616static bool battery_settings_menu(void)
1617{
1618 int m;
1619 bool result;
1620
1621 static const struct menu_item items[] = {
1622#ifndef SIMULATOR
1623 { ID2P(LANG_BATTERY_CAPACITY), battery_capacity },
1624#if BATTERY_TYPES_COUNT > 1
1625 { ID2P(LANG_BATTERY_TYPE), battery_type },
1626#endif
1627#ifdef HAVE_USB_POWER
1628#ifdef CONFIG_CHARGING
1629 { ID2P(LANG_USB_CHARGING), usb_charging },
1630#endif
1631#endif
1632#else
1633 { "Dummy", NULL }, /* to have an entry at all, in the simulator */
1634#endif
1635 };
1636
1637 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1638 NULL, NULL, NULL);
1639 result = menu_run(m);
1640 menu_exit(m);
1641 return result;
1642}
1643
1644#ifndef HAVE_MMC
1645static bool disk_settings_menu(void)
1646{
1647 int m;
1648 bool result;
1649
1650 static const struct menu_item items[] = {
1651 { ID2P(LANG_SPINDOWN), spindown },
1652#ifdef HAVE_DIRCACHE
1653 { ID2P(LANG_DIRCACHE_ENABLE), dircache },
1654#endif
1655 };
1656
1657 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1658 NULL, NULL, NULL);
1659 result = menu_run(m);
1660 menu_exit(m);
1661 return result;
1662}
1663#endif /* !HAVE_MMC */
1664
1665#ifdef CONFIG_RTC
1666static bool time_settings_menu(void)
1667{
1668 int m;
1669 bool result;
1670
1671 static const struct menu_item items[] = {
1672 { ID2P(LANG_TIME), timedate_set },
1673 { ID2P(LANG_TIMEFORMAT), timeformat_set },
1674 };
1675
1676 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1677 NULL, NULL, NULL);
1678 result = menu_run(m);
1679 menu_exit(m);
1680 return result;
1681}
1682#endif
1683static bool manage_settings_write_config(void) 1108static bool manage_settings_write_config(void)
1684{ 1109{
1685 return settings_save_config(SETTINGS_SAVE_ALL); 1110 return settings_save_config(SETTINGS_SAVE_ALL);
@@ -1708,76 +1133,3 @@ bool manage_settings_menu(void)
1708 return result; 1133 return result;
1709} 1134}
1710 1135
1711static bool limits_settings_menu(void)
1712{
1713 int m;
1714 bool result;
1715
1716 static const struct menu_item items[] = {
1717 { ID2P(LANG_MAX_FILES_IN_DIR), max_files_in_dir },
1718 { ID2P(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist },
1719 };
1720
1721 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1722 NULL, NULL, NULL);
1723 result = menu_run(m);
1724 menu_exit(m);
1725 return result;
1726}
1727
1728
1729static bool system_settings_menu(void)
1730{
1731 int m;
1732 bool result;
1733
1734 static const struct menu_item items[] = {
1735 { ID2P(LANG_BATTERY_MENU), battery_settings_menu },
1736#ifndef HAVE_MMC
1737 { ID2P(LANG_DISK_MENU), disk_settings_menu },
1738#endif
1739#ifdef CONFIG_RTC
1740 { ID2P(LANG_TIME_MENU), time_settings_menu },
1741#endif
1742 { ID2P(LANG_POWEROFF_IDLE), poweroff_idle_timer },
1743 { ID2P(LANG_SLEEP_TIMER), sleep_timer },
1744#ifdef HAVE_ALARM_MOD
1745 { ID2P(LANG_ALARM_MOD_ALARM_MENU), alarm_screen },
1746#endif
1747 { ID2P(LANG_LIMITS_MENU), limits_settings_menu },
1748#if CONFIG_CODEC == MAS3507D
1749 { ID2P(LANG_LINE_IN), line_in },
1750#endif
1751#ifdef CONFIG_CHARGING
1752 { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode },
1753#endif
1754 };
1755
1756 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1757 NULL, NULL, NULL);
1758 result = menu_run(m);
1759 menu_exit(m);
1760 return result;
1761}
1762
1763bool settings_menu(void)
1764{
1765 int m;
1766 bool result;
1767
1768 static const struct menu_item items[] = {
1769 { ID2P(LANG_PLAYBACK), playback_settings_menu },
1770 { ID2P(LANG_FILE), fileview_settings_menu },
1771 { ID2P(LANG_DISPLAY), display_settings_menu },
1772 { ID2P(LANG_SYSTEM), system_settings_menu },
1773 { ID2P(LANG_BOOKMARK_SETTINGS),bookmark_settings_menu },
1774 { ID2P(LANG_LANGUAGE), language_browse },
1775 { ID2P(LANG_VOICE), voice_menu },
1776 };
1777
1778 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1779 NULL, NULL, NULL);
1780 result = menu_run(m);
1781 menu_exit(m);
1782 return result;
1783}