summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_display.c12
-rw-r--r--apps/gui/skin_engine/skin_parser.c9
-rw-r--r--apps/gui/skin_engine/skin_tokens.h1
3 files changed, 17 insertions, 5 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 9cef12a690..a0b3497683 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -27,6 +27,7 @@
27#include "system.h" 27#include "system.h"
28#include "rbunicode.h" 28#include "rbunicode.h"
29#include "sound.h" 29#include "sound.h"
30#include "powermgmt.h"
30#ifdef DEBUG 31#ifdef DEBUG
31#include "debug.h" 32#include "debug.h"
32#endif 33#endif
@@ -145,6 +146,11 @@ static void draw_progressbar(struct gui_wps *gwps,
145 length = maxvol-minvol; 146 length = maxvol-minvol;
146 elapsed = global_settings.volume-minvol; 147 elapsed = global_settings.volume-minvol;
147 } 148 }
149 else if (pb->type == WPS_TOKEN_BATTERY_PERCENTBAR)
150 {
151 length = 100;
152 elapsed = battery_level();
153 }
148 else if (id3 && id3->length) 154 else if (id3 && id3->length)
149 { 155 {
150 length = id3->length; 156 length = id3->length;
@@ -608,8 +614,9 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
608 /* clear all pictures in the conditional and nested ones */ 614 /* clear all pictures in the conditional and nested ones */
609 if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY) 615 if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY)
610 clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, data)); 616 clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, data));
611 else if (data->tokens[i].type == WPS_TOKEN_VOLUMEBAR || 617 else if (data->tokens[i].type == WPS_TOKEN_VOLUMEBAR ||
612 data->tokens[i].type == WPS_TOKEN_PROGRESSBAR) 618 data->tokens[i].type == WPS_TOKEN_PROGRESSBAR ||
619 data->tokens[i].type == WPS_TOKEN_BATTERY_PERCENTBAR )
613 { 620 {
614 struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data; 621 struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data;
615 bar->draw = false; 622 bar->draw = false;
@@ -677,6 +684,7 @@ static bool get_line(struct gui_wps *gwps,
677 684
678#ifdef HAVE_LCD_BITMAP 685#ifdef HAVE_LCD_BITMAP
679 case WPS_TOKEN_VOLUMEBAR: 686 case WPS_TOKEN_VOLUMEBAR:
687 case WPS_TOKEN_BATTERY_PERCENTBAR:
680 case WPS_TOKEN_PROGRESSBAR: 688 case WPS_TOKEN_PROGRESSBAR:
681 { 689 {
682 struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data; 690 struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index eb63ac56e9..6ea0180534 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -202,7 +202,7 @@ static const struct wps_tag all_tags[] = {
202 { WPS_TOKEN_ALIGN_RIGHT_RTL, "aR", 0, NULL }, 202 { WPS_TOKEN_ALIGN_RIGHT_RTL, "aR", 0, NULL },
203 { WPS_NO_TOKEN, "ax", 0, parse_languagedirection }, 203 { WPS_NO_TOKEN, "ax", 0, parse_languagedirection },
204 204
205 { WPS_TOKEN_BATTERY_PERCENT, "bl", WPS_REFRESH_DYNAMIC, NULL }, 205 { WPS_TOKEN_BATTERY_PERCENT, "bl", WPS_REFRESH_DYNAMIC, parse_progressbar },
206 { WPS_TOKEN_BATTERY_VOLTS, "bv", WPS_REFRESH_DYNAMIC, NULL }, 206 { WPS_TOKEN_BATTERY_VOLTS, "bv", WPS_REFRESH_DYNAMIC, NULL },
207 { WPS_TOKEN_BATTERY_TIME, "bt", WPS_REFRESH_DYNAMIC, NULL }, 207 { WPS_TOKEN_BATTERY_TIME, "bt", WPS_REFRESH_DYNAMIC, NULL },
208 { WPS_TOKEN_BATTERY_SLEEPTIME, "bs", WPS_REFRESH_DYNAMIC, NULL }, 208 { WPS_TOKEN_BATTERY_SLEEPTIME, "bs", WPS_REFRESH_DYNAMIC, NULL },
@@ -1166,7 +1166,7 @@ static int parse_progressbar(const char *wps_bufptr,
1166 pb->width = vp->width; 1166 pb->width = vp->width;
1167 pb->height = SYSFONT_HEIGHT-2; 1167 pb->height = SYSFONT_HEIGHT-2;
1168 pb->y = -line_num - 1; /* Will be computed during the rendering */ 1168 pb->y = -line_num - 1; /* Will be computed during the rendering */
1169 if (token->type == WPS_TOKEN_VOLUME) 1169 if (token->type == WPS_TOKEN_VOLUME || token->type == WPS_TOKEN_BATTERY_PERCENT)
1170 return 0; /* dont add it, let the regular token handling do the work */ 1170 return 0; /* dont add it, let the regular token handling do the work */
1171 add_to_ll_chain(&wps_data->progressbars, item); 1171 add_to_ll_chain(&wps_data->progressbars, item);
1172 return 0; 1172 return 0;
@@ -1233,12 +1233,15 @@ static int parse_progressbar(const char *wps_bufptr,
1233 add_to_ll_chain(&wps_data->progressbars, item); 1233 add_to_ll_chain(&wps_data->progressbars, item);
1234 if (token->type == WPS_TOKEN_VOLUME) 1234 if (token->type == WPS_TOKEN_VOLUME)
1235 token->type = WPS_TOKEN_VOLUMEBAR; 1235 token->type = WPS_TOKEN_VOLUMEBAR;
1236 else if (token->type == WPS_TOKEN_BATTERY_PERCENT)
1237 token->type = WPS_TOKEN_BATTERY_PERCENTBAR;
1236 pb->type = token->type; 1238 pb->type = token->type;
1237 1239
1238 return ptr+1-wps_bufptr; 1240 return ptr+1-wps_bufptr;
1239#else 1241#else
1240 (void)wps_bufptr; 1242 (void)wps_bufptr;
1241 if (token->type != WPS_TOKEN_VOLUME) 1243 if (token->type != WPS_TOKEN_VOLUME &&
1244 token->type != WPS_TOKEN_BATTERY_PERCENTBAR)
1242 { 1245 {
1243 wps_data->full_line_progressbar = 1246 wps_data->full_line_progressbar =
1244 token->type == WPS_TOKEN_PLAYER_PROGRESSBAR; 1247 token->type == WPS_TOKEN_PLAYER_PROGRESSBAR;
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index e727c255a1..3b155509f9 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -59,6 +59,7 @@ enum wps_token_type {
59 /* Battery */ 59 /* Battery */
60 TOKEN_MARKER_BATTERY, 60 TOKEN_MARKER_BATTERY,
61 WPS_TOKEN_BATTERY_PERCENT, 61 WPS_TOKEN_BATTERY_PERCENT,
62 WPS_TOKEN_BATTERY_PERCENTBAR,
62 WPS_TOKEN_BATTERY_VOLTS, 63 WPS_TOKEN_BATTERY_VOLTS,
63 WPS_TOKEN_BATTERY_TIME, 64 WPS_TOKEN_BATTERY_TIME,
64 WPS_TOKEN_BATTERY_CHARGER_CONNECTED, 65 WPS_TOKEN_BATTERY_CHARGER_CONNECTED,