Review of resource types/paths

Dag danders at get2net.dk
Thu Aug 25 13:50:58 BST 2016


I have worked on resource paths lately, and that prompts me to suggest a 
review how this is used in calligra.
I have noticed the following:

* generally apps do:
KoResourcePaths::addResourceType("sheet-styles", "data", 
"calligrasheets/sheetstyles/")

Qt can find the apps directory so a better way (imo) would be:
KoResourcePaths::addResourceType("sheet-styles", "appdata", 
"sheetstyles/")

According to qt docs the first will not be compatible with all 
platforms.

* common calligra resources like calligra/thesarus is now got at by eg:
KoResourcePaths::findResource("data", 
"calligra/thesaurus/thesaurus.txt"));
A better (imho) would be to add a thesaurus resource type:
KoResourcePaths::addResourceType("calligra_thesaurus", "data", 
"calligra/thesaurus")
and then all could get it by:
KoResourcePaths::findResource("calligra_thesaurus", "thesaurus.txt"));

This eases maintenance if for some reason they must be moved later.

* There are some absolute paths to gimp files like:
KoResourcePaths::addResourceDir("ko_patterns", 
"/usr/share/create/patterns/gimp");
This is of course not platform agnostic, so is it possible with better 
solution?
Is it neccessary, now that krita is gone?

Cheers, Dag



More information about the calligra-devel mailing list