Merge pull request #403 from LorenDB/fixEmojiCategories

Get category switching working
This commit is contained in:
DeepBlueV7.X 2021-01-23 23:31:05 +01:00 committed by GitHub
commit ccc5903161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1701 additions and 97 deletions

View file

@ -11,19 +11,6 @@ class Emoji(object):
self.code = repr(code.encode('utf-8'))[1:].strip("'") self.code = repr(code.encode('utf-8'))[1:].strip("'")
self.shortname = shortname self.shortname = shortname
def generate_code(emojis, category):
tmpl = Template('''
const std::vector<Emoji> emoji::Provider::{{ category }} = {
// {{ category.capitalize() }}
{%- for e in emoji %}
Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ category.capitalize() }}},
{%- endfor %}
};
''')
d = dict(category=category, emoji=emojis)
print(tmpl.render(d))
def generate_qml_list(**kwargs): def generate_qml_list(**kwargs):
tmpl = Template(''' tmpl = Template('''
const QVector<Emoji> emoji::Provider::emoji = { const QVector<Emoji> emoji::Provider::emoji = {
@ -93,12 +80,4 @@ if __name__ == '__main__':
# Use xclip to pipe the output to clipboard. # Use xclip to pipe the output to clipboard.
# e.g ./codegen.py emoji.json | xclip -sel clip # e.g ./codegen.py emoji.json | xclip -sel clip
generate_code(people, 'people') generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags)
generate_code(nature, 'nature')
generate_code(food, 'food')
generate_code(activity, 'activity')
generate_code(travel, 'travel')
generate_code(objects, 'objects')
generate_code(symbols, 'symbols')
generate_code(flags, 'flags')
generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags)

View file

@ -19,11 +19,11 @@ enum class DecryptionErrorCode
// and try again // and try again
MissingSessionIndex, // Session was found, but it does not reach back enough to this index, MissingSessionIndex, // Session was found, but it does not reach back enough to this index,
// retrieve from backup or request from other devices and try again // retrieve from backup or request from other devices and try again
DbError, // DB read failed DbError, // DB read failed
DecryptionFailed, // libolm error DecryptionFailed, // libolm error
ParsingFailed, // Failed to parse the actual event ParsingFailed, // Failed to parse the actual event
ReplayAttack, // Megolm index reused ReplayAttack, // Megolm index reused
UnknownFingerprint, // Unknown device Fingerprint UnknownFingerprint, // Unknown device Fingerprint
}; };
struct DecryptionResult struct DecryptionResult

File diff suppressed because it is too large Load diff