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
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VCommandLine::VCommandLine() : parser(), optionsUsed(), isGuiEnabled(false)
|
||||
VCommandLine::VCommandLine() : parser(), isGuiEnabled(false)
|
||||
{
|
||||
parser.setApplicationDescription(translate("VCommandLine", "Pattern making program."));
|
||||
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
|
||||
//=================================================================================================================
|
||||
VCommandLineOption option =
|
||||
VCommandLineOption(QStringList({SINGLE_OPTION_BASENAME, LONG_OPTION_BASENAME}),
|
||||
translate("VCommandLine", "The base filename of exported layout files. Use it to "
|
||||
"enable console export mode."),
|
||||
translate("VCommandLine", "The base filename of layout files"));
|
||||
optionsUsed.insert(LONG_OPTION_BASENAME, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_DESTINATION, LONG_OPTION_DESTINATION}),
|
||||
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", "The measure file"));
|
||||
optionsUsed.insert(LONG_OPTION_MEASUREFILE, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_NESTING_TIME, LONG_OPTION_NESTING_TIME}),
|
||||
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."),
|
||||
translate("VCommandLine", "Time"));
|
||||
optionsUsed.insert(LONG_OPTION_NESTING_TIME, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(LONG_OPTION_EFFICIENCY_COEFFICIENT,
|
||||
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(),
|
||||
translate("VCommandLine", "Format number"), QChar('0'));
|
||||
optionsUsed.insert(LONG_OPTION_EXP2FORMAT, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form."));
|
||||
optionsUsed.insert(LONG_OPTION_BINARYDXF, option);
|
||||
parser.addOption(option);
|
||||
|
||||
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", "The name regex"));
|
||||
optionsUsed.insert(LONG_OPTION_EXPORTSUCHDETAILS, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_GRADATIONSIZE, LONG_OPTION_GRADATIONSIZE}),
|
||||
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(", "))),
|
||||
translate("VCommandLine", "The size value"));
|
||||
optionsUsed.insert(LONG_OPTION_GRADATIONSIZE, option);
|
||||
parser.addOption(option);
|
||||
|
||||
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);
|
||||
|
||||
parser.addOptions({
|
||||
{{SINGLE_OPTION_BASENAME, LONG_OPTION_BASENAME},
|
||||
translate("VCommandLine", "The base filename of exported layout files. Use it to enable console export mode."),
|
||||
translate("VCommandLine", "The base filename of layout files")},
|
||||
{{SINGLE_OPTION_DESTINATION, LONG_OPTION_DESTINATION},
|
||||
translate("VCommandLine", "The path to output destination folder. By default the directory at which the "
|
||||
"application was started."),
|
||||
translate("VCommandLine", "The destination folder")},
|
||||
{{SINGLE_OPTION_MEASUREFILE, LONG_OPTION_MEASUREFILE},
|
||||
translate("VCommandLine", "Path to custom measure file (export mode)."),
|
||||
translate("VCommandLine", "The measure file")},
|
||||
{{SINGLE_OPTION_NESTING_TIME, LONG_OPTION_NESTING_TIME},
|
||||
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."),
|
||||
translate("VCommandLine", "Time")},
|
||||
{LONG_OPTION_EFFICIENCY_COEFFICIENT,
|
||||
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")},
|
||||
{{SINGLE_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT},
|
||||
translate("VCommandLine", "Number corresponding to output format (default = 0, export mode):") +
|
||||
DialogSaveLayout::MakeHelpFormatList(),
|
||||
translate("VCommandLine", "Format number"), QChar('0')},
|
||||
{LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
|
||||
{LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
|
||||
{LONG_OPTION_EXPORTONLYDETAILS,
|
||||
translate("VCommandLine", "Export only details. Export details as they positioned in the details mode. Any "
|
||||
"layout related options will be ignored.")},
|
||||
{LONG_OPTION_EXPORTSUCHDETAILS,
|
||||
translate("VCommandLine", "Export only details that match a piece name regex."),
|
||||
translate("VCommandLine", "The name regex")},
|
||||
{{SINGLE_OPTION_GRADATIONSIZE, LONG_OPTION_GRADATIONSIZE},
|
||||
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(", "))),
|
||||
translate("VCommandLine", "The size value")},
|
||||
{{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")},
|
||||
{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")},
|
||||
//=================================================================================================================
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_PAGETEMPLATE, LONG_OPTION_PAGETEMPLATE}),
|
||||
translate("VCommandLine", "Number corresponding to layout page template "
|
||||
"(default = 0, export mode):") +
|
||||
DialogLayoutSettings::MakeHelpTemplateList(),
|
||||
translate("VCommandLine", "Template number"), QChar('0'));
|
||||
optionsUsed.insert(LONG_OPTION_PAGETEMPLATE, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(LONG_OPTION_LANDSCAPE_ORIENTATION,
|
||||
translate("VCommandLine", "Switch page template orientation to landscape "
|
||||
"(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),
|
||||
translate("VCommandLine", "The page width"));
|
||||
optionsUsed.insert(LONG_OPTION_PAGEW, option);
|
||||
parser.addOption(option);
|
||||
|
||||
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),
|
||||
translate("VCommandLine", "The page height"));
|
||||
optionsUsed.insert(LONG_OPTION_PAGEH, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_PAGEUNITS, LONG_OPTION_PAGEUNITS}),
|
||||
translate("VCommandLine", "Page measure units (export mode). Valid values: %1.")
|
||||
.arg(VDomDocument::UnitsHelpString()),
|
||||
translate("VCommandLine", "The measure unit"));
|
||||
optionsUsed.insert(LONG_OPTION_PAGEUNITS, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_IGNORE_MARGINS, LONG_OPTION_IGNORE_MARGINS}),
|
||||
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."));
|
||||
optionsUsed.insert(LONG_OPTION_IGNORE_MARGINS, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_LEFT_MARGIN, LONG_OPTION_LEFT_MARGIN}),
|
||||
translate("VCommandLine", "Page left 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 left margin"));
|
||||
optionsUsed.insert(LONG_OPTION_LEFT_MARGIN, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_RIGHT_MARGIN, LONG_OPTION_RIGHT_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);
|
||||
|
||||
{{SINGLE_OPTION_PAGETEMPLATE, LONG_OPTION_PAGETEMPLATE},
|
||||
translate("VCommandLine", "Number corresponding to layout page template (default = 0, export mode):") +
|
||||
DialogLayoutSettings::MakeHelpTemplateList(),
|
||||
translate("VCommandLine", "Template number"), QChar('0')},
|
||||
{LONG_OPTION_LANDSCAPE_ORIENTATION,
|
||||
translate("VCommandLine", "Switch page template orientation to landscape (export mode). This option has "
|
||||
"effect only for one of predefined page templates.")},
|
||||
{{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),
|
||||
translate("VCommandLine", "The page width")},
|
||||
{{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),
|
||||
translate("VCommandLine", "The page height")},
|
||||
{{SINGLE_OPTION_PAGEUNITS, LONG_OPTION_PAGEUNITS},
|
||||
translate("VCommandLine", "Page measure units (export mode). Valid values: %1.")
|
||||
.arg(VDomDocument::UnitsHelpString()),
|
||||
translate("VCommandLine", "The measure unit")},
|
||||
{{SINGLE_OPTION_IGNORE_MARGINS, LONG_OPTION_IGNORE_MARGINS},
|
||||
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.")},
|
||||
{{SINGLE_OPTION_LEFT_MARGIN, LONG_OPTION_LEFT_MARGIN},
|
||||
translate("VCommandLine", "Page left 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 left margin")},
|
||||
{{SINGLE_OPTION_RIGHT_MARGIN, LONG_OPTION_RIGHT_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")},
|
||||
{{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")},
|
||||
{{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")},
|
||||
//=================================================================================================================
|
||||
option = VCommandLineOption(LONG_OPTION_FOLLOW_GRAINLINE,
|
||||
translate("VCommandLine", "Order detail to follow grainline direction (export mode)."));
|
||||
optionsUsed.insert(LONG_OPTION_FOLLOW_GRAINLINE, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_CROP, LONG_OPTION_CROP}),
|
||||
translate("VCommandLine", "Auto crop unused length (export mode)."));
|
||||
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);
|
||||
|
||||
{LONG_OPTION_FOLLOW_GRAINLINE,
|
||||
translate("VCommandLine", "Order detail to follow grainline direction (export mode).")},
|
||||
{{SINGLE_OPTION_CROP, LONG_OPTION_CROP},
|
||||
translate("VCommandLine", "Auto crop unused length (export mode).")},
|
||||
{{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.")},
|
||||
//=================================================================================================================
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_SAVELENGTH, LONG_OPTION_SAVELENGTH}),
|
||||
translate("VCommandLine", "Save length of the sheet if set (export mode). The "
|
||||
"option tells the program to use as much as possible "
|
||||
"width of sheet. Quality of a layout can be worse when "
|
||||
"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", "The unit"));
|
||||
optionsUsed.insert(LONG_OPTION_SHIFTUNITS, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_GAPWIDTH, LONG_OPTION_GAPWIDTH}),
|
||||
translate("VCommandLine", "The layout gap width x2, measured in layout units "
|
||||
"(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.")
|
||||
.arg(DialogLayoutSettings::MakeGroupsHelp()),
|
||||
translate("VCommandLine", "Grouping type"), QChar('2'));
|
||||
optionsUsed.insert(LONG_OPTION_GROUPPING, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(QStringList({SINGLE_OPTION_TEST, LONG_OPTION_TEST}),
|
||||
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'.")
|
||||
.arg(LONG_OPTION_BASENAME));
|
||||
optionsUsed.insert(LONG_OPTION_TEST, option);
|
||||
parser.addOption(option);
|
||||
|
||||
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);
|
||||
|
||||
{{SINGLE_OPTION_SAVELENGTH, LONG_OPTION_SAVELENGTH},
|
||||
translate("VCommandLine", "Save length of the sheet if set (export mode). The option tells the program to use "
|
||||
"as much as possible width of sheet. Quality of a layout can be worse when this option was used.")},
|
||||
{{SINGLE_OPTION_SHIFTUNITS, LONG_OPTION_SHIFTUNITS},
|
||||
translate("VCommandLine", "Layout units (as paper's one except px, export mode)."),
|
||||
translate("VCommandLine", "The unit")},
|
||||
{{SINGLE_OPTION_GAPWIDTH, LONG_OPTION_GAPWIDTH},
|
||||
translate("VCommandLine", "The layout gap width x2, measured in layout units (export mode). Set distance "
|
||||
"between details and a detail and a sheet."),
|
||||
translate("VCommandLine", "The gap width")},
|
||||
{{SINGLE_OPTION_GROUPPING, LONG_OPTION_GROUPPING},
|
||||
translate("VCommandLine", "Sets layout groupping cases (export mode): %1.")
|
||||
.arg(DialogLayoutSettings::MakeGroupsHelp()),
|
||||
translate("VCommandLine", "Grouping type"), QChar('2')},
|
||||
{{SINGLE_OPTION_TEST, LONG_OPTION_TEST},
|
||||
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'.")
|
||||
.arg(LONG_OPTION_BASENAME)},
|
||||
{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.")},
|
||||
{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"))},
|
||||
//=================================================================================================================
|
||||
option = VCommandLineOption(LONG_OPTION_CSVWITHHEADER,
|
||||
translate("VCommandLine", "Export to csv with header. By default disabled."));
|
||||
optionsUsed.insert(LONG_OPTION_CSVWITHHEADER, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(LONG_OPTION_CSVCODEC,
|
||||
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 systems, the codec will might "
|
||||
"fall back to using the iconv library if no builtin "
|
||||
"codec for the locale can be found. Valid values for "
|
||||
"this installation:")
|
||||
+ DialogExportToCSV::MakeHelpCodecsList(),
|
||||
translate("VCommandLine", "Codec name"),
|
||||
QString(QTextCodec::codecForLocale()->name()));
|
||||
optionsUsed.insert(LONG_OPTION_CSVCODEC, option);
|
||||
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);
|
||||
|
||||
{LONG_OPTION_CSVWITHHEADER,
|
||||
translate("VCommandLine", "Export to csv with header. By default disabled.")},
|
||||
{LONG_OPTION_CSVCODEC,
|
||||
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 "
|
||||
"systems, the codec will might fall back to using the iconv library if no builtin codec for the locale can be "
|
||||
"found. Valid values for this installation:") + DialogExportToCSV::MakeHelpCodecsList(),
|
||||
translate("VCommandLine", "Codec name"), QString(QTextCodec::codecForLocale()->name())},
|
||||
{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())},
|
||||
{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")},
|
||||
//=================================================================================================================
|
||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
|
||||
translate("VCommandLine", "Number corresponding to tiled pdf page template "
|
||||
"(default = 0, export mode with tiled pdf format):") +
|
||||
DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
|
||||
translate("VCommandLine", "Template number"), QChar('0'));
|
||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_PAGE_TEMPLATE, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_LEFT_MARGIN,
|
||||
translate("VCommandLine","Tiled page left margin in current units like 3.0 "
|
||||
"(export mode). If not set will be used default value 1 "
|
||||
"cm."),
|
||||
translate("VCommandLine", "The left margin"));
|
||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_LEFT_MARGIN, option);
|
||||
parser.addOption(option);
|
||||
|
||||
option = VCommandLineOption(LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
|
||||
translate("VCommandLine", "Tiled page right margin in current units like 3.0 "
|
||||
"(export mode). If not set will be used default value "
|
||||
"1 cm."),
|
||||
translate("VCommandLine", "The right margin"));
|
||||
optionsUsed.insert(LONG_OPTION_TILED_PDF_RIGHT_MARGIN, option);
|
||||
parser.addOption(option);
|
||||
|
||||
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);
|
||||
{LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
|
||||
translate("VCommandLine", "Number corresponding to tiled pdf page template (default = 0, export mode with "
|
||||
"tiled pdf format):") + DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
|
||||
translate("VCommandLine", "Template number"), QChar('0')},
|
||||
{LONG_OPTION_TILED_PDF_LEFT_MARGIN,
|
||||
translate("VCommandLine","Tiled page left margin in current units like 3.0 (export mode). If not set will be "
|
||||
"used default value 1 cm."),
|
||||
translate("VCommandLine", "The left margin")},
|
||||
{LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
|
||||
translate("VCommandLine", "Tiled page right margin in current units like 3.0 (export mode). If not set will "
|
||||
"be used default value 1 cm."),
|
||||
translate("VCommandLine", "The right margin")},
|
||||
{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")},
|
||||
{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")},
|
||||
{LONG_OPTION_TILED_PDF_LANDSCAPE,
|
||||
translate("VCommandLine", "Set tiled page orienatation to landscape (export mode). Default value if not set "
|
||||
"portrait.")}
|
||||
});
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VCommandLine::IsOptionSet(const QString &option) const
|
||||
{
|
||||
return parser.isSet(optionsUsed.value(option));
|
||||
return parser.isSet(option);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VCommandLine::OptionValue(const QString &option) const
|
||||
{
|
||||
return parser.value(optionsUsed.value(option));
|
||||
return parser.value(option);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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 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
|
||||
//QCommandLineParser* object must exists until this object alive
|
||||
class VCommandLine
|
||||
|
@ -163,7 +140,6 @@ private:
|
|||
Q_DISABLE_COPY(VCommandLine)
|
||||
static VCommandLinePtr instance;
|
||||
QCommandLineParser parser;
|
||||
QMap<QString, VCommandLineOption> optionsUsed;
|
||||
bool isGuiEnabled;
|
||||
friend class VApplication;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user