Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone - Facilitate easy schemas add, remove, change, etc. - Remove 14 files containing approx 2,190 lines of if/else code and data - Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions) - Isolate and simplify data operations (code) - Remove schemas enum to keep data independent of code - Separate responsibilities: Specifications, data, schemas, schema - Add schema data 'isDefault' - Add schema data name - Prefer algorithms to raw loops - Add schemas unit tests - Tweak quantity unit tests
This commit is contained in:
@@ -876,13 +876,8 @@ Document::Document(const char* documentName)
|
||||
"Additional tag to save the name of the company");
|
||||
ADD_PROPERTY_TYPE(UnitSystem, (""), 0, Prop_None, "Unit system to use in this project");
|
||||
// Set up the possible enum values for the unit system
|
||||
int num = static_cast<int>(Base::UnitSystem::NumUnitSystemTypes);
|
||||
std::vector<std::string> enumValsAsVector;
|
||||
for (int i = 0; i < num; i++) {
|
||||
QString item = Base::UnitsApi::getDescription(static_cast<Base::UnitSystem>(i));
|
||||
enumValsAsVector.emplace_back(item.toStdString());
|
||||
}
|
||||
UnitSystem.setEnums(enumValsAsVector);
|
||||
|
||||
UnitSystem.setEnums(Base::UnitsApi::getDescriptions());
|
||||
// Get the preferences/General unit system as the default for a new document
|
||||
ParameterGrp::handle hGrpu =
|
||||
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Units");
|
||||
|
||||
Reference in New Issue
Block a user