FS#11939: Simplify talk_time_unit().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29347 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
48b1a2d39d
commit
460d54977a
4 changed files with 8 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
12
apps/talk.c
12
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;
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue