From 64c6a28053ebb105181c005fa6683dcdc3f08c7c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 15 Oct 2021 18:27:06 +0300 Subject: [PATCH] Fix reading tiled page margins in console mode. --- ChangeLog.txt | 1 + src/app/valentina/core/vcmdexport.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 00608cb2e..845bdf0da 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -12,6 +12,7 @@ - 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. - 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 - Fix crash. diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index ec8cd4225..f3e83427d 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -572,23 +572,23 @@ int VCommandLine::OptDimensionC() const } //--------------------------------------------------------------------------------------------------------------------- -QMarginsF VCommandLine::TiledPageMargins() const +auto VCommandLine::TiledPageMargins() const -> QMarginsF { QMarginsF margins(10, 10, 10, 10); // mm - if (not IsOptionSet(LONG_OPTION_LEFT_MARGIN)) - { - return margins; - } + Unit unit = Unit::Cm; - const QString value = OptionValue(LONG_OPTION_LEFT_MARGIN); - const QStringList supportedUnits = QStringList() << unitMM << unitCM << unitINCH; - if (not supportedUnits.contains(value)) + if (IsOptionSet(LONG_OPTION_SHIFTUNITS)) { - qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n"; - const_cast(this)->parser.showHelp(V_EX_USAGE); + const QString value = OptionValue(LONG_OPTION_SHIFTUNITS); + const QStringList supportedUnits = QStringList() << unitMM << unitCM << unitINCH; + if (not supportedUnits.contains(value)) + { + qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n"; + const_cast(this)->parser.showHelp(V_EX_USAGE); + } + unit = StrToUnits(value); } - const Unit unit = StrToUnits(value); 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 " "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", "Layout units (as paper's one except px, export mode). Default units cm."), 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 "