1
0
Fork 0
forked from len0rd/rockbox

FS#9173 - move all time/clock related settings in the menus into system > "time & date" (this includes sleep timer, alarm settings)

The time/date dispaly has been moved out of the "rockbox info" screen and into this screen also (only displayed if there is at least 3 lines of text on the screen though)
The time/date is talked in this screen by pressing the usual context-menu button (usually long-select)

Targets without a RTC are not changed (i.e sleep timer isnt moved)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19282 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2008-12-01 09:28:14 +00:00
parent a783453ff9
commit c7fec13fd8
7 changed files with 320 additions and 192 deletions

View file

@ -212,109 +212,9 @@ MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0, Icon_NOICON,
);
#endif
/* Time & Date */
#if CONFIG_RTC
static int timedate_set(void)
{
struct tm tm;
int result;
/* Make a local copy of the time struct */
memcpy(&tm, get_time(), sizeof(struct tm));
/* do some range checks */
/* This prevents problems with time/date setting after a power loss */
if (!valid_time(&tm))
{
/* Macros to convert a 2-digit string to a decimal constant.
(YEAR), MONTH and DAY are set by the date command, which outputs
DAY as 00..31 and MONTH as 01..12. The leading zero would lead to
misinterpretation as an octal constant. */
#define S100(x) 1 ## x
#define C2DIG2DEC(x) (S100(x)-100)
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
tm.tm_mday = C2DIG2DEC(DAY);
tm.tm_mon = C2DIG2DEC(MONTH)-1;
tm.tm_wday = 1;
tm.tm_year = YEAR-1900;
}
result = (int)set_time_screen(str(LANG_SET_TIME), &tm);
if(tm.tm_year != -1) {
set_time(&tm);
}
return result;
}
MENUITEM_FUNCTION(time_set, 0, ID2P(LANG_SET_TIME),
timedate_set, NULL, NULL, Icon_NOICON);
MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, Icon_NOICON, &time_set, &timeformat);
#endif
/* System menu */
MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
#ifdef HAVE_RTC_ALARM
MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU),
(menu_function)alarm_screen, NULL, NULL, Icon_NOICON);
#if CONFIG_TUNER || defined(HAVE_RECORDING)
#if CONFIG_TUNER && !defined(HAVE_RECORDING)
/* This need only be shown if we dont have recording, because if we do
then always show the setting item, because there will always be at least
2 items */
static int alarm_callback(int action,const struct menu_item_ex *this_item)
{
(void)this_item;
switch (action)
{
case ACTION_REQUEST_MENUITEM:
if (radio_hardware_present() == 0)
return ACTION_EXIT_MENUITEM;
break;
}
return action;
}
#else
#define alarm_callback NULL
#endif /* CONFIG_TUNER && !HAVE_RECORDING */
/* have to do this manually because the setting screen
doesnt handle variable item count */
static int alarm_setting(void)
{
struct opt_items items[ALARM_START_COUNT];
int i = 0;
items[i].string = str(LANG_RESUME_PLAYBACK);
items[i].voice_id = LANG_RESUME_PLAYBACK;
i++;
#if CONFIG_TUNER
if (radio_hardware_present())
{
items[i].string = str(LANG_FM_RADIO);
items[i].voice_id = LANG_FM_RADIO;
i++;
}
#endif
#ifdef HAVE_RECORDING
items[i].string = str(LANG_RECORDING);
items[i].voice_id = LANG_RECORDING;
i++;
#endif
return set_option(str(LANG_ALARM_WAKEUP_SCREEN),
&global_settings.alarm_wake_up_screen,
INT, items, i, NULL);
}
MENUITEM_FUNCTION(alarm_wake_up_screen, 0, ID2P(LANG_ALARM_WAKEUP_SCREEN),
alarm_setting, NULL, alarm_callback, Icon_Menu_setting);
#endif /* CONFIG_TUNER || defined(HAVE_RECORDING) */
#endif /* HAVE_RTC_ALARM */
/* Limits menu */
MENUITEM_SETTING(max_files_in_dir, &global_settings.max_files_in_dir, NULL);
MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL);
@ -377,17 +277,8 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#endif
#if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
&disk_menu,
#endif
#if CONFIG_RTC
&time_menu,
#endif
&poweroff,
#ifdef HAVE_RTC_ALARM
&alarm_screen_call,
#if defined(HAVE_RECORDING) || CONFIG_TUNER
&alarm_wake_up_screen,
#endif
#endif
&limits_menu,
#if CONFIG_CODEC == MAS3507D
&line_in,