Draft: Refactor: Private separation, cleaner API and better imports
- Everything not intended for use in distro pages has been moved to org.kde.plasma.welcome.private
- API has been changed:
- Monolithic controller has been broken up into separate singletons with a clear purpose
- Core functionality is private
- No more Q_INVOKABLE for simple getters, instead expose a read-only property to the function
- Monolithic controller has been broken up into separate singletons with a clear purpose
- Minor code cleanup in areas including consistent QML imports between files and removal of unused
Design decisions:
- Moving everything not intended for distro's use to a private import means they won't be tempted to use them, and would clearly do so at risk - we can change and chop them as we see fit.
- The intention in breaking up
Controller
is that it allows for more scoped access to certain things, similar to Kirigami'sUnits
,Utils
and more.
Compatibility has been preserved for distro pages! Deprecation warnings will be printed to console, and we can remove Controller (now broken up) and GenericPage (renamed to Page) later down the road. Only launchApp
, runCommand
and copyToClipboard
persist, as these are the only things I believe distros would have used from there, but other redirections can be added for Distro
and Release
items if wanted.
networkAlreadyConnected
has been removed as QNetworkInformation and its QML equivalent QtNetwork's NetworkInformation do the same thing, but better.
Some weirdness: To use QML singletons in C++, singleton.h
includes common code to expose the same singleton to C++ as QML, and can be created by either. This is only strictly required for org.kde.plasma.welcome.private
's App
, but was also useful for Controller
's moved functionality. It's conceivable that this will be useful in the future, so the functionality has been abstracted out and duplicated for our other singletons.