diff --git a/ChangeLog.txt b/ChangeLog.txt index 44a85edb1..07d2e781b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ - [#895] Improve path validation. Do not allow repeat the same curve twice. - Improve UI. Make placeholder menu scrollable. - [#651] Improve feature: Layout orientation according to grainline. +- New command line option --landscapeOrientation. # Version 0.6.2 (unreleased) - [#903] Bug in tool Cut Spline path. diff --git a/dist/OBS_debian/debian.valentina.1 b/dist/OBS_debian/debian.valentina.1 index 483916188..bcedb2d0e 100644 --- a/dist/OBS_debian/debian.valentina.1 +++ b/dist/OBS_debian/debian.valentina.1 @@ -161,6 +161,8 @@ The path to output destination folder. By default the directory at which the app .RS .BR "*" " Roll 72in = 14." .RE +.IP "--landscapeOrientation" +.RB "Switch page template orientation to landscape (" "export mode" "). This option has effect only for one of predefined page templates." .IP "-W, --pagew " .RB "Page width in current units like 12.0 (cannot be used with \*(lqpageformat\*(rq, " "export mode" ")." .IP "-H, --pageh " diff --git a/dist/debian/valentina.1 b/dist/debian/valentina.1 index 483916188..bcedb2d0e 100644 --- a/dist/debian/valentina.1 +++ b/dist/debian/valentina.1 @@ -161,6 +161,8 @@ The path to output destination folder. By default the directory at which the app .RS .BR "*" " Roll 72in = 14." .RE +.IP "--landscapeOrientation" +.RB "Switch page template orientation to landscape (" "export mode" "). This option has effect only for one of predefined page templates." .IP "-W, --pagew " .RB "Page width in current units like 12.0 (cannot be used with \*(lqpageformat\*(rq, " "export mode" ")." .IP "-H, --pageh " diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index 938bbb646..8873cb00f 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -156,6 +156,12 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap DialogLayoutSettings::MakeHelpTemplateList(), translate("VCommandLine", "Template number"), QChar('0'))); + optionsIndex.insert(LONG_OPTION_LANDSCAPE_ORIENTATION, index++); + options.append(new QCommandLineOption(QStringList() << 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."))); + optionsIndex.insert(LONG_OPTION_PAGEW, index++); options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEW << LONG_OPTION_PAGEW, translate("VCommandLine", "Page width in current units like 12.0 (cannot be " @@ -508,6 +514,13 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const diag.SetPaperHeight (Pg2Px(parser.value(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEH))), diag)); diag.SetPaperWidth (Pg2Px(parser.value(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEW))), diag)); } + else + { // Not explicit page size + if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_LANDSCAPE_ORIENTATION)))) + { + diag.EnableLandscapeOrientation(); + } + } if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_SHIFTUNITS)))) { @@ -520,7 +533,6 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_SHIFTLENGTH)))) { - diag.SetShift(Lo2Px(parser.value(*optionsUsed.value(optionsIndex.value(LONG_OPTION_SHIFTLENGTH))), diag)); } diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index 2276c738c..6ac008900 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -356,6 +356,15 @@ QString DialogLayoutSettings::SelectedPrinter() const return ui->comboBoxPrinter->currentText(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogLayoutSettings::EnableLandscapeOrientation() +{ + if (static_cast(ui->comboBoxTemplates->currentData().toInt()) != PaperSizeTemplate::Custom) + { // Force landscape only for not custom page format + ui->toolButtonLandscape->setChecked(true); + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::TemplateSelected() { @@ -847,8 +856,7 @@ QString DialogLayoutSettings::MakeHelpTiledPdfTemplateList() //--------------------------------------------------------------------------------------------------------------------- QSizeF DialogLayoutSettings::Template() { - PaperSizeTemplate temp; - temp = static_cast(ui->comboBoxTemplates->currentData().toInt()); + const PaperSizeTemplate temp = static_cast(ui->comboBoxTemplates->currentData().toInt()); const Unit paperUnit = PaperUnit(); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.h b/src/app/valentina/dialogs/dialoglayoutsettings.h index d8ed76e9d..d5bf8164f 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.h +++ b/src/app/valentina/dialogs/dialoglayoutsettings.h @@ -105,6 +105,8 @@ public: QString SelectedPrinter() const; + void EnableLandscapeOrientation(); + //support functions for the command line parser which uses invisible dialog to properly build layout generator bool SelectTemplate(const PaperSizeTemplate& id); static QString MakeHelpTemplateList(); diff --git a/src/libs/vmisc/commandoptions.cpp b/src/libs/vmisc/commandoptions.cpp index 1ea4650c2..d0ce3cba3 100644 --- a/src/libs/vmisc/commandoptions.cpp +++ b/src/libs/vmisc/commandoptions.cpp @@ -129,6 +129,8 @@ const QString LONG_OPTION_TILED_PDF_LANDSCAPE = QStringLiteral("tiledLandsca const QString LONG_OPTION_FOLLOW_GRAINLINE = QStringLiteral("followGrainline"); +const QString LONG_OPTION_LANDSCAPE_ORIENTATION = QStringLiteral("landscapeOrientation"); + //--------------------------------------------------------------------------------------------------------------------- /** * @brief AllKeys return list with all command line keys (short and long forms). Used for testing on conflicts. @@ -178,7 +180,8 @@ QStringList AllKeys() << LONG_OPTION_TILED_PDF_TOP_MARGIN << LONG_OPTION_TILED_PDF_BOTTOM_MARGIN << LONG_OPTION_TILED_PDF_LANDSCAPE - << LONG_OPTION_FOLLOW_GRAINLINE; + << LONG_OPTION_FOLLOW_GRAINLINE + << LONG_OPTION_LANDSCAPE_ORIENTATION; return list; } diff --git a/src/libs/vmisc/commandoptions.h b/src/libs/vmisc/commandoptions.h index 41bc678e1..9bb7ccdc6 100644 --- a/src/libs/vmisc/commandoptions.h +++ b/src/libs/vmisc/commandoptions.h @@ -124,6 +124,7 @@ extern const QString LONG_OPTION_TILED_PDF_TOP_MARGIN; extern const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN; extern const QString LONG_OPTION_TILED_PDF_LANDSCAPE; extern const QString LONG_OPTION_FOLLOW_GRAINLINE; +extern const QString LONG_OPTION_LANDSCAPE_ORIENTATION; QStringList AllKeys();