From 47bcfd74ab289afd54d5dc49f9b6b87489adbcb1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 29 Mar 2019 11:31:17 +0200 Subject: [PATCH] Changes for dialog. --HG-- branch : feature --- src/app/valentina/core/vcmdexport.cpp | 129 +++++----- src/app/valentina/core/vcmdexport.h | 5 +- .../dialogs/dialoglayoutsettings.cpp | 80 ++---- .../valentina/dialogs/dialoglayoutsettings.h | 13 +- .../valentina/dialogs/dialoglayoutsettings.ui | 240 ++++-------------- src/libs/vlayout/vlayoutgenerator.cpp | 24 ++ src/libs/vlayout/vlayoutgenerator.h | 8 + src/libs/vmisc/commandoptions.cpp | 16 +- src/libs/vmisc/commandoptions.h | 12 +- src/libs/vmisc/vsettings.cpp | 118 +++------ src/libs/vmisc/vsettings.h | 20 +- 11 files changed, 229 insertions(+), 436 deletions(-) diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index 4946e7fa0..007eded8c 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -110,19 +110,6 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const } - { - //just anonymous namespace ...don' like to have a,b,c,d everywhere defined - bool a = IsOptionSet(LONG_OPTION_SHIFTLENGTH); - bool b = IsOptionSet(LONG_OPTION_SHIFTUNITS); - - if ((a || b) && !(a && b)) - { - qCritical() << translate("VCommandLine", "Shift/Offset length must be used together with shift units.") - << "\n"; - const_cast(this)->parser.showHelp(V_EX_USAGE); - } - } - { //just anonymous namespace ...don' like to have a,b,c,d everywhere defined bool a = IsOptionSet(LONG_OPTION_GAPWIDTH); @@ -163,19 +150,6 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const CheckKey(LONG_OPTION_TILED_PDF_BOTTOM_MARGIN, translate("VCommandLine", "Tiled bottom margin must be used together with page units.")); - const int rotateDegree = OptRotation(); - diag.SetRotate(rotateDegree != 0 ); // 0 disable rotation - - if (rotateDegree != VSettings::GetDefLayoutRotationIncrease())//Value by default - { - if (not diag.SetIncrease(rotateDegree)) - { - qCritical() << translate("VCommandLine", "Invalid rotation value. That must be one of predefined values.") - << "\n"; - const_cast(this)->parser.showHelp(V_EX_USAGE); - } - } - // if present units MUST be set before any other to keep conversions correct if (!diag.SelectTemplate(OptPaperSize())) { @@ -212,11 +186,6 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const } } - if (IsOptionSet(LONG_OPTION_SHIFTLENGTH)) - { - diag.SetShift(Lo2Px(OptionValue(LONG_OPTION_SHIFTLENGTH), diag)); - } - if (IsOptionSet(LONG_OPTION_GAPWIDTH)) { diag.SetLayoutWidth(Lo2Px(OptionValue(LONG_OPTION_GAPWIDTH), diag)); @@ -256,6 +225,8 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const diag.SetFields(margins); diag.SetFollowGrainline(IsOptionSet(LONG_OPTION_FOLLOW_GRAINLINE)); + diag.SetNestingTime(OptNestingTime()); + diag.SetEfficiencyCoefficient(OptEfficiencyCoefficient()); diag.DialogAccepted(); // filling VLayoutGenerator @@ -340,24 +311,6 @@ VAbstractLayoutDialog::PaperSizeTemplate VCommandLine::OptPaperSize() const return FormatSize(LONG_OPTION_PAGETEMPLATE); } -//------------------------------------------------------------------------------------------------------ -int VCommandLine::OptRotation() const -{ - int rotate = VSettings::GetDefLayoutRotationIncrease(); - if (IsOptionSet(LONG_OPTION_ROTATE)) - { - bool ok = false; - rotate = OptionValue(LONG_OPTION_ROTATE).toInt(&ok); - - if (not ok) - { - rotate = VSettings::GetDefLayoutRotationIncrease(); - } - } - - return rotate; -} - //------------------------------------------------------------------------------------------------------ Cases VCommandLine::OptGroup() const { @@ -635,6 +588,24 @@ void VCommandLine::InitCommandLineOptions() optionsUsed.insert(LONG_OPTION_MEASUREFILE, option); parser.addOption(option); + option = VCommandLineOption(QStringList({SINGLE_OPTION_NESTING_TIME, LONG_OPTION_NESTING_TIME}), + translate("VCommandLine", "