Unit conversion

Petri Damstén petri.damsten at gmail.com
Mon Sep 1 15:58:55 CEST 2008


On Monday 01 September 2008 16:07:08 Gerhard Gappmeier wrote:
> The idea behind the tables is,
> that it is not necessary to make own classes for each unit that
> uses a different conversion and to write the conversion code again
> and again for everything.

Simpler conversions already use QHash and conversion code is only in one place 
(SimpleUnit).

> The table works on linear conversion y=k*x+d
> and so it can do all typical conversions from temperatures, over lengths,
> to speed and so on.
> At the moment I don't see a need for a more generic conversion routine
> like logarithmic conversions, but the formula could be extended if needed.

e.g. Time zone and currency cannot be made with simple tables.

> Another important advantage is, that this way it doesn't need much
> resources, and it doesn't need string parsing if you want e.g. convert
> "mph" to "km/h". This would also be very fast if you need to convert
> thousands of values.

I didn't think that plasma applets or runners would do mass conversion so 
performance was not the first priority.

Petri

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080901/028d2349/attachment.sig 


More information about the Plasma-devel mailing list