Introduce global icons hash table
ClosedPublic

Authored by wojnilowicz on Jun 25 2017, 12:49 PM.

Details

Summary

The purpose of this patch is to make icon handling in KMyMoney easier.
Moreover QIcon::fromTheme(QString, QString) make lots of QIcon::isNull(), which are costly. That can be avoided by providing correct icon name right from the beginning. That's what this patch does.

Advantages:

  1. Deduplication of QStringLiterals with icon names.
  2. New kmm_icons shared object allows to get icon names from every place in KMM without code size overhead.
  3. One place to add icon names and icon replacements.
  4. QIcon::isNull() isn't called explicitly, because we can't do anything useful if icon is null, so power isn't wasted on that.
  5. Pixmap cache names are unified now, so there will be no two identical icons in cache under different names.
  6. Simplified KMyMoneyUtils::overlayIcon and MyMoneyAccount::accountPixmap as lots of allocations go through them.
  7. Very easy to add new icon themes and easier to change theme on the fly.

Diff Detail

Repository
R261 KMyMoney
Lint
Lint Skipped
Unit
Unit Tests Skipped
wojnilowicz created this revision.Jun 25 2017, 12:49 PM
tbaumgart accepted this revision as: tbaumgart.Jul 6 2017, 11:39 AM
This revision is now accepted and ready to land.Jul 6 2017, 11:39 AM
wojnilowicz closed this revision.Jul 6 2017, 4:27 PM