2014-10-28 00:32:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# svg-to-png
|
|
|
|
# Convert SVG files to 1x and 2x PNGs. Dump a list of Qt resource
|
|
|
|
# file entries upon successful completion.
|
2014-10-28 15:19:23 +00:00
|
|
|
#
|
|
|
|
# Copyright 2014 Gerald Combs <gerald [AT] wireshark.org>
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2014-10-28 00:32:26 +00:00
|
|
|
|
|
|
|
COMMON_ARGS="--export-area-page"
|
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
set_source_svgs() {
|
2014-10-28 00:32:26 +00:00
|
|
|
local out_icon=$1
|
|
|
|
case $out_icon in
|
|
|
|
x-capture-options)
|
2014-10-28 19:00:44 +00:00
|
|
|
out_icon=x-capture-options-gear
|
2014-10-28 00:32:26 +00:00
|
|
|
;;
|
|
|
|
x-capture-restart)
|
2014-10-28 19:00:44 +00:00
|
|
|
out_icon=x-capture-restart-fin
|
2014-10-28 00:32:26 +00:00
|
|
|
;;
|
|
|
|
x-capture-stop)
|
2014-10-28 19:00:44 +00:00
|
|
|
out_icon=x-capture-stop-red
|
2014-10-28 00:32:26 +00:00
|
|
|
;;
|
|
|
|
esac
|
2014-10-28 19:00:44 +00:00
|
|
|
ONE_X_SVG=${out_icon}.svg
|
|
|
|
TWO_X_SVG=${out_icon}@2x.svg
|
|
|
|
if [ ! -f ${TWO_X_SVG} ] ; then
|
|
|
|
TWO_X_SVG=$ONE_X_SVG
|
|
|
|
fi
|
|
|
|
if [ ! -f ${ONE_X_SVG} ] ; then
|
|
|
|
>&2 echo "Can't find ${ONE_X_SVG}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-10-28 00:32:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ICONS="
|
|
|
|
edit-find
|
|
|
|
go-first
|
|
|
|
go-jump
|
|
|
|
go-last
|
|
|
|
go-next
|
|
|
|
go-previous
|
2014-10-28 19:00:44 +00:00
|
|
|
x-capture-file-close
|
|
|
|
x-capture-file-save
|
2014-10-28 00:32:26 +00:00
|
|
|
x-capture-file-reload
|
|
|
|
x-capture-options
|
|
|
|
x-capture-restart
|
|
|
|
x-capture-start.on
|
|
|
|
x-capture-start
|
|
|
|
x-capture-stop
|
|
|
|
x-colorize-packets
|
|
|
|
x-resize-columns
|
|
|
|
x-stay-last
|
|
|
|
zoom-in
|
|
|
|
zoom-original
|
|
|
|
zoom-out
|
|
|
|
"
|
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
QRC_FILES=""
|
|
|
|
|
2014-10-28 00:32:26 +00:00
|
|
|
# XXX Add support for 16 pixel icons.
|
2014-10-28 19:00:44 +00:00
|
|
|
for SIZE in 16 24 ; do
|
2014-10-28 00:32:26 +00:00
|
|
|
SIZE_DIR=${SIZE}x${SIZE}
|
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
TWO_X_SIZE=`expr $SIZE \* 2`
|
|
|
|
ONE_X_ARGS="--export-width=${SIZE} --export-height=${SIZE}"
|
|
|
|
TWO_X_ARGS="--export-width=${TWO_X_SIZE} --export-height=${TWO_X_SIZE}"
|
2014-10-28 00:32:26 +00:00
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
cd $SIZE_DIR
|
2014-10-28 00:32:26 +00:00
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
for ICON in $ICONS ; do
|
|
|
|
set_source_svgs $ICON
|
2014-10-28 00:32:26 +00:00
|
|
|
|
|
|
|
ONE_X_PNG=${ICON}.png
|
|
|
|
TWO_X_PNG=${ICON}@2x.png
|
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
if [ $ONE_X_SVG -nt $ONE_X_PNG ] ; then
|
|
|
|
inkscape $COMMON_ARGS $ONE_X_ARGS \
|
|
|
|
--file=$ONE_X_SVG --export-png=$ONE_X_PNG || exit 1
|
|
|
|
fi
|
2014-10-28 00:32:26 +00:00
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
if [ $TWO_X_SVG -nt $TWO_X_PNG ] ; then
|
|
|
|
inkscape $COMMON_ARGS $TWO_X_ARGS \
|
|
|
|
--file=$TWO_X_SVG --export-png=$TWO_X_PNG || exit 1
|
|
|
|
fi
|
2014-10-28 00:32:26 +00:00
|
|
|
|
|
|
|
QRC_FILES="${QRC_FILES} ${ONE_X_PNG} ${TWO_X_PNG}"
|
|
|
|
done
|
|
|
|
|
2014-10-28 19:00:44 +00:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
for QRC_FILE in $QRC_FILES ; do
|
|
|
|
echo " <file>toolbar/${SIZE_DIR}/${QRC_FILE}</file>"
|
2014-10-28 00:32:26 +00:00
|
|
|
done
|
2014-10-28 19:00:44 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
#
|