New command line option --landscapeOrientation.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-12-27 16:37:47 +02:00
parent 6016308d58
commit e108a1378f
8 changed files with 35 additions and 4 deletions

View File

@ -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.

View File

@ -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 <The page width>"
.RB "Page width in current units like 12.0 (cannot be used with \*(lqpageformat\*(rq, " "export mode" ")."
.IP "-H, --pageh <The page height>"

View File

@ -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 <The page width>"
.RB "Page width in current units like 12.0 (cannot be used with \*(lqpageformat\*(rq, " "export mode" ")."
.IP "-H, --pageh <The page height>"

View File

@ -156,6 +156,12 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
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));
}

View File

@ -356,6 +356,15 @@ QString DialogLayoutSettings::SelectedPrinter() const
return ui->comboBoxPrinter->currentText();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::EnableLandscapeOrientation()
{
if (static_cast<PaperSizeTemplate>(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<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
const PaperSizeTemplate temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
const Unit paperUnit = PaperUnit();

View File

@ -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();

View File

@ -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;
}

View File

@ -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();