Use Qt Resource System for all the extra files we ship
KMM comes with a bunch of extra resource files that are required for it to work properly, e.g.
- account templates
- icons
- background pics, html and css
- help docs
- etc.
Almost all of these are copied to a target installation location (*nix) or bundled with package (Windows, macOS) and accessed from the code using standard paths, e.g. QStandardPaths::locate(QStandardPaths::GenericDataLocation, "somefile")
Unfortunately, due to inefficiencies of Qt in handling of the peculiarities of these platforms, this generic approach doesn't work for macOS and AppImage without additional hacks (see e.g. https://invent.kde.org/packaging/craft-blueprints-kde/-/tree/master/libs/qt5/qtbase/.qt-5.15.0 or numerous #ifndef IS_APPIMAGE
directives in the code).
Moreover, storing these files on the filesystem introduces extra complexity to the packaging scripts (currently handled by Craft Blueprint) by having to explicitly white- or blacklist them.
All these issues can be remedied by leveraging Qt Resource System to embed such files into our binaries. This has already been implemented for icons handling and can be replicated for all the other resources.
The disadvantage is that it does increase the memory usage for the resources that would otherwise not be immediately loaded on startup, albeit Qt does a decent job at compressing them at build time, so the memory tax should be miniscule. It also makes it impossible to manually edit/adjust those resources.
The obvious advantage is that it is a K.I.S.S approach which will reduce the time we spent on fixing the packaging issues going forward. It also should make things easier for developers when debugging, potentially deprecating the prefix.sh
script (also see FAQ)
Following is the list of the resources and the code bits that can be migrated over, refactored or removed:
-
Icons ( .qrc
already getting generated dynamically in master) -
weboob plugin .py
script (!45 (merged)) -
checking plugin templates -
.kmt
templates (kmymoney\templates
), see https://bugs.kde.org/show_bug.cgi?id=425333 -
background pics ( kmymoney\pics
) -
welcome page ( kmymoney\html
) -
reports ( reports::ReportTable::cssFileNameGet()
) -
reconciliation report -
qml files (chipTan) -
plugins' own .rc
files (not thekmymoneyrc
) (see https://phabricator.kde.org/D528#0b38f892)-
cleanup IS_APPIMAGE
directives
-
-
IBAN/BIC databases (ibanbicdata plugin, doesn't seem to work yet) -
KMyMoneyUtils::findResource()
-
possibly update/removepart of ECMprefix.sh
-
possibly update Craft Blueprint, if needed (after merging to 5.1 as well) -
update developer wiki with guidelines for future development work