KUnitConversion Review

John Layt jlayt at kde.org
Thu Feb 27 16:15:56 UTC 2014


Hi,

I've been reviewing KUnitConversion (KUC for short) and doing some small 
clean-ups, and I'm slowly coming to the conclusion I'm not a fan of the api.  
However it is used in a few places, so rather than try rewrite the api in the 
time remaining, I'll finish up the clean-ups and we can release it as is and 
look to replace it later on.

The main clean-ups are:

* Remove use of KCurrencyCode.  Currently it's only used to get the currency 
name of the 50 currencies KUC supports and it seems overkill to keep all 207 
data files and the api in KUC just for that purpose.  Instead I'd move it to 
kde4support with the rest of KLocale (we also need to move the config files 
from kde-runtime).  This would also remove the dependency on KConfigCore.

* Try port away from ki18n to tr().  KUC makes extensive use of ki18nc() and 
ki18ncp(), but I need to check with Chusselove if all the plural translations 
can be handled with Qt or if any are scripted.

* If we remove those two dependencies then KUC becomes Tier 1, but Tier 2 is 
fine either way.

* Convert more classes to QSharedData

* Some small API changes

* Lots of docs clean-ups, code style, etc are needed but can be done later.

I've done the first step, and I just need a volunteer to do the git magic 
required to:

* Move kcurrencycode.h and kcurrencycode.cpp including history from 
"kunitconversion/src" to "kde4support/src/kdecore"

* Move "kde-runtime/localization" and everything in it including history to 
"kde4support/src/localization" or "kde4support/runtime/localization" or 
wherever deemed appropriate

* Move "kde-runtime/l10n" and everything in it including history into the same 
"localization" folder as above but folder renamed from "l10n" to 
"localization/country" (i.e. at same level as "currency" folder)

* Make sure the data files are built and installed, but need to think about 
parallel installs with KDE4 data files

The data file moves are part of the kde-runtime clean-up, but it makes sense 
to do them alongside the code moves.

Longer term, I've started work on a new Tier 1 library tentatively called 
KStandards to support the different ISO code standards, and measurement 
standards and conversions.  I've already converted KCurrencyCode to a new 
KCurrency class using json files, and KCountry and KUnits should follow in due 
course to provide a future migration path for apps that need them.

Cheers!

John.



More information about the Kde-frameworks-devel mailing list