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.c115
1 files changed, 60 insertions, 55 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index d40263cd00..678eda437e 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -36,17 +36,18 @@
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 "lang.h"
39 40
40static Menu show_hidden_files(void) 41static Menu show_hidden_files(void)
41{ 42{
42 set_bool_options( "Hidden Files", &global_settings.show_hidden_files, 43 set_bool_options( str(LANG_HIDDEN), &global_settings.show_hidden_files,
43 "show", "hide" ); 44 str(LANG_HIDDEN_SHOW), str(LANG_HIDDEN_HIDE) );
44 return MENU_OK; 45 return MENU_OK;
45} 46}
46 47
47static Menu contrast(void) 48static Menu contrast(void)
48{ 49{
49 set_int( "Contrast", "", &global_settings.contrast, 50 set_int( str(LANG_CONTRAST), "", &global_settings.contrast,
50 lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING ); 51 lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING );
51 return MENU_OK; 52 return MENU_OK;
52} 53}
@@ -54,50 +55,53 @@ static Menu contrast(void)
54#ifndef HAVE_RECORDER_KEYPAD 55#ifndef HAVE_RECORDER_KEYPAD
55static Menu shuffle(void) 56static Menu shuffle(void)
56{ 57{
57 set_bool( "Shuffle", &global_settings.playlist_shuffle ); 58 set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle );
58 return MENU_OK; 59 return MENU_OK;
59} 60}
60#endif 61#endif
61 62
62static Menu play_selected(void) 63static Menu play_selected(void)
63{ 64{
64 set_bool( "Play Selected", &global_settings.play_selected ); 65 set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected );
65 return MENU_OK; 66 return MENU_OK;
66} 67}
67 68
68static Menu mp3_filter(void) 69static Menu mp3_filter(void)
69{ 70{
70 set_bool( "Music Filter", &global_settings.mp3filter ); 71 set_bool( str(LANG_MP3FILTER), &global_settings.mp3filter );
71 return MENU_OK; 72 return MENU_OK;
72} 73}
73 74
74static Menu sort_case(void) 75static Menu sort_case(void)
75{ 76{
76 set_bool( "Sort Case Sensitive", &global_settings.sort_case ); 77 set_bool( str(LANG_SORT_CASE), &global_settings.sort_case );
77 return MENU_OK; 78 return MENU_OK;
78} 79}
79 80
80static Menu resume(void) 81static Menu resume(void)
81{ 82{
82 char* names[] = { "off", "ask", "on" }; 83 char* names[] = { str(LANG_OFF),
83 set_option( "Resume", &global_settings.resume, names, 3, NULL ); 84 str(LANG_RESUME_SETTING_ASK),
85 str(LANG_ON) };
86 set_option( str(LANG_RESUME), &global_settings.resume, names, 3, NULL );
84 return MENU_OK; 87 return MENU_OK;
85} 88}
86 89
87static Menu backlight_timer(void) 90static Menu backlight_timer(void)
88{ 91{
89 char* names[] = { "off", "on ", 92 char* names[] = { str(LANG_OFF), str(LANG_ON),
90 "1s ", "2s ", "3s ", "4s ", "5s ", 93 "1s ", "2s ", "3s ", "4s ", "5s ",
91 "6s ", "7s ", "8s ", "9s ", "10s", 94 "6s ", "7s ", "8s ", "9s ", "10s",
92 "15s", "20s", "25s", "30s", "45s", 95 "15s", "20s", "25s", "30s", "45s",
93 "60s", "90s"}; 96 "60s", "90s"};
94 set_option("Backlight", &global_settings.backlight, names, 19, backlight_time ); 97 set_option(str(LANG_BACKLIGHT), &global_settings.backlight, names, 19,
98 backlight_time );
95 return MENU_OK; 99 return MENU_OK;
96} 100}
97 101
98static Menu scroll_speed(void) 102static Menu scroll_speed(void)
99{ 103{
100 set_int("Scroll Speed Setting Example", "", &global_settings.scroll_speed, 104 set_int(str(LANG_SCROLL), "", &global_settings.scroll_speed,
101 &lcd_scroll_speed, 1, 1, 30 ); 105 &lcd_scroll_speed, 1, 1, 30 );
102 return MENU_OK; 106 return MENU_OK;
103} 107}
@@ -105,7 +109,7 @@ static Menu scroll_speed(void)
105#ifdef HAVE_CHARGE_CTRL 109#ifdef HAVE_CHARGE_CTRL
106static Menu deep_discharge(void) 110static Menu deep_discharge(void)
107{ 111{
108 set_bool( "Deep Discharge", &global_settings.discharge ); 112 set_bool( str(LANG_DISCHARGE), &global_settings.discharge );
109 charge_restart_level = global_settings.discharge ? 113 charge_restart_level = global_settings.discharge ?
110 CHARGE_RESTART_LO : CHARGE_RESTART_HI; 114 CHARGE_RESTART_LO : CHARGE_RESTART_HI;
111 return MENU_OK; 115 return MENU_OK;
@@ -139,7 +143,7 @@ static Menu timedate_set(void)
139 timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); 143 timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f);
140 144
141 145
142 set_time("Set time/date",timedate); 146 set_time(str(LANG_TIME),timedate);
143 147
144 if(timedate[0] != -1) { 148 if(timedate[0] != -1) {
145 /* hour */ 149 /* hour */
@@ -155,14 +159,14 @@ static Menu timedate_set(void)
155 /* day */ 159 /* day */
156 timedate[5] = ((timedate[5]/10) << 4 | timedate[5]%10) & 0x3f; 160 timedate[5] = ((timedate[5]/10) << 4 | timedate[5]%10) & 0x3f;
157 161
158 rtc_write(0x03, timedate[0] | (rtc_read(0x03) & 0xc0)); /* hour */ 162 rtc_write(0x03, timedate[0] | (rtc_read(0x03) & 0xc0)); /* hour */
159 rtc_write(0x02, timedate[1] | (rtc_read(0x02) & 0x80)); /* minute */ 163 rtc_write(0x02, timedate[1] | (rtc_read(0x02) & 0x80)); /* minute */
160 rtc_write(0x01, timedate[2] | (rtc_read(0x01) & 0x80)); /* second */ 164 rtc_write(0x01, timedate[2] | (rtc_read(0x01) & 0x80)); /* second */
161 rtc_write(0x07, timedate[3]); /* year */ 165 rtc_write(0x07, timedate[3]); /* year */
162 rtc_write(0x06, timedate[4] | (rtc_read(0x06) & 0xe0)); /* month */ 166 rtc_write(0x06, timedate[4] | (rtc_read(0x06) & 0xe0)); /* month */
163 rtc_write(0x05, timedate[5] | (rtc_read(0x05) & 0xc0)); /* day */ 167 rtc_write(0x05, timedate[5] | (rtc_read(0x05) & 0xc0)); /* day */
164 rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */ 168 rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */
165 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ 169 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */
166 } 170 }
167 return MENU_OK; 171 return MENU_OK;
168} 172}
@@ -170,7 +174,7 @@ static Menu timedate_set(void)
170 174
171static Menu spindown(void) 175static Menu spindown(void)
172{ 176{
173 set_int("Disk Spindown", "s", &global_settings.disk_spindown, 177 set_int(str(LANG_SPINDOWN), "s", &global_settings.disk_spindown,
174 ata_spindown, 1, 3, 254 ); 178 ata_spindown, 1, 3, 254 );
175 return MENU_OK; 179 return MENU_OK;
176} 180}
@@ -181,25 +185,25 @@ static Menu ff_rewind_min_step(void)
181 "5s", "6s", "8s", "10s", 185 "5s", "6s", "8s", "10s",
182 "15s", "20s", "25s", "30s", 186 "15s", "20s", "25s", "30s",
183 "45s", "60s" }; 187 "45s", "60s" };
184 set_option("FF/RW Min Step", &global_settings.ff_rewind_min_step, 188 set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step,
185 names, 14, NULL ); 189 names, 14, NULL );
186 return MENU_OK; 190 return MENU_OK;
187} 191}
188 192
189static Menu ff_rewind_accel(void) 193static Menu ff_rewind_accel(void)
190{ 194{
191 char* names[] = { "off", "2x/1s", "2x/2s", "2x/3s", 195 char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s",
192 "2x/4s", "2x/5s", "2x/6s", "2x/7s", 196 "2x/4s", "2x/5s", "2x/6s", "2x/7s",
193 "2x/8s", "2x/9s", "2x/10s", "2x/11s", 197 "2x/8s", "2x/9s", "2x/10s", "2x/11s",
194 "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; 198 "2x/12s", "2x/13s", "2x/14s", "2x/15s", };
195 set_option("FF/RW Accel", &global_settings.ff_rewind_accel, 199 set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel,
196 names, 16, NULL ); 200 names, 16, NULL );
197 return MENU_OK; 201 return MENU_OK;
198} 202}
199 203
200static Menu browse_current(void) 204static Menu browse_current(void)
201{ 205{
202 set_bool( "Follow Playlist", &global_settings.browse_current ); 206 set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
203 return MENU_OK; 207 return MENU_OK;
204} 208}
205 209
@@ -210,13 +214,14 @@ Menu playback_settings_menu(void)
210 214
211 struct menu_items items[] = { 215 struct menu_items items[] = {
212#ifndef HAVE_RECORDER_KEYPAD 216#ifndef HAVE_RECORDER_KEYPAD
213 { "Shuffle", shuffle }, 217 { str(LANG_SHUFFLE), shuffle },
214#endif 218#endif
215 { "Play Selected", play_selected }, 219 { str(LANG_PLAY_SELECTED), play_selected },
216 { "Resume", resume }, 220 { str(LANG_RESUME), resume },
217 { "FF/RW Min Step", ff_rewind_min_step }, 221 { str(LANG_FFRW_STEP), ff_rewind_min_step },
218 { "FF/RW Accel", ff_rewind_accel }, 222 { str(LANG_FFRW_ACCEL), ff_rewind_accel },
219 }; 223 };
224
220 bool old_shuffle = global_settings.playlist_shuffle; 225 bool old_shuffle = global_settings.playlist_shuffle;
221 226
222 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 227 m=menu_init( items, sizeof items / sizeof(struct menu_items) );
@@ -243,26 +248,26 @@ static Menu reset_settings(void)
243 248
244 lcd_clear_display(); 249 lcd_clear_display();
245#ifdef HAVE_LCD_CHARCELLS 250#ifdef HAVE_LCD_CHARCELLS
246 lcd_puts(0,0,"Really?"); 251 lcd_puts(0,0,str(LANG_RESET_ASK_PLAYER));
247 lcd_puts(0,1,"Play/Stop"); 252 lcd_puts(0,1,str(LANG_RESET_CONFIRM_PLAYER));
248#else 253#else
249 lcd_puts(0,0,"Are you sure?"); 254 lcd_puts(0,0,str(LANG_RESET_ASK_RECORDER));
250 lcd_puts(0,1,"Play = Yes"); 255 lcd_puts(0,1,str(LANG_RESET_CONFIRM_RECORDER));
251 lcd_puts(0,2,"Any Other = No"); 256 lcd_puts(0,2,str(LANG_RESET_CANCEL_RECORDER));
252#endif 257#endif
253 lcd_update(); 258 lcd_update();
254 button = button_get(true); 259 button = button_get(true);
255 if (button == BUTTON_PLAY) { 260 if (button == BUTTON_PLAY) {
256 settings_reset(); 261 settings_reset();
257 lcd_clear_display(); 262 lcd_clear_display();
258 lcd_puts(0,0,"Settings"); 263 lcd_puts(0,0,str(LANG_RESET_DONE_SETTING));
259 lcd_puts(0,1,"Cleared"); 264 lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR));
260 lcd_update(); 265 lcd_update();
261 sleep(HZ); 266 sleep(HZ);
262 return(true); 267 return(true);
263 } else { 268 } else {
264 lcd_clear_display(); 269 lcd_clear_display();
265 lcd_puts(0,0,"Canceled"); 270 lcd_puts(0,0,str(LANG_RESET_DONE_CANCEL));
266 lcd_update(); 271 lcd_update();
267 sleep(HZ); 272 sleep(HZ);
268 return(false); 273 return(false);
@@ -275,10 +280,10 @@ static Menu fileview_settings_menu(void)
275 Menu result; 280 Menu result;
276 281
277 struct menu_items items[] = { 282 struct menu_items items[] = {
278 { "Sort Mode", sort_case }, 283 { str(LANG_CASE_MENU), sort_case },
279 { "Music Filter", mp3_filter }, 284 { str(LANG_MP3FILTER), mp3_filter },
280 { "Hidden Files", show_hidden_files }, 285 { str(LANG_HIDDEN), show_hidden_files },
281 { "Follow Playlist", browse_current }, 286 { str(LANG_FOLLOW), browse_current },
282 }; 287 };
283 288
284 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 289 m=menu_init( items, sizeof items / sizeof(struct menu_items) );
@@ -293,9 +298,9 @@ static Menu display_settings_menu(void)
293 Menu result; 298 Menu result;
294 299
295 struct menu_items items[] = { 300 struct menu_items items[] = {
296 { "Scroll Speed", scroll_speed }, 301 { str(LANG_SCROLL_MENU), scroll_speed },
297 { "Backlight", backlight_timer }, 302 { str(LANG_BACKLIGHT), backlight_timer },
298 { "Contrast", contrast }, 303 { str(LANG_CONTRAST), contrast },
299 }; 304 };
300 305
301 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 306 m=menu_init( items, sizeof items / sizeof(struct menu_items) );
@@ -310,14 +315,14 @@ static Menu system_settings_menu(void)
310 Menu result; 315 Menu result;
311 316
312 struct menu_items items[] = { 317 struct menu_items items[] = {
313 { "Disk Spindown", spindown }, 318 { str(LANG_SPINDOWN), spindown },
314#ifdef HAVE_CHARGE_CTRL 319#ifdef HAVE_CHARGE_CTRL
315 { "Deep Discharge", deep_discharge }, 320 { str(LANG_DISCHARGE), deep_discharge },
316#endif 321#endif
317#ifdef HAVE_RTC 322#ifdef HAVE_RTC
318 { "Time/Date", timedate_set }, 323 { str(LANG_TIME), timedate_set },
319#endif 324#endif
320 { "Reset settings", reset_settings }, 325 { str(LANG_RESET), reset_settings },
321 }; 326 };
322 327
323 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 328 m=menu_init( items, sizeof items / sizeof(struct menu_items) );
@@ -332,10 +337,10 @@ Menu settings_menu(void)
332 Menu result; 337 Menu result;
333 338
334 struct menu_items items[] = { 339 struct menu_items items[] = {
335 { "Playback", playback_settings_menu }, 340 { str(LANG_PLAYBACK), playback_settings_menu },
336 { "File View", fileview_settings_menu }, 341 { str(LANG_FILE), fileview_settings_menu },
337 { "Display", display_settings_menu }, 342 { str(LANG_DISPLAY), display_settings_menu },
338 { "System", system_settings_menu }, 343 { str(LANG_SYSTEM), system_settings_menu },
339 }; 344 };
340 345
341 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 346 m=menu_init( items, sizeof items / sizeof(struct menu_items) );