From 868445184374a04b6b2d0aaf24dcf448da7ef748 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 31 Aug 2018 22:44:37 +0200 Subject: [PATCH] Find icons in QML files --- scripts/required_icons.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/required_icons.sh b/scripts/required_icons.sh index dfca61f..a5c0934 100755 --- a/scripts/required_icons.sh +++ b/scripts/required_icons.sh @@ -15,10 +15,21 @@ for srcdir in "$@"; do icon_names["${iconset: 7 : -1}"]=1 fi done + # find icons in *.cpp files for from_theme_call in $(find "$srcdir" -iname '*.cpp' -print0 | xargs -0 cat | grep -Po 'QIcon::fromTheme\(QStringLiteral\(\".*?\"\)'); do icon_names["${from_theme_call: 33 : -2}"]=1 done + + # find icons in *.qml files + for icon_name in $(find "$srcdir" -iname '*.qml' -print0 | xargs -0 cat | grep -Pzo '(?<=icon\.name\: |iconName\: |source\: )(\".+\"|(.|\n)* \? \".+\" : \".+\")'); do + # FIXME: improve pattern to get rid of of this + [ "${#icon_name}" -ge 3 ] || continue + [ "${icon_name: 0 : 1}" == '"' ] || continue + [ "${icon_name: -1 : 1}" == '"' ] || continue + [ "${icon_name: 1 : 1}" == '#' ] && continue + icon_names["${icon_name: 1 : -1}"]=1 + done done # sort results