summaryrefslogtreecommitdiff
path: root/apps/menus/settings_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/menus/settings_menu.c')
-rw-r--r--apps/menus/settings_menu.c109
1 files changed, 0 insertions, 109 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index ebba295570..6bb032d169 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -212,109 +212,9 @@ MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0, Icon_NOICON,
212 ); 212 );
213#endif 213#endif
214 214
215/* Time & Date */
216#if CONFIG_RTC
217static int timedate_set(void)
218{
219 struct tm tm;
220 int result;
221
222 /* Make a local copy of the time struct */
223 memcpy(&tm, get_time(), sizeof(struct tm));
224
225 /* do some range checks */
226 /* This prevents problems with time/date setting after a power loss */
227 if (!valid_time(&tm))
228 {
229/* Macros to convert a 2-digit string to a decimal constant.
230 (YEAR), MONTH and DAY are set by the date command, which outputs
231 DAY as 00..31 and MONTH as 01..12. The leading zero would lead to
232 misinterpretation as an octal constant. */
233#define S100(x) 1 ## x
234#define C2DIG2DEC(x) (S100(x)-100)
235
236 tm.tm_hour = 0;
237 tm.tm_min = 0;
238 tm.tm_sec = 0;
239 tm.tm_mday = C2DIG2DEC(DAY);
240 tm.tm_mon = C2DIG2DEC(MONTH)-1;
241 tm.tm_wday = 1;
242 tm.tm_year = YEAR-1900;
243 }
244
245 result = (int)set_time_screen(str(LANG_SET_TIME), &tm);
246
247 if(tm.tm_year != -1) {
248 set_time(&tm);
249 }
250 return result;
251}
252
253MENUITEM_FUNCTION(time_set, 0, ID2P(LANG_SET_TIME),
254 timedate_set, NULL, NULL, Icon_NOICON);
255MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
256MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, Icon_NOICON, &time_set, &timeformat);
257#endif
258
259/* System menu */ 215/* System menu */
260MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL); 216MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
261 217
262#ifdef HAVE_RTC_ALARM
263MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU),
264 (menu_function)alarm_screen, NULL, NULL, Icon_NOICON);
265#if CONFIG_TUNER || defined(HAVE_RECORDING)
266
267#if CONFIG_TUNER && !defined(HAVE_RECORDING)
268/* This need only be shown if we dont have recording, because if we do
269 then always show the setting item, because there will always be at least
270 2 items */
271static int alarm_callback(int action,const struct menu_item_ex *this_item)
272{
273 (void)this_item;
274 switch (action)
275 {
276 case ACTION_REQUEST_MENUITEM:
277 if (radio_hardware_present() == 0)
278 return ACTION_EXIT_MENUITEM;
279 break;
280 }
281 return action;
282}
283#else
284#define alarm_callback NULL
285#endif /* CONFIG_TUNER && !HAVE_RECORDING */
286/* have to do this manually because the setting screen
287 doesnt handle variable item count */
288static int alarm_setting(void)
289{
290 struct opt_items items[ALARM_START_COUNT];
291 int i = 0;
292 items[i].string = str(LANG_RESUME_PLAYBACK);
293 items[i].voice_id = LANG_RESUME_PLAYBACK;
294 i++;
295#if CONFIG_TUNER
296 if (radio_hardware_present())
297 {
298 items[i].string = str(LANG_FM_RADIO);
299 items[i].voice_id = LANG_FM_RADIO;
300 i++;
301 }
302#endif
303#ifdef HAVE_RECORDING
304 items[i].string = str(LANG_RECORDING);
305 items[i].voice_id = LANG_RECORDING;
306 i++;
307#endif
308 return set_option(str(LANG_ALARM_WAKEUP_SCREEN),
309 &global_settings.alarm_wake_up_screen,
310 INT, items, i, NULL);
311}
312
313MENUITEM_FUNCTION(alarm_wake_up_screen, 0, ID2P(LANG_ALARM_WAKEUP_SCREEN),
314 alarm_setting, NULL, alarm_callback, Icon_Menu_setting);
315#endif /* CONFIG_TUNER || defined(HAVE_RECORDING) */
316#endif /* HAVE_RTC_ALARM */
317
318/* Limits menu */ 218/* Limits menu */
319MENUITEM_SETTING(max_files_in_dir, &global_settings.max_files_in_dir, NULL); 219MENUITEM_SETTING(max_files_in_dir, &global_settings.max_files_in_dir, NULL);
320MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL); 220MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL);
@@ -378,16 +278,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
378#if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE) 278#if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
379 &disk_menu, 279 &disk_menu,
380#endif 280#endif
381#if CONFIG_RTC
382 &time_menu,
383#endif
384 &poweroff, 281 &poweroff,
385#ifdef HAVE_RTC_ALARM
386 &alarm_screen_call,
387#if defined(HAVE_RECORDING) || CONFIG_TUNER
388 &alarm_wake_up_screen,
389#endif
390#endif
391 &limits_menu, 282 &limits_menu,
392#if CONFIG_CODEC == MAS3507D 283#if CONFIG_CODEC == MAS3507D
393 &line_in, 284 &line_in,