Use RenderTemperature method in OptionsView, always re-render it on defocus, and remove degree symbol
This commit is contained in:
parent
fe67ec8550
commit
b6cb6801df
@ -184,13 +184,13 @@ void format::RenderTemperature(StringBuilder &sb, float temp, int scale)
|
|||||||
switch (scale)
|
switch (scale)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
sb << (temp - 273.15f) << " °C";
|
sb << (temp - 273.15f) << "C";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sb << (temp - 273.15f) * 1.8f + 32.0f << " °F";
|
sb << (temp - 273.15f) * 1.8f + 32.0f << "F";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sb << temp << " K";
|
sb << temp << "K";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,18 +455,7 @@ void OptionsView::AmbientAirTempToTextBox(float airTemp)
|
|||||||
{
|
{
|
||||||
StringBuilder sb;
|
StringBuilder sb;
|
||||||
sb << Format::Precision(2);
|
sb << Format::Precision(2);
|
||||||
switch (temperatureScale->GetOption().second)
|
format::RenderTemperature(sb, airTemp, temperatureScale->GetOption().second);
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
sb << (airTemp - 273.15f) << "C";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
sb << (airTemp - 273.15f) * 1.8f + 32.0f << "F";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sb << airTemp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ambientAirTemp->SetText(sb.Build());
|
ambientAirTemp->SetText(sb.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,8 +488,6 @@ void OptionsView::UpdateAirTemp(String temp, bool isDefocus)
|
|||||||
airTemp = MIN_TEMP;
|
airTemp = MIN_TEMP;
|
||||||
else if (airTemp > MAX_TEMP)
|
else if (airTemp > MAX_TEMP)
|
||||||
airTemp = MAX_TEMP;
|
airTemp = MAX_TEMP;
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
AmbientAirTempToTextBox(airTemp);
|
AmbientAirTempToTextBox(airTemp);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user