Review of resource types/paths
Jaroslaw Staniek
staniek at kde.org
Thu Aug 25 14:26:27 BST 2016
Maybe on topic: I am all for Qt-ifying the path management and testing
how every change works on Windows/Mac. I find using the
QStandardPaths::AppDataLocation a good move, on Windows gives
QCoreApplication::applicationDirPath() + "/data/". Among other things
it makes it easier to prepare "relocable" or "portable" installation
that is not scattered across the folders.
Kexi is not using the KoResourcePaths at all but we of course shall
exchange experience and patterns.
Regarding replacing hardcoded path /usr/share/create/patterns/gimp
maybe this would work:
QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
"create/patterns/gimp", StandardPaths::LocateDirectory)
On 25 August 2016 at 14:50, Dag <danders at get2net.dk> wrote:
> 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
--
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
More information about the calligra-devel
mailing list