Implement sorting of the device tree items
ClosedPublic

Authored by isaact on Aug 5 2017, 6:03 PM.

Details

Summary

This patch fixes the issue of processor numbers not being sorted in human-readable order.

It overloads the < operator on the SolDevice class to implement sorting by process number and sorting by storage volume names (as they should go, e.g.: sda, sda1, sda2...).

BUG: 380355

Test Plan

Diff Detail

Repository
R102 KInfoCenter
Lint
Lint Skipped
Unit
Unit Tests Skipped
isaact created this revision.Aug 5 2017, 6:03 PM
Restricted Application added a project: Plasma. · View Herald TranscriptAug 5 2017, 6:03 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
anthonyfieroni added a subscriber: anthonyfieroni.
anthonyfieroni added inline comments.
Modules/devinfo/soldevice.cpp
165 ↗(On Diff #17758)

left->number() < right->number() ?

169 ↗(On Diff #17758)

Reverse again ?

177 ↗(On Diff #17758)

Add a new line.

Modules/devinfo/soldevice.h
108 ↗(On Diff #17758)

Why virtual ?

broulik added inline comments.
Modules/devinfo/devicelisting.cpp
49 ↗(On Diff #17758)

Why disable again?

Modules/devinfo/soldevice.cpp
153 ↗(On Diff #17758)

Coding style: brace on the same line, also no need for explicit nullptr check:

if (otherDevice) {
cfeck requested changes to this revision.Aug 23 2017, 12:04 PM
cfeck added a subscriber: cfeck.

Isaac, do you want to work on the requested changes?

This revision now requires changes to proceed.Aug 23 2017, 12:04 PM
In D7155#138825, @cfeck wrote:

Isaac, do you want to work on the requested changes?

Sorry for the long delay in responding - I will work on the suggestions this weekend.

isaact marked 6 inline comments as done.Sep 4 2017, 7:18 PM

Thanks for the feedback - diff has been updated

Modules/devinfo/devicelisting.cpp
49 ↗(On Diff #17758)

I've removed the disable as it's pointless

Modules/devinfo/soldevice.cpp
165 ↗(On Diff #17758)

This is reversed as it's sorted in the opposite order (ascending) to the other entries (descending)

169 ↗(On Diff #17758)

These are also sorted in ascending order, so that it goes from sda1, sda2, etc.

Modules/devinfo/soldevice.h
108 ↗(On Diff #17758)

Habit - removed

isaact updated this revision to Diff 19184.Sep 4 2017, 7:22 PM
isaact edited edge metadata.
isaact marked 4 inline comments as done.

Updated code as per feedback

isaact edited the summary of this revision. (Show Details)Sep 4 2017, 7:22 PM
isaact edited the summary of this revision. (Show Details)Sep 4 2017, 7:24 PM
broulik accepted this revision.Jan 4 2018, 3:42 PM

Working well, thanks and sorry it took so long.
Do you have commit access? You perhaps need to rebase the patch since in the meantime the code was modernized and your patch doesn't cleanly apply anymore. I can take care of this if you want.

isaact updated this revision to Diff 26293.Jan 31 2018, 9:38 PM

Hi @broulik, I've rebased the diff based on the latest source revision (d3d3ee543a17a3859bf2204c15dc7c36804eed15).

Unfortunately I don't have commit access.

cfeck accepted this revision.Jun 21 2018, 11:10 PM

Looks like we lost tracking this. If nobody objects, I will commit this next week.

This revision is now accepted and ready to land.Jun 21 2018, 11:10 PM
davidedmundson accepted this revision.Jun 21 2018, 11:42 PM
davidedmundson added a subscriber: davidedmundson.

@cfeck go for it.

ngraham edited the summary of this revision. (Show Details)Jun 22 2018, 2:30 PM
ngraham edited the test plan for this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.