Allow to turn of the QStandardPaths lookups
ClosedPublic

Authored by cullmann on Aug 22 2018, 8:31 PM.

Details

Summary

Rational: If you deploy this framework on your own, you might use a version not compatible with stuff in the normal QStandardPaths location. Or you just only want to have the highlighting files as shipped with your tool (and put in the resource or via addCustomSearchPath, like QtCreator).

Test Plan

make && make test works

Diff Detail

Repository
R216 Syntax Highlighting
Lint
Lint Skipped
Unit
Unit Tests Skipped
cullmann created this revision.Aug 22 2018, 8:31 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptAug 22 2018, 8:31 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
cullmann requested review of this revision.Aug 22 2018, 8:31 PM

I generally agree with having that option, just wondering if this should be a compile-time or runtime setting? Runtime would allow to also use the system framework if you only want to load your custom theme or syntax files, while still enabling the bundling use-cases you describe.

I can live with a runtime setter, too.
But it must be some stuff you can set before you instantiate the Repository, as you don't want to load potential hazard stuff from the normal locations.
Would some static function in repository that toggles this off/on be acceptable?

On the other side, with the define, no body can mess with the global settings of lookup without compiling a own version, which has it's benefits, too. (and all people bundling the stuff like QtCreator will anyways compile an own variant)

vkrause accepted this revision.Aug 23 2018, 7:31 AM

Good point regarding the initialization order, adding stuff is easier there than removing things. The only alternative I can think of would be lazy-loading in Repository, so you have the time to call normal members. Probably not worth the effort, let's go with the compile-time option then.

This revision is now accepted and ready to land.Aug 23 2018, 7:31 AM
This revision was automatically updated to reflect the committed changes.

I think now all things are in place for MIT like usage by other tools.
The AbsInt CI tells that tests still pass on macOS/Linux/Windows with both FEATURE_NO_STANDARD_PATHS on and SYNTAX_RESOURCE off.

Nice :) One thing that came to mind for static builds is that we probably need to manually initialize the qrc files in Repository, as that doesn't work automatically then. But if you take them out anyway, that's not a problem.

Nice :) One thing that came to mind for static builds is that we probably need to manually initialize the qrc files in Repository, as that doesn't work automatically then. But if you take them out anyway, that's not a problem.

We do that ;=)

static void initResource()
{
#ifdef HAS_SYNTAX_RESOURCE

Q_INIT_RESOURCE(syntax_data);

#endif

Q_INIT_RESOURCE(theme_data);

}

e.g. the themes work perfectly fine with static builds.

Ah, perfect :)