mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
Move Sleep Timer function from the settings into the System menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12549 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4855615944
commit
fdaacd5ec6
2 changed files with 36 additions and 34 deletions
|
|
@ -341,6 +341,40 @@ static bool show_info(void)
|
||||||
}
|
}
|
||||||
MENUITEM_FUNCTION(show_info_item, ID2P(LANG_INFO_MENU),
|
MENUITEM_FUNCTION(show_info_item, ID2P(LANG_INFO_MENU),
|
||||||
(menu_function)show_info, NULL, NOICON);
|
(menu_function)show_info, NULL, NOICON);
|
||||||
|
|
||||||
|
|
||||||
|
/* sleep Menu */
|
||||||
|
static void sleep_timer_formatter(char* buffer, int buffer_size, int value,
|
||||||
|
const char* unit)
|
||||||
|
{
|
||||||
|
int minutes, hours;
|
||||||
|
|
||||||
|
(void) unit;
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
hours = value / 60;
|
||||||
|
minutes = value - (hours * 60);
|
||||||
|
snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
|
||||||
|
} else {
|
||||||
|
snprintf(buffer, buffer_size, "%s", str(LANG_OFF));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sleep_timer_set(int minutes)
|
||||||
|
{
|
||||||
|
set_sleep_timer(minutes * 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sleep_timer(void)
|
||||||
|
{
|
||||||
|
int minutes = (get_sleep_timer() + 59) / 60; /* round up */
|
||||||
|
return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
|
||||||
|
&sleep_timer_set, -5, 300, 0, sleep_timer_formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
|
||||||
|
NULL, bitmap_icons_6x8[Icon_Menu_setting]); /* make it look like a
|
||||||
|
setting to the user */
|
||||||
MENUITEM_FUNCTION(show_credits_item, ID2P(LANG_VERSION),
|
MENUITEM_FUNCTION(show_credits_item, ID2P(LANG_VERSION),
|
||||||
(menu_function)show_credits, NULL, NOICON);
|
(menu_function)show_credits, NULL, NOICON);
|
||||||
MENUITEM_FUNCTION(show_runtime_item, ID2P(LANG_RUNNING_TIME),
|
MENUITEM_FUNCTION(show_runtime_item, ID2P(LANG_RUNNING_TIME),
|
||||||
|
|
@ -360,6 +394,7 @@ MENUITEM_FUNCTION(logfdump_item, "logfdump",(int (*)(void)) logfdump, NULL, NOIC
|
||||||
|
|
||||||
MAKE_MENU(info_menu, ID2P(LANG_INFO), 0, bitmap_icons_6x8[Icon_Questionmark],
|
MAKE_MENU(info_menu, ID2P(LANG_INFO), 0, bitmap_icons_6x8[Icon_Questionmark],
|
||||||
&show_info_item, &show_credits_item, &show_runtime_item,
|
&show_info_item, &show_credits_item, &show_runtime_item,
|
||||||
|
&sleep_timer_call,
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
&debug_menu_item
|
&debug_menu_item
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -214,38 +214,6 @@ MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_se
|
||||||
/* System menu */
|
/* System menu */
|
||||||
MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
|
MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
|
||||||
|
|
||||||
/* sleep Menu */
|
|
||||||
static void sleep_timer_formatter(char* buffer, int buffer_size, int value,
|
|
||||||
const char* unit)
|
|
||||||
{
|
|
||||||
int minutes, hours;
|
|
||||||
|
|
||||||
(void) unit;
|
|
||||||
|
|
||||||
if (value) {
|
|
||||||
hours = value / 60;
|
|
||||||
minutes = value - (hours * 60);
|
|
||||||
snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
|
|
||||||
} else {
|
|
||||||
snprintf(buffer, buffer_size, "%s", str(LANG_OFF));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sleep_timer_set(int minutes)
|
|
||||||
{
|
|
||||||
set_sleep_timer(minutes * 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sleep_timer(void)
|
|
||||||
{
|
|
||||||
int minutes = (get_sleep_timer() + 59) / 60; /* round up */
|
|
||||||
return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
|
|
||||||
&sleep_timer_set, -5, 300, 0, sleep_timer_formatter);
|
|
||||||
}
|
|
||||||
|
|
||||||
MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
|
|
||||||
NULL, bitmap_icons_6x8[Icon_Menu_setting]); /* make it look like a
|
|
||||||
setting to the user */
|
|
||||||
#ifdef HAVE_RTC_ALARM
|
#ifdef HAVE_RTC_ALARM
|
||||||
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
|
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
|
||||||
(menu_function)alarm_screen, rtc_detect_callback, NOICON);
|
(menu_function)alarm_screen, rtc_detect_callback, NOICON);
|
||||||
|
|
@ -292,7 +260,6 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
|
||||||
&time_menu,
|
&time_menu,
|
||||||
#endif
|
#endif
|
||||||
&poweroff,
|
&poweroff,
|
||||||
&sleep_timer_call,
|
|
||||||
#ifdef HAVE_RTC_ALARM
|
#ifdef HAVE_RTC_ALARM
|
||||||
&alarm_screen_call,
|
&alarm_screen_call,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue