skin engine: Streamline handling of the %mp tag a little
current_playmode() returns a value from 'enum playmode' and we can take advantage of the enum values to simplify the code. Change-Id: I368ec38ba5061f6cc6d3382e536db2312b27d643
This commit is contained in:
parent
3815ef8050
commit
9f09cdc9b8
1 changed files with 11 additions and 28 deletions
|
@ -1039,36 +1039,19 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
case SKIN_TOKEN_PLAYBACK_STATUS:
|
case SKIN_TOKEN_PLAYBACK_STATUS:
|
||||||
{
|
{
|
||||||
int status = current_playmode();
|
int status = current_playmode();
|
||||||
/* music */
|
switch (status) {
|
||||||
int mode = 1; /* stop */
|
case STATUS_STOP:
|
||||||
if (status == STATUS_PLAY)
|
numeric_ret = 1;
|
||||||
mode = 2; /* play */
|
break;
|
||||||
if (status == STATUS_PAUSE && !status_get_ffmode())
|
case STATUS_PLAY:
|
||||||
mode = 3; /* pause */
|
numeric_ret = 2;
|
||||||
else
|
break;
|
||||||
{ /* ff / rwd */
|
default:
|
||||||
if (status_get_ffmode() == STATUS_FASTFORWARD)
|
numeric_ret = status + 1;
|
||||||
mode = 4;
|
break;
|
||||||
if (status_get_ffmode() == STATUS_FASTBACKWARD)
|
|
||||||
mode = 5;
|
|
||||||
}
|
}
|
||||||
#ifdef HAVE_RECORDING
|
|
||||||
/* recording */
|
|
||||||
if (status == STATUS_RECORD)
|
|
||||||
mode = 6;
|
|
||||||
else if (status == STATUS_RECORD_PAUSE)
|
|
||||||
mode = 7;
|
|
||||||
#endif
|
|
||||||
#if CONFIG_TUNER
|
|
||||||
/* radio */
|
|
||||||
if (status == STATUS_RADIO)
|
|
||||||
mode = 8;
|
|
||||||
else if (status == STATUS_RADIO_PAUSE)
|
|
||||||
mode = 9;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
numeric_ret = mode;
|
snprintf(buf, buf_size, "%d", numeric_ret-1);
|
||||||
snprintf(buf, buf_size, "%d", mode-1);
|
|
||||||
numeric_buf = buf;
|
numeric_buf = buf;
|
||||||
goto gtv_ret_numeric_tag_info;
|
goto gtv_ret_numeric_tag_info;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue