diff options
-rw-r--r-- | apps/settings_menu.c | 118 |
1 files changed, 76 insertions, 42 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 5d130e9cda..f825c03944 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -31,11 +31,12 @@ | |||
31 | #include "settings.h" | 31 | #include "settings.h" |
32 | #include "settings_menu.h" | 32 | #include "settings_menu.h" |
33 | #include "backlight.h" | 33 | #include "backlight.h" |
34 | #include "playlist.h" /* for playlist_shuffle */ | 34 | #include "playlist.h" /* for playlist_shuffle */ |
35 | #include "fat.h" /* For dotfile settings */ | 35 | #include "fat.h" /* For dotfile settings */ |
36 | #include "powermgmt.h" | 36 | #include "powermgmt.h" |
37 | #include "rtc.h" | 37 | #include "rtc.h" |
38 | #include "ata.h" | 38 | #include "ata.h" |
39 | #include "usb.h" | ||
39 | #ifdef HAVE_LCD_BITMAP | 40 | #ifdef HAVE_LCD_BITMAP |
40 | #include "peakmeter.h" | 41 | #include "peakmeter.h" |
41 | #endif | 42 | #endif |
@@ -51,41 +52,45 @@ static bool contrast(void) | |||
51 | /** | 52 | /** |
52 | * Menu to set the hold time of normal peaks. | 53 | * Menu to set the hold time of normal peaks. |
53 | */ | 54 | */ |
54 | static bool peak_meter_hold(void) { | 55 | static bool peak_meter_hold(void) |
56 | { | ||
55 | char* names[] = { str(LANG_OFF), | 57 | char* names[] = { str(LANG_OFF), |
56 | "200 ms ", "300 ms ", "500 ms ", "1 s ", "2 s ", | 58 | "200 ms ", "300 ms ", "500 ms ", "1 s ", "2 s ", |
57 | "3 s ", "4 s ", "5 s ", "6 s ", "7 s", | 59 | "3 s ", "4 s ", "5 s ", "6 s ", "7 s", |
58 | "8 s", "9 s", "10 s", "15 s", "20 s", | 60 | "8 s", "9 s", "10 s", "15 s", "20 s", |
59 | "30 s", "1 min" | 61 | "30 s", "1 min" |
60 | }; | 62 | }; |
61 | return set_option( str(LANG_PM_PEAK_HOLD), | 63 | return set_option( str(LANG_PM_PEAK_HOLD), |
62 | &global_settings.peak_meter_hold, names, | 64 | &global_settings.peak_meter_hold, names, |
63 | 18, NULL); | 65 | 18, NULL); |
64 | } | 66 | } |
65 | 67 | ||
66 | /** | 68 | /** |
67 | * Menu to set the hold time of clips. | 69 | * Menu to set the hold time of clips. |
68 | */ | 70 | */ |
69 | static bool peak_meter_clip_hold(void) { | 71 | static bool peak_meter_clip_hold(void) |
72 | { | ||
70 | char* names[] = { str(LANG_PM_ETERNAL), | 73 | char* names[] = { str(LANG_PM_ETERNAL), |
71 | "1s ", "2s ", "3s ", "4s ", "5s ", | 74 | "1s ", "2s ", "3s ", "4s ", "5s ", |
72 | "6s ", "7s ", "8s ", "9s ", "10s", | 75 | "6s ", "7s ", "8s ", "9s ", "10s", |
73 | "15s", "20s", "25s", "30s", "45s", | 76 | "15s", "20s", "25s", "30s", "45s", |
74 | "60s", "90s", "2min", "3min", "5min", | 77 | "60s", "90s", "2min", "3min", "5min", |
75 | "10min", "20min", "45min", "90min" | 78 | "10min", "20min", "45min", "90min" |
76 | }; | 79 | }; |
80 | |||
77 | return set_option( str(LANG_PM_CLIP_HOLD), | 81 | return set_option( str(LANG_PM_CLIP_HOLD), |
78 | &global_settings.peak_meter_clip_hold, names, | 82 | &global_settings.peak_meter_clip_hold, names, |
79 | 25, peak_meter_set_clip_hold); | 83 | 25, peak_meter_set_clip_hold); |
80 | } | 84 | } |
81 | 85 | ||
82 | /** | 86 | /** |
83 | * Menu to set the release time of the peak meter. | 87 | * Menu to set the release time of the peak meter. |
84 | */ | 88 | */ |
85 | static bool peak_meter_release(void) { | 89 | static bool peak_meter_release(void) |
90 | { | ||
86 | return set_int( str(LANG_PM_RELEASE), str(LANG_PM_UNITS_PER_READ), | 91 | return set_int( str(LANG_PM_RELEASE), str(LANG_PM_UNITS_PER_READ), |
87 | &global_settings.peak_meter_release, | 92 | &global_settings.peak_meter_release, |
88 | NULL, 1, 1, LCD_WIDTH); | 93 | NULL, 1, 1, LCD_WIDTH); |
89 | } | 94 | } |
90 | 95 | ||
91 | /** | 96 | /** |
@@ -124,7 +129,7 @@ static bool repeat_mode(void) | |||
124 | int old_repeat = global_settings.repeat_mode; | 129 | int old_repeat = global_settings.repeat_mode; |
125 | 130 | ||
126 | result = set_option( str(LANG_REPEAT), &global_settings.repeat_mode, | 131 | result = set_option( str(LANG_REPEAT), &global_settings.repeat_mode, |
127 | names, 3, NULL ); | 132 | names, 3, NULL ); |
128 | 133 | ||
129 | if (old_repeat != global_settings.repeat_mode) | 134 | if (old_repeat != global_settings.repeat_mode) |
130 | mpeg_flush_and_reload_tracks(); | 135 | mpeg_flush_and_reload_tracks(); |
@@ -142,6 +147,7 @@ static bool dir_filter(void) | |||
142 | char* names[] = { str(LANG_FILTER_ALL), | 147 | char* names[] = { str(LANG_FILTER_ALL), |
143 | str(LANG_FILTER_SUPPORTED), | 148 | str(LANG_FILTER_SUPPORTED), |
144 | str(LANG_FILTER_MUSIC) }; | 149 | str(LANG_FILTER_MUSIC) }; |
150 | |||
145 | return set_option( str(LANG_FILTER), &global_settings.dirfilter, | 151 | return set_option( str(LANG_FILTER), &global_settings.dirfilter, |
146 | names, 3, NULL ); | 152 | names, 3, NULL ); |
147 | } | 153 | } |
@@ -156,6 +162,7 @@ static bool resume(void) | |||
156 | char* names[] = { str(LANG_SET_BOOL_NO), | 162 | char* names[] = { str(LANG_SET_BOOL_NO), |
157 | str(LANG_RESUME_SETTING_ASK), | 163 | str(LANG_RESUME_SETTING_ASK), |
158 | str(LANG_SET_BOOL_YES) }; | 164 | str(LANG_SET_BOOL_YES) }; |
165 | |||
159 | return set_option( str(LANG_RESUME), &global_settings.resume, | 166 | return set_option( str(LANG_RESUME), &global_settings.resume, |
160 | names, 3, NULL ); | 167 | names, 3, NULL ); |
161 | } | 168 | } |
@@ -175,6 +182,7 @@ static bool backlight_timer(void) | |||
175 | "6s ", "7s ", "8s ", "9s ", "10s", | 182 | "6s ", "7s ", "8s ", "9s ", "10s", |
176 | "15s", "20s", "25s", "30s", "45s", | 183 | "15s", "20s", "25s", "30s", "45s", |
177 | "60s", "90s"}; | 184 | "60s", "90s"}; |
185 | |||
178 | return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout, | 186 | return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout, |
179 | names, 19, backlight_set_timeout ); | 187 | names, 19, backlight_set_timeout ); |
180 | } | 188 | } |
@@ -185,6 +193,7 @@ static bool poweroff_idle_timer(void) | |||
185 | "1m ", "2m ", "3m ", "4m ", "5m ", | 193 | "1m ", "2m ", "3m ", "4m ", "5m ", |
186 | "6m ", "7m ", "8m ", "9m ", "10m", | 194 | "6m ", "7m ", "8m ", "9m ", "10m", |
187 | "15m", "30m", "45m", "60m"}; | 195 | "15m", "30m", "45m", "60m"}; |
196 | |||
188 | return set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff, | 197 | return set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff, |
189 | names, 15, set_poweroff_timeout); | 198 | names, 15, set_poweroff_timeout); |
190 | } | 199 | } |
@@ -290,6 +299,7 @@ static bool ff_rewind_min_step(void) | |||
290 | "5s", "6s", "8s", "10s", | 299 | "5s", "6s", "8s", "10s", |
291 | "15s", "20s", "25s", "30s", | 300 | "15s", "20s", "25s", "30s", |
292 | "45s", "60s" }; | 301 | "45s", "60s" }; |
302 | |||
293 | return set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step, | 303 | return set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step, |
294 | names, 14, NULL ); | 304 | names, 14, NULL ); |
295 | } | 305 | } |
@@ -300,6 +310,7 @@ static bool ff_rewind_accel(void) | |||
300 | "2x/4s", "2x/5s", "2x/6s", "2x/7s", | 310 | "2x/4s", "2x/5s", "2x/6s", "2x/7s", |
301 | "2x/8s", "2x/9s", "2x/10s", "2x/11s", | 311 | "2x/8s", "2x/9s", "2x/10s", "2x/11s", |
302 | "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; | 312 | "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; |
313 | |||
303 | return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel, | 314 | return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel, |
304 | names, 16, NULL ); | 315 | names, 16, NULL ); |
305 | } | 316 | } |
@@ -345,35 +356,52 @@ static bool playback_settings_menu(void) | |||
345 | 356 | ||
346 | static bool reset_settings(void) | 357 | static bool reset_settings(void) |
347 | { | 358 | { |
348 | int button = 0; | 359 | bool done=false; |
349 | 360 | int line; | |
361 | |||
350 | lcd_clear_display(); | 362 | lcd_clear_display(); |
363 | |||
351 | #ifdef HAVE_LCD_CHARCELLS | 364 | #ifdef HAVE_LCD_CHARCELLS |
352 | lcd_puts(0,0,str(LANG_RESET_ASK_PLAYER)); | 365 | line = 0; |
353 | lcd_puts(0,1,str(LANG_RESET_CONFIRM_PLAYER)); | ||
354 | #else | 366 | #else |
367 | line = 1; | ||
355 | lcd_puts(0,0,str(LANG_RESET_ASK_RECORDER)); | 368 | lcd_puts(0,0,str(LANG_RESET_ASK_RECORDER)); |
356 | lcd_puts(0,1,str(LANG_RESET_CONFIRM_RECORDER)); | ||
357 | lcd_puts(0,2,str(LANG_RESET_CANCEL_RECORDER)); | ||
358 | #endif | 369 | #endif |
370 | lcd_puts(0,line,str(LANG_RESET_CONFIRM)); | ||
371 | lcd_puts(0,line+1,str(LANG_RESET_CANCEL)); | ||
372 | |||
359 | lcd_update(); | 373 | lcd_update(); |
360 | button = button_get(true); | 374 | |
361 | if (button == BUTTON_PLAY) { | 375 | lcd_clear_display(); |
362 | settings_reset(); | 376 | |
363 | settings_apply(); | 377 | while(!done) { |
364 | lcd_clear_display(); | 378 | switch(button_get(true)) { |
365 | lcd_puts(0,0,str(LANG_RESET_DONE_SETTING)); | 379 | case BUTTON_PLAY: |
366 | lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR)); | 380 | settings_reset(); |
367 | lcd_update(); | 381 | settings_apply(); |
368 | sleep(HZ); | 382 | lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR)); |
369 | return(true); | 383 | done = true; |
370 | } else { | 384 | break; |
371 | lcd_clear_display(); | 385 | |
372 | lcd_puts(0,0,str(LANG_RESET_DONE_CANCEL)); | 386 | #ifdef HAVE_LCD_BITMAP |
373 | lcd_update(); | 387 | case BUTTON_OFF: |
374 | sleep(HZ); | 388 | #else |
375 | return(false); | 389 | case BUTTON_STOP: |
390 | #endif | ||
391 | lcd_puts(0,1,str(LANG_RESET_DONE_CANCEL)); | ||
392 | done = true; | ||
393 | break; | ||
394 | |||
395 | case SYS_USB_CONNECTED: | ||
396 | usb_screen(); | ||
397 | return true; | ||
398 | } | ||
376 | } | 399 | } |
400 | |||
401 | lcd_puts(0,0,str(LANG_RESET_DONE_SETTING)); | ||
402 | lcd_update(); | ||
403 | sleep(HZ); | ||
404 | return false; | ||
377 | } | 405 | } |
378 | 406 | ||
379 | static bool fileview_settings_menu(void) | 407 | static bool fileview_settings_menu(void) |
@@ -454,3 +482,9 @@ bool settings_menu(void) | |||
454 | menu_exit(m); | 482 | menu_exit(m); |
455 | return result; | 483 | return result; |
456 | } | 484 | } |
485 | |||
486 | /* ----------------------------------------------------------------- | ||
487 | * local variables: | ||
488 | * eval: (load-file "../firmware/rockbox-mode.el") | ||
489 | * end: | ||
490 | */ | ||