Find icons in QML files

This commit is contained in:
Martchus 2018-08-31 22:44:37 +02:00
parent e41326fede
commit 8684451843
1 changed files with 11 additions and 0 deletions

View File

@ -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