diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-20 15:23:18 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-20 15:23:18 +0000 |
commit | 460d54977ae2f9c2c5997c6c4cd5541ab436d718 (patch) | |
tree | bcbb8b72f174ccf6b242f4bef0bd0f2e978da1c9 /apps | |
parent | 48b1a2d39d1678c0dfa7b2271c29c52b6c8169d0 (diff) | |
download | rockbox-460d54977ae2f9c2c5997c6c4cd5541ab436d718.tar.gz rockbox-460d54977ae2f9c2c5997c6c4cd5541ab436d718.zip |
FS#11939: Simplify talk_time_unit().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29347 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/menus/main_menu.c | 2 | ||||
-rw-r--r-- | apps/screens.c | 2 | ||||
-rw-r--r-- | apps/talk.c | 12 | ||||
-rw-r--r-- | apps/talk.h | 3 |
4 files changed, 8 insertions, 11 deletions
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 902e14b819..6ee7ba4156 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -303,7 +303,7 @@ static int info_speak_item(int selected_item, void * data) | |||
303 | { | 303 | { |
304 | talk_id(LANG_BATTERY_TIME, false); | 304 | talk_id(LANG_BATTERY_TIME, false); |
305 | talk_value(battery_level(), UNIT_PERCENT, true); | 305 | talk_value(battery_level(), UNIT_PERCENT, true); |
306 | talk_value(battery_time() *60, UNIT_TIME_EXACT, true); | 306 | talk_value(battery_time() *60, UNIT_TIME, true); |
307 | } | 307 | } |
308 | else talk_id(VOICE_BLANK, false); | 308 | else talk_id(VOICE_BLANK, false); |
309 | break; | 309 | break; |
diff --git a/apps/screens.c b/apps/screens.c index a11c4333ea..81472e6cc7 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -805,7 +805,7 @@ static int runtime_speak_data(int selected_item, void* data) | |||
805 | talk_ids(false, | 805 | talk_ids(false, |
806 | (selected_item < 2) ? LANG_RUNNING_TIME : LANG_TOP_TIME, | 806 | (selected_item < 2) ? LANG_RUNNING_TIME : LANG_TOP_TIME, |
807 | TALK_ID((selected_item < 2) ? global_status.runtime | 807 | TALK_ID((selected_item < 2) ? global_status.runtime |
808 | : global_status.topruntime, UNIT_TIME_EXACT)); | 808 | : global_status.topruntime, UNIT_TIME)); |
809 | return 0; | 809 | return 0; |
810 | } | 810 | } |
811 | 811 | ||
diff --git a/apps/talk.c b/apps/talk.c index 5fddf85986..8c0f1f3a07 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -1015,7 +1015,7 @@ int talk_number(long n, bool enqueue) | |||
1015 | 1015 | ||
1016 | /* Say time duration/interval. Input is time in seconds, | 1016 | /* Say time duration/interval. Input is time in seconds, |
1017 | say hours,minutes,seconds. */ | 1017 | say hours,minutes,seconds. */ |
1018 | static int talk_time_unit(long secs, bool exact, bool enqueue) | 1018 | static int talk_time_unit(long secs, bool enqueue) |
1019 | { | 1019 | { |
1020 | int hours, mins; | 1020 | int hours, mins; |
1021 | if (!enqueue) | 1021 | if (!enqueue) |
@@ -1026,11 +1026,9 @@ static int talk_time_unit(long secs, bool exact, bool enqueue) | |||
1026 | } | 1026 | } |
1027 | if((mins = secs/60)) { | 1027 | if((mins = secs/60)) { |
1028 | secs %= 60; | 1028 | secs %= 60; |
1029 | if(exact || !hours) | 1029 | talk_value(mins, UNIT_MIN, true); |
1030 | talk_value(mins, UNIT_MIN, true); | ||
1031 | else talk_number(mins, true); /* don't say "minutes" */ | ||
1032 | } | 1030 | } |
1033 | if((exact && secs) || (!hours && !mins)) | 1031 | if((secs) || (!hours && !mins)) |
1034 | talk_value(secs, UNIT_SEC, true); | 1032 | talk_value(secs, UNIT_SEC, true); |
1035 | else if(!hours && secs) | 1033 | else if(!hours && secs) |
1036 | talk_number(secs, true); | 1034 | talk_number(secs, true); |
@@ -1110,8 +1108,8 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) | |||
1110 | #endif | 1108 | #endif |
1111 | 1109 | ||
1112 | /* special case for time duration */ | 1110 | /* special case for time duration */ |
1113 | if (unit == UNIT_TIME || unit == UNIT_TIME_EXACT) | 1111 | if (unit == UNIT_TIME) |
1114 | return talk_time_unit(n, unit == UNIT_TIME_EXACT, enqueue); | 1112 | return talk_time_unit(n, enqueue); |
1115 | 1113 | ||
1116 | if (unit < 0 || unit >= UNIT_LAST) | 1114 | if (unit < 0 || unit >= UNIT_LAST) |
1117 | unit_id = -1; | 1115 | unit_id = -1; |
diff --git a/apps/talk.h b/apps/talk.h index fc1bfe5a2d..a2a9f44e4e 100644 --- a/apps/talk.h +++ b/apps/talk.h | |||
@@ -50,8 +50,7 @@ enum { | |||
50 | UNIT_MB, /* Megabytes */ | 50 | UNIT_MB, /* Megabytes */ |
51 | UNIT_KBIT, /* kilobits per sec */ | 51 | UNIT_KBIT, /* kilobits per sec */ |
52 | UNIT_PM_TICK, /* peak meter units per tick */ | 52 | UNIT_PM_TICK, /* peak meter units per tick */ |
53 | UNIT_TIME_EXACT,/* time duration/interval in seconds, says hours,mins,secs*/ | 53 | UNIT_TIME, /* time duration/interval in seconds, says hours,mins,secs */ |
54 | UNIT_TIME, /* as above but less verbose */ | ||
55 | UNIT_LAST /* END MARKER */ | 54 | UNIT_LAST /* END MARKER */ |
56 | }; | 55 | }; |
57 | 56 | ||