[nightcolor] Expose some properties to d-bus

Authored by zzag on Dec 13 2019, 1:21 PM.



Currently, in order to retrieve the current screen color temperature
applied to all screen as well other attributes of night color manager,
one has to call nightColorInfo() periodically. This goes against well
established patterns in d-bus world. It is recommended to expose a
bunch of d-bus properties rather than have a method that returns all
relevant properties stored in a JSON object.

The ugliest thing about this patch is that a lot of code is duplicated
to emit the PropertiesChanged signal. Unfortunately, QtDBus doesn't
take care of this and we are left with only two options - either do
weird things with QMetaObject or manually emit the signal. I have
picked the second option since it's more comprehensible and less magic
is going on, but I have to admit that the chosen approach is ugly.

I hope that "Qt 6 will fix it."

CCBUG: 400418

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Dec 13 2019, 1:21 PM
Restricted Application added a project: KWin. · View Herald TranscriptDec 13 2019, 1:21 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Dec 13 2019, 1:21 PM
davidedmundson accepted this revision.Dec 13 2019, 1:38 PM
This revision is now accepted and ready to land.Dec 13 2019, 1:38 PM
zzag updated this revision to Diff 71536.Dec 14 2019, 5:42 PM

Expose target temperature property.

This revision was automatically updated to reflect the committed changes.