Improve display of yearly statistics

Display the units in the header, make the header more consistent
looking, convert the values into the right units with appropriate
precision.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-06-18 10:48:46 -07:00
parent dda28c76aa
commit 370673cc99
3 changed files with 67 additions and 34 deletions

View file

@ -196,6 +196,14 @@ QString get_depth_string(depth_t depth, bool showunit)
}
}
QString get_depth_unit()
{
if (prefs.units.length == units::METERS)
return "m";
else
return "ft";
}
QString get_weight_string(weight_t weight, bool showunit)
{
if (prefs.units.weight == units::KG) {
@ -207,6 +215,14 @@ QString get_weight_string(weight_t weight, bool showunit)
}
}
QString get_weight_unit()
{
if (prefs.units.weight == units::KG)
return "kg";
else
return "lbs";
}
QString get_temperature_string(temperature_t temp, bool showunit)
{
if (prefs.units.temperature == units::CELSIUS) {
@ -220,6 +236,14 @@ QString get_temperature_string(temperature_t temp, bool showunit)
}
}
QString get_temp_unit()
{
if (prefs.units.temperature == units::CELSIUS)
return QString(UTF8_DEGREE "C");
else
return QString(UTF8_DEGREE "F");
}
QString get_volume_string(volume_t volume, bool showunit)
{
if (prefs.units.volume == units::LITER) {
@ -231,6 +255,14 @@ QString get_volume_string(volume_t volume, bool showunit)
}
}
QString get_volume_unit()
{
if (prefs.units.volume == units::LITER)
return "l";
else
return "cuft";
}
QString get_pressure_string(pressure_t pressure, bool showunit)
{
if (prefs.units.pressure == units::BAR) {