Bug 341364

Summary: Nicklist themes don't scale to higher DPI
Product: [Applications] konversation Reporter: Eike Hein <hein>
Component: generalAssignee: Konversation Developers <konversation-devel>
Status: CONFIRMED ---    
Severity: normal CC: andrew.crouthamel, kde, kossebau
Priority: NOR    
Version: frameworks   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 341361    

Description Eike Hein 2014-11-28 14:45:49 UTC
Nicklist themes currently ship a single pixmap size optimized for low-DPI displays.

We need to:

- Revamp the theme format to support shipping multiple sizes and/or scalable assets. We should look at the tray icon overlay stuff in Plasma themes for inspiration there.

- Fix the code to properly use the assets. Again the Plasma tray overlay theme code should serve as a useful precedent here; we probably want QIcon to do all the selection work for us.

- Bring up at least the default theme to hi-dpi standards.

- Retain backwards compatibility with existing third-party themes.

Reproducible: Always
Comment 1 David Edmundson 2015-03-04 15:30:20 UTC
Given you load them as pixmaps manually from a filename if someone shipped .pngs called
irc_admin@2x.png it will load it automatically and set the right devicePixelRatio

The rest of your painting code looks to be fine.
Comment 2 Friedrich W. H. Kossebau 2020-09-30 16:12:58 UTC
(In reply to David Edmundson from comment #1)
> Given you load them as pixmaps manually from a filename if someone shipped
> .pngs called
> irc_admin@2x.png it will load it automatically and set the right
> devicePixelRatio

Neat, learned something new, was not aware of that QImageReader feature :) Though in Konversation case some pixmap overlay work is done, like putting the away or operator state pixmap on top of the user icon, so we need to replicate such loading behaviour to also pick up @2x variant files ourselves.

https://invent.kde.org/network/konversation/-/merge_requests/8 would be a first approach to the problem:

it extends the current support to alternatively to PNG icons load and use SVG icons, if files are found with the SVG suffix.

And for the PNG icons it checks for the presence of "@2x" PNG files and if present loads them to create and add alternative hidpi pixmaps to the QIcons used in the nick list.
Comment 3 Friedrich W. H. Kossebau 2020-09-30 17:53:49 UTC
*** Bug 392810 has been marked as a duplicate of this bug. ***
Comment 4 Friedrich W. H. Kossebau 2020-10-12 07:59:51 UTC
Git commit 42dc7b1429853f0840e4209d9faef3454a034898 by Friedrich W. H. Kossebau.
Committed on 12/10/2020 at 07:25.
Pushed by kossebau into branch '1.7'.

Support SVG nick icon themes, switch default to SVG

M  +13   -3    data/images/nickicons/default/CMakeLists.txt
D  +-    --    data/images/nickicons/default/irc_admin.png
A  +20   -0    data/images/nickicons/default/irc_admin.svg
D  +-    --    data/images/nickicons/default/irc_away.png
A  +11   -0    data/images/nickicons/default/irc_away.svg
D  +-    --    data/images/nickicons/default/irc_away_stacked.png
A  +11   -0    data/images/nickicons/default/irc_away_stacked.svg
D  +-    --    data/images/nickicons/default/irc_halfop.png
A  +18   -0    data/images/nickicons/default/irc_halfop.svg
D  +-    --    data/images/nickicons/default/irc_normal.png
A  +20   -0    data/images/nickicons/default/irc_normal.svg
D  +-    --    data/images/nickicons/default/irc_op.png
A  +9    -0    data/images/nickicons/default/irc_op.svg
D  +-    --    data/images/nickicons/default/irc_owner.png
A  +20   -0    data/images/nickicons/default/irc_owner.svg
D  +-    --    data/images/nickicons/default/irc_voice.png
A  +18   -0    data/images/nickicons/default/irc_voice.svg
M  +1    -0    src/CMakeLists.txt
M  +0    -15   src/common.cpp
M  +0    -1    src/common.h
M  +12   -9    src/config/theme_config.cpp
M  +1    -1    src/irc/nick.cpp
M  +30   -15   src/irc/nicklistview.cpp
M  +3    -6    src/irc/nicksonline.cpp
M  +14   -145  src/viewer/images.cpp
M  +7    -7    src/viewer/images.h
A  +307  -0    src/viewer/nickiconset.cpp     [License: GPL (v2+)]
A  +45   -0    src/viewer/nickiconset.h     [License: GPL (v2+)]

https://invent.kde.org/network/konversation/commit/42dc7b1429853f0840e4209d9faef3454a034898