summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/skin_engine/skin_tokens.h63
-rw-r--r--apps/gui/skin_engine/wps_debug.c36
2 files changed, 70 insertions, 29 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index 31546b8cf6..901cd883a6 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -24,9 +24,11 @@
24 24
25#include <stdbool.h> 25#include <stdbool.h>
26 26
27 27
28enum wps_token_type { 28enum wps_token_type {
29 WPS_NO_TOKEN, /* for WPS tags we don't want to save as tokens */ 29
30 TOKEN_MARKER_CONTROL_TOKENS = -1,
31 WPS_NO_TOKEN = 0, /* for WPS tags we don't want to save as tokens */
30 WPS_TOKEN_UNKNOWN, 32 WPS_TOKEN_UNKNOWN,
31 33
32 /* Markers */ 34 /* Markers */
@@ -41,8 +43,18 @@ enum wps_token_type {
41 43
42 /* Sublines */ 44 /* Sublines */
43 WPS_TOKEN_SUBLINE_TIMEOUT, 45 WPS_TOKEN_SUBLINE_TIMEOUT,
46
47 /* Conditional */
48 WPS_TOKEN_CONDITIONAL,
49 WPS_TOKEN_CONDITIONAL_START,
50 WPS_TOKEN_CONDITIONAL_OPTION,
51 WPS_TOKEN_CONDITIONAL_END,
44 52
53 /* Viewport display */
54 WPS_VIEWPORT_ENABLE,
55
45 /* Battery */ 56 /* Battery */
57 TOKEN_MARKER_BATTERY,
46 WPS_TOKEN_BATTERY_PERCENT, 58 WPS_TOKEN_BATTERY_PERCENT,
47 WPS_TOKEN_BATTERY_VOLTS, 59 WPS_TOKEN_BATTERY_VOLTS,
48 WPS_TOKEN_BATTERY_TIME, 60 WPS_TOKEN_BATTERY_TIME,
@@ -51,6 +63,7 @@ enum wps_token_type {
51 WPS_TOKEN_BATTERY_SLEEPTIME, 63 WPS_TOKEN_BATTERY_SLEEPTIME,
52 64
53 /* Sound */ 65 /* Sound */
66 TOKEN_MARKER_SOUND,
54#if (CONFIG_CODEC != MAS3507D) 67#if (CONFIG_CODEC != MAS3507D)
55 WPS_TOKEN_SOUND_PITCH, 68 WPS_TOKEN_SOUND_PITCH,
56#endif 69#endif
@@ -60,7 +73,7 @@ enum wps_token_type {
60#endif 73#endif
61 74
62 /* Time */ 75 /* Time */
63 76 TOKEN_MARKER_RTC,
64 WPS_TOKEN_RTC_PRESENT, 77 WPS_TOKEN_RTC_PRESENT,
65 78
66 /* The begin/end values allow us to know if a token is an RTC one. 79 /* The begin/end values allow us to know if a token is an RTC one.
@@ -89,13 +102,8 @@ enum wps_token_type {
89 102
90 WPS_TOKENS_RTC_END, /* just the end marker, not an actual token */ 103 WPS_TOKENS_RTC_END, /* just the end marker, not an actual token */
91 104
92 /* Conditional */
93 WPS_TOKEN_CONDITIONAL,
94 WPS_TOKEN_CONDITIONAL_START,
95 WPS_TOKEN_CONDITIONAL_OPTION,
96 WPS_TOKEN_CONDITIONAL_END,
97
98 /* Database */ 105 /* Database */
106 TOKEN_MARKER_DATABASE,
99#ifdef HAVE_TAGCACHE 107#ifdef HAVE_TAGCACHE
100 WPS_TOKEN_DATABASE_PLAYCOUNT, 108 WPS_TOKEN_DATABASE_PLAYCOUNT,
101 WPS_TOKEN_DATABASE_RATING, 109 WPS_TOKEN_DATABASE_RATING,
@@ -103,6 +111,7 @@ enum wps_token_type {
103#endif 111#endif
104 112
105 /* File */ 113 /* File */
114 TOKEN_MARKER_FILE,
106 WPS_TOKEN_FILE_BITRATE, 115 WPS_TOKEN_FILE_BITRATE,
107 WPS_TOKEN_FILE_CODEC, 116 WPS_TOKEN_FILE_CODEC,
108 WPS_TOKEN_FILE_FREQUENCY, 117 WPS_TOKEN_FILE_FREQUENCY,
@@ -116,6 +125,7 @@ enum wps_token_type {
116 125
117#ifdef HAVE_LCD_BITMAP 126#ifdef HAVE_LCD_BITMAP
118 /* Image */ 127 /* Image */
128 TOKEN_MARKER_IMAGES,
119 WPS_TOKEN_IMAGE_BACKDROP, 129 WPS_TOKEN_IMAGE_BACKDROP,
120 WPS_TOKEN_IMAGE_PROGRESS_BAR, 130 WPS_TOKEN_IMAGE_PROGRESS_BAR,
121 WPS_TOKEN_IMAGE_PRELOAD, 131 WPS_TOKEN_IMAGE_PRELOAD,
@@ -130,6 +140,7 @@ enum wps_token_type {
130#endif 140#endif
131 141
132 /* Metadata */ 142 /* Metadata */
143 TOKEN_MARKER_METADATA,
133 WPS_TOKEN_METADATA_ARTIST, 144 WPS_TOKEN_METADATA_ARTIST,
134 WPS_TOKEN_METADATA_COMPOSER, 145 WPS_TOKEN_METADATA_COMPOSER,
135 WPS_TOKEN_METADATA_ALBUM_ARTIST, 146 WPS_TOKEN_METADATA_ALBUM_ARTIST,
@@ -143,30 +154,20 @@ enum wps_token_type {
143 WPS_TOKEN_METADATA_YEAR, 154 WPS_TOKEN_METADATA_YEAR,
144 WPS_TOKEN_METADATA_COMMENT, 155 WPS_TOKEN_METADATA_COMMENT,
145 156
157 TOKEN_MARKER_PLAYBACK_INFO,
146 /* Mode */ 158 /* Mode */
147 WPS_TOKEN_REPEAT_MODE, 159 WPS_TOKEN_REPEAT_MODE,
148 WPS_TOKEN_PLAYBACK_STATUS, 160 WPS_TOKEN_PLAYBACK_STATUS,
149
150 WPS_TOKEN_MAIN_HOLD,
151
152#ifdef HAS_REMOTE_BUTTON_HOLD
153 WPS_TOKEN_REMOTE_HOLD,
154#endif
155
156 /* Progressbar */ 161 /* Progressbar */
157 WPS_TOKEN_PROGRESSBAR, 162 WPS_TOKEN_PROGRESSBAR,
158#ifdef HAVE_LCD_CHARCELLS 163#ifdef HAVE_LCD_CHARCELLS
159 WPS_TOKEN_PLAYER_PROGRESSBAR, 164 WPS_TOKEN_PLAYER_PROGRESSBAR,
160#endif 165#endif
161
162#ifdef HAVE_LCD_BITMAP 166#ifdef HAVE_LCD_BITMAP
163 /* Peakmeter */ 167 /* Peakmeter */
164 WPS_TOKEN_PEAKMETER, 168 WPS_TOKEN_PEAKMETER,
165#endif 169#endif
166 170
167 /* Volume level */
168 WPS_TOKEN_VOLUME,
169
170 /* Current track */ 171 /* Current track */
171 WPS_TOKEN_TRACK_ELAPSED_PERCENT, 172 WPS_TOKEN_TRACK_ELAPSED_PERCENT,
172 WPS_TOKEN_TRACK_TIME_ELAPSED, 173 WPS_TOKEN_TRACK_TIME_ELAPSED,
@@ -174,32 +175,42 @@ enum wps_token_type {
174 WPS_TOKEN_TRACK_LENGTH, 175 WPS_TOKEN_TRACK_LENGTH,
175 176
176 /* Playlist */ 177 /* Playlist */
178 TOKEN_MARKER_PLAYLIST,
177 WPS_TOKEN_PLAYLIST_ENTRIES, 179 WPS_TOKEN_PLAYLIST_ENTRIES,
178 WPS_TOKEN_PLAYLIST_NAME, 180 WPS_TOKEN_PLAYLIST_NAME,
179 WPS_TOKEN_PLAYLIST_POSITION, 181 WPS_TOKEN_PLAYLIST_POSITION,
180 WPS_TOKEN_PLAYLIST_SHUFFLE, 182 WPS_TOKEN_PLAYLIST_SHUFFLE,
181#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
182 /* Virtual LED */
183 WPS_TOKEN_VLED_HDD,
184#endif
185 183
186 /* Viewport display */
187 WPS_VIEWPORT_ENABLE,
188 184
189 /* buttons */ 185 /* buttons */
186 TOKEN_MARKER_MISC,
190 WPS_TOKEN_BUTTON_VOLUME, 187 WPS_TOKEN_BUTTON_VOLUME,
191 WPS_TOKEN_LASTTOUCH, 188 WPS_TOKEN_LASTTOUCH,
189#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
190 /* Virtual LED */
191 WPS_TOKEN_VLED_HDD,
192#endif
193 /* Volume level */
194 WPS_TOKEN_VOLUME,
195 /* hold */
196 WPS_TOKEN_MAIN_HOLD,
197#ifdef HAS_REMOTE_BUTTON_HOLD
198 WPS_TOKEN_REMOTE_HOLD,
199#endif
192 200
193 /* Setting option */ 201 /* Setting option */
194 WPS_TOKEN_SETTING, 202 WPS_TOKEN_SETTING,
195 WPS_TOKEN_CURRENT_SCREEN, 203 WPS_TOKEN_CURRENT_SCREEN,
196 204
197 /* Recording Tokens */ 205 /* Recording Tokens */
206 TOKEN_MARKER_RECORDING,
198 WPS_TOKEN_HAVE_RECORDING, 207 WPS_TOKEN_HAVE_RECORDING,
199 WPS_TOKEN_REC_FREQ, 208 WPS_TOKEN_REC_FREQ,
200 WPS_TOKEN_REC_ENCODER, 209 WPS_TOKEN_REC_ENCODER,
201 WPS_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */ 210 WPS_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */
202 WPS_TOKEN_REC_MONO, 211 WPS_TOKEN_REC_MONO,
212
213 TOKEN_MARKER_END, /* this needs to be the last value in this enum */
203}; 214};
204 215
205struct wps_token { 216struct wps_token {
diff --git a/apps/gui/skin_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index 86f929ad23..7d485f2c50 100644
--- a/apps/gui/skin_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
@@ -42,6 +42,29 @@ extern bool debug_wps;
42extern int wps_verbose_level; 42extern int wps_verbose_level;
43#endif 43#endif
44 44
45struct debug_token_table
46{
47 enum wps_token_type start_marker;
48 char *desc;
49};
50#define X(name) name, #name
51struct debug_token_table tokens[] = {
52 { X(TOKEN_MARKER_CONTROL_TOKENS) },
53 { X(TOKEN_MARKER_BATTERY) },
54 { X(TOKEN_MARKER_SOUND) },
55 { X(TOKEN_MARKER_RTC) },
56 { X(TOKEN_MARKER_DATABASE) },
57 { X(TOKEN_MARKER_FILE) },
58 { X(TOKEN_MARKER_IMAGES) },
59 { X(TOKEN_MARKER_METADATA) },
60 { X(TOKEN_MARKER_PLAYBACK_INFO) },
61 { X(TOKEN_MARKER_PLAYLIST) },
62 { X(TOKEN_MARKER_MISC) },
63 { X(TOKEN_MARKER_RECORDING) },
64 { X(TOKEN_MARKER_END) },
65};
66#undef X
67
45static char *next_str(bool next) { 68static char *next_str(bool next) {
46 return next ? "next " : ""; 69 return next ? "next " : "";
47} 70}
@@ -49,11 +72,11 @@ static char *next_str(bool next) {
49static char *get_token_desc(struct wps_token *token, char *buf, 72static char *get_token_desc(struct wps_token *token, char *buf,
50 int bufsize, struct wps_data *data) 73 int bufsize, struct wps_data *data)
51{ 74{
75 unsigned i;
52#ifndef HAVE_LCD_BITMAP 76#ifndef HAVE_LCD_BITMAP
53 (void)data; /* kill charcell warning */ 77 (void)data; /* kill charcell warning */
54#endif 78#endif
55 bool next = token->next; 79 bool next = token->next;
56
57 switch(token->type) 80 switch(token->type)
58 { 81 {
59 case WPS_NO_TOKEN: 82 case WPS_NO_TOKEN:
@@ -468,8 +491,15 @@ static char *get_token_desc(struct wps_token *token, char *buf,
468 settings[token->value.i].cfg_name); 491 settings[token->value.i].cfg_name);
469 break; 492 break;
470 default: 493 default:
471 snprintf(buf, bufsize, "FIXME (code: %d)", 494 for(i=1; i<sizeof(tokens)/sizeof(*token); i++)
472 token->type); 495 {
496 if (token->type < tokens[i].start_marker)
497 {
498 snprintf(buf, bufsize, "FIXME: %s + %d\n", tokens[i-1].desc,
499 token->type - tokens[i-1].start_marker);
500 break;
501 }
502 }
473 break; 503 break;
474 } 504 }
475 505