From 98e846459ab9ecded8b1c65d32ad0a43eddf2343 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Mon, 3 Apr 2023 11:24:12 -0400 Subject: [PATCH] BOM Presets: don't use designated initializers --- common/settings/bom_settings.cpp | 83 +++++++++----------------------- 1 file changed, 23 insertions(+), 60 deletions(-) diff --git a/common/settings/bom_settings.cpp b/common/settings/bom_settings.cpp index 29244f4731..5a56975f18 100644 --- a/common/settings/bom_settings.cpp +++ b/common/settings/bom_settings.cpp @@ -129,25 +129,15 @@ bool BOM_PRESET::operator==( const BOM_PRESET& rhs ) const BOM_PRESET BOM_PRESET::GroupedByValue() { - BOM_PRESET p = { .name = _HKI( "Grouped By Value" ), - .readOnly = true, - .sortField = _( "Reference" ), - .sortAsc = true, - .groupSymbols = true, - .excludeDNP = false }; + BOM_PRESET p{ _HKI( "Grouped By Value" ), true, {}, _( "Reference" ), true, "", true, false }; - p.fieldsOrdered = std::vector( { - ( BOM_FIELD ){ - .name = "Reference", .label = "Reference", .show = true, .groupBy = false }, - ( BOM_FIELD ){ - .name = "Value", .label = "Value", .show = true, .groupBy = true }, - ( BOM_FIELD ){ - .name = "Datasheet", .label = "Datasheet", .show = true, .groupBy = false }, - ( BOM_FIELD ){ - .name = "Footprint", .label = "Footprint", .show = true, .groupBy = false }, - ( BOM_FIELD ){ - .name = "Quantity", .label = "Qty", .show = true, .groupBy = false }, - } ); + p.fieldsOrdered = std::vector{ + { "Reference", "Reference", true, false }, + { "Value", "Value", true, true }, + { "Datasheet", "Datasheet", true, false }, + { "Footprint", "Footprint", true, false }, + { "Quantity", "Qty", true, false }, + }; return p; } @@ -155,25 +145,17 @@ BOM_PRESET BOM_PRESET::GroupedByValue() BOM_PRESET BOM_PRESET::GroupedByValueFootprint() { - BOM_PRESET p = { .name = _HKI( "Grouped By Value and Footprint" ), - .readOnly = true, - .sortField = _( "Reference" ), - .sortAsc = true, - .groupSymbols = true, - .excludeDNP = false }; + BOM_PRESET p{ + _HKI( "Grouped By Value and Footprint" ), true, {}, _( "Reference" ), true, "", true, false + }; - p.fieldsOrdered = std::vector( { - ( BOM_FIELD ){ - .name = "Reference", .label = "Reference", .show = true, .groupBy = false }, - ( BOM_FIELD ){ - .name = "Value", .label = "Value", .show = true, .groupBy = true }, - ( BOM_FIELD ){ - .name = "Datasheet", .label = "Datasheet", .show = true, .groupBy = false }, - ( BOM_FIELD ){ - .name = "Footprint", .label = "Footprint", .show = true, .groupBy = true }, - ( BOM_FIELD ){ - .name = "Quantity", .label = "Qty", .show = true, .groupBy = false }, - } ); + p.fieldsOrdered = std::vector{ + { "Reference", "Reference", true, false }, + { "Value", "Value", true, true }, + { "Datasheet", "Datasheet", true, false }, + { "Footprint", "Footprint", true, true }, + { "Quantity", "Qty", true, false }, + }; return p; } @@ -228,36 +210,17 @@ void from_json( const nlohmann::json& j, BOM_FMT_PRESET& f ) BOM_FMT_PRESET BOM_FMT_PRESET::CSV() { - return ( BOM_FMT_PRESET ){ .name = _HKI( "CSV" ), - .readOnly = true, - .fieldDelimiter = wxS( "," ), - .stringDelimiter = wxT( "\"" ), - .refDelimiter = wxT( "," ), - .refRangeDelimiter = wxT( "" ), - .keepTabs = false, - .keepLineBreaks = false }; + return { _HKI( "CSV" ), true, wxS( "," ), wxT( "\"" ), wxT( "," ), wxT( "" ), false, false }; } BOM_FMT_PRESET BOM_FMT_PRESET::TSV() { - return ( BOM_FMT_PRESET ){ .name = _HKI( "TSV" ), - .readOnly = true, - .fieldDelimiter = wxS( "\t" ), - .stringDelimiter = wxT( "" ), - .refDelimiter = wxT( "," ), - .refRangeDelimiter = wxT( "" ), - .keepTabs = false, - .keepLineBreaks = false }; + return { _HKI( "TSV" ), true, wxS( "\t" ), wxT( "" ), wxT( "," ), wxT( "" ), false, false }; } BOM_FMT_PRESET BOM_FMT_PRESET::Semicolons() { - return ( BOM_FMT_PRESET ){ .name = _HKI( "Semicolons" ), - .readOnly = true, - .fieldDelimiter = wxS( ";" ), - .stringDelimiter = wxT( "'" ), - .refDelimiter = wxT( "," ), - .refRangeDelimiter = wxT( "" ), - .keepTabs = false, - .keepLineBreaks = false }; + return { + _HKI( "Semicolons" ), true, wxS( ";" ), wxT( "'" ), wxT( "," ), wxT( "" ), false, false + }; }