diff options
-rw-r--r-- | apps/settings.c | 66 | ||||
-rw-r--r-- | apps/settings.h | 1 | ||||
-rw-r--r-- | apps/settings_menu.c | 121 | ||||
-rw-r--r-- | apps/settings_menu.h | 4 |
4 files changed, 105 insertions, 87 deletions
diff --git a/apps/settings.c b/apps/settings.c index 1a020c305d..7ebe612ce7 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -524,64 +524,15 @@ void settings_display(void) | |||
524 | 524 | ||
525 | void set_bool(char* string, bool* variable ) | 525 | void set_bool(char* string, bool* variable ) |
526 | { | 526 | { |
527 | bool done = false; | 527 | set_bool_options(string, variable, "yes", "no "); |
528 | int button; | 528 | } |
529 | |||
530 | #ifdef HAVE_LCD_BITMAP | ||
531 | if(global_settings.statusbar) | ||
532 | lcd_setmargins(0, STATUSBAR_HEIGHT); | ||
533 | else | ||
534 | lcd_setmargins(0, 0); | ||
535 | #endif | ||
536 | lcd_clear_display(); | ||
537 | lcd_puts_scroll(0, 0, string); | ||
538 | |||
539 | while ( !done ) { | ||
540 | lcd_puts(0, 1, *variable ? "on " : "off"); | ||
541 | #ifdef HAVE_LCD_BITMAP | ||
542 | status_draw(); | ||
543 | #endif | ||
544 | lcd_update(); | ||
545 | |||
546 | button = button_get_w_tmo(HZ/2); | ||
547 | switch ( button ) { | ||
548 | #ifdef HAVE_RECORDER_KEYPAD | ||
549 | case BUTTON_LEFT: | ||
550 | #else | ||
551 | case BUTTON_STOP: | ||
552 | case BUTTON_MENU: | ||
553 | #endif | ||
554 | done = true; | ||
555 | break; | ||
556 | |||
557 | #ifdef HAVE_RECORDER_KEYPAD | ||
558 | case BUTTON_UP: | ||
559 | case BUTTON_DOWN: | ||
560 | #else | ||
561 | case BUTTON_LEFT: | ||
562 | case BUTTON_RIGHT: | ||
563 | #endif | ||
564 | if(!(button & BUTTON_REL)) | ||
565 | *variable = !*variable; | ||
566 | break; | ||
567 | 529 | ||
568 | #ifdef HAVE_RECORDER_KEYPAD | 530 | void set_bool_options(char* string, bool* variable, char* yes_str, char* no_str ) |
569 | case BUTTON_F3: | 531 | { |
570 | #ifdef HAVE_LCD_BITMAP | 532 | char* names[] = { yes_str, no_str }; |
571 | global_settings.statusbar = !global_settings.statusbar; | 533 | int value = !*variable; |
572 | settings_save(); | 534 | set_option(string, &value, names, 2); |
573 | if(global_settings.statusbar) | 535 | *variable = !value; |
574 | lcd_setmargins(0, STATUSBAR_HEIGHT); | ||
575 | else | ||
576 | lcd_setmargins(0, 0); | ||
577 | lcd_clear_display(); | ||
578 | lcd_puts_scroll(0, 0, string); | ||
579 | #endif | ||
580 | break; | ||
581 | #endif | ||
582 | } | ||
583 | } | ||
584 | lcd_stop_scroll(); | ||
585 | } | 536 | } |
586 | 537 | ||
587 | void set_int(char* string, | 538 | void set_int(char* string, |
@@ -600,6 +551,7 @@ void set_int(char* string, | |||
600 | else | 551 | else |
601 | lcd_setmargins(0, 0); | 552 | lcd_setmargins(0, 0); |
602 | #endif | 553 | #endif |
554 | |||
603 | lcd_clear_display(); | 555 | lcd_clear_display(); |
604 | lcd_puts_scroll(0, 0, string); | 556 | lcd_puts_scroll(0, 0, string); |
605 | 557 | ||
diff --git a/apps/settings.h b/apps/settings.h index 353b50abe9..283d719b5a 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -106,6 +106,7 @@ void settings_reset(void); | |||
106 | void settings_display(void); | 106 | void settings_display(void); |
107 | 107 | ||
108 | bool settings_load_eq(char* file); | 108 | bool settings_load_eq(char* file); |
109 | void set_bool_options(char* string, bool* variable, char* yes_str, char* no_str ); | ||
109 | 110 | ||
110 | void set_bool(char* string, bool* variable ); | 111 | void set_bool(char* string, bool* variable ); |
111 | void set_option(char* string, int* variable, char* options[], int numoptions ); | 112 | void set_option(char* string, int* variable, char* options[], int numoptions ); |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index e1bfad4939..47efb1e55d 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -39,13 +39,14 @@ | |||
39 | 39 | ||
40 | static Menu show_hidden_files(void) | 40 | static Menu show_hidden_files(void) |
41 | { | 41 | { |
42 | set_bool( "[Show hidden files]", &global_settings.show_hidden_files ); | 42 | set_bool_options( "Hidden Files", &global_settings.show_hidden_files, |
43 | "show", "hide" ); | ||
43 | return MENU_OK; | 44 | return MENU_OK; |
44 | } | 45 | } |
45 | 46 | ||
46 | static Menu contrast(void) | 47 | static Menu contrast(void) |
47 | { | 48 | { |
48 | set_int( "[Contrast]", "", &global_settings.contrast, | 49 | set_int( "Contrast", "", &global_settings.contrast, |
49 | lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING ); | 50 | lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING ); |
50 | return MENU_OK; | 51 | return MENU_OK; |
51 | } | 52 | } |
@@ -53,27 +54,27 @@ static Menu contrast(void) | |||
53 | #ifndef HAVE_RECORDER_KEYPAD | 54 | #ifndef HAVE_RECORDER_KEYPAD |
54 | static Menu shuffle(void) | 55 | static Menu shuffle(void) |
55 | { | 56 | { |
56 | set_bool( "[Shuffle]", &global_settings.playlist_shuffle ); | 57 | set_bool( "Shuffle", &global_settings.playlist_shuffle ); |
57 | return MENU_OK; | 58 | return MENU_OK; |
58 | } | 59 | } |
59 | #endif | 60 | #endif |
60 | 61 | ||
61 | static Menu mp3_filter(void) | 62 | static Menu mp3_filter(void) |
62 | { | 63 | { |
63 | set_bool( "[MP3/M3U filter]", &global_settings.mp3filter ); | 64 | set_bool( "Music Filter", &global_settings.mp3filter ); |
64 | return MENU_OK; | 65 | return MENU_OK; |
65 | } | 66 | } |
66 | 67 | ||
67 | static Menu sort_case(void) | 68 | static Menu sort_case(void) |
68 | { | 69 | { |
69 | set_bool( "[Sort case sensitive]", &global_settings.sort_case ); | 70 | set_bool( "Sort Case Sensitive", &global_settings.sort_case ); |
70 | return MENU_OK; | 71 | return MENU_OK; |
71 | } | 72 | } |
72 | 73 | ||
73 | static Menu resume(void) | 74 | static Menu resume(void) |
74 | { | 75 | { |
75 | char* names[] = { "off", "ask", "on " }; | 76 | char* names[] = { "off", "ask", "on " }; |
76 | set_option( "[Resume]", &global_settings.resume, names, 3 ); | 77 | set_option( "Resume", &global_settings.resume, names, 3 ); |
77 | return MENU_OK; | 78 | return MENU_OK; |
78 | } | 79 | } |
79 | 80 | ||
@@ -84,14 +85,14 @@ static Menu backlight_timer(void) | |||
84 | "6s ", "7s ", "8s ", "9s ", "10s", | 85 | "6s ", "7s ", "8s ", "9s ", "10s", |
85 | "15s", "20s", "25s", "30s", "45s", | 86 | "15s", "20s", "25s", "30s", "45s", |
86 | "60s", "90s"}; | 87 | "60s", "90s"}; |
87 | set_option("[Backlight]", &global_settings.backlight, names, 19 ); | 88 | set_option("Backlight", &global_settings.backlight, names, 19 ); |
88 | backlight_time(global_settings.backlight); | 89 | backlight_time(global_settings.backlight); |
89 | return MENU_OK; | 90 | return MENU_OK; |
90 | } | 91 | } |
91 | 92 | ||
92 | static Menu scroll_speed(void) | 93 | static Menu scroll_speed(void) |
93 | { | 94 | { |
94 | set_int("Scroll speed indicator... ", "", &global_settings.scroll_speed, | 95 | set_int("Scroll Speed", "", &global_settings.scroll_speed, |
95 | &lcd_scroll_speed, 1, 1, 20 ); | 96 | &lcd_scroll_speed, 1, 1, 20 ); |
96 | return MENU_OK; | 97 | return MENU_OK; |
97 | } | 98 | } |
@@ -99,7 +100,7 @@ static Menu scroll_speed(void) | |||
99 | #ifdef HAVE_CHARGE_CTRL | 100 | #ifdef HAVE_CHARGE_CTRL |
100 | static Menu deep_discharge(void) | 101 | static Menu deep_discharge(void) |
101 | { | 102 | { |
102 | set_bool( "[Deep discharge]", &global_settings.discharge ); | 103 | set_bool( "Deep Discharge", &global_settings.discharge ); |
103 | charge_restart_level = global_settings.discharge ? | 104 | charge_restart_level = global_settings.discharge ? |
104 | CHARGE_RESTART_LO : CHARGE_RESTART_HI; | 105 | CHARGE_RESTART_LO : CHARGE_RESTART_HI; |
105 | return MENU_OK; | 106 | return MENU_OK; |
@@ -133,7 +134,7 @@ static Menu timedate_set(void) | |||
133 | timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); | 134 | timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); |
134 | 135 | ||
135 | 136 | ||
136 | set_time("[Set time/date]",timedate); | 137 | set_time("Set time/date",timedate); |
137 | 138 | ||
138 | if(timedate[0] != -1) { | 139 | if(timedate[0] != -1) { |
139 | /* hour */ | 140 | /* hour */ |
@@ -164,7 +165,7 @@ static Menu timedate_set(void) | |||
164 | 165 | ||
165 | static Menu spindown(void) | 166 | static Menu spindown(void) |
166 | { | 167 | { |
167 | set_int("[Disk spindown]", "s", &global_settings.disk_spindown, | 168 | set_int("Disk Spindown", "s", &global_settings.disk_spindown, |
168 | ata_spindown, 1, 3, 254 ); | 169 | ata_spindown, 1, 3, 254 ); |
169 | return MENU_OK; | 170 | return MENU_OK; |
170 | } | 171 | } |
@@ -175,7 +176,7 @@ static Menu ff_rewind_min_step(void) | |||
175 | "5s ", "6s ", "8s ", "10s", | 176 | "5s ", "6s ", "8s ", "10s", |
176 | "15s", "20s", "25s", "30s", | 177 | "15s", "20s", "25s", "30s", |
177 | "45s", "60s" }; | 178 | "45s", "60s" }; |
178 | set_option("[FF/rewind min step]", &global_settings.ff_rewind_min_step, | 179 | set_option("FF/RW Min Step", &global_settings.ff_rewind_min_step, |
179 | names, 14 ); | 180 | names, 14 ); |
180 | return MENU_OK; | 181 | return MENU_OK; |
181 | } | 182 | } |
@@ -186,7 +187,7 @@ static Menu ff_rewind_accel(void) | |||
186 | "2x/4s ", "2x/5s ", "2x/6s ", "2x/7s ", | 187 | "2x/4s ", "2x/5s ", "2x/6s ", "2x/7s ", |
187 | "2x/8s ", "2x/9s ", "2x/10s", "2x/11s", | 188 | "2x/8s ", "2x/9s ", "2x/10s", "2x/11s", |
188 | "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; | 189 | "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; |
189 | set_option("[FF/rewind accel]", &global_settings.ff_rewind_accel, | 190 | set_option("FF/RW Accel", &global_settings.ff_rewind_accel, |
190 | names, 16 ); | 191 | names, 16 ); |
191 | return MENU_OK; | 192 | return MENU_OK; |
192 | } | 193 | } |
@@ -197,25 +198,30 @@ Menu settings_menu(void) | |||
197 | Menu result; | 198 | Menu result; |
198 | 199 | ||
199 | struct menu_items items[] = { | 200 | struct menu_items items[] = { |
201 | { "Playback", playback_settings_menu }, | ||
202 | { "File View", fileview_settings_menu }, | ||
203 | { "Display", display_settings_menu }, | ||
204 | { "System", system_settings_menu }, | ||
205 | }; | ||
206 | |||
207 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | ||
208 | result = menu_run(m); | ||
209 | menu_exit(m); | ||
210 | return result; | ||
211 | } | ||
212 | |||
213 | Menu playback_settings_menu(void) | ||
214 | { | ||
215 | int m; | ||
216 | Menu result; | ||
217 | |||
218 | struct menu_items items[] = { | ||
200 | #ifndef HAVE_RECORDER_KEYPAD | 219 | #ifndef HAVE_RECORDER_KEYPAD |
201 | { "Shuffle", shuffle }, | 220 | { "Shuffle", shuffle }, |
202 | #endif | ||
203 | { "MP3/M3U filter", mp3_filter }, | ||
204 | { "Sort mode", sort_case }, | ||
205 | { "Backlight Timer", backlight_timer }, | ||
206 | { "Contrast", contrast }, | ||
207 | { "Scroll speed", scroll_speed }, | ||
208 | #ifdef HAVE_CHARGE_CTRL | ||
209 | { "Deep discharge", deep_discharge }, | ||
210 | #endif | 221 | #endif |
211 | #ifdef HAVE_RTC | 222 | { "Resume", resume }, |
212 | { "Time/Date", timedate_set }, | 223 | { "FF/RW Min Step", ff_rewind_min_step }, |
213 | #endif | 224 | { "FF/RW Accel", ff_rewind_accel }, |
214 | { "Show hidden files", show_hidden_files }, | ||
215 | { "FF/Rewind Min Step", ff_rewind_min_step }, | ||
216 | { "FF/Rewind Accel", ff_rewind_accel }, | ||
217 | { "Resume", resume }, | ||
218 | { "Disk spindown", spindown }, | ||
219 | }; | 225 | }; |
220 | bool old_shuffle = global_settings.playlist_shuffle; | 226 | bool old_shuffle = global_settings.playlist_shuffle; |
221 | 227 | ||
@@ -236,3 +242,58 @@ Menu settings_menu(void) | |||
236 | } | 242 | } |
237 | return result; | 243 | return result; |
238 | } | 244 | } |
245 | |||
246 | Menu fileview_settings_menu(void) | ||
247 | { | ||
248 | int m; | ||
249 | Menu result; | ||
250 | |||
251 | struct menu_items items[] = { | ||
252 | { "Sort Mode", sort_case }, | ||
253 | { "Music Filter", mp3_filter }, | ||
254 | { "Hidden Files", show_hidden_files }, | ||
255 | }; | ||
256 | |||
257 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | ||
258 | result = menu_run(m); | ||
259 | menu_exit(m); | ||
260 | return result; | ||
261 | } | ||
262 | |||
263 | Menu display_settings_menu(void) | ||
264 | { | ||
265 | int m; | ||
266 | Menu result; | ||
267 | |||
268 | struct menu_items items[] = { | ||
269 | { "Scroll Speed", scroll_speed }, | ||
270 | { "Backlight", backlight_timer }, | ||
271 | { "Contrast", contrast }, | ||
272 | }; | ||
273 | |||
274 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | ||
275 | result = menu_run(m); | ||
276 | menu_exit(m); | ||
277 | return result; | ||
278 | } | ||
279 | |||
280 | Menu system_settings_menu(void) | ||
281 | { | ||
282 | int m; | ||
283 | Menu result; | ||
284 | |||
285 | struct menu_items items[] = { | ||
286 | { "Disk Spindown", spindown }, | ||
287 | #ifdef HAVE_CHARGE_CTRL | ||
288 | { "Deep Discharge", deep_discharge }, | ||
289 | #endif | ||
290 | #ifdef HAVE_RTC | ||
291 | { "Time/Date", timedate_set }, | ||
292 | #endif | ||
293 | }; | ||
294 | |||
295 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | ||
296 | result = menu_run(m); | ||
297 | menu_exit(m); | ||
298 | return result; | ||
299 | } | ||
diff --git a/apps/settings_menu.h b/apps/settings_menu.h index 19cffaccae..5654512ac7 100644 --- a/apps/settings_menu.h +++ b/apps/settings_menu.h | |||
@@ -21,6 +21,10 @@ | |||
21 | 21 | ||
22 | #include "menu.h" | 22 | #include "menu.h" |
23 | 23 | ||
24 | Menu playback_settings_menu(void); | ||
25 | Menu fileview_settings_menu(void); | ||
26 | Menu display_settings_menu(void); | ||
27 | Menu system_settings_menu(void); | ||
24 | Menu settings_menu(void); | 28 | Menu settings_menu(void); |
25 | 29 | ||
26 | #endif | 30 | #endif |