summaryrefslogtreecommitdiff
path: root/apps/settings_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings_menu.c')
-rw-r--r--apps/settings_menu.c129
1 files changed, 60 insertions, 69 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 1e7f2f7808..41afc72468 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -38,99 +38,94 @@
38#include "ata.h" 38#include "ata.h"
39#include "lang.h" 39#include "lang.h"
40 40
41static Menu show_hidden_files(void) 41static bool show_hidden_files(void)
42{ 42{
43 set_bool_options( str(LANG_HIDDEN), &global_settings.show_hidden_files, 43 return set_bool_options( str(LANG_HIDDEN),
44 str(LANG_HIDDEN_SHOW), str(LANG_HIDDEN_HIDE) ); 44 &global_settings.show_hidden_files,
45 return MENU_OK; 45 str(LANG_HIDDEN_SHOW),
46 str(LANG_HIDDEN_HIDE) );
46} 47}
47 48
48static Menu contrast(void) 49static bool contrast(void)
49{ 50{
50 set_int( str(LANG_CONTRAST), "", &global_settings.contrast, 51 return set_int( str(LANG_CONTRAST), "", &global_settings.contrast,
51 lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING ); 52 lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING );
52 return MENU_OK;
53} 53}
54 54
55#ifndef HAVE_RECORDER_KEYPAD 55#ifndef HAVE_RECORDER_KEYPAD
56static Menu shuffle(void) 56static bool shuffle(void)
57{ 57{
58 set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle ); 58 return set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle );
59 return MENU_OK;
60} 59}
61#endif 60#endif
62 61
63static Menu play_selected(void) 62static bool play_selected(void)
64{ 63{
65 set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected ); 64 return set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected );
66 return MENU_OK;
67} 65}
68 66
69static Menu mp3_filter(void) 67static bool mp3_filter(void)
70{ 68{
71 set_bool( str(LANG_MP3FILTER), &global_settings.mp3filter ); 69 return set_bool( str(LANG_MP3FILTER), &global_settings.mp3filter );
72 return MENU_OK;
73} 70}
74 71
75static Menu sort_case(void) 72static bool sort_case(void)
76{ 73{
77 set_bool( str(LANG_SORT_CASE), &global_settings.sort_case ); 74 return set_bool( str(LANG_SORT_CASE), &global_settings.sort_case );
78 return MENU_OK;
79} 75}
80 76
81static Menu resume(void) 77static bool resume(void)
82{ 78{
83 char* names[] = { str(LANG_OFF), 79 char* names[] = { str(LANG_OFF),
84 str(LANG_RESUME_SETTING_ASK), 80 str(LANG_RESUME_SETTING_ASK),
85 str(LANG_ON) }; 81 str(LANG_ON) };
86 set_option( str(LANG_RESUME), &global_settings.resume, names, 3, NULL ); 82 return set_option( str(LANG_RESUME), &global_settings.resume,
87 return MENU_OK; 83 names, 3, NULL );
88} 84}
89 85
90static Menu backlight_timer(void) 86static bool backlight_timer(void)
91{ 87{
92 char* names[] = { str(LANG_OFF), str(LANG_ON), 88 char* names[] = { str(LANG_OFF), str(LANG_ON),
93 "1s ", "2s ", "3s ", "4s ", "5s ", 89 "1s ", "2s ", "3s ", "4s ", "5s ",
94 "6s ", "7s ", "8s ", "9s ", "10s", 90 "6s ", "7s ", "8s ", "9s ", "10s",
95 "15s", "20s", "25s", "30s", "45s", 91 "15s", "20s", "25s", "30s", "45s",
96 "60s", "90s"}; 92 "60s", "90s"};
97 set_option(str(LANG_BACKLIGHT), &global_settings.backlight, names, 19, 93 return set_option(str(LANG_BACKLIGHT), &global_settings.backlight,
98 backlight_time ); 94 names, 19, backlight_time );
99 return MENU_OK;
100} 95}
101 96
102static Menu poweroff_idle_timer(void) 97static bool poweroff_idle_timer(void)
103{ 98{
104 char* names[] = { str(LANG_OFF), 99 char* names[] = { str(LANG_OFF),
105 "1m ", "2m ", "3m ", "4m ", "5m ", 100 "1m ", "2m ", "3m ", "4m ", "5m ",
106 "6m ", "7m ", "8m ", "9m ", "10m", 101 "6m ", "7m ", "8m ", "9m ", "10m",
107 "15m", "30m", "45m", "60m"}; 102 "15m", "30m", "45m", "60m"};
108 set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff, names, 103 return set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff,
109 15, set_poweroff_timeout); 104 names, 15, set_poweroff_timeout);
110 return MENU_OK;
111} 105}
112 106
113static Menu scroll_speed(void) 107static bool scroll_speed(void)
114{ 108{
115 set_int(str(LANG_SCROLL), "", &global_settings.scroll_speed, 109 return set_int(str(LANG_SCROLL), "", &global_settings.scroll_speed,
116 &lcd_scroll_speed, 1, 1, 30 ); 110 &lcd_scroll_speed, 1, 1, 30 );
117 return MENU_OK;
118} 111}
119 112
120#ifdef HAVE_CHARGE_CTRL 113#ifdef HAVE_CHARGE_CTRL
121static Menu deep_discharge(void) 114static bool deep_discharge(void)
122{ 115{
123 set_bool( str(LANG_DISCHARGE), &global_settings.discharge ); 116 bool result;
117 result = set_bool( str(LANG_DISCHARGE), &global_settings.discharge );
124 charge_restart_level = global_settings.discharge ? 118 charge_restart_level = global_settings.discharge ?
125 CHARGE_RESTART_LO : CHARGE_RESTART_HI; 119 CHARGE_RESTART_LO : CHARGE_RESTART_HI;
126 return MENU_OK; 120 return result;
127} 121}
128#endif 122#endif
129 123
130#ifdef HAVE_LCD_BITMAP 124#ifdef HAVE_LCD_BITMAP
131static Menu timedate_set(void) 125static bool timedate_set(void)
132{ 126{
133 int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */ 127 int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */
128 bool result;
134 129
135#ifdef HAVE_RTC 130#ifdef HAVE_RTC
136 timedate[0] = rtc_read(0x03); /* hour */ 131 timedate[0] = rtc_read(0x03); /* hour */
@@ -167,7 +162,7 @@ static Menu timedate_set(void)
167 timedate[5] = 1; 162 timedate[5] = 1;
168#endif 163#endif
169 164
170 set_time(str(LANG_TIME),timedate); 165 result = set_time(str(LANG_TIME),timedate);
171 166
172#ifdef HAVE_RTC 167#ifdef HAVE_RTC
173 if(timedate[0] != -1) { 168 if(timedate[0] != -1) {
@@ -194,49 +189,45 @@ static Menu timedate_set(void)
194 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ 189 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */
195 } 190 }
196#endif 191#endif
197 return MENU_OK; 192 return result;
198} 193}
199#endif 194#endif
200 195
201static Menu spindown(void) 196static bool spindown(void)
202{ 197{
203 set_int(str(LANG_SPINDOWN), "s", &global_settings.disk_spindown, 198 return set_int(str(LANG_SPINDOWN), "s", &global_settings.disk_spindown,
204 ata_spindown, 1, 3, 254 ); 199 ata_spindown, 1, 3, 254 );
205 return MENU_OK;
206} 200}
207 201
208static Menu ff_rewind_min_step(void) 202static bool ff_rewind_min_step(void)
209{ 203{
210 char* names[] = { "1s", "2s", "3s", "4s", 204 char* names[] = { "1s", "2s", "3s", "4s",
211 "5s", "6s", "8s", "10s", 205 "5s", "6s", "8s", "10s",
212 "15s", "20s", "25s", "30s", 206 "15s", "20s", "25s", "30s",
213 "45s", "60s" }; 207 "45s", "60s" };
214 set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step, 208 return set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step,
215 names, 14, NULL ); 209 names, 14, NULL );
216 return MENU_OK;
217} 210}
218 211
219static Menu ff_rewind_accel(void) 212static bool ff_rewind_accel(void)
220{ 213{
221 char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s", 214 char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s",
222 "2x/4s", "2x/5s", "2x/6s", "2x/7s", 215 "2x/4s", "2x/5s", "2x/6s", "2x/7s",
223 "2x/8s", "2x/9s", "2x/10s", "2x/11s", 216 "2x/8s", "2x/9s", "2x/10s", "2x/11s",
224 "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; 217 "2x/12s", "2x/13s", "2x/14s", "2x/15s", };
225 set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel, 218 return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel,
226 names, 16, NULL ); 219 names, 16, NULL );
227 return MENU_OK;
228} 220}
229 221
230static Menu browse_current(void) 222static bool browse_current(void)
231{ 223{
232 set_bool( str(LANG_FOLLOW), &global_settings.browse_current ); 224 return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
233 return MENU_OK;
234} 225}
235 226
236Menu playback_settings_menu(void) 227static bool playback_settings_menu(void)
237{ 228{
238 int m; 229 int m;
239 Menu result; 230 bool result;
240 231
241 struct menu_items items[] = { 232 struct menu_items items[] = {
242#ifndef HAVE_RECORDER_KEYPAD 233#ifndef HAVE_RECORDER_KEYPAD
@@ -268,7 +259,7 @@ Menu playback_settings_menu(void)
268 return result; 259 return result;
269} 260}
270 261
271static Menu reset_settings(void) 262static bool reset_settings(void)
272{ 263{
273 int button = 0; 264 int button = 0;
274 265
@@ -300,10 +291,10 @@ static Menu reset_settings(void)
300 } 291 }
301} 292}
302 293
303static Menu fileview_settings_menu(void) 294static bool fileview_settings_menu(void)
304{ 295{
305 int m; 296 int m;
306 Menu result; 297 bool result;
307 298
308 struct menu_items items[] = { 299 struct menu_items items[] = {
309 { str(LANG_CASE_MENU), sort_case }, 300 { str(LANG_CASE_MENU), sort_case },
@@ -312,16 +303,16 @@ static Menu fileview_settings_menu(void)
312 { str(LANG_FOLLOW), browse_current }, 303 { str(LANG_FOLLOW), browse_current },
313 }; 304 };
314 305
315 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 306 m = menu_init( items, sizeof items / sizeof(struct menu_items) );
316 result = menu_run(m); 307 result = menu_run(m);
317 menu_exit(m); 308 menu_exit(m);
318 return result; 309 return result;
319} 310}
320 311
321static Menu display_settings_menu(void) 312static bool display_settings_menu(void)
322{ 313{
323 int m; 314 int m;
324 Menu result; 315 bool result;
325 316
326 struct menu_items items[] = { 317 struct menu_items items[] = {
327 { str(LANG_SCROLL_MENU), scroll_speed }, 318 { str(LANG_SCROLL_MENU), scroll_speed },
@@ -335,10 +326,10 @@ static Menu display_settings_menu(void)
335 return result; 326 return result;
336} 327}
337 328
338static Menu system_settings_menu(void) 329static bool system_settings_menu(void)
339{ 330{
340 int m; 331 int m;
341 Menu result; 332 bool result;
342 333
343 struct menu_items items[] = { 334 struct menu_items items[] = {
344 { str(LANG_SPINDOWN), spindown }, 335 { str(LANG_SPINDOWN), spindown },
@@ -358,10 +349,10 @@ static Menu system_settings_menu(void)
358 return result; 349 return result;
359} 350}
360 351
361Menu settings_menu(void) 352bool settings_menu(void)
362{ 353{
363 int m; 354 int m;
364 Menu result; 355 bool result;
365 356
366 struct menu_items items[] = { 357 struct menu_items items[] = {
367 { str(LANG_PLAYBACK), playback_settings_menu }, 358 { str(LANG_PLAYBACK), playback_settings_menu },
@@ -370,7 +361,7 @@ Menu settings_menu(void)
370 { str(LANG_SYSTEM), system_settings_menu }, 361 { str(LANG_SYSTEM), system_settings_menu },
371 }; 362 };
372 363
373 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 364 m = menu_init( items, sizeof items / sizeof(struct menu_items) );
374 result = menu_run(m); 365 result = menu_run(m);
375 menu_exit(m); 366 menu_exit(m);
376 return result; 367 return result;