Add imperial gallon and US pint
ClosedPublic

Authored by riiga on Apr 19 2020, 8:48 PM.

Details

Summary

Adds imperial gallon and US pint as requested in a bug report.

BUG: 341072

Test Plan

I haven't figured out how to test the changes, so any directions are welcome. I've tried LD_PRELOAD with the compiled library when launching KRunner to no avail.

Diff Detail

Repository
R292 KUnitConversion
Lint
Lint Skipped
Unit
Unit Tests Skipped
riiga requested review of this revision.Apr 19 2020, 8:48 PM
riiga created this revision.
ngraham requested changes to this revision.Apr 19 2020, 10:54 PM
ngraham added a subscriber: ngraham.

Thanks very much for the patch, but that bug report is very old and these units of measurement were already added in 5.53 as GallonUS and PintImperial. I'm sorry the the bug report wasn't correctly closed after those units were added (I have just done so). You did a great job here though. Would you care to work on a different unit conversion bug report? Here are a few: https://bugs.kde.org/buglist.cgi?component=general&list_id=1736763&product=frameworks-kunitconversion&resolution=---

This revision now requires changes to proceed.Apr 19 2020, 10:54 PM
riiga added a comment.Apr 20 2020, 6:12 AM

The units added in 5.53 were pint (imperial) and gallon (US). The units in the bug report and added by me now are pint (US) and gallon (imperial).

Aren't Imperial and US the same thing?The USA is the only country that still officially uses the imperiaI system.

bruns added a subscriber: bruns.Apr 20 2020, 4:48 PM

Aren't Imperial and US the same thing?The USA is the only country that still officially uses the imperiaI system.

Every time you use "is the same as" in reference to imperial measures, a kitten dies ...

https://en.wikipedia.org/wiki/Gallon

riiga added a comment.Apr 20 2020, 4:55 PM

Aren't Imperial and US the same thing?The USA is the only country that still officially uses the imperiaI system.

The US uses USC units which are derived from the British imperial system, but some units differ such as the volume of the gallon and pint. So there is an American gallon and a British gallon, and an American pint and a British pint and probably even more variants. Prevoiusly the US gallon and British pint had been added. I've added the US pint and the British gallon (which it seems had been added for fuel efficiency calucations, but not regular calculations).

Ah, I see.

I wonder if it actually makes sense to mark the non-US imperial measurements as common. Are these units still widely used outside of the USA? Speaking as an American where everything is gallons, it will be kind of annoying to see imperial gallons appear in KRunner first.

riiga added a comment.Apr 20 2020, 6:02 PM

The imperial gallon has limited use in the UK as liters mostly are used these days except for mileage which is in miles per imperial gallon. So I agree that it shouldn't be a common unit for volume.

@ngraham How widespread is usage of the pint in the US? Does it make sense to keep both pints as a common unit? (The British pint is still used widely in the UK.)

The imperial gallon has limited use in the UK as liters mostly are used these days except for mileage which is in miles per imperial gallon. So I agree that it shouldn't be a common unit for volume.

@ngraham How widespread is usage of the pint in the US? Does it make sense to keep both pints as a common unit? (The British pint is still used widely in the UK.)

Pints are not very commonly used in the USA. So yeah, I guess both of these new units should be non-common units.

riiga updated this revision to Diff 80686.Apr 20 2020, 7:21 PM

Changed to regular unit from common unit.

ngraham accepted this revision.Apr 20 2020, 9:17 PM

Thanks, and sorry for the earlier confusion.

This revision is now accepted and ready to land.Apr 20 2020, 9:17 PM
This revision was automatically updated to reflect the committed changes.