Simplify calls to QCommandLineParser::addOption.
--HG-- branch : develop
This commit is contained in:
parent
83e61a85a8
commit
e04e4907b5
|
@ -58,7 +58,7 @@ qreal Pg2Px(const QString& src, const DialogLayoutSettings& converter)
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VCommandLine::VCommandLine() : parser(), optionsUsed(), isGuiEnabled(false)
|
VCommandLine::VCommandLine() : parser(), isGuiEnabled(false)
|
||||||
{
|
{
|
||||||
parser.setApplicationDescription(translate("VCommandLine", "Pattern making program."));
|
parser.setApplicationDescription(translate("VCommandLine", "Pattern making program."));
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
|
@ -567,362 +567,186 @@ void VCommandLine::InitCommandLineOptions()
|
||||||
{
|
{
|
||||||
//keep in mind order here - that is how user will see it, so group-up for usability
|
//keep in mind order here - that is how user will see it, so group-up for usability
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
VCommandLineOption option =
|
parser.addOptions({
|
||||||
VCommandLineOption(QStringList({SINGLE_OPTION_BASENAME, LONG_OPTION_BASENAME}),
|
{{SINGLE_OPTION_BASENAME, LONG_OPTION_BASENAME},
|
||||||
translate("VCommandLine", "The base filename of exported layout files. Use it to "
|
translate("VCommandLine", "The base filename of exported layout files. Use it to enable console export mode."),
|
||||||
"enable console export mode."),
|
translate("VCommandLine", "The base filename of layout files")},
|
||||||
translate("VCommandLine", "The base filename of layout files"));
|
{{SINGLE_OPTION_DESTINATION, LONG_OPTION_DESTINATION},
|
||||||
optionsUsed.insert(LONG_OPTION_BASENAME, option);
|
translate("VCommandLine", "The path to output destination folder. By default the directory at which the "
|
||||||
parser.addOption(option);
|
"application was started."),
|
||||||
|
translate("VCommandLine", "The destination folder")},
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_DESTINATION, LONG_OPTION_DESTINATION}),
|
{{SINGLE_OPTION_MEASUREFILE, LONG_OPTION_MEASUREFILE},
|
||||||
translate("VCommandLine", "The path to output destination folder. By default the "
|
|
||||||
"directory at which the application was started."),
|
|
||||||
translate("VCommandLine", "The destination folder"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_DESTINATION, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_MEASUREFILE, LONG_OPTION_MEASUREFILE}),
|
|
||||||
translate("VCommandLine", "Path to custom measure file (export mode)."),
|
translate("VCommandLine", "Path to custom measure file (export mode)."),
|
||||||
translate("VCommandLine", "The measure file"));
|
translate("VCommandLine", "The measure file")},
|
||||||
optionsUsed.insert(LONG_OPTION_MEASUREFILE, option);
|
{{SINGLE_OPTION_NESTING_TIME, LONG_OPTION_NESTING_TIME},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "<Time> in minutes given for the algorithm to find best layout. Time must be in "
|
||||||
|
"range from 1 minute to 60 minutes. Default value 1 minute."),
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_NESTING_TIME, LONG_OPTION_NESTING_TIME}),
|
translate("VCommandLine", "Time")},
|
||||||
translate("VCommandLine", "<Time> in minutes given for the algorithm to find best "
|
{LONG_OPTION_EFFICIENCY_COEFFICIENT,
|
||||||
"layout. Time must be in range from 1 minute to 60 "
|
translate("VCommandLine", "Set layout efficiency <coefficient>. Layout efficiency coefficient is the ratio of "
|
||||||
"minutes. Default value 1 minute."),
|
"the area occupied by the pieces to the bounding rect of all pieces. If nesting reaches required level the "
|
||||||
translate("VCommandLine", "Time"));
|
"process stops. If value is 0 no check will be made. Сoefficient must be in range from 0 to 100. Default "
|
||||||
optionsUsed.insert(LONG_OPTION_NESTING_TIME, option);
|
"value 0."),
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Coefficient")},
|
||||||
|
{{SINGLE_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT},
|
||||||
option = VCommandLineOption(LONG_OPTION_EFFICIENCY_COEFFICIENT,
|
translate("VCommandLine", "Number corresponding to output format (default = 0, export mode):") +
|
||||||
translate("VCommandLine", "Set layout efficiency <coefficient>. Layout efficiency "
|
|
||||||
"coefficient is the ratio of the area occupied by the pieces "
|
|
||||||
"to the bounding rect of all pieces. If nesting reaches "
|
|
||||||
"required level the process stops. If value is 0 no check "
|
|
||||||
"will be made. Сoefficient must be in range from 0 to 100. "
|
|
||||||
"Default value 0."),
|
|
||||||
translate("VCommandLine", "Coefficient"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_EFFICIENCY_COEFFICIENT, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT}),
|
|
||||||
translate("VCommandLine", "Number corresponding to output format (default = 0, "
|
|
||||||
"export mode):") +
|
|
||||||
DialogSaveLayout::MakeHelpFormatList(),
|
DialogSaveLayout::MakeHelpFormatList(),
|
||||||
translate("VCommandLine", "Format number"), QChar('0'));
|
translate("VCommandLine", "Format number"), QChar('0')},
|
||||||
optionsUsed.insert(LONG_OPTION_EXP2FORMAT, option);
|
{LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
|
||||||
parser.addOption(option);
|
{LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
|
||||||
|
{LONG_OPTION_EXPORTONLYDETAILS,
|
||||||
option = VCommandLineOption(LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form."));
|
translate("VCommandLine", "Export only details. Export details as they positioned in the details mode. Any "
|
||||||
optionsUsed.insert(LONG_OPTION_BINARYDXF, option);
|
"layout related options will be ignored.")},
|
||||||
parser.addOption(option);
|
{LONG_OPTION_EXPORTSUCHDETAILS,
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_TEXT2PATHS, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_EXPORTONLYDETAILS,
|
|
||||||
translate("VCommandLine", "Export only details. Export details as they positioned in "
|
|
||||||
"the details mode. Any layout related options will be "
|
|
||||||
"ignored."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_EXPORTONLYDETAILS, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_EXPORTSUCHDETAILS,
|
|
||||||
translate("VCommandLine", "Export only details that match a piece name regex."),
|
translate("VCommandLine", "Export only details that match a piece name regex."),
|
||||||
translate("VCommandLine", "The name regex"));
|
translate("VCommandLine", "The name regex")},
|
||||||
optionsUsed.insert(LONG_OPTION_EXPORTSUCHDETAILS, option);
|
{{SINGLE_OPTION_GRADATIONSIZE, LONG_OPTION_GRADATIONSIZE},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Set size value for pattern file, that was opened with multisize measurements "
|
||||||
|
"(export mode). Valid values: %1cm.").arg(VMeasurement::WholeListSizes(Unit::Cm) .join(QStringLiteral(", "))),
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_GRADATIONSIZE, LONG_OPTION_GRADATIONSIZE}),
|
translate("VCommandLine", "The size value")},
|
||||||
translate("VCommandLine", "Set size value for pattern file, that was opened "
|
{{SINGLE_OPTION_GRADATIONHEIGHT, LONG_OPTION_GRADATIONHEIGHT},
|
||||||
"with multisize measurements (export mode). Valid "
|
translate("VCommandLine", "Set height value for pattern file, that was opened with multisize measurements "
|
||||||
"values: %1cm.")
|
"(export mode). Valid values: %1cm.").arg(VMeasurement::WholeListHeights(Unit::Cm).join(QStringLiteral(", "))),
|
||||||
.arg(VMeasurement::WholeListSizes(Unit::Cm)
|
translate("VCommandLine", "The height value")},
|
||||||
.join(QStringLiteral(", "))),
|
{LONG_OPTION_USER_MATERIAL,
|
||||||
translate("VCommandLine", "The size value"));
|
translate("VCommandLine", "Use this option to override user material defined in pattern. The value must be in "
|
||||||
optionsUsed.insert(LONG_OPTION_GRADATIONSIZE, option);
|
"form <number>@<user matrial name>. The number should be in range from 1 to %1. For example, 1@Fabric2. The "
|
||||||
parser.addOption(option);
|
"key can be used multiple times. Has no effect in GUI mode.").arg(userMaterialPlaceholdersQuantity),
|
||||||
|
translate("VCommandLine", "User material")},
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_GRADATIONHEIGHT, LONG_OPTION_GRADATIONHEIGHT}),
|
|
||||||
translate("VCommandLine", "Set height value for pattern file, that was opened"
|
|
||||||
" with multisize measurements (export mode). Valid "
|
|
||||||
"values: %1cm.")
|
|
||||||
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(QStringLiteral(", "))),
|
|
||||||
translate("VCommandLine", "The height value"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_GRADATIONHEIGHT, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_USER_MATERIAL,
|
|
||||||
translate("VCommandLine", "Use this option to override user material defined in "
|
|
||||||
"pattern. The value must be in form <number>@<user "
|
|
||||||
"matrial name>. The number should be in range from 1 "
|
|
||||||
"to %1. For example, 1@Fabric2. The key can be used "
|
|
||||||
"multiple times. Has no effect in GUI mode.")
|
|
||||||
.arg(userMaterialPlaceholdersQuantity),
|
|
||||||
translate("VCommandLine", "User material"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_USER_MATERIAL, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_PAGETEMPLATE, LONG_OPTION_PAGETEMPLATE}),
|
{{SINGLE_OPTION_PAGETEMPLATE, LONG_OPTION_PAGETEMPLATE},
|
||||||
translate("VCommandLine", "Number corresponding to layout page template "
|
translate("VCommandLine", "Number corresponding to layout page template (default = 0, export mode):") +
|
||||||
"(default = 0, export mode):") +
|
|
||||||
DialogLayoutSettings::MakeHelpTemplateList(),
|
DialogLayoutSettings::MakeHelpTemplateList(),
|
||||||
translate("VCommandLine", "Template number"), QChar('0'));
|
translate("VCommandLine", "Template number"), QChar('0')},
|
||||||
optionsUsed.insert(LONG_OPTION_PAGETEMPLATE, option);
|
{LONG_OPTION_LANDSCAPE_ORIENTATION,
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Switch page template orientation to landscape (export mode). This option has "
|
||||||
|
"effect only for one of predefined page templates.")},
|
||||||
option = VCommandLineOption(LONG_OPTION_LANDSCAPE_ORIENTATION,
|
{{SINGLE_OPTION_PAGEW, LONG_OPTION_PAGEW},
|
||||||
translate("VCommandLine", "Switch page template orientation to landscape "
|
translate("VCommandLine", "Page width in current units like 12.0 (cannot be used with \"%1\", export mode).")
|
||||||
"(export mode). This option has effect only for one of "
|
|
||||||
"predefined page templates."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_LANDSCAPE_ORIENTATION, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_PAGEW, LONG_OPTION_PAGEW}),
|
|
||||||
translate("VCommandLine", "Page width in current units like 12.0 (cannot be used "
|
|
||||||
"with \"%1\", export mode).")
|
|
||||||
.arg(LONG_OPTION_PAGETEMPLATE),
|
.arg(LONG_OPTION_PAGETEMPLATE),
|
||||||
translate("VCommandLine", "The page width"));
|
translate("VCommandLine", "The page width")},
|
||||||
optionsUsed.insert(LONG_OPTION_PAGEW, option);
|
{{SINGLE_OPTION_PAGEH, LONG_OPTION_PAGEH},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Page height in current units like 12.0 (cannot be used with \"%1\", export mode).")
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_PAGEH, LONG_OPTION_PAGEH}),
|
|
||||||
translate("VCommandLine", "Page height in current units like 12.0 (cannot be "
|
|
||||||
"used with \"%1\", export mode).")
|
|
||||||
.arg(LONG_OPTION_PAGETEMPLATE),
|
.arg(LONG_OPTION_PAGETEMPLATE),
|
||||||
translate("VCommandLine", "The page height"));
|
translate("VCommandLine", "The page height")},
|
||||||
optionsUsed.insert(LONG_OPTION_PAGEH, option);
|
{{SINGLE_OPTION_PAGEUNITS, LONG_OPTION_PAGEUNITS},
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_PAGEUNITS, LONG_OPTION_PAGEUNITS}),
|
|
||||||
translate("VCommandLine", "Page measure units (export mode). Valid values: %1.")
|
translate("VCommandLine", "Page measure units (export mode). Valid values: %1.")
|
||||||
.arg(VDomDocument::UnitsHelpString()),
|
.arg(VDomDocument::UnitsHelpString()),
|
||||||
translate("VCommandLine", "The measure unit"));
|
translate("VCommandLine", "The measure unit")},
|
||||||
optionsUsed.insert(LONG_OPTION_PAGEUNITS, option);
|
{{SINGLE_OPTION_IGNORE_MARGINS, LONG_OPTION_IGNORE_MARGINS},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Ignore printer margins (export mode). Use if need full paper space. In case of "
|
||||||
|
"later printing you must account for the margins himself.")},
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_IGNORE_MARGINS, LONG_OPTION_IGNORE_MARGINS}),
|
{{SINGLE_OPTION_LEFT_MARGIN, LONG_OPTION_LEFT_MARGIN},
|
||||||
translate("VCommandLine", "Ignore printer margins (export mode). Use if need "
|
translate("VCommandLine", "Page left margin in current units like 3.0 (export mode). If not set will be used "
|
||||||
"full paper space. In case of later printing you must "
|
"value from default printer. Or 0 if none printers was found."),
|
||||||
"account for the margins himself."));
|
translate("VCommandLine", "The left margin")},
|
||||||
optionsUsed.insert(LONG_OPTION_IGNORE_MARGINS, option);
|
{{SINGLE_OPTION_RIGHT_MARGIN, LONG_OPTION_RIGHT_MARGIN},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Page right margin in current units like 3.0 (export mode). If not set will be used "
|
||||||
|
"value from default printer. Or 0 if none printers was found."),
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_LEFT_MARGIN, LONG_OPTION_LEFT_MARGIN}),
|
translate("VCommandLine", "The right margin")},
|
||||||
translate("VCommandLine", "Page left margin in current units like 3.0 (export "
|
{{SINGLE_OPTION_TOP_MARGIN, LONG_OPTION_TOP_MARGIN},
|
||||||
"mode). If not set will be used value from default "
|
translate("VCommandLine", "Page top margin in current units like 3.0 (export mode). If not set will be used "
|
||||||
"printer. Or 0 if none printers was found."),
|
"value from default printer. Or 0 if none printers was found."),
|
||||||
translate("VCommandLine", "The left margin"));
|
translate("VCommandLine", "The top margin")},
|
||||||
optionsUsed.insert(LONG_OPTION_LEFT_MARGIN, option);
|
{{SINGLE_OPTION_BOTTOM_MARGIN, LONG_OPTION_BOTTOM_MARGIN},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Page bottom margin in current units like 3.0 (export mode). If not set will be "
|
||||||
|
"used value from default printer. Or 0 if none printers was found."),
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_RIGHT_MARGIN, LONG_OPTION_RIGHT_MARGIN}),
|
translate("VCommandLine", "The bottom margin")},
|
||||||
translate("VCommandLine", "Page right margin in current units like 3.0 (export "
|
|
||||||
"mode). If not set will be used value from default "
|
|
||||||
"printer. Or 0 if none printers was found."),
|
|
||||||
translate("VCommandLine", "The right margin"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_RIGHT_MARGIN, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_TOP_MARGIN, LONG_OPTION_TOP_MARGIN}),
|
|
||||||
translate("VCommandLine", "Page top margin in current units like 3.0 (export "
|
|
||||||
"mode). If not set will be used value from default "
|
|
||||||
"printer. Or 0 if none printers was found."),
|
|
||||||
translate("VCommandLine", "The top margin"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_TOP_MARGIN, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_BOTTOM_MARGIN, LONG_OPTION_BOTTOM_MARGIN}),
|
|
||||||
translate("VCommandLine", "Page bottom margin in current units like 3.0 (export "
|
|
||||||
"mode). If not set will be used value from default "
|
|
||||||
"printer. Or 0 if none printers was found."),
|
|
||||||
translate("VCommandLine", "The bottom margin"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_BOTTOM_MARGIN, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
option = VCommandLineOption(LONG_OPTION_FOLLOW_GRAINLINE,
|
{LONG_OPTION_FOLLOW_GRAINLINE,
|
||||||
translate("VCommandLine", "Order detail to follow grainline direction (export mode)."));
|
translate("VCommandLine", "Order detail to follow grainline direction (export mode).")},
|
||||||
optionsUsed.insert(LONG_OPTION_FOLLOW_GRAINLINE, option);
|
{{SINGLE_OPTION_CROP, LONG_OPTION_CROP},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Auto crop unused length (export mode).")},
|
||||||
|
{{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE},
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_CROP, LONG_OPTION_CROP}),
|
translate("VCommandLine", "Unite pages if possible (export mode). Maximum value limited by QImage that "
|
||||||
translate("VCommandLine", "Auto crop unused length (export mode)."));
|
"supports only a maximum of 32768x32768 px images.")},
|
||||||
optionsUsed.insert(LONG_OPTION_CROP, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_UNITE, LONG_OPTION_UNITE}),
|
|
||||||
translate("VCommandLine", "Unite pages if possible (export mode). Maximum value "
|
|
||||||
"limited by QImage that supports only a maximum of "
|
|
||||||
"32768x32768 px images."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_UNITE, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_SAVELENGTH, LONG_OPTION_SAVELENGTH}),
|
{{SINGLE_OPTION_SAVELENGTH, LONG_OPTION_SAVELENGTH},
|
||||||
translate("VCommandLine", "Save length of the sheet if set (export mode). The "
|
translate("VCommandLine", "Save length of the sheet if set (export mode). The option tells the program to use "
|
||||||
"option tells the program to use as much as possible "
|
"as much as possible width of sheet. Quality of a layout can be worse when this option was used.")},
|
||||||
"width of sheet. Quality of a layout can be worse when "
|
{{SINGLE_OPTION_SHIFTUNITS, LONG_OPTION_SHIFTUNITS},
|
||||||
"this option was used."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_SAVELENGTH, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_SHIFTUNITS, LONG_OPTION_SHIFTUNITS}),
|
|
||||||
translate("VCommandLine", "Layout units (as paper's one except px, export mode)."),
|
translate("VCommandLine", "Layout units (as paper's one except px, export mode)."),
|
||||||
translate("VCommandLine", "The unit"));
|
translate("VCommandLine", "The unit")},
|
||||||
optionsUsed.insert(LONG_OPTION_SHIFTUNITS, option);
|
{{SINGLE_OPTION_GAPWIDTH, LONG_OPTION_GAPWIDTH},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "The layout gap width x2, measured in layout units (export mode). Set distance "
|
||||||
|
"between details and a detail and a sheet."),
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_GAPWIDTH, LONG_OPTION_GAPWIDTH}),
|
translate("VCommandLine", "The gap width")},
|
||||||
translate("VCommandLine", "The layout gap width x2, measured in layout units "
|
{{SINGLE_OPTION_GROUPPING, LONG_OPTION_GROUPPING},
|
||||||
"(export mode). Set distance between details and a "
|
|
||||||
"detail and a sheet."),
|
|
||||||
translate("VCommandLine", "The gap width"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_GAPWIDTH, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_GROUPPING, LONG_OPTION_GROUPPING}),
|
|
||||||
translate("VCommandLine", "Sets layout groupping cases (export mode): %1.")
|
translate("VCommandLine", "Sets layout groupping cases (export mode): %1.")
|
||||||
.arg(DialogLayoutSettings::MakeGroupsHelp()),
|
.arg(DialogLayoutSettings::MakeGroupsHelp()),
|
||||||
translate("VCommandLine", "Grouping type"), QChar('2'));
|
translate("VCommandLine", "Grouping type"), QChar('2')},
|
||||||
optionsUsed.insert(LONG_OPTION_GROUPPING, option);
|
{{SINGLE_OPTION_TEST, LONG_OPTION_TEST},
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Run the program in a test mode. The program in this mode loads a single pattern "
|
||||||
|
"file and silently quit without showing the main window. The key have priority before key '%1'.")
|
||||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_TEST, LONG_OPTION_TEST}),
|
.arg(LONG_OPTION_BASENAME)},
|
||||||
translate("VCommandLine", "Run the program in a test mode. The program in this "
|
{LONG_OPTION_PENDANTIC,
|
||||||
"mode loads a single pattern file and silently quit "
|
translate("VCommandLine", "Make all parsing warnings into errors. Have effect only in console mode. Use to "
|
||||||
"without showing the main window. The key have "
|
"force Valentina to immediately terminate if a pattern contains a parsing warning.")},
|
||||||
"priority before key '%1'.")
|
{LONG_OPTION_NO_HDPI_SCALING,
|
||||||
.arg(LONG_OPTION_BASENAME));
|
translate("VCommandLine", "Disable high dpi scaling. Call this option if has problem with scaling (by default "
|
||||||
optionsUsed.insert(LONG_OPTION_TEST, option);
|
"scaling enabled). Alternatively you can use the %1 environment variable.")
|
||||||
parser.addOption(option);
|
.arg(QStringLiteral("QT_AUTO_SCREEN_SCALE_FACTOR=0"))},
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_PENDANTIC,
|
|
||||||
translate("VCommandLine", "Make all parsing warnings into errors. Have effect "
|
|
||||||
"only in console mode. Use to force Valentina to "
|
|
||||||
"immediately terminate if a pattern contains a parsing "
|
|
||||||
"warning."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_PENDANTIC, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_NO_HDPI_SCALING,
|
|
||||||
translate("VCommandLine", "Disable high dpi scaling. Call this option if has "
|
|
||||||
"problem with scaling (by default scaling enabled). "
|
|
||||||
"Alternatively you can use the %1 environment "
|
|
||||||
"variable.")
|
|
||||||
.arg(QStringLiteral("QT_AUTO_SCREEN_SCALE_FACTOR=0")));
|
|
||||||
optionsUsed.insert(LONG_OPTION_NO_HDPI_SCALING, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
option = VCommandLineOption(LONG_OPTION_CSVWITHHEADER,
|
{LONG_OPTION_CSVWITHHEADER,
|
||||||
translate("VCommandLine", "Export to csv with header. By default disabled."));
|
translate("VCommandLine", "Export to csv with header. By default disabled.")},
|
||||||
optionsUsed.insert(LONG_OPTION_CSVWITHHEADER, option);
|
{LONG_OPTION_CSVCODEC,
|
||||||
parser.addOption(option);
|
translate("VCommandLine", "Specify codec that will be used to save data. List of supported codecs provided by "
|
||||||
|
"Qt. Default value depend from system. On Windows, the codec will be based on a system locale. On Unix "
|
||||||
option = VCommandLineOption(LONG_OPTION_CSVCODEC,
|
"systems, the codec will might fall back to using the iconv library if no builtin codec for the locale can be "
|
||||||
translate("VCommandLine", "Specify codec that will be used to save data. List of "
|
"found. Valid values for this installation:") + DialogExportToCSV::MakeHelpCodecsList(),
|
||||||
"supported codecs provided by Qt. Default value depend "
|
translate("VCommandLine", "Codec name"), QString(QTextCodec::codecForLocale()->name())},
|
||||||
"from system. On Windows, the codec will be based on a "
|
{LONG_OPTION_CSVSEPARATOR,
|
||||||
"system locale. On Unix systems, the codec will might "
|
translate("VCommandLine", "Specify csv separator character. Default value is '%1'. Valid characters:")
|
||||||
"fall back to using the iconv library if no builtin "
|
.arg(VCommonSettings::GetDefCSVSeparator()) + DialogExportToCSV::MakeHelpSeparatorList(),
|
||||||
"codec for the locale can be found. Valid values for "
|
translate("VCommandLine", "Separator character"), QString(VCommonSettings::GetDefCSVSeparator())},
|
||||||
"this installation:")
|
{LONG_OPTION_CSVEXPORTFM,
|
||||||
+ DialogExportToCSV::MakeHelpCodecsList(),
|
translate("VCommandLine", "Calling this command enable exporting final measurements. Specify path to csv file "
|
||||||
translate("VCommandLine", "Codec name"),
|
"with final measurements. The path must contain path to directory and name of file. It can be absolute or "
|
||||||
QString(QTextCodec::codecForLocale()->name()));
|
"relatetive. In case of relative path will be used current working directory to calc a destination path."),
|
||||||
optionsUsed.insert(LONG_OPTION_CSVCODEC, option);
|
translate("VCommandLine", "Path to csv file")},
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_CSVSEPARATOR,
|
|
||||||
translate("VCommandLine", "Specify csv separator character. Default value is "
|
|
||||||
"'%1'. Valid characters:")
|
|
||||||
.arg(VCommonSettings::GetDefCSVSeparator()) +
|
|
||||||
DialogExportToCSV::MakeHelpSeparatorList(),
|
|
||||||
translate("VCommandLine", "Separator character"),
|
|
||||||
QString(VCommonSettings::GetDefCSVSeparator()));
|
|
||||||
optionsUsed.insert(LONG_OPTION_CSVSEPARATOR, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_CSVEXPORTFM,
|
|
||||||
translate("VCommandLine", "Calling this command enable exporting final "
|
|
||||||
"measurements. Specify path to csv file with final "
|
|
||||||
"measurements. The path must contain path to directory "
|
|
||||||
"and name of file. It can be absolute or relatetive. "
|
|
||||||
"In case of relative path will be used current working "
|
|
||||||
"directory to calc a destination path."),
|
|
||||||
translate("VCommandLine", "Path to csv file"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_CSVEXPORTFM, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
|
{LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
|
||||||
translate("VCommandLine", "Number corresponding to tiled pdf page template "
|
translate("VCommandLine", "Number corresponding to tiled pdf page template (default = 0, export mode with "
|
||||||
"(default = 0, export mode with tiled pdf format):") +
|
"tiled pdf format):") + DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
|
||||||
DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
|
translate("VCommandLine", "Template number"), QChar('0')},
|
||||||
translate("VCommandLine", "Template number"), QChar('0'));
|
{LONG_OPTION_TILED_PDF_LEFT_MARGIN,
|
||||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_PAGE_TEMPLATE, option);
|
translate("VCommandLine","Tiled page left margin in current units like 3.0 (export mode). If not set will be "
|
||||||
parser.addOption(option);
|
"used default value 1 cm."),
|
||||||
|
translate("VCommandLine", "The left margin")},
|
||||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_LEFT_MARGIN,
|
{LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
|
||||||
translate("VCommandLine","Tiled page left margin in current units like 3.0 "
|
translate("VCommandLine", "Tiled page right margin in current units like 3.0 (export mode). If not set will "
|
||||||
"(export mode). If not set will be used default value 1 "
|
"be used default value 1 cm."),
|
||||||
"cm."),
|
translate("VCommandLine", "The right margin")},
|
||||||
translate("VCommandLine", "The left margin"));
|
{LONG_OPTION_TILED_PDF_TOP_MARGIN,
|
||||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_LEFT_MARGIN, option);
|
translate("VCommandLine", "Tiled page top margin in current units like 3.0 (export mode). If not set will be "
|
||||||
parser.addOption(option);
|
"used value default value 1 cm."),
|
||||||
|
translate("VCommandLine", "The top margin")},
|
||||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
|
{LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
|
||||||
translate("VCommandLine", "Tiled page right margin in current units like 3.0 "
|
translate("VCommandLine", "Tiled page bottom margin in current units like 3.0 (export mode). If not set will "
|
||||||
"(export mode). If not set will be used default value "
|
"be used value default value 1 cm."),
|
||||||
"1 cm."),
|
translate("VCommandLine", "The bottom margin")},
|
||||||
translate("VCommandLine", "The right margin"));
|
{LONG_OPTION_TILED_PDF_LANDSCAPE,
|
||||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_RIGHT_MARGIN, option);
|
translate("VCommandLine", "Set tiled page orienatation to landscape (export mode). Default value if not set "
|
||||||
parser.addOption(option);
|
"portrait.")}
|
||||||
|
});
|
||||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_TOP_MARGIN,
|
|
||||||
translate("VCommandLine", "Tiled page top margin in current units like 3.0 "
|
|
||||||
"(export mode). If not set will be used value default "
|
|
||||||
"value 1 cm."),
|
|
||||||
translate("VCommandLine", "The top margin"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_TOP_MARGIN, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
|
|
||||||
translate("VCommandLine", "Tiled page bottom margin in current units like 3.0 "
|
|
||||||
"(export mode). If not set will be used value default "
|
|
||||||
"value 1 cm."),
|
|
||||||
translate("VCommandLine", "The bottom margin"));
|
|
||||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_BOTTOM_MARGIN, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
|
|
||||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_LANDSCAPE,
|
|
||||||
translate("VCommandLine", "Set tiled page orienatation to landscape (export "
|
|
||||||
"mode). Default value if not set portrait."));
|
|
||||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_LANDSCAPE, option);
|
|
||||||
parser.addOption(option);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VCommandLine::IsOptionSet(const QString &option) const
|
bool VCommandLine::IsOptionSet(const QString &option) const
|
||||||
{
|
{
|
||||||
return parser.isSet(optionsUsed.value(option));
|
return parser.isSet(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommandLine::OptionValue(const QString &option) const
|
QString VCommandLine::OptionValue(const QString &option) const
|
||||||
{
|
{
|
||||||
return parser.value(optionsUsed.value(option));
|
return parser.value(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VCommandLine::OptionValues(const QString &option) const
|
QStringList VCommandLine::OptionValues(const QString &option) const
|
||||||
{
|
{
|
||||||
return parser.values(optionsUsed.value(option));
|
return parser.values(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -42,29 +42,6 @@ class VCommandLine;
|
||||||
using VCommandLinePtr = std::shared_ptr<VCommandLine>;
|
using VCommandLinePtr = std::shared_ptr<VCommandLine>;
|
||||||
using VLayoutGeneratorPtr = std::shared_ptr<VLayoutGenerator>;
|
using VLayoutGeneratorPtr = std::shared_ptr<VLayoutGenerator>;
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VCommandLineOption class wrapper for class QCommandLineOption. Add support for containers.
|
|
||||||
*/
|
|
||||||
class VCommandLineOption : public QCommandLineOption
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VCommandLineOption()
|
|
||||||
: QCommandLineOption(QStringLiteral("fakeOption")) {}
|
|
||||||
|
|
||||||
VCommandLineOption(const QString &name, const QString &description, const QString &valueName = QString(),
|
|
||||||
const QString &defaultValue = QString())
|
|
||||||
: QCommandLineOption(name, description, valueName, defaultValue) {}
|
|
||||||
|
|
||||||
VCommandLineOption(const QStringList &names, const QString &description, const QString &valueName = QString(),
|
|
||||||
const QString &defaultValue = QString())
|
|
||||||
: QCommandLineOption(names, description, valueName, defaultValue) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
QT_WARNING_POP
|
|
||||||
|
|
||||||
//@brief: class used to install export command line options and parse their values
|
//@brief: class used to install export command line options and parse their values
|
||||||
//QCommandLineParser* object must exists until this object alive
|
//QCommandLineParser* object must exists until this object alive
|
||||||
class VCommandLine
|
class VCommandLine
|
||||||
|
@ -163,7 +140,6 @@ private:
|
||||||
Q_DISABLE_COPY(VCommandLine)
|
Q_DISABLE_COPY(VCommandLine)
|
||||||
static VCommandLinePtr instance;
|
static VCommandLinePtr instance;
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
QMap<QString, VCommandLineOption> optionsUsed;
|
|
||||||
bool isGuiEnabled;
|
bool isGuiEnabled;
|
||||||
friend class VApplication;
|
friend class VApplication;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user