Move ExportFormatSuffix and Description to VLayoutExporter

This commit is contained in:
Ronan 2021-05-22 11:52:24 +02:00
parent 1c6aebec4f
commit 302a1fbc2b
7 changed files with 213 additions and 352 deletions

View File

@ -1,10 +1,13 @@
#include "vpexporter.h"
#include <QFileDialog>
#include <QMessageBox>
#include "../vwidgets/vmaingraphicsscene.h"
#include "vpsheet.h"
#include "vpmaingraphicsview.h"
#include "../vobj/vobjpaintdevice.h"
#include "../vdxf/vdxfpaintdevice.h"
//---------------------------------------------------------------------------------------------------------------------
@ -63,8 +66,24 @@ void VPExporter::Export(VPLayout* layout, LayoutExportFormats format, VPMainGrap
ExportToTIF(mainGraphicsView->scene());
break;
case LayoutExportFormats::OBJ:
ExportToOBJ(mainGraphicsView->scene());
break;
case LayoutExportFormats::PS:
ExportToPS(mainGraphicsView->scene());
break;
case LayoutExportFormats::EPS:
ExportToEPS(mainGraphicsView->scene());
break;
default:
// do nothing
// just for test purpuses, to be removed:
QMessageBox msgBox;
msgBox.setText(QString("TODO VPExporter, Handling for format %1 is still missing.").arg(ExportFormatDescription(format)));
int ret = msgBox.exec();
Q_UNUSED(ret);
break;
}
@ -72,159 +91,6 @@ void VPExporter::Export(VPLayout* layout, LayoutExportFormats format, VPMainGrap
}
}
// FIXME Bad copy paste from DialogSaveLayout, because I didn't know how to call this function from here
// to be removed as soon as I know how to call the central function from valentina
//---------------------------------------------------------------------------------------------------------------------
QString VPExporter::ExportFormatDescription(LayoutExportFormats format)
{
const QString dxfSuffix = QStringLiteral("(*.dxf)");
const QString dxfFlatFilesStr = tr("(flat) files");
const QString filesStr = tr("files");
switch(format)
{
case LayoutExportFormats::SVG:
return QStringLiteral("Svg %1 (*.svg)").arg(filesStr);
case LayoutExportFormats::PDF:
return QStringLiteral("PDF %1 (*.pdf)").arg(filesStr);
case LayoutExportFormats::PNG:
return tr("Image files") + QStringLiteral(" (*.png)");
case LayoutExportFormats::OBJ:
return QStringLiteral("Wavefront OBJ (*.obj)");
case LayoutExportFormats::PS:
return QStringLiteral("PS %1 (*.ps)").arg(filesStr);
case LayoutExportFormats::EPS:
return QStringLiteral("EPS %1 (*.eps)").arg(filesStr);
case LayoutExportFormats::DXF_AC1006_Flat:
return QStringLiteral("AutoCAD DXF R10 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_Flat:
return QStringLiteral("AutoCAD DXF R11/12 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_Flat:
return QStringLiteral("AutoCAD DXF R13 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_Flat:
return QStringLiteral("AutoCAD DXF R14 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_Flat:
return QStringLiteral("AutoCAD DXF 2000 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_Flat:
return QStringLiteral("AutoCAD DXF 2004 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_Flat:
return QStringLiteral("AutoCAD DXF 2007 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_Flat:
return QStringLiteral("AutoCAD DXF 2010 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_Flat:
return QStringLiteral("AutoCAD DXF 2013 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1006_AAMA:
return QStringLiteral("AutoCAD DXF R10 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_AAMA:
return QStringLiteral("AutoCAD DXF R11/12 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_AAMA:
return QStringLiteral("AutoCAD DXF R13 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_AAMA:
return QStringLiteral("AutoCAD DXF R14 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_AAMA:
return QStringLiteral("AutoCAD DXF 2000 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_AAMA:
return QStringLiteral("AutoCAD DXF 2004 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_AAMA:
return QStringLiteral("AutoCAD DXF 2007 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_AAMA:
return QStringLiteral("AutoCAD DXF 2010 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_AAMA:
return QStringLiteral("AutoCAD DXF 2013 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1006_ASTM:
return QStringLiteral("AutoCAD DXF R10 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_ASTM:
return QStringLiteral("AutoCAD DXF R11/12 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_ASTM:
return QStringLiteral("AutoCAD DXF R13 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_ASTM:
return QStringLiteral("AutoCAD DXF R14 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_ASTM:
return QStringLiteral("AutoCAD DXF 2000 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_ASTM:
return QStringLiteral("AutoCAD DXF 2004 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_ASTM:
return QStringLiteral("AutoCAD DXF 2007 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_ASTM:
return QStringLiteral("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::PDFTiled:
return QStringLiteral("PDF %1 %2 (*.pdf)").arg(tr("tiled"), filesStr);
case LayoutExportFormats::NC:
return QStringLiteral("%1 %2 (*.nc)").arg(tr("Numerical control"), filesStr);
case LayoutExportFormats::RLD:
return QStringLiteral("%1 %2 (*.rld)").arg(tr("Raw Layout Data"), filesStr);
case LayoutExportFormats::TIF:
return QStringLiteral("TIFF %1 (*.tif)").arg(filesStr);
default:
return QString();
}
}
// FIXME Bad copy paste from DialogSaveLayout, because I didn't know how to call this function from here
// to be removed as soon as I know how to call the central function from valentina
//---------------------------------------------------------------------------------------------------------------------
QString VPExporter::ExportFormatSuffix(LayoutExportFormats format)
{
switch(format)
{
case LayoutExportFormats::SVG:
return QStringLiteral(".svg");
case LayoutExportFormats::PDF:
case LayoutExportFormats::PDFTiled:
return QStringLiteral(".pdf");
case LayoutExportFormats::PNG:
return QStringLiteral(".png");
case LayoutExportFormats::OBJ:
return QStringLiteral(".obj");
case LayoutExportFormats::PS:
return QStringLiteral(".ps");
case LayoutExportFormats::EPS:
return QStringLiteral(".eps");
case LayoutExportFormats::DXF_AC1006_Flat:
case LayoutExportFormats::DXF_AC1009_Flat:
case LayoutExportFormats::DXF_AC1012_Flat:
case LayoutExportFormats::DXF_AC1014_Flat:
case LayoutExportFormats::DXF_AC1015_Flat:
case LayoutExportFormats::DXF_AC1018_Flat:
case LayoutExportFormats::DXF_AC1021_Flat:
case LayoutExportFormats::DXF_AC1024_Flat:
case LayoutExportFormats::DXF_AC1027_Flat:
case LayoutExportFormats::DXF_AC1006_AAMA:
case LayoutExportFormats::DXF_AC1009_AAMA:
case LayoutExportFormats::DXF_AC1012_AAMA:
case LayoutExportFormats::DXF_AC1014_AAMA:
case LayoutExportFormats::DXF_AC1015_AAMA:
case LayoutExportFormats::DXF_AC1018_AAMA:
case LayoutExportFormats::DXF_AC1021_AAMA:
case LayoutExportFormats::DXF_AC1024_AAMA:
case LayoutExportFormats::DXF_AC1027_AAMA:
case LayoutExportFormats::DXF_AC1006_ASTM:
case LayoutExportFormats::DXF_AC1009_ASTM:
case LayoutExportFormats::DXF_AC1012_ASTM:
case LayoutExportFormats::DXF_AC1014_ASTM:
case LayoutExportFormats::DXF_AC1015_ASTM:
case LayoutExportFormats::DXF_AC1018_ASTM:
case LayoutExportFormats::DXF_AC1021_ASTM:
case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral(".dxf");
case LayoutExportFormats::NC:
return QStringLiteral(".nc");
case LayoutExportFormats::RLD:
return QStringLiteral(".rld");
case LayoutExportFormats::TIF:
return QStringLiteral(".tif");
default:
return QString();
}
}
// FIXME Bad copy paste from DialogSaveLayout, because I didn't know how to call this function from here
// to be removed as soon as I know how to call the central function from valentina
//---------------------------------------------------------------------------------------------------------------------
QVector<std::pair<QString, LayoutExportFormats> > VPExporter::InitFormats()
{
@ -238,43 +104,44 @@ QVector<std::pair<QString, LayoutExportFormats> > VPExporter::InitFormats()
InitFormat(LayoutExportFormats::SVG);
InitFormat(LayoutExportFormats::PDF);
// InitFormat(LayoutExportFormats::PNG);
InitFormat(LayoutExportFormats::TIF);
// InitFormat(LayoutExportFormats::OBJ);
InitFormat(LayoutExportFormats::OBJ);
// InitFormat(LayoutExportFormats::PS);
// InitFormat(LayoutExportFormats::EPS);
InitFormat(LayoutExportFormats::PS);
InitFormat(LayoutExportFormats::EPS);
InitFormat(LayoutExportFormats::DXF_AC1006_Flat);
/* InitFormat(LayoutExportFormats::DXF_AC1009_Flat);
InitFormat(LayoutExportFormats::DXF_AC1012_Flat);
InitFormat(LayoutExportFormats::DXF_AC1014_Flat);
InitFormat(LayoutExportFormats::DXF_AC1015_Flat);
InitFormat(LayoutExportFormats::DXF_AC1018_Flat);
InitFormat(LayoutExportFormats::DXF_AC1021_Flat);
InitFormat(LayoutExportFormats::DXF_AC1024_Flat);
InitFormat(LayoutExportFormats::DXF_AC1027_Flat);
InitFormat(LayoutExportFormats::DXF_AC1006_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1009_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1012_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1014_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1015_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1018_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1021_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1024_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1027_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1006_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1009_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1012_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1014_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1015_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1018_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);*/
// InitFormat(LayoutExportFormats::DXF_AC1006_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1009_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1012_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1014_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1015_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1018_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1021_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1024_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1027_Flat);
// InitFormat(LayoutExportFormats::DXF_AC1006_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1009_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1012_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1014_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1015_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1018_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1021_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1024_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1027_AAMA);
// InitFormat(LayoutExportFormats::DXF_AC1006_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1009_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1012_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1014_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1015_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1018_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
// InitFormat(LayoutExportFormats::PDFTiled);
// InitFormat(LayoutExportFormats::NC);
// InitFormat(LayoutExportFormats::RLD);
InitFormat(LayoutExportFormats::TIF);
return list;
}

View File

@ -21,21 +21,12 @@ public:
void Export(VPLayout* layout, LayoutExportFormats format, VPMainGraphicsView *mainGraphicsView);
// FIXME Bad copy paste from DialogSaveLayout, because I didn't know how to call this function from here
// to be removed as soon as I know how to call the central function from valentina
/**
* @brief InitFormats
* @return returns the list of formats, that we can export in puzzle
*/
QVector<std::pair<QString, LayoutExportFormats> > InitFormats();
private:
// FIXME Bad copy paste from DialogSaveLayout, because I didn't know how to call this function from here
// to be removed as soon as I know how to call the central function from valentina
static QString ExportFormatDescription(LayoutExportFormats format);
static QString ExportFormatSuffix(LayoutExportFormats format);
};
#endif // VPEXPORTER_H

View File

@ -349,151 +349,6 @@ Draw DialogSaveLayout::Mode() const
return m_mode;
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
{
const QString dxfSuffix = QStringLiteral("(*.dxf)");
const QString dxfFlatFilesStr = tr("(flat) files");
const QString filesStr = tr("files");
switch(format)
{
case LayoutExportFormats::SVG:
return QStringLiteral("Svg %1 (*.svg)").arg(filesStr);
case LayoutExportFormats::PDF:
return QStringLiteral("PDF %1 (*.pdf)").arg(filesStr);
case LayoutExportFormats::PNG:
return tr("Image files") + QStringLiteral(" (*.png)");
case LayoutExportFormats::OBJ:
return QStringLiteral("Wavefront OBJ (*.obj)");
case LayoutExportFormats::PS:
return QStringLiteral("PS %1 (*.ps)").arg(filesStr);
case LayoutExportFormats::EPS:
return QStringLiteral("EPS %1 (*.eps)").arg(filesStr);
case LayoutExportFormats::DXF_AC1006_Flat:
return QStringLiteral("AutoCAD DXF R10 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_Flat:
return QStringLiteral("AutoCAD DXF R11/12 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_Flat:
return QStringLiteral("AutoCAD DXF R13 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_Flat:
return QStringLiteral("AutoCAD DXF R14 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_Flat:
return QStringLiteral("AutoCAD DXF 2000 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_Flat:
return QStringLiteral("AutoCAD DXF 2004 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_Flat:
return QStringLiteral("AutoCAD DXF 2007 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_Flat:
return QStringLiteral("AutoCAD DXF 2010 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_Flat:
return QStringLiteral("AutoCAD DXF 2013 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1006_AAMA:
return QStringLiteral("AutoCAD DXF R10 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_AAMA:
return QStringLiteral("AutoCAD DXF R11/12 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_AAMA:
return QStringLiteral("AutoCAD DXF R13 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_AAMA:
return QStringLiteral("AutoCAD DXF R14 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_AAMA:
return QStringLiteral("AutoCAD DXF 2000 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_AAMA:
return QStringLiteral("AutoCAD DXF 2004 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_AAMA:
return QStringLiteral("AutoCAD DXF 2007 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_AAMA:
return QStringLiteral("AutoCAD DXF 2010 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_AAMA:
return QStringLiteral("AutoCAD DXF 2013 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1006_ASTM:
return QStringLiteral("AutoCAD DXF R10 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_ASTM:
return QStringLiteral("AutoCAD DXF R11/12 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_ASTM:
return QStringLiteral("AutoCAD DXF R13 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_ASTM:
return QStringLiteral("AutoCAD DXF R14 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_ASTM:
return QStringLiteral("AutoCAD DXF 2000 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_ASTM:
return QStringLiteral("AutoCAD DXF 2004 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_ASTM:
return QStringLiteral("AutoCAD DXF 2007 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_ASTM:
return QStringLiteral("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::PDFTiled:
return QStringLiteral("PDF %1 %2 (*.pdf)").arg(tr("tiled"), filesStr);
case LayoutExportFormats::NC:
return QStringLiteral("%1 %2 (*.nc)").arg(tr("Numerical control"), filesStr);
case LayoutExportFormats::RLD:
return QStringLiteral("%1 %2 (*.rld)").arg(tr("Raw Layout Data"), filesStr);
case LayoutExportFormats::TIF:
return QStringLiteral("TIFF %1 (*.tif)").arg(filesStr);
default:
return QString();
}
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::ExportFormatSuffix(LayoutExportFormats format)
{
switch(format)
{
case LayoutExportFormats::SVG:
return QStringLiteral(".svg");
case LayoutExportFormats::PDF:
case LayoutExportFormats::PDFTiled:
return QStringLiteral(".pdf");
case LayoutExportFormats::PNG:
return QStringLiteral(".png");
case LayoutExportFormats::OBJ:
return QStringLiteral(".obj");
case LayoutExportFormats::PS:
return QStringLiteral(".ps");
case LayoutExportFormats::EPS:
return QStringLiteral(".eps");
case LayoutExportFormats::DXF_AC1006_Flat:
case LayoutExportFormats::DXF_AC1009_Flat:
case LayoutExportFormats::DXF_AC1012_Flat:
case LayoutExportFormats::DXF_AC1014_Flat:
case LayoutExportFormats::DXF_AC1015_Flat:
case LayoutExportFormats::DXF_AC1018_Flat:
case LayoutExportFormats::DXF_AC1021_Flat:
case LayoutExportFormats::DXF_AC1024_Flat:
case LayoutExportFormats::DXF_AC1027_Flat:
case LayoutExportFormats::DXF_AC1006_AAMA:
case LayoutExportFormats::DXF_AC1009_AAMA:
case LayoutExportFormats::DXF_AC1012_AAMA:
case LayoutExportFormats::DXF_AC1014_AAMA:
case LayoutExportFormats::DXF_AC1015_AAMA:
case LayoutExportFormats::DXF_AC1018_AAMA:
case LayoutExportFormats::DXF_AC1021_AAMA:
case LayoutExportFormats::DXF_AC1024_AAMA:
case LayoutExportFormats::DXF_AC1027_AAMA:
case LayoutExportFormats::DXF_AC1006_ASTM:
case LayoutExportFormats::DXF_AC1009_ASTM:
case LayoutExportFormats::DXF_AC1012_ASTM:
case LayoutExportFormats::DXF_AC1014_ASTM:
case LayoutExportFormats::DXF_AC1015_ASTM:
case LayoutExportFormats::DXF_AC1018_ASTM:
case LayoutExportFormats::DXF_AC1021_ASTM:
case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral(".dxf");
case LayoutExportFormats::NC:
return QStringLiteral(".nc");
case LayoutExportFormats::RLD:
return QStringLiteral(".rld");
case LayoutExportFormats::TIF:
return QStringLiteral(".tif");
default:
return QString();
}
}
//---------------------------------------------------------------------------------------------------------------------
DialogSaveLayout::~DialogSaveLayout()
{
@ -525,7 +380,7 @@ void DialogSaveLayout::Save()
for (int i=0; i < count; ++i)
{
const QString name = Path()+'/'+FileName()+QString::number(i+1)+ExportFormatSuffix(Format());
const QString name = Path()+'/'+FileName()+QString::number(i+1)+VLayoutExporter::ExportFormatSuffix(Format());
if (QFile::exists(name))
{
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
@ -573,7 +428,7 @@ void DialogSaveLayout::PathChanged(const QString &text)
void DialogSaveLayout::ShowExample()
{
const LayoutExportFormats currentFormat = Format();
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') + ExportFormatSuffix(currentFormat));
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') + VLayoutExporter::ExportFormatSuffix(currentFormat));
ui->checkBoxBinaryDXF->setEnabled(false);
ui->groupBoxPaperFormat->setEnabled(false);
@ -822,7 +677,7 @@ QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats(
auto InitFormat = [&list](LayoutExportFormats format)
{
list.append(std::make_pair(ExportFormatDescription(format), format));
list.append(std::make_pair(VLayoutExporter::ExportFormatDescription(format), format));
};
InitFormat(LayoutExportFormats::SVG);

View File

@ -61,9 +61,6 @@ public:
Draw Mode() const;
static QString ExportFormatDescription(LayoutExportFormats format);
static QString ExportFormatSuffix(LayoutExportFormats format);
bool IsTextAsPaths() const;
void SetTextAsPaths(bool textAsPaths);

View File

@ -514,7 +514,7 @@ void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails)
for (int i = 0; i < detailsOnLayout.size(); ++i)
{
const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() +
QString::number(i+1) + DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
QString::number(i+1) + VLayoutExporter::ExportFormatSuffix(m_dialogSaveLayout->Format());
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(
m_layoutSettings->LayoutPapers().at(i));
@ -827,7 +827,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDe
}
const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() +
QString::number(1) + DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
QString::number(1) + VLayoutExporter::ExportFormatSuffix(m_dialogSaveLayout->Format());
ExportApparelLayout(listDetails, name, rect.size());
}
@ -1110,7 +1110,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
if (paper != nullptr)
{
const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() +
QString::number(i+1) + DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
QString::number(i+1) + VLayoutExporter::ExportFormatSuffix(m_dialogSaveLayout->Format());
auto *brush = new QBrush();
brush->setColor( QColor( Qt::white ) );
QGraphicsScene *scene = scenes.at(i);

View File

@ -433,3 +433,149 @@ void VLayoutExporter::PdfToPs(const QStringList &params)
qCritical() << qUtf8Printable(tr("Creating file '%1' failed! %2").arg(params.last(), proc.errorString()));
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VLayoutExporter::ExportFormatDescription(LayoutExportFormats format)
{
const QString dxfSuffix = QStringLiteral("(*.dxf)");
const QString dxfFlatFilesStr = tr("(flat) files");
const QString filesStr = tr("files");
switch(format)
{
case LayoutExportFormats::SVG:
return QStringLiteral("Svg %1 (*.svg)").arg(filesStr);
case LayoutExportFormats::PDF:
return QStringLiteral("PDF %1 (*.pdf)").arg(filesStr);
case LayoutExportFormats::PNG:
return tr("Image files") + QStringLiteral(" (*.png)");
case LayoutExportFormats::OBJ:
return QStringLiteral("Wavefront OBJ (*.obj)");
case LayoutExportFormats::PS:
return QStringLiteral("PS %1 (*.ps)").arg(filesStr);
case LayoutExportFormats::EPS:
return QStringLiteral("EPS %1 (*.eps)").arg(filesStr);
case LayoutExportFormats::DXF_AC1006_Flat:
return QStringLiteral("AutoCAD DXF R10 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_Flat:
return QStringLiteral("AutoCAD DXF R11/12 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_Flat:
return QStringLiteral("AutoCAD DXF R13 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_Flat:
return QStringLiteral("AutoCAD DXF R14 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_Flat:
return QStringLiteral("AutoCAD DXF 2000 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_Flat:
return QStringLiteral("AutoCAD DXF 2004 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_Flat:
return QStringLiteral("AutoCAD DXF 2007 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_Flat:
return QStringLiteral("AutoCAD DXF 2010 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_Flat:
return QStringLiteral("AutoCAD DXF 2013 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1006_AAMA:
return QStringLiteral("AutoCAD DXF R10 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_AAMA:
return QStringLiteral("AutoCAD DXF R11/12 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_AAMA:
return QStringLiteral("AutoCAD DXF R13 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_AAMA:
return QStringLiteral("AutoCAD DXF R14 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_AAMA:
return QStringLiteral("AutoCAD DXF 2000 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_AAMA:
return QStringLiteral("AutoCAD DXF 2004 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_AAMA:
return QStringLiteral("AutoCAD DXF 2007 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_AAMA:
return QStringLiteral("AutoCAD DXF 2010 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_AAMA:
return QStringLiteral("AutoCAD DXF 2013 AAMA %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1006_ASTM:
return QStringLiteral("AutoCAD DXF R10 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1009_ASTM:
return QStringLiteral("AutoCAD DXF R11/12 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1012_ASTM:
return QStringLiteral("AutoCAD DXF R13 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1014_ASTM:
return QStringLiteral("AutoCAD DXF R14 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1015_ASTM:
return QStringLiteral("AutoCAD DXF 2000 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1018_ASTM:
return QStringLiteral("AutoCAD DXF 2004 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1021_ASTM:
return QStringLiteral("AutoCAD DXF 2007 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1024_ASTM:
return QStringLiteral("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::PDFTiled:
return QStringLiteral("PDF %1 %2 (*.pdf)").arg(tr("tiled"), filesStr);
case LayoutExportFormats::NC:
return QStringLiteral("%1 %2 (*.nc)").arg(tr("Numerical control"), filesStr);
case LayoutExportFormats::RLD:
return QStringLiteral("%1 %2 (*.rld)").arg(tr("Raw Layout Data"), filesStr);
case LayoutExportFormats::TIF:
return QStringLiteral("TIFF %1 (*.tif)").arg(filesStr);
default:
return QString();
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VLayoutExporter::ExportFormatSuffix(LayoutExportFormats format)
{
switch(format)
{
case LayoutExportFormats::SVG:
return QStringLiteral(".svg");
case LayoutExportFormats::PDF:
case LayoutExportFormats::PDFTiled:
return QStringLiteral(".pdf");
case LayoutExportFormats::PNG:
return QStringLiteral(".png");
case LayoutExportFormats::OBJ:
return QStringLiteral(".obj");
case LayoutExportFormats::PS:
return QStringLiteral(".ps");
case LayoutExportFormats::EPS:
return QStringLiteral(".eps");
case LayoutExportFormats::DXF_AC1006_Flat:
case LayoutExportFormats::DXF_AC1009_Flat:
case LayoutExportFormats::DXF_AC1012_Flat:
case LayoutExportFormats::DXF_AC1014_Flat:
case LayoutExportFormats::DXF_AC1015_Flat:
case LayoutExportFormats::DXF_AC1018_Flat:
case LayoutExportFormats::DXF_AC1021_Flat:
case LayoutExportFormats::DXF_AC1024_Flat:
case LayoutExportFormats::DXF_AC1027_Flat:
case LayoutExportFormats::DXF_AC1006_AAMA:
case LayoutExportFormats::DXF_AC1009_AAMA:
case LayoutExportFormats::DXF_AC1012_AAMA:
case LayoutExportFormats::DXF_AC1014_AAMA:
case LayoutExportFormats::DXF_AC1015_AAMA:
case LayoutExportFormats::DXF_AC1018_AAMA:
case LayoutExportFormats::DXF_AC1021_AAMA:
case LayoutExportFormats::DXF_AC1024_AAMA:
case LayoutExportFormats::DXF_AC1027_AAMA:
case LayoutExportFormats::DXF_AC1006_ASTM:
case LayoutExportFormats::DXF_AC1009_ASTM:
case LayoutExportFormats::DXF_AC1012_ASTM:
case LayoutExportFormats::DXF_AC1014_ASTM:
case LayoutExportFormats::DXF_AC1015_ASTM:
case LayoutExportFormats::DXF_AC1018_ASTM:
case LayoutExportFormats::DXF_AC1021_ASTM:
case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral(".dxf");
case LayoutExportFormats::NC:
return QStringLiteral(".nc");
case LayoutExportFormats::RLD:
return QStringLiteral(".rld");
case LayoutExportFormats::TIF:
return QStringLiteral(".tif");
default:
return QString();
}
}

View File

@ -34,6 +34,8 @@
#include <QString>
#include <QCoreApplication>
#include "../vlayout/vlayoutdef.h"
class QGraphicsScene;
class QGraphicsItem;
class VLayoutPiece;
@ -91,6 +93,9 @@ public:
static auto SupportPDFConversion() -> bool;
static QString ExportFormatDescription(LayoutExportFormats format);
static QString ExportFormatSuffix(LayoutExportFormats format);
private:
QString m_fileName{};
QMarginsF m_margins{};