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-9f09cdc9b819f4e42e54d1bff404398e9c8c379a.tar.gz rockbox-9f09cdc9b819f4e42e54d1bff404398e9c8c379a.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, | |||
1039 | case SKIN_TOKEN_PLAYBACK_STATUS: | 1039 | case SKIN_TOKEN_PLAYBACK_STATUS: |
1040 | { | 1040 | { |
1041 | int status = current_playmode(); | 1041 | int status = current_playmode(); |
1042 | /* music */ | 1042 | switch (status) { |
1043 | int mode = 1; /* stop */ | 1043 | case STATUS_STOP: |
1044 | if (status == STATUS_PLAY) | 1044 | numeric_ret = 1; |
1045 | mode = 2; /* play */ | 1045 | break; |
1046 | if (status == STATUS_PAUSE && !status_get_ffmode()) | 1046 | case STATUS_PLAY: |
1047 | mode = 3; /* pause */ | 1047 | numeric_ret = 2; |
1048 | else | 1048 | break; |
1049 | { /* ff / rwd */ | 1049 | default: |
1050 | if (status_get_ffmode() == STATUS_FASTFORWARD) | 1050 | numeric_ret = status + 1; |
1051 | mode = 4; | 1051 | break; |
1052 | if (status_get_ffmode() == STATUS_FASTBACKWARD) | ||
1053 | mode = 5; | ||
1054 | } | 1052 | } |
1055 | #ifdef HAVE_RECORDING | ||
1056 | /* recording */ | ||
1057 | if (status == STATUS_RECORD) | ||
1058 | mode = 6; | ||
1059 | else if (status == STATUS_RECORD_PAUSE) | ||
1060 | mode = 7; | ||
1061 | #endif | ||
1062 | #if CONFIG_TUNER | ||
1063 | /* radio */ | ||
1064 | if (status == STATUS_RADIO) | ||
1065 | mode = 8; | ||
1066 | else if (status == STATUS_RADIO_PAUSE) | ||
1067 | mode = 9; | ||
1068 | #endif | ||
1069 | 1053 | ||
1070 | numeric_ret = mode; | 1054 | snprintf(buf, buf_size, "%d", numeric_ret-1); |
1071 | snprintf(buf, buf_size, "%d", mode-1); | ||
1072 | numeric_buf = buf; | 1055 | numeric_buf = buf; |
1073 | goto gtv_ret_numeric_tag_info; | 1056 | goto gtv_ret_numeric_tag_info; |
1074 | } | 1057 | } |