Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Torr Pressure-Converter Option #2121

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion src/CalcViewModel/DataLoaders/UnitConverterDataConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ namespace CalculatorApp
Area_Pyeong = UnitStart + 165,
Energy_Kilowatthour = UnitStart + 166,
Data_Nibble = UnitStart + 167,
UnitEnd = Data_Nibble
Pressure_Torr = UnitStart + 168,
UnitEnd = Pressure_Torr
};
}
}
5 changes: 4 additions & 1 deletion src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,8 @@ void UnitConverterDataLoader::GetUnits(_In_ unordered_map<ViewMode, vector<Order
OrderedUnit{ UnitConverterUnits::Pressure_Pascal, GetLocalizedStringName(L"UnitName_Pascal"), GetLocalizedStringName(L"UnitAbbreviation_Pascal"), 5 });
pressureUnits.push_back(OrderedUnit{
UnitConverterUnits::Pressure_PSI, GetLocalizedStringName(L"UnitName_PSI"), GetLocalizedStringName(L"UnitAbbreviation_PSI"), 6, false, false, false });
pressureUnits.push_back(OrderedUnit{
UnitConverterUnits::Pressure_Torr, GetLocalizedStringName(L"UnitName_Torr"), GetLocalizedStringName(L"UnitAbbreviation_Torr"), 7});
unitMap.emplace(ViewMode::Pressure, pressureUnits);

vector<OrderedUnit> angleUnits;
Expand Down Expand Up @@ -944,7 +946,8 @@ void UnitConverterDataLoader::GetConversionData(_In_ unordered_map<ViewMode, uno
{ ViewMode::Pressure, UnitConverterUnits::Pressure_KiloPascal, 0.0098692326671601 },
{ ViewMode::Pressure, UnitConverterUnits::Pressure_MillimeterOfMercury, 0.0013155687145324 },
{ ViewMode::Pressure, UnitConverterUnits::Pressure_Pascal, 9.869232667160128e-6 },
{ ViewMode::Pressure, UnitConverterUnits::Pressure_PSI, 0.068045961016531 } };
{ ViewMode::Pressure, UnitConverterUnits::Pressure_PSI, 0.068045961016531 },
{ ViewMode::Pressure, UnitConverterUnits::Pressure_Torr, 0.00131578947368 } };

// Populate the hash map and return;
for (UnitData unitdata : unitDataList)
Expand Down
8 changes: 8 additions & 0 deletions src/Calculator/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,10 @@
<value>psi</value>
<comment>An abbreviation for a measurement unit of Pressure</comment>
</data>
<data name="UnitAbbreviation_Torr" xml:space="preserve">
<value>Torr</value>
<comment>An abbreviation for a measurement unit of Pressure</comment>
</data>
<data name="UnitAbbreviation_Centigram" xml:space="preserve">
<value>cg</value>
<comment>An abbreviation for a measurement unit of weight</comment>
Expand Down Expand Up @@ -2445,6 +2449,10 @@
<value>Pounds per square inch</value>
<comment>A measurement unit for Pressure.</comment>
</data>
<data name="UnitName_Torr" xml:space="preserve">
<value>Torr</value>
<comment>A measurement unit for Pressure.</comment>
</data>
<data name="UnitName_Centigram" xml:space="preserve">
<value>Centigrams</value>
<comment>A measurement unit for weight. (Please choose the most appropriate plural form to fit any number between 0 and 999,999,999,999,999)</comment>
Expand Down
3 changes: 3 additions & 0 deletions src/CalculatorUnitTests/Test.resw
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@
<data name="Atmospheres-Pounds per square inch">
<value>0.068045961016531</value>
</data>
<data name="Atmospheres-Torr">
<value>0.00131578947368</value>
</data>
<data name="Liters-Cubic meters-2" xml:space="preserve">
<value>0.002</value>
</data>
Expand Down
Loading