[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2023-11-15 01:29:58 +00:00
committed by wwmayer
parent 7194c29a81
commit 6a66034ce2
3 changed files with 52 additions and 49 deletions

View File

@@ -65,56 +65,56 @@ int UnitsApi::UserPrefDecimals = 2;
QString UnitsApi::getDescription(UnitSystem system)
{
switch (system) {
case UnitSystem::SI1:
return tr("Standard (mm, kg, s, degree)");
case UnitSystem::SI2:
return tr("MKS (m, kg, s, degree)");
case UnitSystem::Imperial1:
return tr("US customary (in, lb)");
case UnitSystem::ImperialDecimal:
return tr("Imperial decimal (in, lb)");
case UnitSystem::Centimeters:
return tr("Building Euro (cm, m², m³)");
case UnitSystem::ImperialBuilding:
return tr("Building US (ft-in, sqft, cft)");
case UnitSystem::MmMin:
return tr("Metric small parts & CNC(mm, mm/min)");
case UnitSystem::ImperialCivil:
return tr("Imperial for Civil Eng (ft, ft/sec)");
case UnitSystem::FemMilliMeterNewton:
return tr("FEM (mm, N, s)");
case UnitSystem::MeterDecimal:
return tr("Meter decimal (m, m², m³)");
default:
return tr("Unknown schema");
case UnitSystem::SI1:
return tr("Standard (mm, kg, s, degree)");
case UnitSystem::SI2:
return tr("MKS (m, kg, s, degree)");
case UnitSystem::Imperial1:
return tr("US customary (in, lb)");
case UnitSystem::ImperialDecimal:
return tr("Imperial decimal (in, lb)");
case UnitSystem::Centimeters:
return tr("Building Euro (cm, m², m³)");
case UnitSystem::ImperialBuilding:
return tr("Building US (ft-in, sqft, cft)");
case UnitSystem::MmMin:
return tr("Metric small parts & CNC(mm, mm/min)");
case UnitSystem::ImperialCivil:
return tr("Imperial for Civil Eng (ft, ft/sec)");
case UnitSystem::FemMilliMeterNewton:
return tr("FEM (mm, N, s)");
case UnitSystem::MeterDecimal:
return tr("Meter decimal (m, m², m³)");
default:
return tr("Unknown schema");
}
}
UnitsSchemaPtr UnitsApi::createSchema(UnitSystem system)
{
switch (system) {
case UnitSystem::SI1:
return std::make_unique<UnitsSchemaInternal>();
case UnitSystem::SI2:
return std::make_unique<UnitsSchemaMKS>();
case UnitSystem::Imperial1:
return std::make_unique<UnitsSchemaImperial1>();
case UnitSystem::ImperialDecimal:
return std::make_unique<UnitsSchemaImperialDecimal>();
case UnitSystem::Centimeters:
return std::make_unique<UnitsSchemaCentimeters>();
case UnitSystem::ImperialBuilding:
return std::make_unique<UnitsSchemaImperialBuilding>();
case UnitSystem::MmMin:
return std::make_unique<UnitsSchemaMmMin>();
case UnitSystem::ImperialCivil:
return std::make_unique<UnitsSchemaImperialCivil>();
case UnitSystem::FemMilliMeterNewton:
return std::make_unique<UnitsSchemaFemMilliMeterNewton>();
case UnitSystem::MeterDecimal:
return std::make_unique<UnitsSchemaMeterDecimal>();
default:
break;
case UnitSystem::SI1:
return std::make_unique<UnitsSchemaInternal>();
case UnitSystem::SI2:
return std::make_unique<UnitsSchemaMKS>();
case UnitSystem::Imperial1:
return std::make_unique<UnitsSchemaImperial1>();
case UnitSystem::ImperialDecimal:
return std::make_unique<UnitsSchemaImperialDecimal>();
case UnitSystem::Centimeters:
return std::make_unique<UnitsSchemaCentimeters>();
case UnitSystem::ImperialBuilding:
return std::make_unique<UnitsSchemaImperialBuilding>();
case UnitSystem::MmMin:
return std::make_unique<UnitsSchemaMmMin>();
case UnitSystem::ImperialCivil:
return std::make_unique<UnitsSchemaImperialCivil>();
case UnitSystem::FemMilliMeterNewton:
return std::make_unique<UnitsSchemaFemMilliMeterNewton>();
case UnitSystem::MeterDecimal:
return std::make_unique<UnitsSchemaMeterDecimal>();
default:
break;
}
return nullptr;

View File

@@ -34,7 +34,8 @@ namespace Base
/** Units systems */
enum class UnitSystem
{
SI1 = 0, /** internal (mm,kg,s) SI system (http://en.wikipedia.org/wiki/International_System_of_Units) */
SI1 = 0, /** internal (mm,kg,s) SI system
(http://en.wikipedia.org/wiki/International_System_of_Units) */
SI2 = 1, /** MKS (m,kg,s) SI system */
Imperial1 = 2, /** the Imperial system (http://en.wikipedia.org/wiki/Imperial_units) */
ImperialDecimal = 3, /** Imperial with length in inch only */
@@ -43,8 +44,8 @@ enum class UnitSystem
MmMin = 6, /** Lengths in mm, Speed in mm/min. Angle in degrees. Useful for small parts & CNC */
ImperialCivil = 7, /** Lengths in ft, Speed in ft/sec. Used in Civil Eng in North America */
FemMilliMeterNewton = 8, /** Lengths in mm, Mass in t, TimeSpan in s, thus force is in N */
MeterDecimal = 9, /** Lengths in metres always */
NumUnitSystemTypes // must be the last item!
MeterDecimal = 9, /** Lengths in metres always */
NumUnitSystemTypes // must be the last item!
};

View File

@@ -30,7 +30,7 @@
#include "PreCompiled.h"
#ifdef __GNUC__
# include <unistd.h>
#include <unistd.h>
#endif
#include <QString>
@@ -41,7 +41,9 @@
using namespace Base;
QString UnitsSchemaMeterDecimal::schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString)
QString UnitsSchemaMeterDecimal::schemaTranslate(const Base::Quantity& quant,
double& factor,
QString& unitString)
{
Unit unit = quant.getUnit();
if (unit == Unit::Length) {