[Weather] Make compact representation temperature text match size of clock text
ClosedPublic

Authored by ngraham on Nov 19 2019, 7:59 PM.

Details

Summary

Right now, the Weather widget's compact representation's temperature text is not the same
size as the text for the clock, which looks especially awkward when both are placed
adjacent to one another. In addition, the text size has no upper bound, so it can become
absolutely gigantic with a tall panel.

This patch fixes both issues by using the same size logic used in the digital clock,
ensuring that the text sizes are identical.

I know that this uses a magic value, and that this is bad and I should feel bad.
However it's the same one used in the digital clock. Once more than one widget is using
this "height * 0.7" value, it becomes feasible to factor it out into something in
plasma-framework maybe so we can use it to get consistent text size everywhere.

Hopefully that can be material for a subsequent patch though.

Test Plan

No change for vertical panels.

Before, default horizontal panel:

After, default horizontal panel:

Before: double-height horizontal panel:

After, double-height horizontal panel:

Before, absurdly humongous horizontal panel:

After, absurdely humongous horizontal panel:

Diff Detail

Repository
R114 Plasma Addons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Nov 19 2019, 7:59 PM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 19 2019, 7:59 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ngraham requested review of this revision.Nov 19 2019, 7:59 PM
filipf added a subscriber: filipf.Nov 19 2019, 9:33 PM

and I should feel bad.

:D

+1. It might also be useful to add a little reminder in the digital clock's code that the magic numbers are also used here if someone wants to change digital clock.

Sure, if and when this lands, I'll add that note to the applicable place in the code for the Digital Clock. And then we can plan out how to turn this into a constant that lives somewhere else.

I wonder, some users might not want to see the temperature decimal points, maybe an option to hide it? The reason I exposed that level of temperature in the engine was when you live in cold climates the exact decimal temperature might help to tell you if there was ice possible. But from the UI side we could hide it by default instead and make it optional to expose the decimals?

I wonder, some users might not want to see the temperature decimal points, maybe an option to hide it? The reason I exposed that level of temperature in the engine was when you live in cold climates the exact decimal temperature might help to tell you if there was ice possible. But from the UI side we could hide it by default instead and make it optional to expose the decimals?

I would say that for Celsius it is always useful because Censius is has a more restricted range of common temperatures, but for Fahrenheit with its wider range, it's never useful. Material for the next patch, maybe. Is this one okay?

Probably could also say the same for, winds/visibility those could be rounded in some places depending on the unit(s).

as for the change, it looks good to me..

Can you formally accept, maybe?

spstarr accepted this revision.Nov 20 2019, 5:42 PM
This revision is now accepted and ready to land.Nov 20 2019, 5:42 PM
This revision was automatically updated to reflect the committed changes.