Remove extension from fallback icon names using resources aliases

Bug #1534906 reported by djcj
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
Fix Released
Wishlist
Adam Reichold

Bug Description

Can you change the build and source files so that png icons are automatically used when the configuration "without_svg" was set?

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello djcj,

thank you for taking the time to report this. Can you explain more specifically what you mean by "png icons are automatically used"? If you disable SVG support, the only effects should be that the program will not be able to load SVG icons and hence not be able to use the fallback SVG icons. Usage of system-wide icon theme containing PNG icons should not be affected and there are no PNG versions of the fallback icons.

Best regards, Adam.

Revision history for this message
djcj (djcj) wrote :

Okay, so from begin on. I was working on Mingw32 builds because I needed a good FOSS pdf viewer for Windows. Since this app doesn't use global icons on Windows I had to rely on the fallback icons. The svg icons worked fine on Windows 10 (but QtSvg lib needed to be in the directory) but weren't shown in Wine. So I replaced them with png versions and disabled the svg support (side effect: makes the whole bundle a bit smaller).
This is the shell script I use for building on Msys:

#!/bin/sh

# helper script for mingw32 builds on Msys

VERSION="0.4.16"
include="/mingw32/include"

cat <<EOF > qpdfview_win32.pri
isEmpty(APPLICATION_VERSION):APPLICATION_VERSION = $VERSION

CONFIG += without_pkgconfig
CONFIG += without_magic
CONFIG += without_cups
CONFIG += without_synctex
CONFIG += without_signals
CONFIG += without_svg

RESOURCES += icons_png.qrc

PDF_PLUGIN_NAME = qpdfview_pdf.dll
PS_PLUGIN_NAME = qpdfview_ps.dll
DJVU_PLUGIN_NAME = qpdfview_djvu.dll
IMAGE_PLUGIN_NAME = qpdfview_image.dll

DJVU_PLUGIN_INCLUDEPATH += $include
DJVU_PLUGIN_LIBS += -ldjvulibre

PDF_PLUGIN_DEFINES += HAS_POPPLER_14
PDF_PLUGIN_DEFINES += HAS_POPPLER_18
PDF_PLUGIN_DEFINES += HAS_POPPLER_20
PDF_PLUGIN_DEFINES += HAS_POPPLER_22
PDF_PLUGIN_DEFINES += HAS_POPPLER_24
PDF_PLUGIN_DEFINES += HAS_POPPLER_26
#PDF_PLUGIN_DEFINES += HAS_POPPLER_31
#PDF_PLUGIN_DEFINES += HAS_POPPLER_35
PDF_PLUGIN_INCLUDEPATH += $include/poppler/qt4 $include/poppler
PDF_PLUGIN_LIBS += -lpoppler-qt4

PS_PLUGIN_INCLUDEPATH += $include
PS_PLUGIN_LIBS += -lspectre
EOF

make distclean
rm -f Makefile* lib*.a translations/*.qm icons/*.png

if [ ! -d sources_backup ]; then
    cp -r sources sources_backup
    for f in sources/*; do
        sed -i 's|\.svg"|.png"|g' $f
    done
fi

sed 's|\.svg|.png|g' icons.qrc > icons_png.qrc
for f in icons/*.svg; do
    rsvg-convert -o $(echo ${f%.*}).png $f
done

for f in translations/*.ts; do
    lrelease $f
done

mkdir -p release/data
cp -f help/*.html translations/*.qm release/data

qmake qpdfview.pro
make release

It works pretty well but I was wondering if it would make sense to add an option to use png fallback icons instead of svg ones.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello djcj,

thank you for your detailed explanation. First of all, let me remark that building under MSYS and running under Wine is a pretty niche scenario for an already niche application IMHO, which limits the amount of maintenance burden I would be willing to carry for this.

What I could do to make the above scenario simpler is using the alias function of Qt's resource system [1] to reference the icons with a format-independent name in the application so that patching the source would be unnecessary. Converting the icons and patching the QRC file however does not look out of place in a packaging script IMHO. What do you think about this?

Best regards, Adam.

[1] https://doc.qt.io/qt-4.8/resources.html#resource-collection-files-op-op-qrc

Revision history for this message
djcj (djcj) wrote :

Using the alias function so I don't have to modify the source sounds great.

Changed in qpdfview:
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Adam Reichold (adamreichold)
milestone: none → 0.4.17
summary: - use png icons when built without svg
+ Remove extension from fallback icon names using resources aliases
Changed in qpdfview:
status: Triaged → Fix Committed
Changed in qpdfview:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.