Resolved issue #660. New export: Export details without layout.
--HG-- branch : develop
This commit is contained in:
parent
b4622341b6
commit
7d205d7596
|
@ -10,6 +10,7 @@
|
||||||
- [#630] Improve export: upgrade to DXF r14 format.
|
- [#630] Improve export: upgrade to DXF r14 format.
|
||||||
- [#669] Improve export: export labels as text in DXF.
|
- [#669] Improve export: export labels as text in DXF.
|
||||||
- [#716] Command line option to create *tiled* export.
|
- [#716] Command line option to create *tiled* export.
|
||||||
|
- [#660] New export: Export details without layout.
|
||||||
|
|
||||||
# Version 0.5.1
|
# Version 0.5.1
|
||||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||||
|
|
2
dist/debian/valentina.1
vendored
2
dist/debian/valentina.1
vendored
|
@ -77,6 +77,8 @@ The path to output destination folder. By default the directory at which the app
|
||||||
.RB "Export dxf in binary form."
|
.RB "Export dxf in binary form."
|
||||||
.IP "--text2paths"
|
.IP "--text2paths"
|
||||||
.RB "Export text as paths."
|
.RB "Export text as paths."
|
||||||
|
.IP "--exportOnlyDetails"
|
||||||
|
.RB "Export only details. Export details as they positioned in the details mode. Any layout related options will be ignored."
|
||||||
.IP "-x, --gsize <The size value>"
|
.IP "-x, --gsize <The size value>"
|
||||||
.RB "Set size value a pattern file, that was opened with standard measurements " "(export mode)" ". Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm."
|
.RB "Set size value a pattern file, that was opened with standard measurements " "(export mode)" ". Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm."
|
||||||
.IP "-e, --gheight <The height value>"
|
.IP "-e, --gheight <The height value>"
|
||||||
|
|
|
@ -108,6 +108,12 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
||||||
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TEXT2PATHS,
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_TEXT2PATHS,
|
||||||
translate("VCommandLine", "Export text as paths.")));
|
translate("VCommandLine", "Export text as paths.")));
|
||||||
|
|
||||||
|
optionsIndex.insert(LONG_OPTION_EXPORTONLYDETAILS, index++);
|
||||||
|
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_EXPORTONLYDETAILS,
|
||||||
|
translate("VCommandLine", "Export only details. Export details as they "
|
||||||
|
"positioned in the details mode. Any layout related"
|
||||||
|
" options will be ignored.")));
|
||||||
|
|
||||||
optionsIndex.insert(LONG_OPTION_GRADATIONSIZE, index++);
|
optionsIndex.insert(LONG_OPTION_GRADATIONSIZE, index++);
|
||||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
|
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
|
||||||
translate("VCommandLine", "Set size value a pattern file, that was opened "
|
translate("VCommandLine", "Set size value a pattern file, that was opened "
|
||||||
|
@ -637,6 +643,12 @@ int VCommandLine::IsTextAsPaths() const
|
||||||
return parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_TEXT2PATHS)));
|
return parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_TEXT2PATHS)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VCommandLine::IsExportOnlyDetails() const
|
||||||
|
{
|
||||||
|
return parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_EXPORTONLYDETAILS)));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VCommandLine::OptInputFileNames() const
|
QStringList VCommandLine::OptInputFileNames() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
|
|
||||||
int IsBinaryDXF() const;
|
int IsBinaryDXF() const;
|
||||||
int IsTextAsPaths() const;
|
int IsTextAsPaths() const;
|
||||||
|
int IsExportOnlyDetails() const;
|
||||||
|
|
||||||
//generator creation is moved here ... because most options are for it only, so no need to create extra getters...
|
//generator creation is moved here ... because most options are for it only, so no need to create extra getters...
|
||||||
//@brief creates VLayoutGenerator
|
//@brief creates VLayoutGenerator
|
||||||
|
|
|
@ -46,11 +46,12 @@ bool DialogSaveLayout::havePdf = false;
|
||||||
bool DialogSaveLayout::tested = false;
|
bool DialogSaveLayout::tested = false;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *parent)
|
DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogSaveLAyout),
|
ui(new Ui::DialogSaveLAyout),
|
||||||
count(count),
|
count(count),
|
||||||
isInitialized(false)
|
isInitialized(false),
|
||||||
|
m_mode(mode)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -88,12 +89,18 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
||||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||||
}
|
}
|
||||||
#ifdef V_NO_ASSERT // Temporarily unavailable
|
#ifdef V_NO_ASSERT // Temporarily unavailable
|
||||||
const int index = ui->comboBoxFormat->findData(static_cast<int>(LayoutExportFormats::OBJ));
|
RemoveFormatFromList(LayoutExportFormats::OBJ);
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
ui->comboBoxFormat->removeItem(index);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (m_mode != Draw::Layout)
|
||||||
|
{
|
||||||
|
RemoveFormatFromList(LayoutExportFormats::PDFTiled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->checkBoxTextAsPaths->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
||||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
||||||
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
|
@ -278,6 +285,12 @@ void DialogSaveLayout::SetDestinationPath(const QString &cmdDestinationPath)
|
||||||
ui->lineEditPath->setText(path);
|
ui->lineEditPath->setText(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Draw DialogSaveLayout::Mode() const
|
||||||
|
{
|
||||||
|
return m_mode;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
|
QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
|
||||||
{
|
{
|
||||||
|
@ -534,6 +547,25 @@ void DialogSaveLayout::ShowExample()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogSaveLayout::IsTextAsPaths() const
|
||||||
|
{
|
||||||
|
return ui->checkBoxTextAsPaths->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSaveLayout::SetTextAsPaths(bool textAsPaths)
|
||||||
|
{
|
||||||
|
if (m_mode != Draw::Layout)
|
||||||
|
{
|
||||||
|
ui->checkBoxTextAsPaths->setChecked(textAsPaths);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->checkBoxTextAsPaths->setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSaveLayout::showEvent(QShowEvent *event)
|
void DialogSaveLayout::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -640,3 +672,13 @@ QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats(
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSaveLayout::RemoveFormatFromList(LayoutExportFormats format)
|
||||||
|
{
|
||||||
|
const int index = ui->comboBoxFormat->findData(static_cast<int>(format));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxFormat->removeItem(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define DIALOGSAVELAYOUT_H
|
#define DIALOGSAVELAYOUT_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# define PDFTOPS "pdftops.exe"
|
# define PDFTOPS "pdftops.exe"
|
||||||
|
@ -86,7 +87,8 @@ class DialogSaveLayout : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogSaveLayout(int count, const QString &fileName = QString(), QWidget *parent = nullptr);
|
explicit DialogSaveLayout(int count, Draw mode = Draw::Layout, const QString &fileName = QString(),
|
||||||
|
QWidget *parent = nullptr);
|
||||||
virtual ~DialogSaveLayout();
|
virtual ~DialogSaveLayout();
|
||||||
|
|
||||||
QString Path() const;
|
QString Path() const;
|
||||||
|
@ -101,8 +103,14 @@ public:
|
||||||
static QString MakeHelpFormatList();
|
static QString MakeHelpFormatList();
|
||||||
void SetDestinationPath(const QString& cmdDestinationPath);
|
void SetDestinationPath(const QString& cmdDestinationPath);
|
||||||
|
|
||||||
|
Draw Mode() const;
|
||||||
|
|
||||||
static QString ExportFormatDescription(LayoutExportFormats format);
|
static QString ExportFormatDescription(LayoutExportFormats format);
|
||||||
static QString ExportFromatSuffix(LayoutExportFormats format);
|
static QString ExportFromatSuffix(LayoutExportFormats format);
|
||||||
|
|
||||||
|
bool IsTextAsPaths() const;
|
||||||
|
void SetTextAsPaths(bool textAsPaths);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -114,11 +122,15 @@ private:
|
||||||
Ui::DialogSaveLAyout *ui;
|
Ui::DialogSaveLAyout *ui;
|
||||||
int count;
|
int count;
|
||||||
bool isInitialized;
|
bool isInitialized;
|
||||||
|
Draw m_mode;
|
||||||
|
|
||||||
static bool havePdf;
|
static bool havePdf;
|
||||||
static bool tested;
|
static bool tested;
|
||||||
static bool SupportPSTest();
|
static bool SupportPSTest();
|
||||||
static bool TestPdf();
|
static bool TestPdf();
|
||||||
static QVector<std::pair<QString, LayoutExportFormats> > InitFormats();
|
static QVector<std::pair<QString, LayoutExportFormats> > InitFormats();
|
||||||
|
|
||||||
|
void RemoveFormatFromList(LayoutExportFormats format);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGSAVELAYOUT_H
|
#endif // DIALOGSAVELAYOUT_H
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>748</width>
|
<width>748</width>
|
||||||
<height>178</height>
|
<height>206</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -92,14 +92,31 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBoxBinaryDXF">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Binary form</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>File name:</string>
|
<string>File name:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEditFileName">
|
<widget class="QLineEdit" name="lineEditFileName">
|
||||||
|
@ -135,20 +152,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QCheckBox" name="checkBoxTextAsPaths">
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QCheckBox" name="checkBoxBinaryDXF">
|
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Binary form</string>
|
<string>Text as paths</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -1947,6 +1947,7 @@ void MainWindow::InitToolButtons()
|
||||||
connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove);
|
connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove);
|
||||||
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
|
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
|
||||||
connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs);
|
connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs);
|
||||||
|
connect(ui->toolButtonDetailExportAs, &QToolButton::clicked, this, &MainWindow::ExportDetailsAs);
|
||||||
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
|
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
|
||||||
connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin);
|
connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin);
|
||||||
connect(ui->toolButtonInsertNode, &QToolButton::clicked, this, &MainWindow::ToolInsertNode);
|
connect(ui->toolButtonInsertNode, &QToolButton::clicked, this, &MainWindow::ToolInsertNode);
|
||||||
|
@ -2461,7 +2462,7 @@ void MainWindow::ActionLayout(bool checked)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PrepareDetailsForLayout(&details);
|
listDetails = PrepareDetailsForLayout(details);
|
||||||
}
|
}
|
||||||
catch (VException &e)
|
catch (VException &e)
|
||||||
{
|
{
|
||||||
|
@ -3329,6 +3330,7 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
|
|
||||||
//Modeling Tools
|
//Modeling Tools
|
||||||
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
||||||
|
ui->toolButtonDetailExportAs->setEnabled(modelingTools);
|
||||||
|
|
||||||
//Layout tools
|
//Layout tools
|
||||||
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
|
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
|
||||||
|
@ -4389,7 +4391,7 @@ void MainWindow::ExportLayoutAs()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DialogSaveLayout dialog(scenes.size(), FileName(), this);
|
DialogSaveLayout dialog(scenes.size(), Draw::Layout, FileName(), this);
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Rejected)
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
|
@ -4397,7 +4399,7 @@ void MainWindow::ExportLayoutAs()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportLayout(dialog);
|
ExportLayout(dialog, scenes, papers, shadows, ignorePrinterFields, margins);
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
|
@ -4409,6 +4411,64 @@ void MainWindow::ExportLayoutAs()
|
||||||
ui->toolButtonLayoutExportAs->setChecked(false);
|
ui->toolButtonLayoutExportAs->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ExportDetailsAs()
|
||||||
|
{
|
||||||
|
const QHash<quint32, VPiece> *allDetails = pattern->DataPieces();
|
||||||
|
QHash<quint32, VPiece>::const_iterator i = allDetails->constBegin();
|
||||||
|
QHash<quint32, VPiece> detailsInLayout;
|
||||||
|
while (i != allDetails->constEnd())
|
||||||
|
{
|
||||||
|
if (i.value().IsInLayout())
|
||||||
|
{
|
||||||
|
detailsInLayout.insert(i.key(), i.value());
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (detailsInLayout.count() == 0)
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("Layout mode"), tr("You don't have enough details to export. Please, "
|
||||||
|
"include at least one detail in layout."),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<VLayoutPiece> listDetails;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
listDetails = PrepareDetailsForLayout(detailsInLayout);
|
||||||
|
}
|
||||||
|
catch (VException &e)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Export details"),
|
||||||
|
tr("Can't export details.") + QLatin1String(" \n") + e.ErrorMessage(),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DialogSaveLayout dialog(1, Draw::Modeling, FileName(), this);
|
||||||
|
|
||||||
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
|
{
|
||||||
|
ui->toolButtonDetailExportAs->setChecked(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportData(listDetails, dialog);
|
||||||
|
}
|
||||||
|
catch (const VException &e)
|
||||||
|
{
|
||||||
|
ui->toolButtonDetailExportAs->setChecked(false);
|
||||||
|
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Export error.")),
|
||||||
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ui->toolButtonDetailExportAs->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
||||||
{
|
{
|
||||||
|
@ -4686,8 +4746,30 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PrepareDetailsForLayout(details);
|
listDetails = PrepareDetailsForLayout(*details);
|
||||||
|
|
||||||
|
const bool exportOnlyDetails = expParams->IsExportOnlyDetails();
|
||||||
|
if (exportOnlyDetails)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DialogSaveLayout dialog(1, Draw::Modeling, expParams->OptBaseName(), this);
|
||||||
|
dialog.SetDestinationPath(expParams->OptDestinationPath());
|
||||||
|
dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
||||||
|
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
||||||
|
dialog.SetTextAsPaths(expParams->IsTextAsPaths());
|
||||||
|
|
||||||
|
ExportData(listDetails, dialog);
|
||||||
|
}
|
||||||
|
catch (const VException &e)
|
||||||
|
{
|
||||||
|
qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Export error.")), qUtf8Printable(e.ErrorMessage()));
|
||||||
|
qApp->exit(V_EX_DATAERR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
auto settings = expParams->DefaultGenerator();
|
auto settings = expParams->DefaultGenerator();
|
||||||
settings->SetTestAsPaths(expParams->IsTextAsPaths());
|
settings->SetTestAsPaths(expParams->IsTextAsPaths());
|
||||||
|
|
||||||
|
@ -4695,11 +4777,12 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DialogSaveLayout dialog(scenes.size(), expParams->OptBaseName(), this);
|
DialogSaveLayout dialog(scenes.size(), Draw::Layout, expParams->OptBaseName(), this);
|
||||||
dialog.SetDestinationPath(expParams->OptDestinationPath());
|
dialog.SetDestinationPath(expParams->OptDestinationPath());
|
||||||
dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
||||||
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
||||||
ExportLayout(dialog);
|
|
||||||
|
ExportData(listDetails, dialog);
|
||||||
}
|
}
|
||||||
catch (const VException &e)
|
catch (const VException &e)
|
||||||
{
|
{
|
||||||
|
@ -4712,6 +4795,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qApp->exit(V_EX_OK);
|
qApp->exit(V_EX_OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,7 @@ private slots:
|
||||||
void CreateMeasurements();
|
void CreateMeasurements();
|
||||||
#endif
|
#endif
|
||||||
void ExportLayoutAs();
|
void ExportLayoutAs();
|
||||||
|
void ExportDetailsAs();
|
||||||
|
|
||||||
void ArrowTool();
|
void ArrowTool();
|
||||||
void ToolEndLine(bool checked);
|
void ToolEndLine(bool checked);
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Tools</string>
|
<string>Export details skiping the Layout stage</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>5</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -1504,6 +1504,29 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QToolButton" name="toolButtonDetailExportAs">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/export_to_picture_document.png</normaloff>:/icon/32x32/export_to_picture_document.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutPage">
|
<widget class="QWidget" name="layoutPage">
|
||||||
|
@ -2655,8 +2678,8 @@
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
|
||||||
<include location="share/resources/toolicon.qrc"/>
|
<include location="share/resources/toolicon.qrc"/>
|
||||||
|
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -149,8 +149,8 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
|
||||||
CleanLayout();
|
CleanLayout();
|
||||||
papers = lGenerator.GetPapersItems();// Blank sheets
|
papers = lGenerator.GetPapersItems();// Blank sheets
|
||||||
details = lGenerator.GetAllDetails();// All details
|
details = lGenerator.GetAllDetails();// All details
|
||||||
CreateShadows();
|
shadows = CreateShadows(papers);
|
||||||
CreateScenes();
|
scenes = CreateScenes(papers, shadows, details);
|
||||||
PrepareSceneList();
|
PrepareSceneList();
|
||||||
ignorePrinterFields = not lGenerator.IsUsePrinterFields();
|
ignorePrinterFields = not lGenerator.IsUsePrinterFields();
|
||||||
margins = lGenerator.GetPrinterFields();
|
margins = lGenerator.GetPrinterFields();
|
||||||
|
@ -199,7 +199,48 @@ void MainWindowsNoGUI::ErrorConsoleMode(const LayoutErrors &state)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails, const DialogSaveLayout &dialog)
|
||||||
|
{
|
||||||
|
if (dialog.Mode() == Draw::Layout)
|
||||||
|
{
|
||||||
|
ExportLayout(dialog, scenes, papers, shadows, ignorePrinterFields, margins);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> list;
|
||||||
|
for (int i=0; i < listDetails.count(); ++i)
|
||||||
|
{
|
||||||
|
list.append(listDetails.at(i).GetItem(dialog.IsTextAsPaths()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
scene->addItem(list.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> papers;// Blank sheets
|
||||||
|
papers.append(new QGraphicsRectItem(scene->itemsBoundingRect().toRect()));
|
||||||
|
|
||||||
|
QList<QList<QGraphicsItem *> > details;// All details
|
||||||
|
details.append(list);
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> shadows = CreateShadows(papers);
|
||||||
|
QList<QGraphicsScene *> scenes = CreateScenes(papers, shadows, details);
|
||||||
|
|
||||||
|
const bool ignorePrinterFields = false;
|
||||||
|
const qreal margin = ToPixel(2, Unit::Mm);
|
||||||
|
ExportLayout(dialog, scenes, papers, shadows, ignorePrinterFields, QMarginsF(margin, margin, margin, margin));
|
||||||
|
|
||||||
|
qDeleteAll(scenes);//Scene will clear all other items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog, const QList<QGraphicsScene *> &scenes,
|
||||||
|
const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
||||||
|
bool ignorePrinterFields, const QMarginsF &margins)
|
||||||
{
|
{
|
||||||
const QString path = dialog.Path();
|
const QString path = dialog.Path();
|
||||||
bool usedNotExistedDir = false;
|
bool usedNotExistedDir = false;
|
||||||
|
@ -218,7 +259,7 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||||
const QString mask = dialog.FileName();
|
const QString mask = dialog.FileName();
|
||||||
const LayoutExportFormats format = dialog.Format();
|
const LayoutExportFormats format = dialog.Format();
|
||||||
|
|
||||||
if (format == LayoutExportFormats::PDFTiled)
|
if (format == LayoutExportFormats::PDFTiled && dialog.Mode() == Draw::Layout)
|
||||||
{
|
{
|
||||||
const QString name = path + QLatin1String("/") + mask + QString::number(1)
|
const QString name = path + QLatin1String("/") + mask + QString::number(1)
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(format);
|
+ DialogSaveLayout::ExportFromatSuffix(format);
|
||||||
|
@ -235,7 +276,8 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||||
+ DialogSaveLayout::ExportFromatSuffix(format);
|
+ DialogSaveLayout::ExportFromatSuffix(format);
|
||||||
QBrush *brush = new QBrush();
|
QBrush *brush = new QBrush();
|
||||||
brush->setColor( QColor( Qt::white ) );
|
brush->setColor( QColor( Qt::white ) );
|
||||||
scenes[i]->setBackgroundBrush( *brush );
|
QGraphicsScene *scene = scenes.at(i);
|
||||||
|
scene->setBackgroundBrush( *brush );
|
||||||
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));
|
||||||
|
|
||||||
|
@ -264,69 +306,69 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
SvgFile(name, i);
|
SvgFile(name, paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
PdfFile(name, i);
|
PdfFile(name, paper, scene, ignorePrinterFields, margins);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
PngFile(name, i);
|
PngFile(name, paper, scene);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::OBJ:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
ObjFile(name, i);
|
ObjFile(name, paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
PsFile(name, i);
|
PsFile(name, paper, scene, ignorePrinterFields, margins);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::EPS:
|
||||||
EpsFile(name, i);
|
EpsFile(name, paper, scene, ignorePrinterFields, margins);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
DxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), i);
|
DxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), paper, scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -561,17 +603,13 @@ void MainWindowsNoGUI::RefreshDetailsLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> *details)
|
QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> &details)
|
||||||
{
|
{
|
||||||
listDetails.clear();
|
QVector<VLayoutPiece> listDetails;
|
||||||
SCASSERT(details != nullptr)
|
if (not details.isEmpty())
|
||||||
if (details->count() == 0)
|
|
||||||
{
|
{
|
||||||
return;
|
QHash<quint32, VPiece>::const_iterator i = details.constBegin();
|
||||||
}
|
while (i != details.constEnd())
|
||||||
|
|
||||||
QHash<quint32, VPiece>::const_iterator i = details->constBegin();
|
|
||||||
while (i != details->constEnd())
|
|
||||||
{
|
{
|
||||||
VAbstractTool *tool = qobject_cast<VAbstractTool*>(VAbstractPattern::getTool(i.key()));
|
VAbstractTool *tool = qobject_cast<VAbstractTool*>(VAbstractPattern::getTool(i.key()));
|
||||||
SCASSERT(tool != nullptr)
|
SCASSERT(tool != nullptr)
|
||||||
|
@ -580,6 +618,9 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> *det
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return listDetails;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::InitTempLayoutScene()
|
void MainWindowsNoGUI::InitTempLayoutScene()
|
||||||
{
|
{
|
||||||
|
@ -623,8 +664,10 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::CreateShadows()
|
QList<QGraphicsItem *> MainWindowsNoGUI::CreateShadows(const QList<QGraphicsItem *> &papers)
|
||||||
{
|
{
|
||||||
|
QList<QGraphicsItem *> shadows;
|
||||||
|
|
||||||
for (int i=0; i< papers.size(); ++i)
|
for (int i=0; i< papers.size(); ++i)
|
||||||
{
|
{
|
||||||
qreal x1=0, y1=0, x2=0, y2=0;
|
qreal x1=0, y1=0, x2=0, y2=0;
|
||||||
|
@ -641,11 +684,16 @@ void MainWindowsNoGUI::CreateShadows()
|
||||||
shadows.append(nullptr);
|
shadows.append(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return shadows;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::CreateScenes()
|
QList<QGraphicsScene *> MainWindowsNoGUI::CreateScenes(const QList<QGraphicsItem *> &papers,
|
||||||
|
const QList<QGraphicsItem *> &shadows,
|
||||||
|
const QList<QList<QGraphicsItem *> > &details)
|
||||||
{
|
{
|
||||||
|
QList<QGraphicsScene *> scenes;
|
||||||
for (int i=0; i<papers.size(); ++i)
|
for (int i=0; i<papers.size(); ++i)
|
||||||
{
|
{
|
||||||
QGraphicsScene *scene = new VMainGraphicsScene();
|
QGraphicsScene *scene = new VMainGraphicsScene();
|
||||||
|
@ -661,6 +709,8 @@ void MainWindowsNoGUI::CreateScenes()
|
||||||
|
|
||||||
scenes.append(scene);
|
scenes.append(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return scenes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -668,16 +718,13 @@ void MainWindowsNoGUI::CreateScenes()
|
||||||
* @brief SvgFile save layout to svg file.
|
* @brief SvgFile save layout to svg file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void MainWindowsNoGUI::SvgFile(const QString &name, int i) const
|
void MainWindowsNoGUI::SvgFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene) const
|
||||||
{
|
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (paper)
|
|
||||||
{
|
{
|
||||||
QSvgGenerator generator;
|
QSvgGenerator generator;
|
||||||
generator.setFileName(name);
|
generator.setFileName(name);
|
||||||
generator.setSize(paper->rect().size().toSize());
|
generator.setSize(paper->rect().size().toSize());
|
||||||
generator.setViewBox(paper->rect());
|
generator.setViewBox(paper->rect());
|
||||||
generator.setTitle("Valentina. Pattern layout");
|
generator.setTitle(tr("Pattern"));
|
||||||
generator.setDescription(doc->GetDescription());
|
generator.setDescription(doc->GetDescription());
|
||||||
generator.setResolution(static_cast<int>(PrintDPI));
|
generator.setResolution(static_cast<int>(PrintDPI));
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
@ -686,20 +733,16 @@ void MainWindowsNoGUI::SvgFile(const QString &name, int i) const
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, widthHairLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, widthHairLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief PngFile save layout to png file.
|
* @brief PngFile save layout to png file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void MainWindowsNoGUI::PngFile(const QString &name, int i) const
|
void MainWindowsNoGUI::PngFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene) const
|
||||||
{
|
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (paper)
|
|
||||||
{
|
{
|
||||||
const QRectF r = paper->rect();
|
const QRectF r = paper->rect();
|
||||||
// Create the image with the exact size of the shrunk scene
|
// Create the image with the exact size of the shrunk scene
|
||||||
|
@ -710,20 +753,17 @@ void MainWindowsNoGUI::PngFile(const QString &name, int i) const
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scene->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
image.save(name);
|
image.save(name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief PdfFile save layout to pdf file.
|
* @brief PdfFile save layout to pdf file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
|
void MainWindowsNoGUI::PdfFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene,
|
||||||
{
|
bool ignorePrinterFields, const QMarginsF &margins) const
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (paper)
|
|
||||||
{
|
{
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
printer.setCreator(QGuiApplication::applicationDisplayName()+QLatin1String(" ")+
|
printer.setCreator(QGuiApplication::applicationDisplayName()+QLatin1String(" ")+
|
||||||
|
@ -756,10 +796,9 @@ void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
scene->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
||||||
|
@ -793,12 +832,13 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
||||||
* @brief EpsFile save layout to eps file.
|
* @brief EpsFile save layout to eps file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void MainWindowsNoGUI::EpsFile(const QString &name, int i) const
|
void MainWindowsNoGUI::EpsFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene,
|
||||||
|
bool ignorePrinterFields, const QMarginsF &margins) const
|
||||||
{
|
{
|
||||||
QTemporaryFile tmp;
|
QTemporaryFile tmp;
|
||||||
if (tmp.open())
|
if (tmp.open())
|
||||||
{
|
{
|
||||||
PdfFile(tmp.fileName(), i);
|
PdfFile(tmp.fileName(), paper, scene, ignorePrinterFields, margins);
|
||||||
QStringList params = QStringList() << "-eps" << tmp.fileName() << name;
|
QStringList params = QStringList() << "-eps" << tmp.fileName() << name;
|
||||||
PdfToPs(params);
|
PdfToPs(params);
|
||||||
}
|
}
|
||||||
|
@ -809,12 +849,13 @@ void MainWindowsNoGUI::EpsFile(const QString &name, int i) const
|
||||||
* @brief PsFile save layout to ps file.
|
* @brief PsFile save layout to ps file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void MainWindowsNoGUI::PsFile(const QString &name, int i) const
|
void MainWindowsNoGUI::PsFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool
|
||||||
|
ignorePrinterFields, const QMarginsF &margins) const
|
||||||
{
|
{
|
||||||
QTemporaryFile tmp;
|
QTemporaryFile tmp;
|
||||||
if (tmp.open())
|
if (tmp.open())
|
||||||
{
|
{
|
||||||
PdfFile(tmp.fileName(), i);
|
PdfFile(tmp.fileName(), paper, scene, ignorePrinterFields, margins);
|
||||||
QStringList params = QStringList() << tmp.fileName() << name;
|
QStringList params = QStringList() << tmp.fileName() << name;
|
||||||
PdfToPs(params);
|
PdfToPs(params);
|
||||||
}
|
}
|
||||||
|
@ -857,10 +898,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::ObjFile(const QString &name, int i) const
|
void MainWindowsNoGUI::ObjFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene) const
|
||||||
{
|
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (paper)
|
|
||||||
{
|
{
|
||||||
VObjPaintDevice generator;
|
VObjPaintDevice generator;
|
||||||
generator.setFileName(name);
|
generator.setFileName(name);
|
||||||
|
@ -868,19 +906,16 @@ void MainWindowsNoGUI::ObjFile(const QString &name, int i) const
|
||||||
generator.setResolution(static_cast<int>(PrintDPI));
|
generator.setResolution(static_cast<int>(PrintDPI));
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
painter.begin(&generator);
|
painter.begin(&generator);
|
||||||
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
|
||||||
void MainWindowsNoGUI::DxfFile(const QString &name, int version, bool binary, int i) const
|
void MainWindowsNoGUI::DxfFile(const QString &name, int version, bool binary, QGraphicsRectItem *paper,
|
||||||
{
|
QGraphicsScene *scene) const
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (paper)
|
|
||||||
{
|
{
|
||||||
PrepareTextForDXF(endStringPlaceholder);
|
PrepareTextForDXF(endStringPlaceholder);
|
||||||
VDxfPaintDevice generator;
|
VDxfPaintDevice generator;
|
||||||
|
@ -910,12 +945,11 @@ void MainWindowsNoGUI::DxfFile(const QString &name, int version, bool binary, in
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
if (painter.begin(&generator))
|
if (painter.begin(&generator))
|
||||||
{
|
{
|
||||||
scenes.at(i)->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
scene->render(&painter, paper->rect(), paper->rect(), Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
RestoreTextAfterDXF(endStringPlaceholder);
|
RestoreTextAfterDXF(endStringPlaceholder);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
struct PosterData;
|
struct PosterData;
|
||||||
|
class QGraphicsRectItem;
|
||||||
|
|
||||||
class MainWindowsNoGUI : public VAbstractMainWindow
|
class MainWindowsNoGUI : public VAbstractMainWindow
|
||||||
{
|
{
|
||||||
|
@ -88,8 +89,14 @@ protected:
|
||||||
QMarginsF margins;
|
QMarginsF margins;
|
||||||
QSizeF paperSize;
|
QSizeF paperSize;
|
||||||
|
|
||||||
void PrepareDetailsForLayout(const QHash<quint32, VPiece> *details);
|
static QVector<VLayoutPiece> PrepareDetailsForLayout(const QHash<quint32, VPiece> &details);
|
||||||
void ExportLayout(const DialogSaveLayout &dialog);
|
|
||||||
|
void ExportData(const QVector<VLayoutPiece> &listDetails, const DialogSaveLayout &dialog);
|
||||||
|
void ExportLayout(const DialogSaveLayout &dialog,
|
||||||
|
const QList<QGraphicsScene *> &scenes,
|
||||||
|
const QList<QGraphicsItem *> &papers,
|
||||||
|
const QList<QGraphicsItem *> &shadows,
|
||||||
|
bool ignorePrinterFields, const QMarginsF &margins);
|
||||||
|
|
||||||
void InitTempLayoutScene();
|
void InitTempLayoutScene();
|
||||||
virtual void CleanLayout()=0;
|
virtual void CleanLayout()=0;
|
||||||
|
@ -110,18 +117,23 @@ private:
|
||||||
|
|
||||||
QString layoutPrinterName;
|
QString layoutPrinterName;
|
||||||
|
|
||||||
void CreateShadows();
|
static QList<QGraphicsItem *> CreateShadows(const QList<QGraphicsItem *> &papers);
|
||||||
void CreateScenes();
|
static QList<QGraphicsScene *> CreateScenes(const QList<QGraphicsItem *> &papers,
|
||||||
|
const QList<QGraphicsItem *> &shadows,
|
||||||
|
const QList<QList<QGraphicsItem *> > &details);
|
||||||
|
|
||||||
void SvgFile(const QString &name, int i)const;
|
void SvgFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene)const;
|
||||||
void PngFile(const QString &name, int i)const;
|
void PngFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene)const;
|
||||||
void PdfFile(const QString &name, int i)const;
|
void PdfFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignorePrinterFields,
|
||||||
|
const QMarginsF &margins)const;
|
||||||
void PdfTiledFile(const QString &name);
|
void PdfTiledFile(const QString &name);
|
||||||
void EpsFile(const QString &name, int i)const;
|
void EpsFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignorePrinterFields,
|
||||||
void PsFile(const QString &name, int i)const;
|
const QMarginsF &margins)const;
|
||||||
|
void PsFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignorePrinterFields,
|
||||||
|
const QMarginsF &margins)const;
|
||||||
void PdfToPs(const QStringList ¶ms)const;
|
void PdfToPs(const QStringList ¶ms)const;
|
||||||
void ObjFile(const QString &name, int i)const;
|
void ObjFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene)const;
|
||||||
void DxfFile(const QString &name, int version, bool binary, int i)const;
|
void DxfFile(const QString &name, int version, bool binary, QGraphicsRectItem *paper, QGraphicsScene *scene)const;
|
||||||
|
|
||||||
void PreparePaper(int index) const;
|
void PreparePaper(int index) const;
|
||||||
void RestorePaper(int index) const;
|
void RestorePaper(int index) const;
|
||||||
|
|
|
@ -51,6 +51,7 @@ const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f");
|
||||||
|
|
||||||
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
|
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
|
||||||
const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths");
|
const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths");
|
||||||
|
const QString LONG_OPTION_EXPORTONLYDETAILS = QStringLiteral("exportOnlyDetails");
|
||||||
|
|
||||||
const QString LONG_OPTION_ROTATE = QStringLiteral("rotate");
|
const QString LONG_OPTION_ROTATE = QStringLiteral("rotate");
|
||||||
const QString SINGLE_OPTION_ROTATE = QStringLiteral("r");
|
const QString SINGLE_OPTION_ROTATE = QStringLiteral("r");
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern const QString SINGLE_OPTION_EXP2FORMAT;
|
||||||
|
|
||||||
extern const QString LONG_OPTION_BINARYDXF;
|
extern const QString LONG_OPTION_BINARYDXF;
|
||||||
extern const QString LONG_OPTION_TEXT2PATHS;
|
extern const QString LONG_OPTION_TEXT2PATHS;
|
||||||
|
extern const QString LONG_OPTION_EXPORTONLYDETAILS;
|
||||||
|
|
||||||
extern const QString LONG_OPTION_ROTATE;
|
extern const QString LONG_OPTION_ROTATE;
|
||||||
extern const QString SINGLE_OPTION_ROTATE;
|
extern const QString SINGLE_OPTION_ROTATE;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user