forked from len0rd/rockbox
Revert "[Feature] Skin engine Themes grab text from a file %ft(file, line) WIP"
This reverts commit 62b5dfd81d
.
This was accidentally merged, and wasn't up-to-date anyway.
Change-Id: I4fcceb8dc4f86762701daab72498202cabd8295a
This commit is contained in:
parent
3b78daed14
commit
e6851a55ed
32 changed files with 50 additions and 144 deletions
|
@ -1316,73 +1316,6 @@ static int parse_progressbar_tag(struct skin_element* element,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int parse_filetext(struct skin_element *element,
|
||||
struct wps_token *token,
|
||||
struct wps_data *wps_data)
|
||||
{
|
||||
(void)wps_data;
|
||||
const char* filename;
|
||||
char buf[MAX_PATH];
|
||||
int line = 0;
|
||||
int fd;
|
||||
|
||||
/* format: %ft(filename[,line]) */
|
||||
filename = get_param_text(element, 0);
|
||||
|
||||
if (element->params_count == 2)
|
||||
line = get_param(element, 1)->data.number;
|
||||
else if (element->params_count != 1)
|
||||
{
|
||||
DEBUGF("%s(file, line): %s Error: param count %d\n",
|
||||
__func__, filename, element->params_count);
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
path_append(buf, root_realpath(), filename, sizeof(buf));
|
||||
DEBUGF("%s %s[%d]\n", __func__, buf, line);
|
||||
|
||||
if ((fd = open_utf8(buf, O_RDONLY)) < 0)
|
||||
{
|
||||
DEBUGF("%s: Error Opening %s\n", __func__, buf);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
int rd = 0;
|
||||
while (line >= 0)
|
||||
{
|
||||
if ((rd = read_line(fd, buf, sizeof(buf))) < 0)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
}
|
||||
line--;
|
||||
}
|
||||
|
||||
if (rd <= 0) /* empty line? */
|
||||
{
|
||||
DEBUGF("%s: Error(%d) Reading %s\n", __func__, rd, filename);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
buf[rd] = '\0';
|
||||
char * skinbuf = skin_buffer_alloc(rd+1);
|
||||
|
||||
if (!skinbuf)
|
||||
{
|
||||
DEBUGF("%s: Error No Buffer %s\n", __func__, filename);
|
||||
close(fd);
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
strcpy(skinbuf, buf);
|
||||
close(fd);
|
||||
token->value.data = PTRTOSKINOFFSET(skin_buffer, skinbuf);
|
||||
token->type = SKIN_TOKEN_STRING;
|
||||
return 0;
|
||||
failure:
|
||||
element->type = COMMENT;
|
||||
token->type = SKIN_TOKEN_NO_TOKEN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ALBUMART
|
||||
static int parse_albumart_load(struct skin_element* element,
|
||||
struct wps_token *token,
|
||||
|
@ -2445,9 +2378,6 @@ static int skin_element_callback(struct skin_element* element, void* data)
|
|||
case SKIN_TOKEN_FILE_DIRECTORY:
|
||||
token->value.i = get_param(element, 0)->data.number;
|
||||
break;
|
||||
case SKIN_TOKEN_FILE_TEXT:
|
||||
function = parse_filetext;
|
||||
break;
|
||||
#ifdef HAVE_BACKDROP_IMAGE
|
||||
case SKIN_TOKEN_VIEWPORT_FGCOLOUR:
|
||||
case SKIN_TOKEN_VIEWPORT_BGCOLOUR:
|
||||
|
|
|
@ -633,23 +633,20 @@ static int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
|
|||
{
|
||||
token = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
if (token)
|
||||
retval = token->value.i;
|
||||
return token->value.i;
|
||||
}
|
||||
else if (element->type == CONDITIONAL)
|
||||
{
|
||||
struct conditional *conditional = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
int val = evaluate_conditional(gwps, 0, conditional, element->children_count);
|
||||
|
||||
int tmoval = get_subline_timeout(gwps, get_child(element->children, val));
|
||||
if (tmoval >= 0)
|
||||
int val = evaluate_conditional(gwps, 0, conditional,
|
||||
element->children_count);
|
||||
if (val >= 0)
|
||||
{
|
||||
return MAX(retval, tmoval); /* Bugfix %t()%?CONDITIONAL tmo ignored */
|
||||
retval = get_subline_timeout(gwps, get_child(element->children, val));
|
||||
if (retval >= 0)
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
else if (element->type == COMMENT)
|
||||
{
|
||||
retval = 0; /* don't display this item */
|
||||
}
|
||||
element = SKINOFFSETTOPTR(skin_buffer, element->next);
|
||||
}
|
||||
return retval;
|
||||
|
@ -660,7 +657,6 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
|
|||
bool changed_lines = false;
|
||||
struct line_alternator *alternator = SKINOFFSETTOPTR(skin_buffer, element->data);
|
||||
unsigned old_refresh = info->refresh_type;
|
||||
|
||||
if (info->refresh_type == SKIN_REFRESH_ALL)
|
||||
{
|
||||
alternator->current_line = element->children_count-1;
|
||||
|
@ -701,10 +697,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
|
|||
if (suitable)
|
||||
{
|
||||
alternator->current_line = try_line;
|
||||
if (TIME_AFTER(current_tick, alternator->next_change_tick))
|
||||
{
|
||||
alternator->next_change_tick = current_tick + rettimeout;
|
||||
}
|
||||
alternator->next_change_tick = current_tick + rettimeout;
|
||||
}
|
||||
|
||||
info->refresh_type = SKIN_REFRESH_ALL;
|
||||
|
|
14
apps/main.c
14
apps/main.c
|
@ -199,20 +199,6 @@ int main(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOTLOADER)
|
||||
char buf[MAX_PATH / 2];
|
||||
path_append(buf, root_realpath(),ROCKBOX_DIR"/playername.txt", sizeof(buf));
|
||||
if (!file_exists(buf))
|
||||
{
|
||||
int fd = open(buf, O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
||||
if(fd >= 0)
|
||||
{
|
||||
fdprintf(fd, "RockBox!");
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUTOROCK
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue