Display units in dive list table based on prefs option

Add a preferences option which enables or disables display of units in the
main dive liste table.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-10-09 08:46:18 +02:00 committed by Lubomir I. Ivanov
parent 2cb5d45231
commit 78cda85444
8 changed files with 94 additions and 16 deletions

View file

@ -1631,6 +1631,11 @@ int UnitsSettings::durationUnits() const
return prefs.units.duration_units;
}
int UnitsSettings::showUnitsTable() const
{
return prefs.units.show_units_table;
}
QString UnitsSettings::unitSystem() const
{
return prefs.unit_system == METRIC ? QStringLiteral("metric")
@ -1721,6 +1726,17 @@ void UnitsSettings::setDurationUnits(int value)
emit durationUnitChanged(value);
}
void UnitsSettings::setShowUnitsTable(int value)
{
if (value == prefs.units.show_units_table)
return;
QSettings s;
s.beginGroup(group);
s.setValue("show_units_table", value);
prefs.units.show_units_table = value;
emit showUnitsTableChanged(value);
}
void UnitsSettings::setCoordinatesTraditional(bool value)
{
if (value == prefs.coordinates_traditional)
@ -2197,6 +2213,7 @@ void SettingsObjectWrapper::load()
}
GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
GET_UNIT3("duration_units", duration_units, units::MIXED, units::ALWAYS_HOURS, units::DURATION);
GET_UNIT_INT("show_units_table", show_units_table);
GET_BOOL("coordinates", coordinates_traditional);
s.endGroup();
s.beginGroup("TecDetails");