Fix export bug. In command line mode Valentina ignored option "in Layout" for

all pieces.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-09-22 15:37:03 +03:00
parent 29972118ff
commit a5c9ba6c4d

View File

@ -4799,17 +4799,38 @@ void MainWindow::ZoomFirstShow()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::DoExport(const VCommandLinePtr &expParams) void MainWindow::DoExport(const VCommandLinePtr &expParams)
{ {
const QHash<quint32, VPiece> *details = pattern->DataPieces(); QHash<quint32, VPiece> details;
if(not qApp->getOpeningPattern()) if(not qApp->getOpeningPattern())
{ {
if (details->count() == 0) const QHash<quint32, VPiece> *allDetails = pattern->DataPieces();
if (allDetails->count() == 0)
{ {
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("You can't export empty scene."))); qCCritical(vMainWindow, "%s", qUtf8Printable(tr("You can't export empty scene.")));
qApp->exit(V_EX_DATAERR); qApp->exit(V_EX_DATAERR);
return; return;
} }
else
{
QHash<quint32, VPiece>::const_iterator i = allDetails->constBegin();
while (i != allDetails->constEnd())
{
if (i.value().IsInLayout())
{
details.insert(i.key(), i.value());
} }
listDetails = PrepareDetailsForLayout(*details); ++i;
}
if (details.count() == 0)
{
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("You can't export empty scene. Please, "
"include at least one detail in layout.")));
qApp->exit(V_EX_DATAERR);
return;
}
}
}
listDetails = PrepareDetailsForLayout(details);
const bool exportOnlyDetails = expParams->IsExportOnlyDetails(); const bool exportOnlyDetails = expParams->IsExportOnlyDetails();
if (exportOnlyDetails) if (exportOnlyDetails)