[Kde-hardware-devel] SolidBackendSelector API review

Kevin Ottens ervin at kde.org
Wed Apr 8 11:34:34 CEST 2009


On Saturday 28 March 2009 04:21:25 Ben Cooksley wrote:
> Visually, I propose using a approach similar to the widget used to
> select the Phonon backend, with "Defer" / "Prefer" buttons at the
> bottom of the list.

And actually Phonon should be a target to porting to a new shared backend 
selector.

> === Proposed specification ==
>
> SolidBackendSelector( QWidget *parent, QString type ) // type is the
> backend type that is going to be configured

If it ever reaches kdelibs, obviously the class name would need to be changed. 
Probably to a "KBackendSelector" or such.

> Functions:
> void saveConfiguration()
> void defaultConfiguration()

I guess that load()/save()/defaults() works better as it matches KCM linguo 
(and AFAIK this new class would be mainly used in KCMs).

> KIcon backendIcon()
> QString backendName()
> QString backendComment()
> QString backendVersion()

You can probably merge all of that in a single method which would be:
KService::Ptr selectedBackend() const;

This way the user of the class can query all the service information he needs, 
even some stuff which would be specific to him. With your proposed API you're 
limiting this ability.

> Signals:
> void selectionChanged()

For this one you have to also carry some information to tell if it changed to 
the initial value or not. Again in the case of a KCM that's needed to know if 
we have to enable or not the Apply button. Use case is the following:
 - I show the widget, we already have a backend X and it's selected, Apply is 
disabled
 - User selects the backend Y, Apply is enabled
 - User selects the backend X again, Apply should be disabled again.
You can only do that if you memorize that X was the previously selected one, 
and provide the information to the outside.

Regards.
-- 
Kévin 'ervin' Ottens, http://ervin.ipsquad.net
"Ni le maître sans disciple, Ni le disciple sans maître,
Ne font reculer l'ignorance."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-hardware-devel/attachments/20090408/4dd4bc84/attachment.sig 


More information about the Kde-hardware-devel mailing list