Reserve number of G-code format for future use.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-04-10 16:32:35 +03:00
parent aa1d30bdb8
commit 26c74d5d49
3 changed files with 20 additions and 9 deletions

View File

@ -103,6 +103,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
RemoveFormatFromList(LayoutExportFormats::OBJ);
#endif
// RemoveFormatFromList(LayoutExportFormats::NC); // No support for now
if (m_mode != Draw::Layout)
{
RemoveFormatFromList(LayoutExportFormats::PDFTiled);
@ -247,6 +249,7 @@ void DialogSaveLayout::SetBinaryDXFFormat(bool binary)
case LayoutExportFormats::OBJ:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::NC:
default:
ui->checkBoxBinaryDXF->setChecked(false);
break;
@ -293,6 +296,7 @@ bool DialogSaveLayout::IsBinaryDXFFormat() const
case LayoutExportFormats::OBJ:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::NC:
default:
return false;
}
@ -429,14 +433,16 @@ QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
case LayoutExportFormats::PDFTiled:
return QStringLiteral("PDF tiled %1 (*.pdf)").arg(filesStr);
return QStringLiteral("PDF %1 %2 (*.pdf)").arg(tr("tiled"), filesStr);
case LayoutExportFormats::NC:
return QStringLiteral("%1 %2 (*.nc)").arg(tr("Numerical control"), filesStr);
default:
return QString();
}
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format)
QString DialogSaveLayout::ExportFormatSuffix(LayoutExportFormats format)
{
switch(format)
{
@ -481,6 +487,8 @@ QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format)
case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM:
return QStringLiteral(".dxf");
case LayoutExportFormats::NC:
return QStringLiteral(".nc");
default:
return QString();
}
@ -515,7 +523,7 @@ void DialogSaveLayout::Save()
{
for (int i=0; i < count; ++i)
{
const QString name = Path()+'/'+FileName()+QString::number(i+1)+ExportFromatSuffix(Format());
const QString name = Path()+'/'+FileName()+QString::number(i+1)+ExportFormatSuffix(Format());
if (QFile::exists(name))
{
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
@ -563,7 +571,7 @@ void DialogSaveLayout::PathChanged(const QString &text)
void DialogSaveLayout::ShowExample()
{
const LayoutExportFormats currentFormat = Format();
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') + ExportFromatSuffix(currentFormat));
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1Char('1') + ExportFormatSuffix(currentFormat));
ui->checkBoxBinaryDXF->setEnabled(false);
ui->groupBoxPaperFormat->setEnabled(false);
@ -610,6 +618,7 @@ void DialogSaveLayout::ShowExample()
case LayoutExportFormats::OBJ:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::NC:
default:
break;
}
@ -813,6 +822,7 @@ QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats(
// InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
InitFormat(LayoutExportFormats::PDFTiled);
// InitFormat(LayoutExportFormats::NC);
return list;
}

View File

@ -81,6 +81,7 @@ enum class LayoutExportFormats : char
DXF_AC1024_ASTM = 31, /* ACAD 2010. */
DXF_AC1027_ASTM = 32, /* ACAD 2013. */
PDFTiled = 33,
NC = 34, /*G-code. Reserved for future*/
COUNT /*Use only for validation*/
};
@ -108,7 +109,7 @@ public:
Draw Mode() const;
static QString ExportFormatDescription(LayoutExportFormats format);
static QString ExportFromatSuffix(LayoutExportFormats format);
static QString ExportFormatSuffix(LayoutExportFormats format);
bool IsTextAsPaths() const;
void SetTextAsPaths(bool textAsPaths);

View File

@ -476,7 +476,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::ExportFromatSuffix(m_dialogSaveLayout->Format());
QString::number(i+1) + DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
SCASSERT(paper != nullptr)
@ -522,7 +522,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes,
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
{
const QString name = path + '/' + m_dialogSaveLayout->FileName() + QString::number(1)
+ DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
+ DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
PdfTiledFile(name);
}
else
@ -743,7 +743,7 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDe
}
const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() +
QString::number(1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
QString::number(1) + DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
ExportApparelLayout(listDetails, name, rect.size());
}
@ -1748,7 +1748,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
if (paper)
{
const QString name = m_dialogSaveLayout->Path() + '/' + m_dialogSaveLayout->FileName() +
QString::number(i+1) + DialogSaveLayout::ExportFromatSuffix(m_dialogSaveLayout->Format());
QString::number(i+1) + DialogSaveLayout::ExportFormatSuffix(m_dialogSaveLayout->Format());
QBrush *brush = new QBrush();
brush->setColor( QColor( Qt::white ) );
QGraphicsScene *scene = scenes.at(i);