Split Image Size into Width/Height
ClosedPublic

Authored by xyquadrat on Mar 30 2018, 7:17 PM.

Details

Summary

This patch splits the single property "Image Size" into "Width" and "Height", providing more fine-tuned control for power users.

FEATURE: 374559

Test Plan
  • Sorting works correctly
  • No real change, only exposed differently

Diff Detail

Repository
R318 Dolphin
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
xyquadrat requested review of this revision.Mar 30 2018, 7:17 PM
xyquadrat created this revision.
elvisangelaccio requested changes to this revision.Mar 31 2018, 9:48 AM
elvisangelaccio added a subscriber: elvisangelaccio.
elvisangelaccio added inline comments.
src/kitemviews/kfileitemmodel.cpp
1848–1853

Since we are splitting into width/height, we can just convert them to int, no?

This revision now requires changes to proceed.Mar 31 2018, 9:48 AM
xyquadrat updated this revision to Diff 31029.Mar 31 2018, 10:53 AM

Merge the ratingRole with widthRole/heightRole

Because the separate roles are now all strings, we can merge them to a single case.

xyquadrat marked an inline comment as done.Mar 31 2018, 10:54 AM
elvisangelaccio requested changes to this revision.Mar 31 2018, 12:57 PM

There are still a few bits of code to be ported:

$ git grep imageSize
src/kitemviews/private/kbaloorolesprovider.cpp:        if (role == "imageSize") {
src/kitemviews/private/kbaloorolesprovider.cpp:            // as one string into the "imageSize" role
src/kitemviews/private/kbaloorolesprovider.cpp:    // width of an image are mapped to the role "imageSize")
src/panels/places/placesitemmodel.cpp:                    props.setVisibleRoles({"text", "imageSize"});
This revision now requires changes to proceed.Mar 31 2018, 12:57 PM
xyquadrat updated this revision to Diff 31035.Mar 31 2018, 1:05 PM

Clean up references to imageSize

ngraham accepted this revision as: ngraham.Mar 31 2018, 5:19 PM
ngraham added a subscriber: ngraham.

+1 conceptually; it was never clear to the user how you could sort by both width and height at the same time. Code looks sane now (just one comment), and it works fine in my testing; actually sorting by width or height both seem to work as expected.

src/kitemviews/kfileitemmodel.cpp
1850

Maybe make it explicit that we're falling through for these with`Q_FALLTHROUGH()`

xyquadrat added inline comments.Mar 31 2018, 7:42 PM
src/kitemviews/kfileitemmodel.cpp
1850

TBH, I never heard of Q_FALLTHROUGH() before, so I had to look it up & found this: https://wiki.qt.io/Qt_Coding_Style#Switch_statements

Qt advises to not use this if another case follows immediately, but I can obviously still do this if this way is preferred here.

elvisangelaccio accepted this revision.Apr 1 2018, 8:58 AM
elvisangelaccio added inline comments.
src/kitemviews/kfileitemmodel.cpp
1850

Correct, Q_FALLTHROUGH is not supposed to be used here.

This revision is now accepted and ready to land.Apr 1 2018, 8:58 AM
xyquadrat marked 3 inline comments as done.Apr 1 2018, 10:12 AM
ngraham added inline comments.Apr 1 2018, 5:29 PM
src/kitemviews/kfileitemmodel.cpp
1850

Hmm, what do you think @elvisangelaccio?

1850

Gotcha, thanks for the correction!

ngraham closed this revision.Apr 1 2018, 5:30 PM