From e65a8bb567dc561b6153881836d0ed7586fab456 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Fri, 11 Sep 2009 13:08:56 +0200 Subject: [PATCH 1/2] Change %pm tag to use current_playmode(). It has upto 9 values now, including recording and radio states. --- apps/gui/skin_engine/skin_tokens.c | 34 ++++++++++++++++++++++++---------- apps/main.c | 1 - apps/status.c | 7 +------ apps/status.h | 1 - 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index deab0ea..9d44256 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -461,17 +461,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; + int status = current_playmode(); + /* music */ + int mode = 1; /* stop */ + if (status == STATUS_PLAY) + mode = 2; /* play */ 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; + (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 c751080..e486736 100644 --- a/apps/main.c +++ b/apps/main.c @@ -553,7 +553,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 92f29c1..485ca0a 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 8a7a69b..36b723e 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); -- 1.6.3.3