Fwd: App-installed icons on Windows

David Faure faure at kde.org
Sun Jan 8 21:06:37 UTC 2017


Hi Albert,

On mardi 3 janvier 2017 17:53:30 CET Albert Vaca wrote:
> Hi David,
> 
> As you came up with the idea of loading "icontheme.rcc" in KIconThemes [1]
> for Windows and OS X, maybe you can help me out with this :)
> 
> The current approach with "initRCCIconTheme()" limits us to a single RCC
> file to load icons from, and this is the Breeze icons file. The problem is
> that some KDE apps bundle icons that are not in Breeze.
> 
> Do you think we can easily make it load icons from more than one RCC file
> (maybe in every *.rcc in the executable directory)? 

I'm not sure I fully understand the issue. When you say "KDE apps bundle icons that are not in breeze", I suppose these icons are not installed into any icon theme but into share/icons, right, i.e. what KIconLoader calls the "User" dir?

I think the solution has nothing to do with rcc files. Apps can add their own icons into a .qrc file, no? (or a .rcc that they load, if they really want to keep it separate, but I don't see much point).

All that might be needed is something like this, then.

diff --git i/src/kiconloader.cpp w/src/kiconloader.cpp
index 726b43f..49a5480 100644
--- i/src/kiconloader.cpp
+++ w/src/kiconloader.cpp
@@ -645,6 +645,7 @@ bool KIconLoaderPrivate::initIconThemes()
 
     // Insert application specific themes at the top.
     searchPaths.append(appname + "/pics");
+    searchPaths.append(":/" + appname + "/pics");
 
     // Add legacy icon dirs.
     searchPaths.append(QStringLiteral("icons")); // was xdgdata-icon in KStandardDirs


> Or simply to mix icons
> from the compiled "icontheme.rcc" with icons present in the more
> traditional "share/icons/"? 

That's exactly how it works already on Unix...

David.

> Thanks for your time!
> Albert
> 
> [1] https://cgit.kde.org/kiconthemes.git/tree/src/kicontheme.cpp#n48
> 
> On Mon, Dec 5, 2016 at 12:07 PM, Albert Vaca <albertvaka at gmail.com> wrote:
> > The problem is Breeze already installs an rcc file (generated from a qrc).
> > I could generate a new one for app icons, but we can't load both with the
> > current code in KIconThemes.
> > 
> > On Mon, Dec 5, 2016 at 9:23 AM, Jasem Mutlaq <mutlaqja at ikarustech.com>
> > 
> > wrote:
> >> We use the .qrc file to store ALL the icons we use since there can
> >> sometimes be trouble locating them across different platforms (OSX &
> >> Windows). This is the most reliable way to ensure you have access to your
> >> icons.
> >> 
> >> Regards,
> >> Jasem
> >> 
> >> On Mon, Dec 5, 2016 at 10:43 AM, Hannah von Reth <vonreth at kde.org> wrote:
> >>> For application specific Icons you best place them in a qrc.
> >>> But I'm not sure what the best practice is here, but I think KStars is
> >>> already doing this and Kate maybe too.
> >>> 
> >>> Kind regards,
> >>> 
> >>> Hannah
> >>> 
> >>> ------------------------------
> >>> From: albertvaka at gmail.com
> >>> Date: Sat, 3 Dec 2016 11:03:37 +0100
> >>> Subject: App-installed icons on Windows
> >>> To: kde-windows at kde.org
> >>> 
> >>> Hi,
> >>> 
> >>> We have in place a solution to load the Breeze icon theme from
> >>> "icontheme.rcc" on Windows. But how can we do to also use app-installed
> >>> icons? Can we just register two rcc files? Should we change the code to
> >>> load every *.rcc file in the data dir, so apps can provide their own,
> >>> instead of limiting it to a single one?
> >>> 
> >>> Albert
> >> 
> >> --
> >> Best Regards,
> >> Jasem Mutlaq


-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-windows mailing list