Add save and reset state functionality to the crop tool
ClosedPublic

Authored by aichingm on Apr 1 2020, 11:39 AM.

Details

Summary

The state is saved after the crop tool emits CropTool::done and gets
recalled if a new CropTool is created. The state also gets reset by
hitting the newly added reset button in the QDialogButtonBox of the
CropTool. The state also gets reset if the saved crop rectangle is
not within the image which is about to be cropped.

The use case for this is cropping the multiple images to the same
area. Like removing boarders of a series of pictures taken in a
photo both.

Test Plan

Select the first image. Use the crop tool to crop it to region.
Click "Crop".
Select an image with the same or a larger size.
Select the crop tool.
The selection area should now be the same as used on the first image.
Hitting the reset button should reset all parameters to the defaults.

Alternatively: instead of the second (equal or larger) image select a image smaller than the crop area.
Again use the crop tool.
The selection should now cover the whole image.

Diff Detail

Repository
R260 Gwenview
Lint
Lint Skipped
Unit
Unit Tests Skipped
aichingm requested review of this revision.Apr 1 2020, 11:39 AM
aichingm created this revision.
aichingm updated this revision to Diff 79091.EditedApr 1 2020, 8:46 PM

Now deleting the state in the destructor

ngraham accepted this revision.Apr 14 2020, 9:08 PM
ngraham added a subscriber: ngraham.

Thanks for your patience here. I've had the same use case in the past and this is pretty much how I would implement it too. I just have one insignificant comment that could be addressed (see below).

Also, could you provide an email address we could use to land this with correct git authorship information?

app/imageopscontextmanageritem.cpp
290

This could also just be setRect(QRect());

This revision is now accepted and ready to land.Apr 14 2020, 9:08 PM

Also, could you provide an email address we could use to land this with correct git authorship information?

I'm new to the phabricator workflow, where would i provide that information?

app/imageopscontextmanageritem.cpp
290

Could you be more specific, I can't find the method QRect::setRect(QRect r)?

Also, could you provide an email address we could use to land this with correct git authorship information?

I'm new to the phabricator workflow, where would i provide that information?

Right here in a comment. This will get a lot better with the GitLab migration in a few weeks. :)

app/imageopscontextmanageritem.cpp
290

never mind, my bad

aichingm marked 3 inline comments as done.Apr 19 2020, 6:49 PM

Right here in a comment. This will get a lot better with the GitLab migration in a few weeks. :)

Mario Aichinger <aichingm@gmail.com>

This revision was automatically updated to reflect the committed changes.

Great job with this patch! May it be the first of many. :)