Fix issue. User should be able to control tiled pdf export through command line.
--HG-- branch : develop
This commit is contained in:
parent
0da31099f3
commit
d15e507aeb
49
dist/debian/valentina.1
vendored
49
dist/debian/valentina.1
vendored
|
@ -1,6 +1,6 @@
|
||||||
.\" Manpage for valentina.
|
.\" Manpage for valentina.
|
||||||
.\" Contact dismine@gmail.com to correct errors.
|
.\" Contact dismine@gmail.com to correct errors.
|
||||||
.TH valentina 1 "28 September, 2017" "valentina man page"
|
.TH valentina 1 "12 October, 2017" "valentina man page"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Valentina \- Pattern making program.
|
Valentina \- Pattern making program.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -113,7 +113,7 @@ The path to output destination folder. By default the directory at which the app
|
||||||
.IP "-e, --gheight <The height value>"
|
.IP "-e, --gheight <The height value>"
|
||||||
.RB "Set height value a pattern file, that was opened with multisize measurements (" "export mode" "). Valid values: 92, 98, 104, 110, 116, 122, 128, 134, 140, 146, 152, 158, 164, 170, 176, 182, 188, 194, 200cm."
|
.RB "Set height value a pattern file, that was opened with multisize measurements (" "export mode" "). Valid values: 92, 98, 104, 110, 116, 122, 128, 134, 140, 146, 152, 158, 164, 170, 176, 182, 188, 194, 200cm."
|
||||||
.IP "-p, --pageformat <Template number>"
|
.IP "-p, --pageformat <Template number>"
|
||||||
.RB "Number corresponding to page template (default = 0, " "export mode" "):"
|
.RB "Number corresponding to layout page template (default = 0, " "export mode" "):"
|
||||||
.RS
|
.RS
|
||||||
.BR "*" " A0 = 0,"
|
.BR "*" " A0 = 0,"
|
||||||
.RE
|
.RE
|
||||||
|
@ -155,17 +155,17 @@ The path to output destination folder. By default the directory at which the app
|
||||||
.IP "-H, --pageh <The page height>"
|
.IP "-H, --pageh <The page height>"
|
||||||
.RB "Page height in current units like 12.0 (cannot be used with \*(lqpageformat\*(rq, " "export mode" ")."
|
.RB "Page height in current units like 12.0 (cannot be used with \*(lqpageformat\*(rq, " "export mode" ")."
|
||||||
.IP "-U, --pageunits <The measure unit>"
|
.IP "-U, --pageunits <The measure unit>"
|
||||||
.RB "Page height/width measure units (cannot be used with \*(lqpageformat\*(rq, " "export mode" "). Valid values: mm, cm, inch, px."
|
.RB "Page measure units (" "export mode" "). Valid values: mm, cm, inch, px."
|
||||||
.IP "-i, --ignoremargins"
|
.IP "-i, --ignoremargins"
|
||||||
.RB "Ignore margins printing (" "export mode" "). Disable value keys: \*(lqlmargin", \*(lqrmargin\*(rq, \*(lqtmargin\*(rq, \*(lqbmargin\*(rq. Set all margins to 0."
|
.RB "Ignore margins printing (" "export mode" "). Use if need full paper space. In case of later printing you must account for the margins himself."
|
||||||
.IP "-L, --lmargin <The left margin>"
|
.IP "-L, --lmargin <The left margin>"
|
||||||
.RB "Page left margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key \*(lqignoremargins\*(rq is used."
|
.RB "Page left margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found."
|
||||||
.IP "-R, --rmargin <The right margin>"
|
.IP "-R, --rmargin <The right margin>"
|
||||||
.RB "Page right margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key \*(lqignoremargins\*(rq is used."
|
.RB "Page right margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found."
|
||||||
.IP "-T, --tmargin <The top margin>"
|
.IP "-T, --tmargin <The top margin>"
|
||||||
.RB "Page top margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key \*(lqignoremargins\*(rq is used."
|
.RB "Page top margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found."
|
||||||
.IP "-B, --bmargin <The bottom margin>"
|
.IP "-B, --bmargin <The bottom margin>"
|
||||||
.RB "Page bottom margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found. Value will be ignored if key \*(lqignoremargins\*(rq is used."
|
.RB "Page bottom margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found."
|
||||||
.IP "-r, --rotate <Angle>"
|
.IP "-r, --rotate <Angle>"
|
||||||
.RB "Rotation in degrees (one of predefined, " "export mode" "). Default value is " "180" ". 0 is no-rotate. Valid values: 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 180. Each value show how many times details will be rotated. For example 180 mean two times (360/180=2) by 180 degree."
|
.RB "Rotation in degrees (one of predefined, " "export mode" "). Default value is " "180" ". 0 is no-rotate. Valid values: 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 180. Each value show how many times details will be rotated. For example 180 mean two times (360/180=2) by 180 degree."
|
||||||
.IP "-c, --crop"
|
.IP "-c, --crop"
|
||||||
|
@ -551,6 +551,39 @@ Run the program in a test mode. The program in this mode loads a single pattern
|
||||||
.RE
|
.RE
|
||||||
.IP "--csvExportFM <Path to csv file>"
|
.IP "--csvExportFM <Path to csv file>"
|
||||||
.RB "Calling this command enable exporting final measurements. Specify path to csv file with final measurements. The path must contain path to directory and name of file. It can be absolute or relatetive. In case of relative path will be used current working directory to calc a destination path."
|
.RB "Calling this command enable exporting final measurements. Specify path to csv file with final measurements. The path must contain path to directory and name of file. It can be absolute or relatetive. In case of relative path will be used current working directory to calc a destination path."
|
||||||
|
.IP "--tiledPageformat <Template number>"
|
||||||
|
.RB "Number corresponding to tiled pdf page template (default = 0, " "export mode with tiled pdf format" "):"
|
||||||
|
.RS
|
||||||
|
.BR "*" " A0 = 0,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " A1 = 1,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " A2 = 2,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " A3 = 3,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " A4 = 4,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " Letter = 5,"
|
||||||
|
.RE
|
||||||
|
.RS
|
||||||
|
.BR "*" " Legal = 6."
|
||||||
|
.RE
|
||||||
|
.IP "--tiledlmargin <The left margin>"
|
||||||
|
.RB "Tiled page left margin in current units like 3.0 (" "export mode" "). If not set will be used default value 1 cm."
|
||||||
|
.IP "--tiledrmargin <The right margin>"
|
||||||
|
.RB "Tiled page right margin in current units like 3.0 (" "export mode" "). If not set will be used default value 1 cm."
|
||||||
|
.IP "--tiledtmargin <The top margin>"
|
||||||
|
.RB "Tiled page top margin in current units like 3.0 (" "export mode" "). If not set will be used value default value 1 cm."
|
||||||
|
.IP "--tiledbmargin <The bottom margin>"
|
||||||
|
.RB "Tiled page bottom margin in current units like 3.0 (" "export mode" "). If not set will be used value default value 1 cm."
|
||||||
|
.IP "--tiledLandscape"
|
||||||
|
.RB "Set tiled page orienatation to landscape (" "export mode" "). Default value if not set portrait."
|
||||||
.IP Arguments:
|
.IP Arguments:
|
||||||
.I filename
|
.I filename
|
||||||
\- a pattern file.
|
\- a pattern file.
|
||||||
|
|
|
@ -141,8 +141,8 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
optionsIndex.insert(LONG_OPTION_PAGETEMPLATE, index++);
|
optionsIndex.insert(LONG_OPTION_PAGETEMPLATE, index++);
|
||||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGETEMPLATE << LONG_OPTION_PAGETEMPLATE,
|
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGETEMPLATE << LONG_OPTION_PAGETEMPLATE,
|
||||||
translate("VCommandLine", "Number corresponding to page template (default = "
|
translate("VCommandLine", "Number corresponding to layout page template "
|
||||||
"0, export mode):") +
|
"(default = 0, export mode):") +
|
||||||
DialogLayoutSettings::MakeHelpTemplateList(),
|
DialogLayoutSettings::MakeHelpTemplateList(),
|
||||||
translate("VCommandLine", "Template number"), "0"));
|
translate("VCommandLine", "Template number"), "0"));
|
||||||
|
|
||||||
|
@ -162,26 +162,24 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_PAGEUNITS, index++);
|
optionsIndex.insert(LONG_OPTION_PAGEUNITS, index++);
|
||||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEUNITS << LONG_OPTION_PAGEUNITS,
|
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEUNITS << LONG_OPTION_PAGEUNITS,
|
||||||
translate("VCommandLine", "Page height/width measure units (cannot be used "
|
translate("VCommandLine",
|
||||||
"with \"%1\", export mode). Valid values: %2.")
|
"Page measure units (export mode). Valid values: %2.")
|
||||||
.arg(LONG_OPTION_PAGETEMPLATE).arg(VDomDocument::UnitsHelpString()),
|
.arg(VDomDocument::UnitsHelpString()),
|
||||||
translate("VCommandLine", "The measure unit")));
|
translate("VCommandLine", "The measure unit")));
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_IGNORE_MARGINS, index++);
|
optionsIndex.insert(LONG_OPTION_IGNORE_MARGINS, index++);
|
||||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_IGNORE_MARGINS << LONG_OPTION_IGNORE_MARGINS,
|
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_IGNORE_MARGINS << LONG_OPTION_IGNORE_MARGINS,
|
||||||
translate("VCommandLine",
|
translate("VCommandLine",
|
||||||
"Ignore margins printing (export mode). Disable value keys: "
|
"Ignore printer margins (export mode). Use if need full paper "
|
||||||
"\"%1\", \"%2\", \"%3\", \"%4\". Set all margins to 0.")
|
"space. In case of later printing you must account for the "
|
||||||
.arg(LONG_OPTION_LEFT_MARGIN).arg(LONG_OPTION_RIGHT_MARGIN)
|
"margins himself.")));
|
||||||
.arg(LONG_OPTION_TOP_MARGIN).arg(LONG_OPTION_BOTTOM_MARGIN)));
|
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_LEFT_MARGIN, index++);
|
optionsIndex.insert(LONG_OPTION_LEFT_MARGIN, index++);
|
||||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_LEFT_MARGIN << LONG_OPTION_LEFT_MARGIN,
|
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_LEFT_MARGIN << LONG_OPTION_LEFT_MARGIN,
|
||||||
translate("VCommandLine",
|
translate("VCommandLine",
|
||||||
"Page left margin in current units like 3.0 (export mode). If "
|
"Page left margin in current units like 3.0 (export mode). If "
|
||||||
"not set will be used value from default printer. Or 0 if none "
|
"not set will be used value from default printer. Or 0 if none "
|
||||||
"printers was found. Value will be ignored if key \"%1\" is used.")
|
"printers was found."),
|
||||||
.arg(LONG_OPTION_IGNORE_MARGINS),
|
|
||||||
("The left margin")));
|
("The left margin")));
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_RIGHT_MARGIN, index++);
|
optionsIndex.insert(LONG_OPTION_RIGHT_MARGIN, index++);
|
||||||
|
@ -189,8 +187,7 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
translate("VCommandLine",
|
translate("VCommandLine",
|
||||||
"Page right margin in current units like 3.0 (export mode). If "
|
"Page right margin in current units like 3.0 (export mode). If "
|
||||||
"not set will be used value from default printer. Or 0 if none "
|
"not set will be used value from default printer. Or 0 if none "
|
||||||
"printers was found. Value will be ignored if key \"%1\" is used.")
|
"printers was found."),
|
||||||
.arg(LONG_OPTION_IGNORE_MARGINS),
|
|
||||||
("The right margin")));
|
("The right margin")));
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_TOP_MARGIN, index++);
|
optionsIndex.insert(LONG_OPTION_TOP_MARGIN, index++);
|
||||||
|
@ -198,8 +195,7 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
translate("VCommandLine",
|
translate("VCommandLine",
|
||||||
"Page top margin in current units like 3.0 (export mode). If "
|
"Page top margin in current units like 3.0 (export mode). If "
|
||||||
"not set will be used value from default printer. Or 0 if none "
|
"not set will be used value from default printer. Or 0 if none "
|
||||||
"printers was found. Value will be ignored if key \"%1\" is used.")
|
"printers was found."),
|
||||||
.arg(LONG_OPTION_IGNORE_MARGINS),
|
|
||||||
("The top margin")));
|
("The top margin")));
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_BOTTOM_MARGIN, index++);
|
optionsIndex.insert(LONG_OPTION_BOTTOM_MARGIN, index++);
|
||||||
|
@ -207,8 +203,7 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
translate("VCommandLine",
|
translate("VCommandLine",
|
||||||
"Page bottom margin in current units like 3.0 (export mode). If "
|
"Page bottom margin in current units like 3.0 (export mode). If "
|
||||||
"not set will be used value from default printer. Or 0 if none "
|
"not set will be used value from default printer. Or 0 if none "
|
||||||
"printers was found. Value will be ignored if key \"%1\" is used.")
|
"printers was found."),
|
||||||
.arg(LONG_OPTION_IGNORE_MARGINS),
|
|
||||||
("The bottom margin")));
|
("The bottom margin")));
|
||||||
|
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
|
@ -320,9 +315,62 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
"relative path will be used current working "
|
"relative path will be used current working "
|
||||||
"directory to calc a destination path."),
|
"directory to calc a destination path."),
|
||||||
translate("VCommandLine", "Path to csv file")));
|
translate("VCommandLine", "Path to csv file")));
|
||||||
|
|
||||||
|
//=================================================================================================================
|
||||||
|
optionsIndex.insert(LONG_OPTION_TILED_PDF_PAGE_TEMPLATE, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
|
||||||
|
translate("VCommandLine", "Number corresponding to tiled pdf page template "
|
||||||
|
"(default = 0, export mode with tiled pdf "
|
||||||
|
"format):") +
|
||||||
|
DialogLayoutSettings::MakeHelpTiledPdfTemplateList(),
|
||||||
|
translate("VCommandLine", "Template number"), "0"));
|
||||||
|
|
||||||
|
optionsIndex.insert(LONG_OPTION_TILED_PDF_LEFT_MARGIN, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TILED_PDF_LEFT_MARGIN,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Tiled page left margin in current units like 3.0 (export mode). "
|
||||||
|
"If not set will be used default value 1 cm."),
|
||||||
|
translate("VCommandLine", "The left margin")));
|
||||||
|
|
||||||
|
optionsIndex.insert(LONG_OPTION_TILED_PDF_RIGHT_MARGIN, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Tiled page right margin in current units like 3.0 (export mode). "
|
||||||
|
"If not set will be used default value 1 cm."),
|
||||||
|
translate("VCommandLine", "The right margin")));
|
||||||
|
|
||||||
|
optionsIndex.insert(LONG_OPTION_TILED_PDF_TOP_MARGIN, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TILED_PDF_TOP_MARGIN,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Tiled page top margin in current units like 3.0 (export mode). If "
|
||||||
|
"not set will be used value default value 1 cm."),
|
||||||
|
translate("VCommandLine", "The top margin")));
|
||||||
|
|
||||||
|
optionsIndex.insert(LONG_OPTION_TILED_PDF_BOTTOM_MARGIN, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Tiled page bottom margin in current units like 3.0 (export mode)."
|
||||||
|
" If not set will be used value default value 1 cm."),
|
||||||
|
translate("VCommandLine", "The bottom margin")));
|
||||||
|
|
||||||
|
optionsIndex.insert(LONG_OPTION_TILED_PDF_LANDSCAPE, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TILED_PDF_LANDSCAPE,
|
||||||
|
translate("VCommandLine", "Set tiled page orienatation to landscape (export "
|
||||||
|
"mode). Default value if not set portrait.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractLayoutDialog::PaperSizeTemplate VCommandLine::FormatSize(const QString &key) const
|
||||||
|
{
|
||||||
|
int ppsize = 0;
|
||||||
|
if (parser.isSet(*optionsUsed.value(optionsIndex.value(key))))
|
||||||
|
{
|
||||||
|
ppsize = parser.value(*optionsUsed.value(optionsIndex.value(key))).toInt();
|
||||||
|
}
|
||||||
|
return static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(ppsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
{
|
{
|
||||||
//this functions covers all options found into layout setup dialog, nothing to add here, unless dialog extended
|
//this functions covers all options found into layout setup dialog, nothing to add here, unless dialog extended
|
||||||
|
@ -338,9 +386,9 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEW)));
|
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEW)));
|
||||||
bool c = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
bool c = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
||||||
|
|
||||||
if ((a || b || c) && x)
|
if ((a || b) && x)
|
||||||
{
|
{
|
||||||
qCritical() << translate("VCommandLine", "Cannot use pageformat and page explicit size/units together.")
|
qCritical() << translate("VCommandLine", "Cannot use pageformat and page explicit size together.")
|
||||||
<< "\n";
|
<< "\n";
|
||||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
||||||
}
|
}
|
||||||
|
@ -378,53 +426,33 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto CheckKey = [this](const QString &key, const QString &message)
|
||||||
{
|
{
|
||||||
//just anonymous namespace ...don' like to have a,b,c,d everywhere defined
|
bool a = parser.isSet(*optionsUsed.value(optionsIndex.value(key)));
|
||||||
bool a = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_LEFT_MARGIN)));
|
|
||||||
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
||||||
|
|
||||||
if ((a || b) && !(a && b))
|
if ((a || b) && !(a && b))
|
||||||
{
|
{
|
||||||
qCritical() << translate("VCommandLine", "Left margin must be used together with page units.") << "\n";
|
qCritical() << message << "\n";
|
||||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
{
|
CheckKey(LONG_OPTION_LEFT_MARGIN, translate("VCommandLine", "Left margin must be used together with page units."));
|
||||||
//just anonymous namespace ...don' like to have a,b,c,d everywhere defined
|
CheckKey(LONG_OPTION_RIGHT_MARGIN,
|
||||||
bool a = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_RIGHT_MARGIN)));
|
translate("VCommandLine", "Right margin must be used together with page units."));
|
||||||
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
CheckKey(LONG_OPTION_TOP_MARGIN, translate("VCommandLine", "Top margin must be used together with page units."));
|
||||||
|
CheckKey(LONG_OPTION_BOTTOM_MARGIN,
|
||||||
|
translate("VCommandLine", "Bottom margin must be used together with page units."));
|
||||||
|
|
||||||
if ((a || b) && !(a && b))
|
CheckKey(LONG_OPTION_TILED_PDF_LEFT_MARGIN,
|
||||||
{
|
translate("VCommandLine", "Tiled left margin must be used together with page units."));
|
||||||
qCritical() << translate("VCommandLine", "Right margin must be used together with page units.") << "\n";
|
CheckKey(LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
|
||||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
translate("VCommandLine", "Tiled right margin must be used together with page units."));
|
||||||
}
|
CheckKey(LONG_OPTION_TILED_PDF_TOP_MARGIN,
|
||||||
}
|
translate("VCommandLine", "Tiled top margin must be used together with page units."));
|
||||||
|
CheckKey(LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
|
||||||
{
|
translate("VCommandLine", "Tiled bottom margin must be used together with page units."));
|
||||||
//just anonymous namespace ...don' like to have a,b,c,d everywhere defined
|
|
||||||
bool a = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_TOP_MARGIN)));
|
|
||||||
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
|
||||||
|
|
||||||
if ((a || b) && !(a && b))
|
|
||||||
{
|
|
||||||
qCritical() << translate("VCommandLine", "Top margin must be used together with page units.") << "\n";
|
|
||||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
//just anonymous namespace ...don' like to have a,b,c,d everywhere defined
|
|
||||||
bool a = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_BOTTOM_MARGIN)));
|
|
||||||
bool b = parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGEUNITS)));
|
|
||||||
|
|
||||||
if ((a || b) && !(a && b))
|
|
||||||
{
|
|
||||||
qCritical() << translate("VCommandLine", "Bottom margin must be used together with page units.") << "\n";
|
|
||||||
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int rotateDegree = OptRotation();
|
const int rotateDegree = OptRotation();
|
||||||
diag.SetRotate(rotateDegree != 0 ); // 0 disable rotation
|
diag.SetRotate(rotateDegree != 0 ); // 0 disable rotation
|
||||||
|
@ -488,8 +516,7 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
{
|
{
|
||||||
diag.SetIgnoreAllFields(true);
|
diag.SetIgnoreAllFields(true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
QMarginsF margins = diag.GetFields();
|
QMarginsF margins = diag.GetFields();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -524,7 +551,6 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diag.SetFields(margins);
|
diag.SetFields(margins);
|
||||||
}
|
|
||||||
|
|
||||||
diag.DialogAccepted(); // filling VLayoutGenerator
|
diag.DialogAccepted(); // filling VLayoutGenerator
|
||||||
|
|
||||||
|
@ -604,14 +630,9 @@ bool VCommandLine::IsExportFMEnabled() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
DialogLayoutSettings::PaperSizeTemplate VCommandLine::OptPaperSize() const
|
VAbstractLayoutDialog::PaperSizeTemplate VCommandLine::OptPaperSize() const
|
||||||
{
|
{
|
||||||
int ppsize = 0;
|
return FormatSize(LONG_OPTION_PAGETEMPLATE);
|
||||||
if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGETEMPLATE))))
|
|
||||||
{
|
|
||||||
ppsize = parser.value(*optionsUsed.value(optionsIndex.value(LONG_OPTION_PAGETEMPLATE))).toInt();
|
|
||||||
}
|
|
||||||
return static_cast<DialogLayoutSettings::PaperSizeTemplate>(ppsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
@ -809,4 +830,72 @@ QString VCommandLine::OptGradationHeight() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMarginsF VCommandLine::TiledPageMargins() const
|
||||||
|
{
|
||||||
|
QMarginsF margins(10, 10, 10, 10); // mm
|
||||||
|
|
||||||
|
const QCommandLineOption *option = optionsUsed.value(optionsIndex.value(LONG_OPTION_LEFT_MARGIN));
|
||||||
|
if (not parser.isSet(*option))
|
||||||
|
{
|
||||||
|
return margins;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString value = parser.value(*option);
|
||||||
|
const QStringList supportedUnits = QStringList() << unitMM << unitCM << unitINCH;
|
||||||
|
if (not supportedUnits.contains(value))
|
||||||
|
{
|
||||||
|
qCritical() << translate("VCommandLine", "Unsupported paper units.") << "\n";
|
||||||
|
const_cast<VCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
|
||||||
|
}
|
||||||
|
const Unit unit = StrToUnits(value);
|
||||||
|
|
||||||
|
{
|
||||||
|
const QCommandLineOption *option = optionsUsed.value(optionsIndex.value(LONG_OPTION_LEFT_MARGIN));
|
||||||
|
if (parser.isSet(*option))
|
||||||
|
{
|
||||||
|
margins.setLeft(UnitConvertor(parser.value(*option).toDouble(), unit, Unit::Mm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QCommandLineOption *option = optionsUsed.value(optionsIndex.value(LONG_OPTION_RIGHT_MARGIN));
|
||||||
|
if (parser.isSet(*option))
|
||||||
|
{
|
||||||
|
margins.setRight(UnitConvertor(parser.value(*option).toDouble(), unit, Unit::Mm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QCommandLineOption *option = optionsUsed.value(optionsIndex.value(LONG_OPTION_TOP_MARGIN));
|
||||||
|
if (parser.isSet(*option))
|
||||||
|
{
|
||||||
|
margins.setTop(UnitConvertor(parser.value(*option).toDouble(), unit, Unit::Mm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QCommandLineOption *option = optionsUsed.value(optionsIndex.value(LONG_OPTION_BOTTOM_MARGIN));
|
||||||
|
if (parser.isSet(*option))
|
||||||
|
{
|
||||||
|
margins.setBottom(UnitConvertor(parser.value(*option).toDouble(), unit, Unit::Mm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return margins;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractLayoutDialog::PaperSizeTemplate VCommandLine::OptTiledPaperSize() const
|
||||||
|
{
|
||||||
|
return FormatSize(LONG_OPTION_TILED_PDF_PAGE_TEMPLATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PageOrientation VCommandLine::OptTiledPageOrientation()
|
||||||
|
{
|
||||||
|
const QString key = LONG_OPTION_TILED_PDF_LANDSCAPE;
|
||||||
|
return static_cast<PageOrientation>(not parser.isSet(*optionsUsed.value(optionsIndex.value(key))));
|
||||||
|
}
|
||||||
|
|
||||||
#undef translate
|
#undef translate
|
||||||
|
|
|
@ -111,12 +111,16 @@ public:
|
||||||
QString OptGradationSize() const;
|
QString OptGradationSize() const;
|
||||||
QString OptGradationHeight() const;
|
QString OptGradationHeight() const;
|
||||||
|
|
||||||
|
QMarginsF TiledPageMargins() const;
|
||||||
|
VAbstractLayoutDialog::PaperSizeTemplate OptTiledPaperSize() const;
|
||||||
|
PageOrientation OptTiledPageOrientation();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
VCommandLine();
|
VCommandLine();
|
||||||
|
|
||||||
//@brief returns DialogLayoutSettings::PaperSizeTemplate
|
//@brief returns VAbstractLayoutDialog::PaperSizeTemplate
|
||||||
DialogLayoutSettings::PaperSizeTemplate OptPaperSize() const;
|
VAbstractLayoutDialog::PaperSizeTemplate OptPaperSize() const;
|
||||||
//@brief returns rotation in degrees or 0 if not set
|
//@brief returns rotation in degrees or 0 if not set
|
||||||
int OptRotation() const;
|
int OptRotation() const;
|
||||||
|
|
||||||
|
@ -141,6 +145,8 @@ private:
|
||||||
static qreal Pg2Px(const QString& src, const DialogLayoutSettings& converter);
|
static qreal Pg2Px(const QString& src, const DialogLayoutSettings& converter);
|
||||||
|
|
||||||
static void InitOptions(VCommandLineOptions &options, QMap<QString, int> &optionsIndex);
|
static void InitOptions(VCommandLineOptions &options, QMap<QString, int> &optionsIndex);
|
||||||
|
|
||||||
|
VAbstractLayoutDialog::PaperSizeTemplate FormatSize(const QString &key) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VCMDEXPORT_H
|
#endif // VCMDEXPORT_H
|
||||||
|
|
|
@ -810,6 +810,27 @@ QString DialogLayoutSettings::MakeHelpTemplateList()
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogLayoutSettings::MakeHelpTiledPdfTemplateList()
|
||||||
|
{
|
||||||
|
QString out = "\n";
|
||||||
|
|
||||||
|
for (int i = 0; i <= static_cast<int>(PaperSizeTemplate::Legal); ++i)
|
||||||
|
{
|
||||||
|
out += "\t* "+VAbstractLayoutDialog::pageFormatNames.at(i)+" = "+ QString::number(i);
|
||||||
|
|
||||||
|
if (i < static_cast<int>(PaperSizeTemplate::Legal))
|
||||||
|
{
|
||||||
|
out += ",\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out += ".\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QSizeF DialogLayoutSettings::Template()
|
QSizeF DialogLayoutSettings::Template()
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
//support functions for the command line parser which uses invisible dialog to properly build layout generator
|
//support functions for the command line parser which uses invisible dialog to properly build layout generator
|
||||||
bool SelectTemplate(const PaperSizeTemplate& id);
|
bool SelectTemplate(const PaperSizeTemplate& id);
|
||||||
static QString MakeHelpTemplateList();
|
static QString MakeHelpTemplateList();
|
||||||
|
static QString MakeHelpTiledPdfTemplateList();
|
||||||
bool SelectPaperUnit(const QString& units);
|
bool SelectPaperUnit(const QString& units);
|
||||||
bool SelectLayoutUnit(const QString& units);
|
bool SelectLayoutUnit(const QString& units);
|
||||||
qreal LayoutToPixels(qreal value) const;
|
qreal LayoutToPixels(qreal value) const;
|
||||||
|
|
|
@ -52,7 +52,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
ui(new Ui::DialogSaveLAyout),
|
ui(new Ui::DialogSaveLAyout),
|
||||||
count(count),
|
count(count),
|
||||||
isInitialized(false),
|
isInitialized(false),
|
||||||
m_mode(mode)
|
m_mode(mode),
|
||||||
|
m_tiledExportMode(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -621,6 +622,83 @@ void DialogSaveLayout::SetTextAsPaths(bool textAsPaths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSaveLayout::SetTiledExportMode(bool tiledExportMode)
|
||||||
|
{
|
||||||
|
m_tiledExportMode = tiledExportMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
|
||||||
|
{
|
||||||
|
// read Margins top, right, bottom, left
|
||||||
|
margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnit());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxLeftField->setValue(margins.left());
|
||||||
|
ui->doubleSpinBoxTopField->setValue(margins.top());
|
||||||
|
ui->doubleSpinBoxRightField->setValue(margins.right());
|
||||||
|
ui->doubleSpinBoxBottomField->setValue(margins.bottom());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMarginsF DialogSaveLayout::GetTiledMargins() const
|
||||||
|
{
|
||||||
|
QMarginsF margins = QMarginsF(
|
||||||
|
ui->doubleSpinBoxLeftField->value(),
|
||||||
|
ui->doubleSpinBoxTopField->value(),
|
||||||
|
ui->doubleSpinBoxRightField->value(),
|
||||||
|
ui->doubleSpinBoxBottomField->value()
|
||||||
|
);
|
||||||
|
|
||||||
|
return UnitConvertor(margins, qApp->patternUnit(), Unit::Mm);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSaveLayout::SetTiledPageFormat(PaperSizeTemplate format)
|
||||||
|
{
|
||||||
|
int index = ui->comboBoxTemplates->findData(static_cast<int>(format));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxTemplates->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractLayoutDialog::PaperSizeTemplate DialogSaveLayout::GetTiledPageFormat() const
|
||||||
|
{
|
||||||
|
if (ui->comboBoxTemplates->currentIndex() != -1)
|
||||||
|
{
|
||||||
|
return static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
|
||||||
|
}
|
||||||
|
return PaperSizeTemplate::A0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSaveLayout::SetTiledPageOrientation(PageOrientation orientation)
|
||||||
|
{
|
||||||
|
if(orientation == PageOrientation::Portrait)
|
||||||
|
{
|
||||||
|
ui->toolButtonPortrait->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->toolButtonLandscape->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PageOrientation DialogSaveLayout::GetTiledPageOrientation() const
|
||||||
|
{
|
||||||
|
if(ui->toolButtonPortrait->isChecked())
|
||||||
|
{
|
||||||
|
return PageOrientation::Portrait;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PageOrientation::Landscape;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSaveLayout::showEvent(QShowEvent *event)
|
void DialogSaveLayout::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -785,7 +863,6 @@ void DialogSaveLayout::ReadSettings()
|
||||||
{
|
{
|
||||||
ui->toolButtonLandscape->setChecked(true);
|
ui->toolButtonLandscape->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -795,6 +872,11 @@ void DialogSaveLayout::ReadSettings()
|
||||||
*/
|
*/
|
||||||
void DialogSaveLayout::WriteSettings() const
|
void DialogSaveLayout::WriteSettings() const
|
||||||
{
|
{
|
||||||
|
if (m_tiledExportMode)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
const Unit unit = qApp->patternUnit();
|
const Unit unit = qApp->patternUnit();
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,17 @@ public:
|
||||||
bool IsTextAsPaths() const;
|
bool IsTextAsPaths() const;
|
||||||
void SetTextAsPaths(bool textAsPaths);
|
void SetTextAsPaths(bool textAsPaths);
|
||||||
|
|
||||||
|
void SetTiledExportMode(bool tiledExportMode);
|
||||||
|
|
||||||
|
void SetTiledMargins(QMarginsF margins);
|
||||||
|
QMarginsF GetTiledMargins() const;
|
||||||
|
|
||||||
|
void SetTiledPageFormat(PaperSizeTemplate format);
|
||||||
|
PaperSizeTemplate GetTiledPageFormat() const;
|
||||||
|
|
||||||
|
void SetTiledPageOrientation(PageOrientation orientation);
|
||||||
|
PageOrientation GetTiledPageOrientation() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||||
void InitTemplates(QComboBox *comboBoxTemplates);
|
void InitTemplates(QComboBox *comboBoxTemplates);
|
||||||
|
@ -125,6 +136,7 @@ private:
|
||||||
int count;
|
int count;
|
||||||
bool isInitialized;
|
bool isInitialized;
|
||||||
Draw m_mode;
|
Draw m_mode;
|
||||||
|
bool m_tiledExportMode;
|
||||||
|
|
||||||
static bool havePdf;
|
static bool havePdf;
|
||||||
static bool tested;
|
static bool tested;
|
||||||
|
|
|
@ -4553,18 +4553,22 @@ void MainWindow::ExportLayoutAs()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DialogSaveLayout dialog(scenes.size(), Draw::Layout, FileName(), this);
|
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(new DialogSaveLayout(scenes.size(), Draw::Layout,
|
||||||
|
FileName(), this));
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Rejected)
|
if (m_dialogSaveLayout->exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
ui->toolButtonLayoutExportAs->setChecked(false);
|
ui->toolButtonLayoutExportAs->setChecked(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportData(QVector<VLayoutPiece>(), dialog);
|
ExportData(QVector<VLayoutPiece>());
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
ui->toolButtonLayoutExportAs->setChecked(false);
|
ui->toolButtonLayoutExportAs->setChecked(false);
|
||||||
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
|
@ -4611,18 +4615,22 @@ void MainWindow::ExportDetailsAs()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DialogSaveLayout dialog(1, Draw::Modeling, FileName(), this);
|
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(new DialogSaveLayout(1, Draw::Modeling, FileName(),
|
||||||
|
this));
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Rejected)
|
if (m_dialogSaveLayout->exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
ui->toolButtonDetailExportAs->setChecked(false);
|
ui->toolButtonDetailExportAs->setChecked(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportData(listDetails, dialog);
|
ExportData(listDetails);
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
ui->toolButtonDetailExportAs->setChecked(false);
|
ui->toolButtonDetailExportAs->setChecked(false);
|
||||||
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
|
@ -4951,16 +4959,27 @@ bool MainWindow::DoExport(const VCommandLinePtr &expParams)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DialogSaveLayout dialog(1, Draw::Modeling, expParams->OptBaseName(), this);
|
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(new DialogSaveLayout(1, Draw::Modeling,
|
||||||
dialog.SetDestinationPath(expParams->OptDestinationPath());
|
expParams->OptBaseName(), this));
|
||||||
dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
|
||||||
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
||||||
dialog.SetTextAsPaths(expParams->IsTextAsPaths());
|
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
||||||
|
m_dialogSaveLayout->SetTextAsPaths(expParams->IsTextAsPaths());
|
||||||
|
|
||||||
ExportData(listDetails, dialog);
|
if (static_cast<LayoutExportFormats>(expParams->OptExportType()) == LayoutExportFormats::PDFTiled)
|
||||||
|
{
|
||||||
|
m_dialogSaveLayout->SetTiledExportMode(true);
|
||||||
|
m_dialogSaveLayout->SetTiledMargins(expParams->TiledPageMargins());
|
||||||
|
m_dialogSaveLayout->SetTiledPageFormat(expParams->OptTiledPaperSize());
|
||||||
|
m_dialogSaveLayout->SetTiledPageOrientation(expParams->OptTiledPageOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportData(listDetails);
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Export error.")), qUtf8Printable(e.ErrorMessage()));
|
qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Export error.")), qUtf8Printable(e.ErrorMessage()));
|
||||||
qApp->exit(V_EX_DATAERR);
|
qApp->exit(V_EX_DATAERR);
|
||||||
return false;
|
return false;
|
||||||
|
@ -4975,15 +4994,27 @@ bool MainWindow::DoExport(const VCommandLinePtr &expParams)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DialogSaveLayout dialog(scenes.size(), Draw::Layout, expParams->OptBaseName(), this);
|
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(new DialogSaveLayout(scenes.size(), Draw::Layout,
|
||||||
dialog.SetDestinationPath(expParams->OptDestinationPath());
|
expParams->OptBaseName(),
|
||||||
dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
this));
|
||||||
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
|
||||||
|
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
||||||
|
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
||||||
|
|
||||||
ExportData(listDetails, dialog);
|
if (static_cast<LayoutExportFormats>(expParams->OptExportType()) == LayoutExportFormats::PDFTiled)
|
||||||
|
{
|
||||||
|
m_dialogSaveLayout->SetTiledExportMode(true);
|
||||||
|
m_dialogSaveLayout->SetTiledMargins(expParams->TiledPageMargins());
|
||||||
|
m_dialogSaveLayout->SetTiledPageFormat(expParams->OptTiledPaperSize());
|
||||||
|
m_dialogSaveLayout->SetTiledPageOrientation(expParams->OptTiledPageOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportData(listDetails);
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
|
m_dialogSaveLayout.clear();
|
||||||
qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
||||||
qUtf8Printable(e.ErrorMessage()));
|
qUtf8Printable(e.ErrorMessage()));
|
||||||
qApp->exit(V_EX_DATAERR);
|
qApp->exit(V_EX_DATAERR);
|
||||||
|
|
|
@ -110,11 +110,11 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
ignorePrinterFields(false),
|
ignorePrinterFields(false),
|
||||||
margins(),
|
margins(),
|
||||||
paperSize(),
|
paperSize(),
|
||||||
|
m_dialogSaveLayout(),
|
||||||
isTiled(false),
|
isTiled(false),
|
||||||
isAutoCrop(false),
|
isAutoCrop(false),
|
||||||
isUnitePages(false),
|
isUnitePages(false),
|
||||||
layoutPrinterName()
|
layoutPrinterName()
|
||||||
|
|
||||||
{
|
{
|
||||||
InitTempLayoutScene();
|
InitTempLayoutScene();
|
||||||
}
|
}
|
||||||
|
@ -254,9 +254,9 @@ void MainWindowsNoGUI::ExportFMeasurementsToCSV()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails, const DialogSaveLayout &dialog)
|
void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails)
|
||||||
{
|
{
|
||||||
const LayoutExportFormats format = dialog.Format();
|
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
||||||
|
|
||||||
if (format == LayoutExportFormats::DXF_AC1006_AAMA ||
|
if (format == LayoutExportFormats::DXF_AC1006_AAMA ||
|
||||||
format == LayoutExportFormats::DXF_AC1009_AAMA ||
|
format == LayoutExportFormats::DXF_AC1009_AAMA ||
|
||||||
|
@ -268,44 +268,45 @@ void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails, cons
|
||||||
format == LayoutExportFormats::DXF_AC1024_AAMA ||
|
format == LayoutExportFormats::DXF_AC1024_AAMA ||
|
||||||
format == LayoutExportFormats::DXF_AC1027_AAMA)
|
format == LayoutExportFormats::DXF_AC1027_AAMA)
|
||||||
{
|
{
|
||||||
if (dialog.Mode() == Draw::Layout)
|
if (m_dialogSaveLayout->Mode() == Draw::Layout)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < detailsOnLayout.size(); ++i)
|
for (int i = 0; i < detailsOnLayout.size(); ++i)
|
||||||
{
|
{
|
||||||
const QString name = dialog.Path() + QLatin1String("/") + dialog.FileName() + QString::number(i+1)
|
const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() +
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(dialog.Format());
|
QString::number(i+1)
|
||||||
|
+ DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
|
||||||
|
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
SCASSERT(paper != nullptr)
|
SCASSERT(paper != nullptr)
|
||||||
|
|
||||||
ExportApparelLayout(dialog, detailsOnLayout.at(i), name, paper->rect().size().toSize());
|
ExportApparelLayout(detailsOnLayout.at(i), name, paper->rect().size().toSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExportDetailsAsApparelLayout(dialog, listDetails);
|
ExportDetailsAsApparelLayout(listDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dialog.Mode() == Draw::Layout)
|
if (m_dialogSaveLayout->Mode() == Draw::Layout)
|
||||||
{
|
{
|
||||||
ExportFlatLayout(dialog, scenes, papers, shadows, details, ignorePrinterFields, margins);
|
ExportFlatLayout(scenes, papers, shadows, details, ignorePrinterFields, margins);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExportDetailsAsFlatLayout(dialog, listDetails);
|
ExportDetailsAsFlatLayout(listDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportFlatLayout(const DialogSaveLayout &dialog, const QList<QGraphicsScene *> &scenes,
|
void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes,
|
||||||
const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
||||||
const QList<QList<QGraphicsItem *> > &details, bool ignorePrinterFields,
|
const QList<QList<QGraphicsItem *> > &details, bool ignorePrinterFields,
|
||||||
const QMarginsF &margins)
|
const QMarginsF &margins)
|
||||||
{
|
{
|
||||||
const QString path = dialog.Path();
|
const QString path = m_dialogSaveLayout->Path();
|
||||||
bool usedNotExistedDir = CreateLayoutPath(path);
|
bool usedNotExistedDir = CreateLayoutPath(path);
|
||||||
if (not usedNotExistedDir)
|
if (not usedNotExistedDir)
|
||||||
{
|
{
|
||||||
|
@ -314,25 +315,24 @@ void MainWindowsNoGUI::ExportFlatLayout(const DialogSaveLayout &dialog, const QL
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetPathLayout(path);
|
qApp->ValentinaSettings()->SetPathLayout(path);
|
||||||
const LayoutExportFormats format = dialog.Format();
|
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
||||||
|
|
||||||
if (format == LayoutExportFormats::PDFTiled && dialog.Mode() == Draw::Layout)
|
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
|
||||||
{
|
{
|
||||||
const QString name = path + QLatin1String("/") + dialog.FileName() + QString::number(1)
|
const QString name = path + QLatin1String("/") + m_dialogSaveLayout->FileName() + QString::number(1)
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(dialog.Format());
|
+ DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
|
||||||
PdfTiledFile(name);
|
PdfTiledFile(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExportScene(dialog, scenes, papers, shadows, details, ignorePrinterFields, margins);
|
ExportScene(scenes, papers, shadows, details, ignorePrinterFields, margins);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveLayoutPath(path, usedNotExistedDir);
|
RemoveLayoutPath(path, usedNotExistedDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const DialogSaveLayout &dialog,
|
void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &listDetails)
|
||||||
const QVector<VLayoutPiece> &listDetails)
|
|
||||||
{
|
{
|
||||||
if (listDetails.isEmpty())
|
if (listDetails.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const DialogSaveLayout &dialog,
|
||||||
QList<QGraphicsItem *> list;
|
QList<QGraphicsItem *> list;
|
||||||
for (int i=0; i < listDetails.count(); ++i)
|
for (int i=0; i < listDetails.count(); ++i)
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = listDetails.at(i).GetItem(dialog.IsTextAsPaths());
|
QGraphicsItem *item = listDetails.at(i).GetItem(m_dialogSaveLayout->IsTextAsPaths());
|
||||||
item->setPos(listDetails.at(i).GetMx(), listDetails.at(i).GetMy());
|
item->setPos(listDetails.at(i).GetMx(), listDetails.at(i).GetMy());
|
||||||
list.append(item);
|
list.append(item);
|
||||||
}
|
}
|
||||||
|
@ -383,17 +383,16 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const DialogSaveLayout &dialog,
|
||||||
|
|
||||||
const bool ignorePrinterFields = false;
|
const bool ignorePrinterFields = false;
|
||||||
const qreal margin = ToPixel(1, Unit::Cm);
|
const qreal margin = ToPixel(1, Unit::Cm);
|
||||||
ExportFlatLayout(dialog, scenes, papers, shadows, details, ignorePrinterFields,
|
ExportFlatLayout(scenes, papers, shadows, details, ignorePrinterFields, QMarginsF(margin, margin, margin, margin));
|
||||||
QMarginsF(margin, margin, margin, margin));
|
|
||||||
|
|
||||||
qDeleteAll(scenes);//Scene will clear all other items
|
qDeleteAll(scenes);//Scene will clear all other items
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportApparelLayout(const DialogSaveLayout &dialog, const QVector<VLayoutPiece> &details,
|
void MainWindowsNoGUI::ExportApparelLayout(const QVector<VLayoutPiece> &details, const QString &name,
|
||||||
const QString &name, const QSize &size) const
|
const QSize &size) const
|
||||||
{
|
{
|
||||||
const QString path = dialog.Path();
|
const QString path = m_dialogSaveLayout->Path();
|
||||||
bool usedNotExistedDir = CreateLayoutPath(path);
|
bool usedNotExistedDir = CreateLayoutPath(path);
|
||||||
if (not usedNotExistedDir)
|
if (not usedNotExistedDir)
|
||||||
{
|
{
|
||||||
|
@ -402,7 +401,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const DialogSaveLayout &dialog, const
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetPathLayout(path);
|
qApp->ValentinaSettings()->SetPathLayout(path);
|
||||||
const LayoutExportFormats format = dialog.Format();
|
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
||||||
|
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
|
@ -418,31 +417,31 @@ void MainWindowsNoGUI::ExportApparelLayout(const DialogSaveLayout &dialog, const
|
||||||
Q_UNREACHABLE(); // For now not supported
|
Q_UNREACHABLE(); // For now not supported
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1006, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1009, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1012, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1014, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1015, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1018, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1021, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1024, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||||
AAMADxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), size, details);
|
AAMADxfFile(name, DRW::AC1027, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
|
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
|
||||||
|
@ -453,8 +452,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const DialogSaveLayout &dialog, const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportDetailsAsApparelLayout(const DialogSaveLayout &dialog,
|
void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDetails)
|
||||||
QVector<VLayoutPiece> listDetails)
|
|
||||||
{
|
{
|
||||||
if (listDetails.isEmpty())
|
if (listDetails.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -466,7 +464,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(const DialogSaveLayout &dial
|
||||||
QList<QGraphicsItem *> list;
|
QList<QGraphicsItem *> list;
|
||||||
for (int i=0; i < listDetails.count(); ++i)
|
for (int i=0; i < listDetails.count(); ++i)
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = listDetails.at(i).GetItem(dialog.IsTextAsPaths());
|
QGraphicsItem *item = listDetails.at(i).GetItem(m_dialogSaveLayout->IsTextAsPaths());
|
||||||
item->setPos(listDetails.at(i).GetMx(), listDetails.at(i).GetMy());
|
item->setPos(listDetails.at(i).GetMx(), listDetails.at(i).GetMy());
|
||||||
list.append(item);
|
list.append(item);
|
||||||
}
|
}
|
||||||
|
@ -499,10 +497,10 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(const DialogSaveLayout &dial
|
||||||
listDetails[i].SetMatrix(moveMatrix);
|
listDetails[i].SetMatrix(moveMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString name = dialog.Path() + QLatin1String("/") + dialog.FileName() + QString::number(1)
|
const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() +
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(dialog.Format());
|
QString::number(1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
|
||||||
|
|
||||||
ExportApparelLayout(dialog, listDetails, name, rect.size());
|
ExportApparelLayout(listDetails, name, rect.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -534,10 +532,19 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
||||||
|
|
||||||
if (isTiled)
|
if (isTiled)
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
PageOrientation orientation;
|
||||||
|
if (not m_dialogSaveLayout.isNull())
|
||||||
|
{
|
||||||
|
orientation = m_dialogSaveLayout->GetTiledPageOrientation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
orientation = qApp->ValentinaSettings()->GetTiledPDFOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
// when isTiled, the landscape tiles have to be rotated, because the pages
|
// when isTiled, the landscape tiles have to be rotated, because the pages
|
||||||
// stay portrait in the pdf
|
// stay portrait in the pdf
|
||||||
if(settings->GetTiledPDFOrientation() == PageOrientation::Landscape)
|
if(orientation == PageOrientation::Landscape)
|
||||||
{
|
{
|
||||||
painter.rotate(-90);
|
painter.rotate(-90);
|
||||||
painter.translate(-ToPixel(printer->pageRect(QPrinter::Millimeter).height(), Unit::Mm), 0);
|
painter.translate(-ToPixel(printer->pageRect(QPrinter::Millimeter).height(), Unit::Mm), 0);
|
||||||
|
@ -551,7 +558,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
||||||
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
*poster += posterazor->Calc(paper->rect().toRect(), i, settings->GetTiledPDFOrientation());
|
*poster += posterazor->Calc(paper->rect().toRect(), i, orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,7 +959,7 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
||||||
|
|
||||||
printer.setOutputFileName(name);
|
printer.setOutputFileName(name);
|
||||||
printer.setResolution(static_cast<int>(PrintDPI));
|
printer.setResolution(static_cast<int>(PrintDPI));
|
||||||
PrintPages( &printer );
|
PrintPages(&printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1287,10 +1294,22 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
|
||||||
bottom = pageMargin.bottom();
|
bottom = pageMargin.bottom();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
QMarginsF pageMargin;
|
||||||
|
PageOrientation orientation;
|
||||||
|
if (not m_dialogSaveLayout.isNull())
|
||||||
|
{
|
||||||
|
pageMargin = m_dialogSaveLayout->GetTiledMargins();
|
||||||
|
orientation = m_dialogSaveLayout->GetTiledPageOrientation();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
QMarginsF pageMargin = QMarginsF(settings->GetTiledPDFMargins(Unit::Mm));
|
pageMargin = QMarginsF(settings->GetTiledPDFMargins(Unit::Mm));
|
||||||
if(settings->GetTiledPDFOrientation() == PageOrientation::Landscape)
|
orientation = settings->GetTiledPDFOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(orientation == PageOrientation::Landscape)
|
||||||
{
|
{
|
||||||
// because when painting we have a -90rotation in landscape modus,
|
// because when painting we have a -90rotation in landscape modus,
|
||||||
// see function PrintPages.
|
// see function PrintPages.
|
||||||
|
@ -1467,7 +1486,7 @@ bool MainWindowsNoGUI::IsPagesFit(const QSizeF &printPaper) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportScene(const DialogSaveLayout &dialog, const QList<QGraphicsScene *> &scenes,
|
void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
||||||
const QList<QList<QGraphicsItem *> > &details, bool ignorePrinterFields,
|
const QList<QList<QGraphicsItem *> > &details, bool ignorePrinterFields,
|
||||||
const QMarginsF &margins) const
|
const QMarginsF &margins) const
|
||||||
|
@ -1477,8 +1496,8 @@ void MainWindowsNoGUI::ExportScene(const DialogSaveLayout &dialog, const QList<Q
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
const QString name = dialog.Path() + QLatin1String("/") + dialog.FileName() + QString::number(i+1)
|
const QString name = m_dialogSaveLayout->Path() + QLatin1String("/") + m_dialogSaveLayout->FileName() +
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(dialog.Format());
|
QString::number(i+1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
|
||||||
QBrush *brush = new QBrush();
|
QBrush *brush = new QBrush();
|
||||||
brush->setColor( QColor( Qt::white ) );
|
brush->setColor( QColor( Qt::white ) );
|
||||||
QGraphicsScene *scene = scenes.at(i);
|
QGraphicsScene *scene = scenes.at(i);
|
||||||
|
@ -1486,7 +1505,7 @@ void MainWindowsNoGUI::ExportScene(const DialogSaveLayout &dialog, const QList<Q
|
||||||
shadows[i]->setVisible(false);
|
shadows[i]->setVisible(false);
|
||||||
paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
|
paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
|
||||||
|
|
||||||
switch (dialog.Format())
|
switch (m_dialogSaveLayout->Format())
|
||||||
{
|
{
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
|
@ -1512,47 +1531,47 @@ void MainWindowsNoGUI::ExportScene(const DialogSaveLayout &dialog, const QList<Q
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1006, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1009, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1012, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1014, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1015, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1018, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1021, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1024, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
FlatDxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), paper, scene, details);
|
FlatDxfFile(name, DRW::AC1027, m_dialogSaveLayout->IsBinaryDXFFormat(), paper, scene, details);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -90,9 +90,11 @@ protected:
|
||||||
QMarginsF margins;
|
QMarginsF margins;
|
||||||
QSizeF paperSize;
|
QSizeF paperSize;
|
||||||
|
|
||||||
|
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout;
|
||||||
|
|
||||||
static QVector<VLayoutPiece> PrepareDetailsForLayout(const QHash<quint32, VPiece> &details);
|
static QVector<VLayoutPiece> PrepareDetailsForLayout(const QHash<quint32, VPiece> &details);
|
||||||
|
|
||||||
void ExportData(const QVector<VLayoutPiece> &listDetails, const DialogSaveLayout &dialog);
|
void ExportData(const QVector<VLayoutPiece> &listDetails);
|
||||||
|
|
||||||
void InitTempLayoutScene();
|
void InitTempLayoutScene();
|
||||||
virtual void CleanLayout()=0;
|
virtual void CleanLayout()=0;
|
||||||
|
@ -156,26 +158,23 @@ private:
|
||||||
bool isPagesUniform() const;
|
bool isPagesUniform() const;
|
||||||
bool IsPagesFit(const QSizeF &printPaper) const;
|
bool IsPagesFit(const QSizeF &printPaper) const;
|
||||||
|
|
||||||
void ExportScene(const DialogSaveLayout &dialog,
|
void ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
const QList<QGraphicsScene *> &scenes,
|
|
||||||
const QList<QGraphicsItem *> &papers,
|
const QList<QGraphicsItem *> &papers,
|
||||||
const QList<QGraphicsItem *> &shadows,
|
const QList<QGraphicsItem *> &shadows,
|
||||||
const QList<QList<QGraphicsItem *> > &details,
|
const QList<QList<QGraphicsItem *> > &details,
|
||||||
bool ignorePrinterFields, const QMarginsF &margins) const;
|
bool ignorePrinterFields, const QMarginsF &margins) const;
|
||||||
|
|
||||||
void ExportApparelLayout(const DialogSaveLayout &dialog, const QVector<VLayoutPiece> &details, const QString &name,
|
void ExportApparelLayout(const QVector<VLayoutPiece> &details, const QString &name, const QSize &size) const;
|
||||||
const QSize &size) const;
|
|
||||||
|
|
||||||
void ExportDetailsAsApparelLayout(const DialogSaveLayout &dialog, QVector<VLayoutPiece> listDetails);
|
void ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDetails);
|
||||||
|
|
||||||
void ExportFlatLayout(const DialogSaveLayout &dialog,
|
void ExportFlatLayout(const QList<QGraphicsScene *> &scenes,
|
||||||
const QList<QGraphicsScene *> &scenes,
|
|
||||||
const QList<QGraphicsItem *> &papers,
|
const QList<QGraphicsItem *> &papers,
|
||||||
const QList<QGraphicsItem *> &shadows,
|
const QList<QGraphicsItem *> &shadows,
|
||||||
const QList<QList<QGraphicsItem *> > &details,
|
const QList<QList<QGraphicsItem *> > &details,
|
||||||
bool ignorePrinterFields, const QMarginsF &margins);
|
bool ignorePrinterFields, const QMarginsF &margins);
|
||||||
|
|
||||||
void ExportDetailsAsFlatLayout(const DialogSaveLayout &dialog, const QVector<VLayoutPiece> &listDetails);
|
void ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &listDetails);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOWSNOGUI_H
|
#endif // MAINWINDOWSNOGUI_H
|
||||||
|
|
|
@ -116,6 +116,13 @@ const QString LONG_OPTION_CSVCODEC = QStringLiteral("csvCodec");
|
||||||
const QString LONG_OPTION_CSVSEPARATOR = QStringLiteral("csvSeparator");
|
const QString LONG_OPTION_CSVSEPARATOR = QStringLiteral("csvSeparator");
|
||||||
const QString LONG_OPTION_CSVEXPORTFM = QStringLiteral("csvExportFM");
|
const QString LONG_OPTION_CSVEXPORTFM = QStringLiteral("csvExportFM");
|
||||||
|
|
||||||
|
const QString LONG_OPTION_TILED_PDF_PAGE_TEMPLATE = QStringLiteral("tiledPageformat");
|
||||||
|
const QString LONG_OPTION_TILED_PDF_LEFT_MARGIN = QStringLiteral("tiledlmargin");
|
||||||
|
const QString LONG_OPTION_TILED_PDF_RIGHT_MARGIN = QStringLiteral("tiledrmargin");
|
||||||
|
const QString LONG_OPTION_TILED_PDF_TOP_MARGIN = QStringLiteral("tiledtmargin");
|
||||||
|
const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN = QStringLiteral("tiledbmargin");
|
||||||
|
const QString LONG_OPTION_TILED_PDF_LANDSCAPE = QStringLiteral("tiledLandscape");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList AllKeys()
|
QStringList AllKeys()
|
||||||
{
|
{
|
||||||
|
@ -152,7 +159,13 @@ QStringList AllKeys()
|
||||||
<< LONG_OPTION_CSVWITHHEADER
|
<< LONG_OPTION_CSVWITHHEADER
|
||||||
<< LONG_OPTION_CSVCODEC
|
<< LONG_OPTION_CSVCODEC
|
||||||
<< LONG_OPTION_CSVSEPARATOR
|
<< LONG_OPTION_CSVSEPARATOR
|
||||||
<< LONG_OPTION_CSVEXPORTFM;
|
<< LONG_OPTION_CSVEXPORTFM
|
||||||
|
<< LONG_OPTION_TILED_PDF_PAGE_TEMPLATE
|
||||||
|
<< LONG_OPTION_TILED_PDF_LEFT_MARGIN
|
||||||
|
<< LONG_OPTION_TILED_PDF_RIGHT_MARGIN
|
||||||
|
<< LONG_OPTION_TILED_PDF_TOP_MARGIN
|
||||||
|
<< LONG_OPTION_TILED_PDF_BOTTOM_MARGIN
|
||||||
|
<< LONG_OPTION_TILED_PDF_LANDSCAPE;
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,13 @@ extern const QString LONG_OPTION_CSVCODEC;
|
||||||
extern const QString LONG_OPTION_CSVSEPARATOR;
|
extern const QString LONG_OPTION_CSVSEPARATOR;
|
||||||
extern const QString LONG_OPTION_CSVEXPORTFM;
|
extern const QString LONG_OPTION_CSVEXPORTFM;
|
||||||
|
|
||||||
|
extern const QString LONG_OPTION_TILED_PDF_PAGE_TEMPLATE;
|
||||||
|
extern const QString LONG_OPTION_TILED_PDF_LEFT_MARGIN;
|
||||||
|
extern const QString LONG_OPTION_TILED_PDF_RIGHT_MARGIN;
|
||||||
|
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;
|
||||||
|
|
||||||
QStringList AllKeys();
|
QStringList AllKeys();
|
||||||
|
|
||||||
#endif // COMMANDOPTIONS_H
|
#endif // COMMANDOPTIONS_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user