This is the "short term" fix, but with some new code that will be part of the long-term fix sitting ready in the background.
Main changes are:
Changed toSI() to toCanonical() and fromSI() to fromCanonical(). Most of our canonical forms are SI or some similar metric system, but, strictly speaking, we don't measure time duration, color, diastatic power etc in SI units
Implemented Localization::getLocale() and changed calls to QLocale() to call Localization::getLocale() instead. This makes it easy to override locale in the settings file for testing.
Added new BtFieldType of NonPhysicalQuantity::Dimensionless for use in numerical fields where the user is not able to specify/choose the units in the input field
New BtLineEdit child classes BtDimensionlessEdit is the corollary to NonPhysicalQuantity::Dimensionless. Others, such as BtViscosityEdit, are mostly unused for now but will come into play when new fields are added as part of BeerJSON work
New class MassOrVolumeAmt, which will get used in the BeerJSON work (where more things can be measured by either mass or volume)
Beefed up Measurement::Amount from a struct to a class so that MassOrVolumeAmt can inherit from it
New units in the Measurement namespace for specific heat capacity - not currently used (as sticking with the hard-coding on Equipment for now) but will be in future
Some improvements to NamedParameterBundle which will make it easier to have optional fields in future
This is the "short term" fix, but with some new code that will be part of the long-term fix sitting ready in the background.
Main changes are:
toSI()
totoCanonical()
andfromSI()
tofromCanonical()
. Most of our canonical forms are SI or some similar metric system, but, strictly speaking, we don't measure time duration, color, diastatic power etc in SI unitsLocalization::getLocale()
and changed calls toQLocale()
to callLocalization::getLocale()
instead. This makes it easy to override locale in the settings file for testing.BtFieldType
ofNonPhysicalQuantity::Dimensionless
for use in numerical fields where the user is not able to specify/choose the units in the input fieldBtLineEdit
child classesBtDimensionlessEdit
is the corollary toNonPhysicalQuantity::Dimensionless
. Others, such asBtViscosityEdit
, are mostly unused for now but will come into play when new fields are added as part of BeerJSON workMassOrVolumeAmt
, which will get used in the BeerJSON work (where more things can be measured by either mass or volume)Measurement::Amount
from a struct to a class so thatMassOrVolumeAmt
can inherit from itMeasurement
namespace for specific heat capacity - not currently used (as sticking with the hard-coding on Equipment for now) but will be in futureNamedParameterBundle
which will make it easier to have optional fields in future