paintopsettings refactoring

LukasT.dev@gmail.com lukast.dev at gmail.com
Fri Jan 15 23:43:43 CET 2010


On Monday 30 November 2009 08:10:11 Boudewijn Rempt wrote:
> We had a discussion this Sunday on what to do with the problem that paintop
> settings and their widgets are so very closely tied together. We came to
>  the following redesign (which I'll also put on the wiki, but I cannot
>  reach that at the moment):

Is that on the wiki? I could not find it.

> We had an idea toremove the KisPaintOpSettings class and put the paintop
> options and custom options directly inside the paintop. But I'm not sure
>  how that works if we look at the flow when selecting a preset and starting
>  to paint:

So we will drop KisPaintOpSettings? 

So far I port the paintop like this

I have:

o KisPaintOpOption (e.g. KisSprayShapeOption)

contains GUI elements usually in UI file  + signals in code, 
sometimes some logic like prescaling QImage for the spray paintop according
particle size
	
every GUI element is connected to sigSettingChanged() so that the settings are 
updated and it also triggers update of the preview of the brush

if you forget to call the signal, the paintop does not know about the change 
in GUI because now paintops does not access widgets but settings

o KisPaintOpSettings

contains paintOutlineRect and paintOutline, basiclly it draws the outline of 
the brush (paintOutline) and returns the area to be restored on the canvas 
from the previous position of the brush outline (paintOutlineRect)

it used to have also changePaintOpSize method which is called by Shift-drag 
on-canvas size changing but that is moved now to KisPaintOpOptionsWidget

Every GUI element value is accessed through code like this 
getInt("Spray/diameter")

My paintops have access just to this KisPaintOpSettings object.

Questions:
1. Paintops will have access to the KisPaintOpOption? What is the design idea?

Problems:
* It is very frustrating job to port my paintops as I have many options in 
GUI. It is easy to make mistake because of the code like 
getInt("Spray/diaemter") compiles fine, but it has mistake (it suppose to be 
diameter). Is there any nice way to fprint the KisPaintOpSettings?

* I wanted to return QImage in the settings object because spray uses 
QImage.But there isn't method getQImage("Spray/imageBrush") or something like 
this.

I looked at the KisBrushOp code and it has access to class KisBrushOption. I 
will do that somehow similar, is that ok? PaintOp will have access to Options?



More information about the kimageshop mailing list