diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-04 13:40:35 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-23 10:08:49 -0500 |
commit | 9f09cdc9b819f4e42e54d1bff404398e9c8c379a (patch) | |
tree | 6edcf68a8e8f5d53df9635ea771f018b67c8f9e9 | |
parent | 3815ef805010486c091c1c38221dcbf898590a8d (diff) | |
download | rockbox-9f09cdc9b8.tar.gz rockbox-9f09cdc9b8.zip |
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
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 6d9d489a17..874eff3809 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -1039,36 +1039,19 @@ const char *get_token_value(struct gui_wps *gwps, case SKIN_TOKEN_PLAYBACK_STATUS: { int status = current_playmode(); - /* music */ - int mode = 1; /* stop */ - if (status == STATUS_PLAY) - mode = 2; /* play */ - if (status == STATUS_PAUSE && !status_get_ffmode()) - mode = 3; /* pause */ - else - { /* ff / rwd */ - if (status_get_ffmode() == STATUS_FASTFORWARD) - mode = 4; - if (status_get_ffmode() == STATUS_FASTBACKWARD) - mode = 5; + switch (status) { + case STATUS_STOP: + numeric_ret = 1; + break; + case STATUS_PLAY: + numeric_ret = 2; + break; + default: + numeric_ret = status + 1; + break; } -#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", mode-1); + snprintf(buf, buf_size, "%d", numeric_ret-1); numeric_buf = buf; goto gtv_ret_numeric_tag_info; } |