Render some icons when possible

8-bit icon is required to make builds deterministic
This commit is contained in:
Luke Dashjr 2016-02-05 06:58:18 +00:00 committed by Gregory Sanders
parent ec8e73a4d6
commit ff6a0a103c
7 changed files with 77 additions and 14 deletions

View file

@ -33,7 +33,7 @@ OSX_BACKGROUND_IMAGE_DPIS=36 72
OSX_DSSTORE_GEN=$(top_srcdir)/contrib/macdeploy/custom_dsstore.py
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
OSX_INSTALLER_ICONS=src/qt/res/rendered_icons/bitcoin.icns
OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
@ -50,7 +50,7 @@ DIST_SHARE = \
BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \
$(top_srcdir)/contrib/devtools/security-check.py
WINDOWS_PACKAGING = $(top_srcdir)/src/qt/res/icons/bitcoin.ico \
WINDOWS_PACKAGING = src/qt/res/rendered_icons/bitcoin.ico \
$(top_srcdir)/share/pixmaps/nsis-header.bmp \
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
$(top_srcdir)/doc/README_windows.txt
@ -90,6 +90,9 @@ $(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
$(MKDIR_P) $(@D)
$(INSTALL_DATA) $< $@
$(OSX_INSTALLER_ICONS): FORCE
$(MAKE) -C src $(patsubst src/%,%,$@)
$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
$(MKDIR_P) $(@D)
$(INSTALL_DATA) $< $@

View file

@ -418,6 +418,17 @@ AC_ARG_WITH([daemon],
[build_bitcoind=$withval],
[build_bitcoind=yes])
can_render_icons=yes
AC_PATH_PROGS([RSVG_CONVERT],[rsvg-convert rsvg],no)
AC_PATH_PROGS([IMAGEMAGICK_CONVERT],[convert],no)
AC_PATH_PROGS([PNG2ICNS],[png2icns],no)
if test x$RSVG_CONVERT = xno; then
can_render_icons='rsvg-convert'
elif test x$IMAGEMAGICK_CONVERT = xno; then
can_render_icons='(ImageMagick) convert'
fi
use_pkgconfig=yes
case $host in
*mingw*)
@ -482,6 +493,10 @@ case $host in
;;
*darwin*)
if test x$PNG2ICNS = xno; then
can_render_icons='png2icns'
fi
TARGET_OS=darwin
LEVELDB_TARGET_FLAGS="-DOS_MACOSX"
if test x$cross_compiling != xyes; then
@ -531,8 +546,6 @@ case $host in
AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool)
AC_PATH_TOOL([OTOOL], [otool], otool)
AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage)
AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert)
AC_PATH_PROGS([IMAGEMAGICK_CONVERT], [convert],convert)
AC_PATH_PROGS([TIFFCP], [tiffcp],tiffcp)
dnl libtool will try to strip the static lib, which is a problem for
@ -582,6 +595,11 @@ case $host in
;;
esac
AM_CONDITIONAL([CAN_RENDER_ICONS], [test x$can_render_icons = xyes])
if test x$can_render_icons != xyes; then
AC_MSG_WARN([Couldn't find ${can_render_icons}; you won't get the Knots-branded Bitcoin icon])
fi
if test x$use_pkgconfig = xyes; then
m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)])
m4_ifdef([PKG_PROG_PKG_CONFIG], [

View file

@ -10,7 +10,7 @@ SetCompressor /SOLID lzma
!define URL @PACKAGE_URL@
# MUI Symbol Definitions
!define MUI_ICON "@abs_top_srcdir@/src/qt/res/icons/bitcoin.ico"
!define MUI_ICON "@abs_top_srcdir@/src/qt/res/rendered_icons/bitcoin.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT

View file

@ -238,14 +238,23 @@ BITCOIN_QT_H = \
qt/walletview.h \
qt/winshutdownmonitor.h
RES_ICONS = \
RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg
RES_RENDERED_ICONS = \
qt/res/rendered_icons/about.png \
qt/res/rendered_icons/bitcoin.ico \
qt/res/rendered_icons/bitcoin1024.png
RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \
qt/res/rendered_icons/about.svg \
$(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 512 1024) \
qt/res/rendered_icons/bitcoin.icns
RES_ICONS = $(RES_RENDERED_ICONS) \
qt/res/icons/add.png \
qt/res/icons/address-book.png \
qt/res/icons/about.png \
qt/res/icons/about_qt.png \
qt/res/icons/bitcoin.ico \
qt/res/icons/bitcoin_testnet.ico \
qt/res/icons/bitcoin.png \
qt/res/icons/chevron.png \
qt/res/icons/clock1.png \
qt/res/icons/clock2.png \
@ -443,7 +452,7 @@ $(QT_QRC_CPP): $(QT_QRC_BUILD) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MO
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD)
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) $(RES_ALL_RENDERED_ICONS)
CLEANFILES += $(CLEAN_QT)
@ -469,3 +478,36 @@ moc_%.cpp: %.h
@test -f $(LRELEASE)
@$(MKDIR_P) $(@D)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@
EXTRA_DIST += $(RES_RENDERED_ICON_SRC)
if CAN_RENDER_ICONS
qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg
$(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@
qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg
@$(MKDIR_P) $(@D)
sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@
qt/res/rendered_icons/bitcoin%.png: qt/res/src/bitcoin.svg
@$(MKDIR_P) $(@D)
$(RSVG_CONVERT) -f png -d $* -p $* < $< > $@
# NOTE: ImageMagick will never convert transparent PNGs to 8-bit ICOs, but GIF is fine
qt/res/rendered_icons/bitcoin%d8.gif: qt/res/rendered_icons/bitcoin%.png
$(IMAGEMAGICK_CONVERT) $^ -colors 256 -channel A -threshold '50%' $@
qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 512 1024 32 16)
$(PNG2ICNS) $@ $^
qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16)
$(IMAGEMAGICK_CONVERT) $^ $@
else
qt/res/rendered_icons/%: qt/res/icons/%
@$(MKDIR_P) $(@D)
cp $< $@
endif

View file

@ -1,6 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/icons">
<file alias="bitcoin">res/icons/bitcoin.png</file>
<file alias="bitcoin">res/rendered_icons/bitcoin1024.png</file>
<file alias="address-book">res/icons/address-book.png</file>
<file alias="quit">res/icons/quit.png</file>
<file alias="send">res/icons/send.png</file>
@ -42,7 +42,7 @@
<file alias="debugwindow">res/icons/debugwindow.png</file>
<file alias="open">res/icons/open.png</file>
<file alias="info">res/icons/info.png</file>
<file alias="about">res/icons/about.png</file>
<file alias="about">res/rendered_icons/about.png</file>
<file alias="about_qt">res/icons/about_qt.png</file>
<file alias="verify">res/icons/verify.png</file>
<file alias="warning">res/icons/warning.png</file>

View file

@ -1,4 +1,4 @@
IDI_ICON1 ICON DISCARDABLE "icons/bitcoin.ico"
IDI_ICON1 ICON DISCARDABLE "rendered_icons/bitcoin.ico"
IDI_ICON2 ICON DISCARDABLE "icons/bitcoin_testnet.ico"
#include <windows.h> // needed for VERSIONINFO

View file

@ -7,7 +7,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1"
id="svg2" sodipodi:docname="bitcoin-logo-noshadow.svg" inkscape:version="0.48.2 r9819" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1024px" height="1024px"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1in" height="1in"
viewBox="-34 -34 580 580" enable-background="new 0 0 1024 1024" xml:space="preserve">
<!-- nice shadow with alpha 0.35 -->

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After