forked from len0rd/rockbox
tagtree: "By First Letter" : fix numerical entry + add a "Special character" entry
- The "Special character" entry will show all special characters (non numerical + non letters) - The numerical entry was bug, and could show some special characters from the ASCII table. It is now fixed. Change-Id: I001fb322fab81918996e15e4d0ca6b7c9e5160af
This commit is contained in:
parent
2cf6a443b1
commit
d5fc0e4cb3
5 changed files with 56 additions and 4 deletions
|
@ -3043,6 +3043,20 @@
|
|||
*: "Numeric"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_DISPLAY_SPECIAL_CHARACTER
|
||||
desc: Special character (japanese, accents, etc)
|
||||
user: core
|
||||
<source>
|
||||
*: "Special character"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Special character"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Special character"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_PM_MENU
|
||||
desc: in the display menu
|
||||
|
|
|
@ -2971,6 +2971,20 @@
|
|||
*: "Numérique"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_DISPLAY_SPECIAL_CHARACTER
|
||||
desc: Special character (japanese, accents, etc)
|
||||
user: core
|
||||
<source>
|
||||
*: "Special character"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Caractère spécial"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Caractère spécial"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_PM_MENU
|
||||
desc: in the display menu
|
||||
|
|
|
@ -234,6 +234,9 @@ static const char * const tag_type_str[] = {
|
|||
[clause_oneof] = "clause_oneof",
|
||||
[clause_begins_oneof] = "clause_begins_oneof",
|
||||
[clause_ends_oneof] = "clause_ends_oneof",
|
||||
[clause_not_oneof] = "clause_not_oneof",
|
||||
[clause_not_begins_oneof] = "clause_not_begins_oneof",
|
||||
[clause_not_ends_oneof] = "clause_not_ends_oneof",
|
||||
[clause_logical_or] = "clause_logical_or"
|
||||
};
|
||||
#define logf_clauses logf
|
||||
|
@ -1441,11 +1444,18 @@ static bool check_against_clause(long numeric, const char *str,
|
|||
return !str_ends_with(str, clause->str);
|
||||
case clause_oneof:
|
||||
return str_oneof(str, clause->str);
|
||||
case clause_not_oneof:
|
||||
return !str_oneof(str, clause->str);
|
||||
case clause_ends_oneof:
|
||||
/* Fall-Through */
|
||||
case clause_begins_oneof:
|
||||
return str_begins_ends_oneof(str, clause->str,
|
||||
clause->type == clause_begins_oneof);
|
||||
case clause_not_ends_oneof:
|
||||
/* Fall-Through */
|
||||
case clause_not_begins_oneof:
|
||||
return !str_begins_ends_oneof(str, clause->str,
|
||||
clause->type == clause_not_begins_oneof);
|
||||
default:
|
||||
logf("Incorrect tag: %d", clause->type);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq,
|
|||
clause_lt, clause_lteq, clause_contains, clause_not_contains,
|
||||
clause_begins_with, clause_not_begins_with, clause_ends_with,
|
||||
clause_not_ends_with, clause_oneof,
|
||||
clause_begins_oneof, clause_ends_oneof,
|
||||
clause_begins_oneof, clause_ends_oneof, clause_not_oneof,
|
||||
clause_not_begins_oneof, clause_not_ends_oneof,
|
||||
clause_logical_or };
|
||||
|
||||
struct tagcache_stat {
|
||||
|
|
|
@ -479,6 +479,9 @@ static int get_clause(int *condition)
|
|||
CLAUSE('@', '^', clause_begins_oneof),
|
||||
CLAUSE('@', '$', clause_ends_oneof),
|
||||
CLAUSE('@', ' ', clause_oneof),
|
||||
CLAUSE('*', '^', clause_not_begins_oneof),
|
||||
CLAUSE('*', '$', clause_not_ends_oneof),
|
||||
CLAUSE('!', '@', clause_not_oneof),
|
||||
CLAUSE(0, 0, 0) /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -1121,9 +1124,9 @@ static void build_firstletter_menu(char *buf, size_t bufsz)
|
|||
const char * const showsub = /* album subitem for canonicalartist */
|
||||
((strcasestr(subitem, "artist") == NULL) ? "title" : "album -> title");
|
||||
|
||||
/* Numeric ex: "Numeric" -> album ? album < "A" -> title = "fmt_title" */
|
||||
snprintf(buf, bufsz, fmt,
|
||||
str(LANG_DISPLAY_NUMERIC), subitem, subitem,'<', 'A', showsub);
|
||||
const char * fmt_numeric ="\"%s\"-> %s ? %s @^ \"0|1|2|3|4|5|6|7|8|9\" -> %s =\"fmt_title\"";
|
||||
snprintf(buf, bufsz, fmt_numeric,
|
||||
str(LANG_DISPLAY_NUMERIC), subitem, subitem, showsub);
|
||||
|
||||
if (!alloc_menu_parse_buf(buf, menu_byfirstletter))
|
||||
{
|
||||
|
@ -1140,6 +1143,16 @@ static void build_firstletter_menu(char *buf, size_t bufsz)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const char * fmt_special ="\"%s\"-> %s ? %s *^ \"0|1|2|3|4|5|6|7|8|9\" & "\
|
||||
"%s *^ \"A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z\" -> %s =\"fmt_title\"";
|
||||
snprintf(buf, bufsz, fmt_special,
|
||||
str(LANG_DISPLAY_SPECIAL_CHARACTER), subitem, subitem, subitem, showsub);
|
||||
|
||||
if (!alloc_menu_parse_buf(buf, menu_byfirstletter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static bool parse_menu(const char *filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue