Change static globals and static initialization in KisResourceTypes
These commits changes a number of things:
-
KisResourceTypes.h
hadstatic
globals, which causes them to be instantiated in every translation unit that includes it. This MR changes them toextern
globals and defined inKisResourceTypes.cpp
. - The QString ones are now initialized using
QStringLiteral
. -
ResourceName::resourceTypeToName
was constructing a freshQMap
on every call, and also translates theKLocalizedStrings
every time. This MR changes this to be statically initialized once on the first call.
The first two items reduces bloat and static initialization overhead, though it is negligible.
The last item fixes https://bugs.kde.org/show_bug.cgi?id=438116.
Test Plan
- Build with translations, and check that the first combobox in the "Manage Resources" dialog contains translated strings (if the strings are translated) or doesn't lag (if the strings are untranslated).
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.