[Kde-imaging] [Bug 297459] Cancel button doesnt work when it is in the process

Gilles Caulier caulier.gilles at gmail.com
Thu Apr 5 08:50:18 UTC 2012


https://bugs.kde.org/show_bug.cgi?id=297459

--- Comment #7 from Gilles Caulier <caulier.gilles at gmail.com> ---
Smit,

I take a look into RedEyesRemoval tool source code to see how it's implemented.

Look like the object used to process image is Locator :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.h#L117

It's called by 3 possible operations provided by tool :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.cpp#L99

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.cpp#L108

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.cpp#L113

To be able to stop Locator operation, cancel variable need to be shared with
Locator instance. We can pass cancel memory address to Locator instance by a
dedicated method.

In Locator implementation, here haarclassifierlocator class :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp

... we need to check if cancel address content pass to true in each processing
loop to cancel computations.

I use this technic into KPWriteImage class to be able to cancel writing image
data  to file :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/common/libkipiplugins/tools/imageio/kpwriteimage.h#L71

Gilles Caulier

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kde-imaging mailing list