summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Braun <markus.braun@krawel.de>2002-10-14 12:50:20 +0000
committerMarkus Braun <markus.braun@krawel.de>2002-10-14 12:50:20 +0000
commit22a7a2d7d34698db41bc08f76f794ca8efb3de1e (patch)
treef0d5e998a789786c873ee4b8a7054ab314bd90cb
parentc7e0bea57ad383593ebf8c106a4cccf8bcd46ba1 (diff)
downloadrockbox-22a7a2d7d34698db41bc08f76f794ca8efb3de1e.tar.gz
rockbox-22a7a2d7d34698db41bc08f76f794ca8efb3de1e.zip
Added 12 hour clock to status bar on recorders.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2621 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang15
-rw-r--r--apps/recorder/icons.c8
-rw-r--r--apps/settings.c13
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_menu.c9
5 files changed, 41 insertions, 5 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 75490b766d..846edde24a 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -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:
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 81de5b8006..adcfda5255 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -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 {
diff --git a/apps/settings.c b/apps/settings.c
index e9e171250f..3dafebc368 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -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;
diff --git a/apps/settings.h b/apps/settings.h
index c2f5c925fb..39a7b7c74e 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -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 */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index f91d884df9..7a7dceacc3 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -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 },