Fix reading tiled page margins in console mode.

This commit is contained in:
Roman Telezhynskyi 2021-10-15 18:27:06 +03:00
parent bcb786958e
commit 64c6a28053
2 changed files with 13 additions and 12 deletions

View File

@ -12,6 +12,7 @@
- Make an increment name valid after user selected it from a completion list. - Make an increment name valid after user selected it from a completion list.
- [smart-pattern/valentina#150] Fix Seam allowance not correct at intersection curve and axis. - [smart-pattern/valentina#150] Fix Seam allowance not correct at intersection curve and axis.
- Show tooltip about defined user material in the label placeholder list. - Show tooltip about defined user material in the label placeholder list.
- Fix reading tiled page margins in console mode.
# Valentina 0.7.49 July 1, 2021 # Valentina 0.7.49 July 1, 2021
- Fix crash. - Fix crash.

View File

@ -572,23 +572,23 @@ int VCommandLine::OptDimensionC() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMarginsF VCommandLine::TiledPageMargins() const auto VCommandLine::TiledPageMargins() const -> QMarginsF
{ {
QMarginsF margins(10, 10, 10, 10); // mm QMarginsF margins(10, 10, 10, 10); // mm
if (not IsOptionSet(LONG_OPTION_LEFT_MARGIN)) Unit unit = Unit::Cm;
{
return margins;
}
const QString value = OptionValue(LONG_OPTION_LEFT_MARGIN); if (IsOptionSet(LONG_OPTION_SHIFTUNITS))
{
const QString value = OptionValue(LONG_OPTION_SHIFTUNITS);
const QStringList supportedUnits = QStringList() << unitMM << unitCM << unitINCH; const QStringList supportedUnits = QStringList() << unitMM << unitCM << unitINCH;
if (not supportedUnits.contains(value)) if (not supportedUnits.contains(value))
{ {
qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n"; qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n";
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE); const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
} }
const Unit unit = StrToUnits(value); unit = StrToUnits(value);
}
if (IsOptionSet(LONG_OPTION_LEFT_MARGIN)) if (IsOptionSet(LONG_OPTION_LEFT_MARGIN))
{ {
@ -747,7 +747,7 @@ void VCommandLine::InitCommandLineOptions()
translate("VCommandLine", "Save length of the sheet if set (export mode). The option tells the program to use " 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.")}, "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}, {{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). Default units cm."),
translate("VCommandLine", "The unit")}, translate("VCommandLine", "The unit")},
{{SINGLE_OPTION_GAPWIDTH, LONG_OPTION_GAPWIDTH}, {{SINGLE_OPTION_GAPWIDTH, LONG_OPTION_GAPWIDTH},
translate("VCommandLine", "The layout gap width x2, measured in layout units (export mode). Set distance " translate("VCommandLine", "The layout gap width x2, measured in layout units (export mode). Set distance "