Commit d7ffece9 authored by David Redondo's avatar David Redondo 🏎
Browse files

Add watt-hour to units

Needed for future power plugin
parent 3b5914ad
...@@ -75,6 +75,7 @@ static KLocalizedString unitFormat(Unit unit) ...@@ -75,6 +75,7 @@ static KLocalizedString unitFormat(Unit unit)
const static KLocalizedString s = ki18nc("Seconds unit symbol", "%1s"); const static KLocalizedString s = ki18nc("Seconds unit symbol", "%1s");
const static KLocalizedString V = ki18nc("Volts unit symbol", "%1 V"); const static KLocalizedString V = ki18nc("Volts unit symbol", "%1 V");
const static KLocalizedString W = ki18nc("Watts unit symbol", "%1 W"); const static KLocalizedString W = ki18nc("Watts unit symbol", "%1 W");
const static KLocalizedString Wh = ki18nc("Watt-hours unit symbol", "%1 Wh");
const static KLocalizedString rate = ki18nc("Rate unit symbol", "%1 s⁻¹"); const static KLocalizedString rate = ki18nc("Rate unit symbol", "%1 s⁻¹");
const static KLocalizedString unitless = ki18nc("Unitless", "%1"); const static KLocalizedString unitless = ki18nc("Unitless", "%1");
...@@ -134,6 +135,8 @@ static KLocalizedString unitFormat(Unit unit) ...@@ -134,6 +135,8 @@ static KLocalizedString unitFormat(Unit unit)
return V; return V;
case UnitWatt: case UnitWatt:
return W; return W;
case UnitWattHour:
return Wh;
default: default:
return unitless; return unitless;
...@@ -163,6 +166,8 @@ static int unitOrder(Unit unit) ...@@ -163,6 +166,8 @@ static int unitOrder(Unit unit)
case UnitGigaHertz: case UnitGigaHertz:
case UnitTeraHertz: case UnitTeraHertz:
case UnitPetaHertz: case UnitPetaHertz:
case UnitWatt:
case UnitWattHour:
return 1000; return 1000;
default: default:
...@@ -372,6 +377,8 @@ QString Formatter::symbol(Unit unit) ...@@ -372,6 +377,8 @@ QString Formatter::symbol(Unit unit)
return i18nc("Volts unit symbol", "V"); return i18nc("Volts unit symbol", "V");
case UnitWatt: case UnitWatt:
return i18nc("Watts unit symbol", "W"); return i18nc("Watts unit symbol", "W");
case UnitWattHour:
return i18nc("Watt-hours unit symbol", "Wh");
case UnitRate: case UnitRate:
return i18nc("Rate unit symbol", "s⁻¹"); return i18nc("Rate unit symbol", "s⁻¹");
......
...@@ -87,6 +87,7 @@ enum Unit { ...@@ -87,6 +87,7 @@ enum Unit {
UnitRpm, UnitRpm,
UnitVolt, UnitVolt,
UnitWatt, UnitWatt,
UnitWattHour
}; };
Q_ENUM_NS(Unit) Q_ENUM_NS(Unit)
......
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