blob: 4572652cd3c7346f2a8c1f8cf2d96b9ea6a0e46c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#!/bin/bash
# layouts-to-png
# Convert SVG files to 1x and 2x PNGs. Dump a list of Qt resource
# file entries upon successful completion.
#
# Copyright 2014 Gerald Combs <gerald [AT] wireshark.org>
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
# COMMON_ARGS="--export-area-page"
#SVGCLEANER=$( type -p svgcleaner )
# Running on WSL. Set as needed for Mac/linux.
INKSCAPE_EXE="inkscape.com"
ICONS="
layout_1
layout_2
layout_3
layout_4
layout_5
layout_6
"
if [ -n "$*" ] ; then
ICONS="$*"
fi
QRC_FILES=""
for SIZE in 16x16 24x24 ; do
WIDTH=${SIZE/x*/}
HEIGHT=${SIZE/*x/}
SIZE_DIR=${SIZE}
TWO_X_WIDTH=$(( WIDTH * 2 ))
TWO_X_HEIGHT=$(( HEIGHT * 2 ))
ONE_X_ARGS="--export-width=${WIDTH} --export-height=${HEIGHT}"
TWO_X_ARGS="--export-width=${TWO_X_WIDTH} --export-height=${TWO_X_HEIGHT}"
echo "Converting $SIZE_DIR"
cd $SIZE_DIR || exit 1
for ICON in $ICONS ; do
echo "Converting $ICON"
ONE_X_SVG="../../layouts.svg"
TWO_X_SVG=$ONE_X_SVG
ICONNAME="x-reset-$ICON"
ONE_X_PNG=${ICONNAME}.png
TWO_X_PNG=${ICONNAME}@2x.png
if [ "$ONE_X_SVG" -nt "$ONE_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $ONE_X_ARGS --export-id="$ICON" \
--export-filename="$ONE_X_PNG" $ONE_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${SIZE_DIR}/${ONE_X_PNG}"
fi
if [ "$TWO_X_SVG" -nt "$TWO_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $TWO_X_ARGS --export-id="$ICON" \
--export-filename="$TWO_X_PNG" $TWO_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${SIZE_DIR}/${TWO_X_PNG}"
fi
done
cd ..
done
for QRC_FILE in $QRC_FILES ; do
echo " <file>stock_icons/${QRC_FILE}</file>"
done
echo "--------------------------------------"
QRC_FILES=""
for SIZE in 48x48 96x96 ; do
WIDTH=${SIZE/x*/}
HEIGHT=${SIZE/*x/}
OUT_DIR=".."
TWO_X_WIDTH=$(( WIDTH * 2 ))
TWO_X_HEIGHT=$(( HEIGHT * 2 ))
ONE_X_ARGS="--export-width=${WIDTH} --export-height=${HEIGHT}"
TWO_X_ARGS="--export-width=${TWO_X_WIDTH} --export-height=${TWO_X_HEIGHT}"
echo "Converting $OUT_DIR"
for ICON in $ICONS ; do
echo "Converting $ICON"
ONE_X_SVG=${OUT_DIR}/layouts.svg
TWO_X_SVG=$ONE_X_SVG
ICONNAME="$ICON"
ONE_X_PNG=${OUT_DIR}/${ICONNAME}.png
TWO_X_PNG=${OUT_DIR}/${ICONNAME}@2x.png
if [ "$ONE_X_SVG" -nt "$ONE_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $ONE_X_ARGS --export-id="$ICON" \
--export-filename="$ONE_X_PNG" $ONE_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${ICONNAME}.png"
fi
if [ "$TWO_X_SVG" -nt "$TWO_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $TWO_X_ARGS --export-id="$ICON" \
--export-filename="$TWO_X_PNG" $TWO_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${ICONNAME}@2x.png"
fi
done
done
for QRC_FILE in $QRC_FILES ; do
echo " <file>${QRC_FILE}</file>"
done
#
# Editor modelines - https://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 4
# tab-width: 8
# indent-tabs-mode: nil
# End:
#
# vi: set shiftwidth=4 tabstop=8 expandtab:
# :indentSize=4:tabSize=8:noTabs=true:
#
|