[analog-clock] Allow themes to define hand shadow offset & hand rot center

Authored by kossebau on Mar 29 2019, 11:05 AM.

Description

[analog-clock] Allow themes to define hand shadow offset & hand rot center

Summary:
Currently the shadow offset of the hands as well as the rotation center of
the hands is hard-coded to match the light model and the hands shape of the
Breeze theme. As well did some older change to move the rotation center to
width/2 in y direction break older themes which relied on the y=0 offset.

This patch adds the option for themes to control the shadow offset as well
as define the rotation offset for each hand (to avoid the need to create
large pixmaps as workaround with empty space to match the assumption of
the center to be at (width/2, width/2), by these new hints:

One shadow offset for all hands, as the simulated physical model can be
assumed to have all hands almost on same layer (also matching that we have
only one shadow for stacked objects, like windows, elsewhere):

  • hint-hands-shadow-offset-to-west/hint-hands-shadows-offset-to-east
  • hint-hands-shadow-offset-to-north/hint-hands-shadow-offset-to-south

(west vs. east & north vs. south as negative rect size is not possible).
If no hint is set, defaults to 0.
The default of 0 is a small breakage, but almost all themes from
store.kde.org do not use a shadow, also was the hour shadow broken/not shown
until recently and only fixed for upcoming Plasma 5.16, where the offset of
the shadows was tuned as well, so any themes with hand shadows will need
some tuning for Plasma 5.16 in any case.

Separate rotation offsets for all hands & their shadows, so pixmaps can be
as small as needed, with no transparent area padding needed:

  • hint-hourhand-rotation-center-offset
  • hint-hourhandshadow-rotation-center-offset
  • hint-minutehand-rotation-center-offset
  • hint-minutehandshadow-rotation-center-offset
  • hint-secondhand-rotation-center-offset
  • hint-secondhandshadow-rotation-center-offset

The offset is taken from the center of the hint element, relative
to the position of the hand element, so visually in the SVG file
the hint element directly marks the rotation center for the hand.
If no hint is set, defaults to (width/2, width/2).

Test Plan:
Clocks of unmodified themes from store.kde.org still look as before.
Themes with hints added have shadows at proper place as well as rotation
center of hands at the expected offset.

Reviewers: Plasma, VDG, mart, davidedmundson, ngraham

Reviewed By: Plasma, VDG, mart, ngraham

Subscribers: plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D20112