forked from len0rd/rockbox
Added 12 hour clock to status bar on recorders.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2621 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c7e0bea57a
commit
22a7a2d7d3
5 changed files with 41 additions and 5 deletions
|
@ -900,3 +900,18 @@ eng: "OFF=Cancel"
|
|||
new:
|
||||
|
||||
id: LANG_TETRIS_LEVEL
|
||||
|
||||
id: LANG_TIMEFORMAT
|
||||
desc: select the time format of time in status bar
|
||||
eng: "Time Format"
|
||||
new:
|
||||
|
||||
id: LANG_12_HOUR_CLOCK
|
||||
desc: option for 12 hour clock
|
||||
eng: "12 hour clock"
|
||||
new:
|
||||
|
||||
id: LANG_24_HOUR_CLOCK
|
||||
desc: option for 24 hour clock
|
||||
eng: "24 hour clock"
|
||||
new:
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "sprintf.h"
|
||||
#include "rtc.h"
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include "icons.h"
|
||||
|
||||
unsigned char slider_bar[] =
|
||||
|
@ -277,6 +279,12 @@ void statusbar_time(int hour, int minute)
|
|||
hour <= 23 &&
|
||||
minute >= 0 &&
|
||||
minute <= 59 ) {
|
||||
if ( global_settings.timeformat ) { /* 12 hour clock */
|
||||
hour %= 12;
|
||||
if ( hour == 0 ) {
|
||||
hour +=12;
|
||||
}
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -295,7 +295,9 @@ int settings_save( void )
|
|||
((global_settings.dirfilter & 2) << 4) |
|
||||
((global_settings.scrollbar & 1) << 6));
|
||||
|
||||
config_block[0xf] = (unsigned char)(global_settings.scroll_speed << 3);
|
||||
config_block[0xf] = (unsigned char)
|
||||
((global_settings.timeformat & 1) << 2) |
|
||||
((global_settings.scroll_speed << 3));
|
||||
|
||||
config_block[0x10] = (unsigned char)
|
||||
((global_settings.ff_rewind_min_step & 15) << 4 |
|
||||
|
@ -410,7 +412,6 @@ void settings_apply(void)
|
|||
*/
|
||||
void settings_load(void)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
DEBUGF( "reload_all_settings()\n" );
|
||||
|
||||
|
@ -462,9 +463,10 @@ void settings_load(void)
|
|||
an uninitialized entry */
|
||||
}
|
||||
|
||||
c = config_block[0xf] >> 3;
|
||||
if (c != 31)
|
||||
global_settings.scroll_speed = c;
|
||||
if (config_block[0xf] != 0xFF) {
|
||||
global_settings.timeformat = (config_block[0xf] >> 2) & 1;
|
||||
global_settings.scroll_speed = config_block[0xf] >> 3;
|
||||
}
|
||||
|
||||
if (config_block[0x10] != 0xFF) {
|
||||
global_settings.ff_rewind_min_step = (config_block[0x10] >> 4) & 15;
|
||||
|
@ -667,6 +669,7 @@ void settings_reset(void) {
|
|||
global_settings.playlist_shuffle = false;
|
||||
global_settings.discharge = 0;
|
||||
global_settings.total_uptime = 0;
|
||||
global_settings.timeformat = 0;
|
||||
global_settings.scroll_speed = 8;
|
||||
global_settings.ff_rewind_min_step = DEFAULT_FF_REWIND_MIN_STEP;
|
||||
global_settings.ff_rewind_accel = DEFAULT_FF_REWIND_ACCEL_SETTING;
|
||||
|
|
|
@ -86,6 +86,7 @@ struct user_settings
|
|||
int repeat_mode; /* 0=off 1=repeat all 2=repeat one */
|
||||
int dirfilter; /* 0=display all, 1=only supported, 2=only music */
|
||||
bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
|
||||
int timeformat; /* time format: 0=24 hour clock, 1=12 hour clock */
|
||||
int scroll_speed; /* long texts scrolling speed: 1-30 */
|
||||
bool playlist_shuffle;
|
||||
bool play_selected; /* Plays selected file even in shuffle mode */
|
||||
|
|
|
@ -285,6 +285,14 @@ static bool timedate_set(void)
|
|||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool timeformat_set(void)
|
||||
{
|
||||
char* names[] = { str(LANG_24_HOUR_CLOCK),
|
||||
str(LANG_12_HOUR_CLOCK) };
|
||||
|
||||
return set_option(str(LANG_TIMEFORMAT), &global_settings.timeformat, names, 2, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool spindown(void)
|
||||
|
@ -454,6 +462,7 @@ static bool system_settings_menu(void)
|
|||
#endif
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
{ str(LANG_TIME), timedate_set },
|
||||
{ str(LANG_TIMEFORMAT), timeformat_set },
|
||||
#endif
|
||||
{ str(LANG_POWEROFF_IDLE), poweroff_idle_timer },
|
||||
{ str(LANG_RESET), reset_settings },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue