File indexing completed on 2024-12-22 04:40:14
0001 #!/bin/sh 0002 0003 set -e 0004 0005 icon_src_dir="$(dirname "$(readlink -f "$0")")" 0006 0007 icons=(`grep -hr QIcon::fromTheme "$icon_src_dir/../../src" \ 0008 | sed -n -E -e '/.*QIcon::fromTheme\((QStringLiteral\()?"([^"]+)"\)?\).*/ s|.*QIcon::fromTheme\((QStringLiteral\()?"([^"]+)"\)?\).*|\2| p'`) 0009 icons+=( 0010 kde 0011 mail-send 0012 languages 0013 set-language 0014 preferences-desktop-locale 0015 dialog-cancel 0016 dialog-close 0017 dialog-input-devices 0018 dialog-messages 0019 dialog-ok-apply 0020 dialog-ok 0021 dialog-scripts 0022 dialog-xml-editor 0023 edit-clear-all 0024 edit-clear-history 0025 edit-clear-list 0026 edit-clear-locationbar-ltr 0027 edit-clear-locationbar-rtl 0028 edit-clear 0029 edit-clone 0030 edit-comment 0031 edit-copy 0032 edit-cut 0033 edit-delete-remove 0034 edit-delete-shred 0035 edit-delete 0036 edit-download 0037 edit-entry 0038 edit-find 0039 edit-none 0040 edit-paste 0041 edit-redo 0042 edit-rename 0043 edit-reset 0044 edit-select-all 0045 edit-select-invert 0046 edit-select-none 0047 edit-select 0048 edit-select-text 0049 edit-undo 0050 tools-check-spelling 0051 tools-report-bug 0052 tools-wizard 0053 settings-configure 0054 configure 0055 configure-shortcuts 0056 configure-toolbars 0057 help-about 0058 help-contents 0059 help-contextual 0060 help-donate 0061 help-feedback 0062 help-hint 0063 help-keybord-shortcuts 0064 help-latex 0065 help-whatsthis 0066 ) 0067 icons=(`(for i in "${icons[@]}" ; do echo $i ; done) | sort -u`) 0068 0069 theme_dir="$1" 0070 [ -z "$theme_dir" -o ! -d "$theme_dir" ] && theme_dir="/usr/share/icons/breeze" 0071 0072 qrcEntries=( 0073 # "<file alias=\"breeze/index.theme\">$theme_dir/index.theme</file>\n" 0074 "<file alias=\"breeze/index.theme\">$icon_src_dir/breeze.theme</file>\n" 0075 ) 0076 groups=(actions/22 actions/24 status/22 places/22 apps/24 apps/22 preferences/32) 0077 for icon in "${icons[@]}"; do 0078 _icon="${icon/-/_}" 0079 0080 # check if already bundle 0081 grep -q -E "(\"|/)$icon.(png|svg)\"" "$icon_src_dir/icon-bundle.qrc" \ 0082 && echo -e "\t\e[32m'$icon'\e[m already in 'icon-bundle.qrc'" 1>&2 && continue 0083 0084 # icons in different dirs are different, thus not using * 0085 for grp in "${groups[@]}"; do 0086 file="$theme_dir/$grp/$icon.svg" 0087 [ -f "$file" ] && break 0088 done 0089 0090 if [ ! -f "$file" ]; then 0091 echo -e "\t\e[1;33mWARNING: can't find '$icon'\e[m" 1>&2 0092 find "$theme_dir" -name "$icon*" -printf "\t- candidate: %p\n" 1>&2 0093 continue 0094 fi 0095 0096 # finally bundle the icon 0097 _alias="$icon.${file##*.}" 0098 _file="$(echo "$file" | sed -Ee "s|$_rt/src/||")" 0099 0100 echo -e "\t'$_alias' => '$_file'" 1>&2 0101 qrcEntries+=("<file alias=\"breeze/actions/22/$_alias\">$_file</file>\n") 0102 done 0103 0104 # generate .qrc file 0105 echo '<!DOCTYPE RCC>' 0106 echo '<RCC version="1.0">' 0107 echo '<qresource prefix="/icons">' 0108 echo -en "${qrcEntries[@]}" 0109 echo '</qresource>' 0110 echo '</RCC>'