RCC for icons - update: Re: Icons installed by apps
Jaroslaw Staniek
staniek at kde.org
Sun Feb 21 21:08:42 UTC 2016
On 18 February 2016 at 18:25, Kåre Särs <kare.sars at iki.fi> wrote:
> On Thursday, February 18, 2016 02:51:58 PM René J.V. Bertin wrote:
> > On Thursday February 18 2016 13:55:18 Jaroslaw Staniek wrote:
> > >>> > since QIcon::fromTheme() apaprently isn't able to find app icons.
> >
> > Care to explain? QIcon::fromTheme() doesn't find anything "out of the
> box"
> > on OS X (and I presume on MS Windows), but that is only because no theme
> > search path is set on those platforms. When you add the standard XDG icon
> > repository to the icon search path on OS X, even "pure" Qt5 application
> > will start showing icons all over if you have an icon theme installed --
> > including in widgets that should not have icons according to the HIG.
> Also
> > on OS X, fromTheme() will only return the application icon (as in the
> icon
> > shown in the Finder) if the current theme defines that same icon for the
> > calling application, and the theme search path is set of course. In all
> > other cases it will not, because the application icon is not defined
> > through a theme on OS X (nor is it on MS Windows, I presume).
> > >> I think the solution with a packaged breeze icons resource working
> > >> out-of-the box could be a good (lightweight) addition for non-Plasma
> > >> (non-Linux?) users of KF5, to popularize KF5. They grab the icons
> package
> >
> > Popularise, with Breeze "art"work? O:-)
> > Anyway, I don't think "grabbing an icon package" will work on OS X, not
> if
> > you want to create standalone app bundles which by definition contain
> > everything they need.
> > >> and icons just work without thousands of files, caching, etc. 'One in
> a
> > >> million' would of these users would be interested in theming.
> >
> > I'd up that estimate if we're still talking about Breeze icons here O:-)
> >
> > >> PS2: I have been beaten by situations such as KToolBar setting 0-size
> > >> icons by default.
> >
> > Partly this is because almost no KF5 code uses the fallback argument of
> > QIcon::fromTheme() explicitly, which means that the function returns an
> > empty icon if the search fails. In particular, statements like
> >
> > app->setWindowIcon(QIcon::fromTheme(programName))
> >
> > should read
> >
> > app->setWindowIcon(QIcon::fromTheme(programName, app->windowIcon()))
> >
> > >> This is in a Windows env where no themes are (properly) installed. If
> the
> > >> rcc-based solution is in use I would imagine that ideally all the KF5
> > >> code
> > >> detects this somehow and would not look for xdg standard themes
> through
> > >> the
> > >> classic KIconLoader but silently adapt so the rcc resource works
> great.
> > >> Just a dream.
> >
> > If your rcc resource corresponds to the resource mentioned in the
> > QIcon::fromTheme() documentation (I think that talks about "qrc") and if
> I
> > interpret that documentation correctly then yes, code using that function
> > will find icons from the rcc/qrc "builtin" resource over those in xdg
> > themes (if the XDG icon repository is even in the icon theme search
> path).
> > >>> What I don't know however is whether artists consider that these
> icons
> > >>> should be themeable...
> >
> > I think icon artists will consider that you should touch their icons (for
> > theming or anything else). They will probably also consider that their
> > icons are the "best" but they really should also consider it a right for
> > anyone to use other icons ;)
> >
>
> The breeze.rcc file way is actually how Christoph solved it in Kate for
> Windows and OSX. We create an .rcc file from the breeze icons and at
> start-up
> we search for the file in QStandardPaths::DataLocation and if the file is
> found we load it with registerResource() and add ":/icons" to the
> themeSearchPaths. (kate.git/icons.h)
>
> Christoph also added ":/icons" to the search path in kicontheme so that
> xmlgui
> toolbars and friends also get the icons from the .rcc file.
>
> We get all the same icons as on Linux neatly in one file :)
>
> breesze's symlinks was a problem on windows, but I created a small
> application
> to replace the symlinked files with an alias pointing to the target file ->
> smaller .rcc file :)
>
Thanks for reminding this, Kåre!
I went this way and started with manual creation of rcc on Windows.
Then I've added some cmake code for creation of an rcc for app icons
(Kexi).
I think the code would be usable to the same for breeze_icons.rcc and have
it in breeze-icons.git, and maybe by default for non-XDG platforms. So
people can build the fresh file very easily. Then a more flexible loading
code could be put into the kiconthemes, and we're mostly done. Things
should work with qmake too, so the list of projects potentially interested
-- grows.
Now I have two rcc files, registering app's icons rcc first, then the
global breeze one, what gives name overriding as expected. Not sure I will
want to override eventually, it's not good idea but nice to have as
emergency (I needed it once).
I'll be experimenting with the approach for _libs_ such as kproperty, that
are almost Qt-only, and have GUI bits so they need icons. Sometimes lib
authors even want to offer a stripped-down option for building their libs.
The rcc icons approach looks nice for them too.
Finally, I don't need to endlessly update the filenames for
ecm_install_icons(), not even the GLOB command is needed.
In terms of Linux packaging, there can be still one rcc breeze package to
create, 13MiB uncompressed, shared. So in 'worst' case two instances of
breeze icons sit in the system, where the second one is the traditional.
Not bad. If I had to develop a 'light' Qt desktop (think LXQt?) I'd look at
rcc files.
--
regards, Jaroslaw Staniek
KDE:
: A world-wide network of software engineers, artists, writers, translators
: and facilitators committed to Free Software development - http://kde.org
Calligra Suite:
: A graphic art and office suite - http://calligra.org
Kexi:
: A visual database apps builder - http://calligra.org/kexi
Qt Certified Specialist:
: http://www.linkedin.com/in/jstaniek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160221/890d6e3a/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list