[Kde-imaging] Proposed enhancement to KIPIPlugins::ImagesList

Andi Clemens andi.clemens at gmx.net
Mon Dec 8 18:14:10 CET 2008


On Monday 08 December 2008 13:25:06 Aurélien Gâteau wrote:
> Andi Clemens wrote:
> > We can also do it like it is used in Digikam::EditorToolSettings. One
> > enum for everything, like so:
> >
> > enum ToolCodes {
> > ButtonsLeft,
> > ButtonsRight,
> > ButtonsBelow,
> > NoButtons,
> > AutoLoad,
> > AllowRAW
> > }
> >
> > We still can have defaults, but you don't have to provide them all the
> > time, only the things you want to change.
> > The widget could be called like this:
> >
> > ImagesList* imgl = new ImagesList(this, ButtonsBelow | AutoLoad);
> >
> > You just combine the things you want, the default is to turn them off or
> > in case of the buttons, display them on the right.
>
> Having all options crammed into one enum does not sound elegant... but I
>   agree it is definitely better than a set of bools. It is more readable
> and easily extended in a BC way.

Yes it is not the best way, but relayouting is also not trivial to do. You 
could split it into two enums, would be possible, too:

enum ButtonStyle
{
ButtonsLeft,
ButtonsRight,
ButtonsBelow,
NoButtons
}

enum I_DONT_KNOW_A_GOOD_NAME_NOW
{
AutoLoad,
AllowRaw
}

and put those two into the ctor

ImagesList(parent, ButtonStyle, UNKNOWN_NAME :-))

> I just had a look at the code of ImagesList ctor and it looks like at
> least moving autoLoad and allowRaw out would be trivial. I can provide a
> patch if you want.

Sure you can provide a patch...

Andi


More information about the Kde-imaging mailing list