Add scan-area sliders and predefined page sizes combobox
ClosedPublic

Authored by sars on Jan 1 2020, 7:08 PM.

Details

Summary

Add scan-area sliders and a combo-box that contains predefined page sizes, but only the ones that fit in the maximum scan area of the scanner. The combo-box also contains landscape versions of the sizes that fit.

Test Plan

The sliders and combo-box interact with the normal selection and does not break it.

Diff Detail

Repository
R382 KSane Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sars requested review of this revision.Jan 1 2020, 7:08 PM
sars created this revision.

Could you add a screenshot to the Test Plan section maybe?

sars edited the test plan for this revision. (Show Details)Jan 2 2020, 7:07 PM
ngraham accepted this revision as: VDG, ngraham.Jan 2 2020, 7:16 PM
This revision is now accepted and ready to land.Jan 2 2020, 7:16 PM
sars added a comment.Jan 2 2020, 7:18 PM

I'm not 100% happy with having the size sliders there directly after the color options.

One option could be a separator line and a second to move the size options to a separate tab.
A third option could be to have a colapsable widget to hide the width,height,... options by default.

Any thoughts?

Are the sliders actually needed at all if the primary way to manipulate the scan area box is directly, by clicking and dragging on the preview?

sars added a comment.EditedJan 2 2020, 7:34 PM

The sliders provide the size of the scanned area in numeric form and there is the possibility to fine-tune the scan area without having to be too steady on the hand when doing the selection. So I do see a value in having the sliders in some form...

What I mean is that the spinboxes provide fine control, numeric input, and feedback. But the sliders provide gross control, which is already provided by the preview.

sars added a comment.Jan 3 2020, 7:24 AM

Ah OK :). The spinbox+slider is a reused widget that is used for all numeric properties in libksane :)

What do you think about having the size options in a separate tab?

Maybe the libksane widget could gain an option to not show the slider component?

@sars That's a really elegant solution. For me the gui is fine. Simple enough and functional. If hiding is necessary something like a collapsable accordeon view might be modern, but I'm no ui design expert.
I found one bug when I switch from a scan source with a big page size to a smaller scan source the combo box is updated and a valid item is selected but the width/height is not set correctly.
Actually I just found out that changing the scan source always resets x,y,w,h to 0,0,max,max

sars updated this revision to Diff 73082.Jan 8 2020, 5:57 PM
  • Set the page size to "Custom" when the source size changes.
sars added a comment.Jan 8 2020, 6:07 PM

@antonarnold Good bug catch! All the scan sources I have here, have the same size so I did never reach that code path...

As I always reset the size to full scan area the default size selection should be "Custom"

In a later PR, we could leave the size as it is, if it fits.

For another PR it could also be possible to go through the sizes in the combobox when the scan size is manually changed and set the size that matches, but I'm not sure it is worth the hassle ;)

antonarnold accepted this revision.Jan 8 2020, 7:03 PM
In D26351#590487, @sars wrote:

@antonarnold Good bug catch! All the scan sources I have here, have the same size so I did never reach that code path...

As I always reset the size to full scan area the default size selection should be "Custom"

In a later PR, we could leave the size as it is, if it fits.

For another PR it could also be possible to go through the sizes in the combobox when the scan size is manually changed and set the size that matches, but I'm not sure it is worth the hassle ;)

The update works as intended. in my opinion it's good enough if all the elements are consistent.
I found another minor bug that changes the size of the x+y offset sliders when the value of the w+h sliders are increased.



But this also ain't a dealbreaker for me.

sars added a comment.Jan 9 2020, 7:49 AM

@antonarnold I'm not exactly sure what is wrong in those ;)

I wonder if you mean that the size of the spin-box changes? The reason for that is that the maximum for the spin-box changes when the size changes. This is done to prevent the selection from being outside the possible scan area.

We could add a minimum width for the spin-box so that the size would not change al the time if that is the problem.

@sars ah you are right I thought it is supposed to be a fixed size layout but it is not as it can be seen in the before picture already.

There are a lot of unit conversions in the diff so I tried to run 'LC_ALL=en_US.en_US ./skanlite'
That doesn't look valid

sars added a comment.Jan 9 2020, 10:29 AM

Everything is big in America :)

I'll fix that asap.

sars updated this revision to Diff 73136.Jan 9 2020, 4:13 PM
  • Fix inch as display unit: 1 inch = 25.4 mm (it was not cm->inch)
This revision was automatically updated to reflect the committed changes.
sars added a comment.Jan 13 2020, 6:47 PM

Thank you both for the reviews :)