summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/emoji_codegen.py17
-rwxr-xr-xscripts/generate_icns.sh36
2 files changed, 42 insertions, 11 deletions
diff --git a/scripts/emoji_codegen.py b/scripts/emoji_codegen.py

index 634887b2..b39feb34 100755 --- a/scripts/emoji_codegen.py +++ b/scripts/emoji_codegen.py
@@ -14,8 +14,9 @@ class Emoji(object): 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{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ category.capitalize() }}}, {%- endfor %} }; ''') @@ -23,6 +24,19 @@ const std::vector<Emoji> emoji::Provider::{{ category }} = { d = dict(category=category, emoji=emojis) print(tmpl.render(d)) +def generate_qml_list(**kwargs): + tmpl = Template(''' +const QVector<Emoji> emoji::Provider::emoji = { + {%- for c in kwargs.items() %} + // {{ c[0].capitalize() }} + {%- for e in c[1] %} + Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ c[0].capitalize() }}}, + {%- endfor %} + {%- endfor %} +}; + ''') + d = dict(kwargs=kwargs) + print(tmpl.render(d)) if __name__ == '__main__': if len(sys.argv) < 2: @@ -87,3 +101,4 @@ if __name__ == '__main__': 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) \ No newline at end of file diff --git a/scripts/generate_icns.sh b/scripts/generate_icns.sh
index 98a5e68f..9563b704 100755 --- a/scripts/generate_icns.sh +++ b/scripts/generate_icns.sh
@@ -9,19 +9,35 @@ set -eu INPUT=$1 OUTPUT=nheko +filename=$(basename -- "$1") +extension="${filename##*.}" + mkdir ${OUTPUT}.iconset -sips -z 16 16 "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16.png -sips -z 32 32 "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16@2x.png -sips -z 32 32 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32.png -sips -z 64 64 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32@2x.png -sips -z 128 128 "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128.png -sips -z 256 256 "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128@2x.png -sips -z 256 256 "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256.png -sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256@2x.png -sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_512x512.png +if [ extension = "svg" ]; then + rsvg-convert -h 16 "${INPUT}" > ${OUTPUT}.iconset/icon_16x16.png + rsvg-convert -h 32 "${INPUT}" > ${OUTPUT}.iconset/icon_16x16@2x.png + rsvg-convert -h 32 "${INPUT}" > ${OUTPUT}.iconset/icon_32x32.png + rsvg-convert -h 64 "${INPUT}" > ${OUTPUT}.iconset/icon_32x32@2x.png + rsvg-convert -h 128 "${INPUT}" > ${OUTPUT}.iconset/icon_128x128.png + rsvg-convert -h 256 "${INPUT}" > ${OUTPUT}.iconset/icon_128x128@2x.png + rsvg-convert -h 256 "${INPUT}" > ${OUTPUT}.iconset/icon_256x256.png + rsvg-convert -h 512 "${INPUT}" > ${OUTPUT}.iconset/icon_256x256@2x.png + rsvg-convert -h 512 "${INPUT}" > ${OUTPUT}.iconset/icon_512x512.png + rsvg-convert -h 1024 "${INPUT}" > ${OUTPUT}.iconset/icon_512x512@2x.png +else + sips -z 16 16 "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16.png + sips -z 32 32 "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16@2x.png + sips -z 32 32 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32.png + sips -z 64 64 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32@2x.png + sips -z 128 128 "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128.png + sips -z 256 256 "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128@2x.png + sips -z 256 256 "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256.png + sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256@2x.png + sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_512x512.png -cp "${INPUT}" ${OUTPUT}.iconset/icon_512x512@2x.png + cp "${INPUT}" ${OUTPUT}.iconset/icon_512x512@2x.png +fi iconutil -c icns ${OUTPUT}.iconset