From 47f3906a05ac66917a06eb8e691c1b76f0a2dec4 Mon Sep 17 00:00:00 2001 From: kugel Date: Fri, 16 Oct 2009 19:14:28 +0000 Subject: [PATCH] Change %mp tag to use current_playmode(). It has upto 9 values now, including recording and radio states. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23206 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_tokens.c | 36 +++++++++++++++++++++++++----------- apps/main.c | 1 - apps/status.c | 7 +------ apps/status.h | 1 - 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index ad4613ed9..2df087bb7 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -467,17 +467,31 @@ const char *get_token_value(struct gui_wps *gwps, case WPS_TOKEN_PLAYBACK_STATUS: { - int status = audio_status(); - int mode = 1; - if (status == AUDIO_STATUS_PLAY) - mode = 2; - if (is_wps_fading() || - (status & AUDIO_STATUS_PAUSE && !status_get_ffmode())) - mode = 3; - if (status_get_ffmode() == STATUS_FASTFORWARD) - mode = 4; - if (status_get_ffmode() == STATUS_FASTBACKWARD) - mode = 5; + int status = current_playmode(); + /* music */ + int mode = 1; /* stop */ + if (status == STATUS_PLAY) + mode = 2; /* play */ + if (is_wps_fading() || + (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; + } + /* recording */ + if (status == STATUS_RECORD) + mode = 6; + else if (status == STATUS_RECORD_PAUSE) + mode = 7; + /* radio */ + if (status == STATUS_RADIO) + mode = 8; + else if (status == STATUS_RADIO_PAUSE) + mode = 9; if (intval) { *intval = mode; diff --git a/apps/main.c b/apps/main.c index 58ff1381b..f48dd2d0a 100644 --- a/apps/main.c +++ b/apps/main.c @@ -564,7 +564,6 @@ static void init(void) eeprom_settings_store(); } #endif - status_init(); playlist_init(); tree_mem_init(); filetype_init(); diff --git a/apps/status.c b/apps/status.c index 92f29c1b8..485ca0aa3 100644 --- a/apps/status.c +++ b/apps/status.c @@ -27,12 +27,7 @@ #include "radio.h" #endif -static enum playmode ff_mode; - -void status_init(void) -{ - ff_mode = 0; -} +static enum playmode ff_mode = 0; void status_set_ffmode(enum playmode mode) { diff --git a/apps/status.h b/apps/status.h index 8a7a69bc6..36b723ecb 100644 --- a/apps/status.h +++ b/apps/status.h @@ -41,7 +41,6 @@ enum playmode STATUS_RADIO_PAUSE }; -void status_init(void); void status_set_ffmode(enum playmode mode); enum playmode status_get_ffmode(void); int current_playmode(void); -- 2.11.4.GIT