Commit 7d945931 authored by Gus Grubba's avatar Gus Grubba

Fix unit translators

It was broken when temperature translation was added in babbfbd1
The system wasn't quite setup to handle anything other than speed and distance. Changed so any arbitrary unit type can be converted to another.
parent cdb4cdfd
This diff is collapsed.
...@@ -205,14 +205,20 @@ private: ...@@ -205,14 +205,20 @@ private:
static QVariant _celsiusToFarenheit(const QVariant& celsius); static QVariant _celsiusToFarenheit(const QVariant& celsius);
static QVariant _farenheitToCelsius(const QVariant& farenheit); static QVariant _farenheitToCelsius(const QVariant& farenheit);
enum UnitTypes {
UnitDistance = 0,
UnitArea,
UnitSpeed,
UnitTemperature
};
struct AppSettingsTranslation_s { struct AppSettingsTranslation_s {
const char* rawUnits; const char* rawUnits;
const char* cookedUnits; const char* cookedUnits;
bool speed; UnitTypes unitType;
uint32_t speedOrDistanceUnits; uint32_t unitOption;
Translator rawTranslator; Translator rawTranslator;
Translator cookedTranslator; Translator cookedTranslator;
}; };
static const AppSettingsTranslation_s* _findAppSettingsDistanceUnitsTranslation(const QString& rawUnits); static const AppSettingsTranslation_s* _findAppSettingsDistanceUnitsTranslation(const QString& rawUnits);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment