From d9874b266ee420e214bdc8c9c96d946c0a922203 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sun, 21 Aug 2005 19:17:50 +0000 Subject: Committed the "[ 1247788 ] Adds wps tags for repeat modes" patch. Please revert back should it cause problems. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7371 a1c6a512-1295-4272-9138-f99709370657 --- apps/status.c | 7 ++++++ apps/status.h | 1 + apps/wps-display.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ docs/CREDITS | 1 + docs/CUSTOM_WPS_FORMAT | 12 +++++++++ 5 files changed, 88 insertions(+) diff --git a/apps/status.c b/apps/status.c index 3cb6722bca..c7f46db6fb 100644 --- a/apps/status.c +++ b/apps/status.c @@ -82,6 +82,13 @@ void status_set_ffmode(enum playmode mode) status_draw(false); } +enum playmode status_get_ffmode(void) +{ + /* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */ + /* use audio_status() for other modes */ + return ff_mode; +} + int current_playmode(void) { int audio_stat = audio_status(); diff --git a/apps/status.h b/apps/status.h index a3c471bafd..0d8c80d7a8 100644 --- a/apps/status.h +++ b/apps/status.h @@ -32,6 +32,7 @@ enum playmode void status_init(void); void status_set_ffmode(enum playmode mode); +enum playmode status_get_ffmode(void); #ifdef HAVE_LCD_BITMAP bool statusbar(bool state); #if CONFIG_KEYPAD == RECORDER_PAD diff --git a/apps/wps-display.c b/apps/wps-display.c index 11a2506611..318da5a717 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -43,6 +43,7 @@ #include "powermgmt.h" #include "sprintf.h" #include "backlight.h" +#include "button.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" @@ -578,6 +579,72 @@ static char* get_tag(struct mp3entry* cid3, } break; + + case 'm': /* playback repeat mode */ + switch (tag[1]) + { + case 'f': /* off */ + if (global_settings.repeat_mode == REPEAT_OFF) + return "f"; + else + return NULL; + case 'a': /* all */ + if (global_settings.repeat_mode == REPEAT_ALL) + return "a"; + else + return NULL; + case 'o': /* one */ + if (global_settings.repeat_mode == REPEAT_ONE) + return "o"; + else + return NULL; + case 's': /* shuffle */ + if (global_settings.repeat_mode == REPEAT_SHUFFLE) + return "s"; + else + return NULL; + /* playback status */ + case 'p': /* play */ + *flags |= WPS_REFRESH_DYNAMIC; + int status = audio_status(); + if (status == AUDIO_STATUS_PLAY && \ + !(status & AUDIO_STATUS_PAUSE)) + return "p"; + else + return NULL; + case 'u': /* pause*/ + *flags |= WPS_REFRESH_DYNAMIC; + if (audio_status() & AUDIO_STATUS_PAUSE && \ + (! status_get_ffmode())) + return "u"; + else + return NULL; + case 'w': /* fast forward */ + *flags |= WPS_REFRESH_DYNAMIC; + if (status_get_ffmode() == STATUS_FASTFORWARD) + return "w"; + else + return NULL; + case 'b': /* Fast backwards */ + *flags |= WPS_REFRESH_DYNAMIC; + if (status_get_ffmode() == STATUS_FASTBACKWARD) + return "b"; + else + return NULL; + case 'h': /* hold */ + *flags |= WPS_REFRESH_DYNAMIC; + if (button_hold()) + return "h"; + else + return NULL; + case 'r': /* remote hold */ + *flags |= WPS_REFRESH_DYNAMIC; + if (remote_button_hold()) + return "r"; + else + return NULL; + } + break; case 'b': /* battery info */ *flags |= WPS_REFRESH_DYNAMIC; diff --git a/docs/CREDITS b/docs/CREDITS index 2e7e064faf..6b1d893d08 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -131,3 +131,4 @@ Frederic Devernay José M. Fandiño Gadi Cohen Naftali Goldstein +David Dent diff --git a/docs/CUSTOM_WPS_FORMAT b/docs/CUSTOM_WPS_FORMAT index 171a7d5906..87dd5c35f6 100644 --- a/docs/CUSTOM_WPS_FORMAT +++ b/docs/CUSTOM_WPS_FORMAT @@ -67,6 +67,18 @@ Playlist/Song Info Tags: %pt : Total Track Time %pv : Current volume +Repeat mode tags: + %mf : repeat off, returns f + %ma : repeat all, returns a + %mo : repeat one, returns o + %ms : repeat shuffle, returns s + +Playback mode tags: + %mp : play, returns p + %mu : pause, returns u + %mw : fastforward, returns w + %mb : fastbackward, returns b + Conditional Tags (If/Else block): %?xx<|> : Conditional: if the tag specified by "xx" has a value, the text between the "<" and the "|" is displayed, else the text -- cgit v1.2.3