From 460d54977ae2f9c2c5997c6c4cd5541ab436d718 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sun, 20 Feb 2011 15:23:18 +0000 Subject: [PATCH] FS#11939: Simplify talk_time_unit(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29347 a1c6a512-1295-4272-9138-f99709370657 --- apps/menus/main_menu.c | 2 +- apps/screens.c | 2 +- apps/talk.c | 12 +++++------- 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) { talk_id(LANG_BATTERY_TIME, false); talk_value(battery_level(), UNIT_PERCENT, true); - talk_value(battery_time() *60, UNIT_TIME_EXACT, true); + talk_value(battery_time() *60, UNIT_TIME, true); } else talk_id(VOICE_BLANK, false); 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) talk_ids(false, (selected_item < 2) ? LANG_RUNNING_TIME : LANG_TOP_TIME, TALK_ID((selected_item < 2) ? global_status.runtime - : global_status.topruntime, UNIT_TIME_EXACT)); + : global_status.topruntime, UNIT_TIME)); return 0; } 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) /* Say time duration/interval. Input is time in seconds, say hours,minutes,seconds. */ -static int talk_time_unit(long secs, bool exact, bool enqueue) +static int talk_time_unit(long secs, bool enqueue) { int hours, mins; if (!enqueue) @@ -1026,11 +1026,9 @@ static int talk_time_unit(long secs, bool exact, bool enqueue) } if((mins = secs/60)) { secs %= 60; - if(exact || !hours) - talk_value(mins, UNIT_MIN, true); - else talk_number(mins, true); /* don't say "minutes" */ + talk_value(mins, UNIT_MIN, true); } - if((exact && secs) || (!hours && !mins)) + if((secs) || (!hours && !mins)) talk_value(secs, UNIT_SEC, true); else if(!hours && secs) talk_number(secs, true); @@ -1110,8 +1108,8 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) #endif /* special case for time duration */ - if (unit == UNIT_TIME || unit == UNIT_TIME_EXACT) - return talk_time_unit(n, unit == UNIT_TIME_EXACT, enqueue); + if (unit == UNIT_TIME) + return talk_time_unit(n, enqueue); if (unit < 0 || unit >= UNIT_LAST) 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 { UNIT_MB, /* Megabytes */ UNIT_KBIT, /* kilobits per sec */ UNIT_PM_TICK, /* peak meter units per tick */ - UNIT_TIME_EXACT,/* time duration/interval in seconds, says hours,mins,secs*/ - UNIT_TIME, /* as above but less verbose */ + UNIT_TIME, /* time duration/interval in seconds, says hours,mins,secs */ UNIT_LAST /* END MARKER */ };