Rework Sensor Browser
Needs RevisionPublic

Authored by tcanabrava on Jan 28 2019, 12:00 PM.

Details

Reviewers
davidedmundson
Summary

Move public classes to Internal Structs
Make sure we are not accessing something wrong
No need to clear on destruction
Simplify ::data() method
Test only once
Simplify iterating over items
Don't use java style iterators, they are quite slow.

Multipe misuses of a QMap

  • Don't detach the values
  • Don't .contains / .value, use find() directly
  • Cache the resut

Remove newlines

Diff Detail

Repository
R106 KSysguard
Branch
CleanSensorBrowser
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8279
Build 8297: arc lint + arc unit
tcanabrava created this revision.Jan 28 2019, 12:00 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 28 2019, 12:00 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
tcanabrava requested review of this revision.Jan 28 2019, 12:00 PM
argonel added inline comments.
gui/SensorBrowser.cpp
51

This one caused me to notice the style issues. The rule is "For pointers or references, use a single space before '*' or '&', but not after"

624

The removal of this constructor eliminates this assert. You've kept the others, perhaps move it to SensorBrowserModel::makeSensor?

tcanabrava added inline comments.Jan 30 2019, 8:10 AM
gui/SensorBrowser.cpp
51

ups. that was a typo.

624

I could argue that's impossible to hit this assert and that's preciosism (just like a try { } catch (...) after every 'new') but I can do that.

tcanabrava marked 4 inline comments as done.Feb 14 2019, 9:37 AM
tcanabrava updated this revision to Diff 51655.Feb 14 2019, 9:37 AM
  • Fix code style
  • re-add assert
  • Fix code style
zzag added a subscriber: zzag.Mar 25 2019, 10:39 AM

Fix code style

In general, the coding style situation in KSysGuard is a bit sad. I personally can't trace any distinct coding style, it's basically a mix of every potential coding style.

We should probably run clang-format and clang-tidy over it some time later.

gui/SensorBrowser.cpp
57

Please delete it.

172

Please make it const instead. It would be nice to use qAsConst as less as possible.

davidedmundson requested changes to this revision.May 17 2019, 12:09 AM
davidedmundson added a subscriber: davidedmundson.

Marking as requst changes due till we get the minor comments from zzag done

This revision now requires changes to proceed.May 17 2019, 12:09 AM