Debian Codegraph @

resources/scripts/generate-used-icons.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 # This script will generate .qrc file from used icons.
4 #
5 # PWD must be the root of repository.
6 # Output qrc file has paths relative to "resources" folder.
7
8 append_icon_theme_filesscip-shell shell shell-project 0.0.0 append_icon_theme_files().() {
9 local -n ICON_NAMES_TO_FIND=$1
10 local -n ALREADY_FOUND_ICONS=$2
11 local ICONS_BASE_FOLDER="$3"
12 local ICON_THEME_NAME="$4"
13
14 local ICON_THEME_FOLDER="$ICONS_BASE_FOLDER/$ICON_THEME_NAME"
15
16 # Find relevant icons.
17 for ICON_NAME in "${ICON_NAMES_TO_FIND[@]}"; do
18 local ICON=$(findscip-shell system . . find. "$ICON_THEME_FOLDER" -name "${ICON_NAME}.*" -printf "%P\n" | tailscip-shell system . . tail. -1)
19
20 if [scip-shell system . . `[`. -n "$ICON" ]; then
21 ALREADY_FOUND_ICONS+=("./$(basenamescip-shell system . . basename. "$ICONS_BASE_FOLDER")/$ICON_THEME_NAME/$ICON")
22 fi
23 done
24
25 # Append index file.
26 ALREADY_FOUND_ICONS+=("./$(basenamescip-shell system . . basename. "$ICONS_BASE_FOLDER")/$ICON_THEME_NAME/index.theme")
27 }
28
29 mainscip-shell shell shell-project 0.0.0 main().() {
30 local ROOT_FOLDER="$(pwdscip-shell system . . pwd.)"
31 local ROOT_SRC_FOLDER="$(pwdscip-shell system . . pwd.)/src/librssguard"
32 local RESOURCES_FOLDER="$ROOT_FOLDER/resources"
33 local THEMES_FOLDER="$RESOURCES_FOLDER/graphics"
34
35 local FOUND_ICON_FILES
36 local ICON_THEMES=("Breeze" "Breeze Dark" "Faenza" "Numix")
37 local ICON_NAMES=($(pcregrep.exe -r -h --om-separator=$'\n' -o1 -o2 '.+fromTheme\(QSL\(\"([\-\+a-z]+)\"\)(?:, QSL\(\"([\-\+a-z]+)\"\))?' "$ROOT_SRC_FOLDER" | sortscip-shell system . . sort. -u))
38
39 #cd $ROOT_SRC_FOLDER
40
41 # Build list of relative paths to individual icons.
42 for THEME_NAME in "${ICON_THEMES[@]}"; do
43 append_icon_theme_filesscip-shell shell shell-project 0.0.0 append_icon_theme_files(). ICON_NAMES FOUND_ICON_FILES "$THEMES_FOLDER" "$THEME_NAME"
44 done
45
46 # Generate final XML and print it.
47 printfscip-shell system . . printf. "<RCC>\n <qresource prefix=\"/\">\n"
48
49 for ICON_FILE in "${FOUND_ICON_FILES[@]}"; do
50 echoscip-shell system . . echo. " <file>$ICON_FILE</file>"
51 done
52
53 printfscip-shell system . . printf. " </qresource>\n</RCC>"
54
55 #declare -p FOUND_ICON_FILES
56 }
57
58 mainscip-shell shell shell-project 0.0.0 main().