Active Settings refactoring done

Sebastian Kügler sebas at kde.org
Sun Jan 1 17:50:26 UTC 2012


Happy new year,

I'm pretty much done with the work we discussed concerning the Active Settings 
app and infrastructure. To refresh your brain, a few keypoints:

* Active Settings is a plugin-based shell to display configuration modules
* Configuration modules are either pure QML packages, for example using 
  KConfig declarative bindings
* Modules provide optional C++ plugins to implement extensions
* Settings modules can be embedded into apps using a set of declarative 
  imports

I've moved and refactored most of the guts of Active Settings into its own 
plugin (in plasma-mobile/components/settings, exported as 
org.kde.active.settings. (If that's not a good name to export, we'd better 
change it now.) Code is currently in the sebas/settingscomponent branch in the 
plasma-mobile git repo. From my POV, I'm planning to move this into master if 
nobody screams.

The C++ plugins are now pretty lightweight, basically exporting one QObject 
derived class as plugin, and registering one or more QObject-based types to 
the declarative runtime. We get away with minimal build deps here (kdelibs 
plugin macros, KPluginFactory and QObject, so it's very easy to ship settings 
modules individually of our releases.

The KConfig bindings have not yet seen more work, so nested group support is 
not yet in there. I'll have a closer look at the JS bindings, and will try to 
come up with something compatible to that, I guess.

As a result of this refactoring, the active-settings appp is now pretty 
minimal, but sadly needing about 236 lines of C++ just to set the command line 
args as context property. (I haven't found a way to do that inside the plugin, 
and I don't see how it would be possible.) We have a fine candidate for a 
"general app launcher" class here, which encapsulates the kdeclarative 
setupBiindings stuff, and loading a package, probably something close to what 
plasmoidviewer or plasma-windowed does. Suggestions welcome, this code is more 
or less duplicated everywhere in plasma-mobile/applications/*.

As a test case for embedding a settings module directly into an app, I've 
implemented an embedded settings module with the browser's dashboard:

Config button: http://wstaw.org/m/2012/01/01/plasma-desktopeT1657.png
Settings module in browser: 
http://wstaw.org/m/2012/01/01/plasma-desktopgz1657.png

I've written a tutorial which covers pretty much all the aspects of 
implementing this.

http://techbase.kde.org/Development/Tutorials/Plasma/QML/ActiveSettings

This very nicely complements Thomas' work on the Active Settings HIG. :)

Questions, comments, reviews are of course welcome.

Cheers,
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Active mailing list