mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 18:50:47 +03:00
Keep old codes alongside new ones
Signed-off-by: BulbyVR <26726264+TheDrawingCoder-Gamer@users.noreply.github.com>
This commit is contained in:
parent
79399d8118
commit
90b88eb592
4 changed files with 52 additions and 18 deletions
10
resources/provider-header.txt
Normal file
10
resources/provider-header.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||||
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "emoji/Provider.h"
|
||||||
|
|
||||||
|
using namespace emoji;
|
||||||
|
|
||||||
|
|
6
scripts/codegen.sh
Normal file
6
scripts/codegen.sh
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
ROOT=$(realpath "$PWD/$(dirname "$0")/..")
|
||||||
|
cd $ROOT
|
||||||
|
cat resources/provider-header.txt > src/emoji/Provider.cpp
|
||||||
|
|
||||||
|
scripts/emoji_codegen.py resources/emoji-test.txt resources/shortcodes.txt >> src/emoji/Provider.cpp
|
|
@ -78,26 +78,26 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
char, name = re.match(r'^(\S+) E\d+\.\d+ (.*)$', charAndName).groups()
|
char, name = re.match(r'^(\S+) E\d+\.\d+ (.*)$', charAndName).groups()
|
||||||
# drop "face" part
|
#TODO: Handle skintone modifiers in a sane way
|
||||||
|
|
||||||
if name in shortcodeDict:
|
if name in shortcodeDict:
|
||||||
name = shortcodeDict[name]
|
# TODO: this duplicates emoji
|
||||||
|
categories[current_category].append(Emoji(code, shortcodeDict[name]))
|
||||||
|
|
||||||
|
if name.endswith(' face'):
|
||||||
|
name = name[:-5]
|
||||||
|
elif name.endswith(' button'):
|
||||||
|
name = name[:-7]
|
||||||
else:
|
else:
|
||||||
if name.endswith(' face'):
|
matchobj = re.match(r'^flag: (.*)$', name)
|
||||||
name = name[:-5]
|
if matchobj:
|
||||||
elif name.endswith(' button'):
|
country, = matchobj.groups()
|
||||||
name = name[:-7]
|
name = country + " flag"
|
||||||
else:
|
name = name.replace(" ", "_")
|
||||||
matchobj = re.match(r'^flag: (.*)$', name)
|
name = name.replace("“", "")
|
||||||
if matchobj:
|
name = name.replace("”", "")
|
||||||
country, = matchobj.groups()
|
name = name.replace(":", "")
|
||||||
name = country + " flag"
|
name = name.lower()
|
||||||
name = name.replace(" ", "_")
|
name = unidecode(name)
|
||||||
name = name.replace("“", "")
|
|
||||||
name = name.replace("”", "")
|
|
||||||
name = name.replace(":", "")
|
|
||||||
name = name.lower()
|
|
||||||
name = unidecode(name)
|
|
||||||
categories[current_category].append(Emoji(code, name))
|
categories[current_category].append(Emoji(code, name))
|
||||||
|
|
||||||
# Use xclip to pipe the output to clipboard.
|
# Use xclip to pipe the output to clipboard.
|
||||||
|
|
|
@ -14,6 +14,9 @@ const QVector<Emoji> emoji::Provider::emoji = {
|
||||||
QStringLiteral(u"grinning_face_with_big_eyes"),
|
QStringLiteral(u"grinning_face_with_big_eyes"),
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F604"), QStringLiteral(u"smile"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F604"), QStringLiteral(u"smile"), emoji::Emoji::Category::People},
|
||||||
|
Emoji{QStringLiteral(u"\U0001F604"),
|
||||||
|
QStringLiteral(u"grinning_face_with_smiling_eyes"),
|
||||||
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F601"),
|
Emoji{QStringLiteral(u"\U0001F601"),
|
||||||
QStringLiteral(u"beaming_face_with_smiling_eyes"),
|
QStringLiteral(u"beaming_face_with_smiling_eyes"),
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
|
@ -23,7 +26,13 @@ const QVector<Emoji> emoji::Provider::emoji = {
|
||||||
Emoji{QStringLiteral(u"\U0001F605"),
|
Emoji{QStringLiteral(u"\U0001F605"),
|
||||||
QStringLiteral(u"sweat_smile"),
|
QStringLiteral(u"sweat_smile"),
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
|
Emoji{QStringLiteral(u"\U0001F605"),
|
||||||
|
QStringLiteral(u"grinning_face_with_sweat"),
|
||||||
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F923"), QStringLiteral(u"rofl"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F923"), QStringLiteral(u"rofl"), emoji::Emoji::Category::People},
|
||||||
|
Emoji{QStringLiteral(u"\U0001F923"),
|
||||||
|
QStringLiteral(u"rolling_on_the_floor_laughing"),
|
||||||
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F602"),
|
Emoji{QStringLiteral(u"\U0001F602"),
|
||||||
QStringLiteral(u"face_with_tears_of_joy"),
|
QStringLiteral(u"face_with_tears_of_joy"),
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
|
@ -213,7 +222,13 @@ const QVector<Emoji> emoji::Provider::emoji = {
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F622"), QStringLiteral(u"crying"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F622"), QStringLiteral(u"crying"), emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F62D"), QStringLiteral(u"sob"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F62D"), QStringLiteral(u"sob"), emoji::Emoji::Category::People},
|
||||||
|
Emoji{QStringLiteral(u"\U0001F62D"),
|
||||||
|
QStringLiteral(u"loudly_crying"),
|
||||||
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F631"), QStringLiteral(u"scream"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F631"), QStringLiteral(u"scream"), emoji::Emoji::Category::People},
|
||||||
|
Emoji{QStringLiteral(u"\U0001F631"),
|
||||||
|
QStringLiteral(u"face_screaming_in_fear"),
|
||||||
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F616"),
|
Emoji{QStringLiteral(u"\U0001F616"),
|
||||||
QStringLiteral(u"confounded"),
|
QStringLiteral(u"confounded"),
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
|
@ -224,6 +239,9 @@ const QVector<Emoji> emoji::Provider::emoji = {
|
||||||
QStringLiteral(u"disappointed"),
|
QStringLiteral(u"disappointed"),
|
||||||
emoji::Emoji::Category::People},
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F613"), QStringLiteral(u"sweat"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F613"), QStringLiteral(u"sweat"), emoji::Emoji::Category::People},
|
||||||
|
Emoji{QStringLiteral(u"\U0001F613"),
|
||||||
|
QStringLiteral(u"downcast_face_with_sweat"),
|
||||||
|
emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F629"), QStringLiteral(u"weary"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F629"), QStringLiteral(u"weary"), emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F62B"), QStringLiteral(u"tired"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F62B"), QStringLiteral(u"tired"), emoji::Emoji::Category::People},
|
||||||
Emoji{QStringLiteral(u"\U0001F971"), QStringLiteral(u"yawning"), emoji::Emoji::Category::People},
|
Emoji{QStringLiteral(u"\U0001F971"), QStringLiteral(u"yawning"), emoji::Emoji::Category::People},
|
||||||
|
|
Loading…
Reference in a new issue