Compare commits

...

5 commits

Author SHA1 Message Date
Roman Telezhynskyi 872e50814d Update manpages. 2023-04-10 13:43:12 +03:00
Roman Telezhynskyi c88da992a0 Clean Puzzle's command line keys.
Remove unused keys.
2023-04-10 13:41:44 +03:00
Roman Telezhynskyi 7dd8aa0058 Fix Clang warning. 2023-04-10 13:17:14 +03:00
Roman Telezhynskyi cb9f029c0f New key --noGrainline. #163 2023-04-10 13:17:01 +03:00
Roman Telezhynskyi a2b701f083 Show/hide grainline when export. Closes #163 2023-04-10 12:20:18 +03:00
36 changed files with 501 additions and 357 deletions

View file

@ -22,6 +22,7 @@
- Fix seam allowance. Loose requirements to case with prong.
- Fix list of dimension popup list. Make sure it will always has enough space for values.
- New grainline type: Four way.
- [smart-pattern/valentina#163] Show/hide grainline when export.
# Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru.

View file

@ -1,6 +1,6 @@
.\" Manpage for puzzle
.\" Contact dismine@gmail.com to correct errors.
.TH puzzle 1 "23 March, 2020" "puzzle man page"
.TH puzzle 1 "10 April, 2023" "puzzle man page"
.SH NAME
Puzzle \- Valentina's manual layout
.SH SYNOPSIS
@ -15,34 +15,8 @@ is a part of Valentina. And used for creating and editing manual layouts.
Displays this help.
.IP "-v, --version"
Displays version information.
.IP "-e, --exportFile <The filename of layout file>"
The filename of exported layout file. Use it to enable console export mode.
.IP "-r, --rawLayout <The raw layout data file>"
Load pattern pieces form the raw layout data file.
.IP "-f, --format <Format number>"
Number corresponding to tiled pdf page template (default = 0, export mode with tiled pdf format): <not defined>
.IP "--bdxf"
Export dxf in binary form.
.IP "--text2paths"
Export text as paths.
.IP "-c, --crop"
Auto crop unused length (export mode).
.IP "--cropWidth"
Auto crop unused width (export mode).
.IP "--tiledPageformat <Template number>"
Number corresponding to tiled pdf page template (default = 0, export mode with tiled pdf format): <not defined>
.IP "--tiledlmargin <The left margin>"
Tiled page left margin in current units like 3.0 (export mode). If not set will be used default value 1 cm.
.IP "--tiledrmargin <The right margin>"
Tiled page right margin in current units like 3.0 (export mode). If not set will be used default value 1 cm.
.IP "--tiledtmargin <The top margin>"
Tiled page top margin in current units like 3.0 (export mode). If not set will be used value default value 1 cm.
.IP "--tiledbmargin <The bottom margin>"
Tiled page bottom margin in current units like 3.0 (export mode). If not set will be used value default value 1 cm.
.IP "--tiledLandscape"
Set tiled page orienatation to landscape (export mode). Default value if not set portrait.
.IP "-t, --test"
Run the program in a test mode. The program in this mode loads a single layout file and silently quit without showing the main window. The key have priority before key 'exportFile'.
.IP "--no-scaling"
Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). Alternatively you can use the QT_AUTO_SCREEN_SCALE_FACTOR=0 environment variable.
.IP Arguments:

View file

@ -1,6 +1,6 @@
.\" Manpage for valentina.
.\" Contact dismine@gmail.com to correct errors.
.TH valentina 1 "3 February, 2021" "valentina man page"
.TH valentina 1 "10 April, 2023" "valentina man page"
.SH NAME
Valentina \- Pattern making program.
.SH SYNOPSIS
@ -136,6 +136,8 @@ The path to output destination folder. By default the directory at which the app
.RE
.IP "--bdxf"
.RB "Export dxf in binary form."
.IP "--noGrainline"
.RB "Show/hide grainline when export layout."
.IP "--text2paths"
.RB "Export text as paths."
.IP "--exportOnlyDetails"

View file

@ -16,3 +16,4 @@ usr/share/icons/hicolor/256x256/mimetypes/*
usr/share/icons/hicolor/512x512/apps/*
usr/share/icons/hicolor/512x512/mimetypes/*
usr/share/applications/*
usr/share/metainfo/*

28
dist/debian/puzzle.1 vendored
View file

@ -1,6 +1,6 @@
.\" Manpage for puzzle
.\" Contact dismine@gmail.com to correct errors.
.TH puzzle 1 "23 March, 2020" "puzzle man page"
.TH puzzle 1 "10 April, 2023" "puzzle man page"
.SH NAME
Puzzle \- Valentina's manual layout
.SH SYNOPSIS
@ -15,34 +15,8 @@ is a part of Valentina. And used for creating and editing manual layouts.
Displays this help.
.IP "-v, --version"
Displays version information.
.IP "-e, --exportFile <The filename of layout file>"
The filename of exported layout file. Use it to enable console export mode.
.IP "-r, --rawLayout <The raw layout data file>"
Load pattern pieces form the raw layout data file.
.IP "-f, --format <Format number>"
Number corresponding to tiled pdf page template (default = 0, export mode with tiled pdf format): <not defined>
.IP "--bdxf"
Export dxf in binary form.
.IP "--text2paths"
Export text as paths.
.IP "-c, --crop"
Auto crop unused length (export mode).
.IP "--cropWidth"
Auto crop unused width (export mode).
.IP "--tiledPageformat <Template number>"
Number corresponding to tiled pdf page template (default = 0, export mode with tiled pdf format): <not defined>
.IP "--tiledlmargin <The left margin>"
Tiled page left margin in current units like 3.0 (export mode). If not set will be used default value 1 cm.
.IP "--tiledrmargin <The right margin>"
Tiled page right margin in current units like 3.0 (export mode). If not set will be used default value 1 cm.
.IP "--tiledtmargin <The top margin>"
Tiled page top margin in current units like 3.0 (export mode). If not set will be used value default value 1 cm.
.IP "--tiledbmargin <The bottom margin>"
Tiled page bottom margin in current units like 3.0 (export mode). If not set will be used value default value 1 cm.
.IP "--tiledLandscape"
Set tiled page orienatation to landscape (export mode). Default value if not set portrait.
.IP "-t, --test"
Run the program in a test mode. The program in this mode loads a single layout file and silently quit without showing the main window. The key have priority before key 'exportFile'.
.IP "--no-scaling"
Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). Alternatively you can use the QT_AUTO_SCREEN_SCALE_FACTOR=0 environment variable.
.IP Arguments:

View file

@ -1,6 +1,6 @@
.\" Manpage for valentina.
.\" Contact dismine@gmail.com to correct errors.
.TH valentina 1 "3 February, 2021" "valentina man page"
.TH valentina 1 "10 April, 2023" "valentina man page"
.SH NAME
Valentina \- Pattern making program.
.SH SYNOPSIS
@ -136,6 +136,8 @@ The path to output destination folder. By default the directory at which the app
.RE
.IP "--bdxf"
.RB "Export dxf in binary form."
.IP "--noGrainline"
.RB "Show/hide grainline when export layout."
.IP "--text2paths"
.RB "Export text as paths."
.IP "--exportOnlyDetails"

View file

@ -250,6 +250,62 @@ auto DialogSaveManualLayout::IsBinaryDXFFormat() const -> bool
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveManualLayout::SetShowGrainline(bool show)
{
switch(Format())
{
case LayoutExportFormats::SVG:
case LayoutExportFormats::PDF:
case LayoutExportFormats::PNG:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::PDFTiled:
case LayoutExportFormats::TIF:
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:
ui->checkBoxShowGrainline->setChecked(show);
break;
default:
ui->checkBoxShowGrainline->setChecked(true);
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogSaveManualLayout::IsShowGrainline() const
{
switch(Format())
{
case LayoutExportFormats::SVG:
case LayoutExportFormats::PDF:
case LayoutExportFormats::PNG:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::PDFTiled:
case LayoutExportFormats::TIF:
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:
return ui->checkBoxShowGrainline->isChecked();
default:
return true;
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveManualLayout::SetDestinationPath(const QString &cmdDestinationPath)
{
@ -444,18 +500,10 @@ void DialogSaveManualLayout::ShowExample()
ui->checkBoxTextAsPaths->setEnabled(true);
ui->checkBoxExportUnified->setEnabled(false);
ui->checkBoxTilesScheme->setEnabled(false);
ui->checkBoxShowGrainline->setEnabled(true);
switch(currentFormat)
{
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:
@ -475,9 +523,11 @@ void DialogSaveManualLayout::ShowExample()
case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM:
ui->checkBoxBinaryDXF->setEnabled(true);
ui->checkBoxShowGrainline->setEnabled(false);
break;
case LayoutExportFormats::RLD:
ui->checkBoxTextAsPaths->setEnabled(false);
ui->checkBoxShowGrainline->setEnabled(false);
break;
case LayoutExportFormats::PDFTiled:
ui->checkBoxTilesScheme->setEnabled(true);
@ -488,10 +538,21 @@ void DialogSaveManualLayout::ShowExample()
case LayoutExportFormats::EPS:
ui->checkBoxExportUnified->setEnabled(true);
break;
case LayoutExportFormats::NC:
case LayoutExportFormats::OBJ:
ui->checkBoxShowGrainline->setEnabled(false);
break;
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::SVG:
case LayoutExportFormats::PNG:
case LayoutExportFormats::OBJ:
case LayoutExportFormats::NC:
case LayoutExportFormats::TIF:
default:
break;
@ -580,6 +641,7 @@ void DialogSaveManualLayout::ReadSettings()
{
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
SelectFormat(static_cast<LayoutExportFormats>(settings->GetLayoutExportFormat()));
SetShowGrainline(settings->GetShowGrainline());
}
//---------------------------------------------------------------------------------------------------------------------
@ -592,4 +654,5 @@ void DialogSaveManualLayout::WriteSettings() const
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetLayoutExportFormat(static_cast<qint8>(Format()));
settings->SetShowGrainline(IsShowGrainline());
}

View file

@ -54,6 +54,9 @@ public:
void SetBinaryDXFFormat(bool binary);
auto IsBinaryDXFFormat() const -> bool;
void SetShowGrainline(bool show);
auto IsShowGrainline() const -> bool;
void SetDestinationPath(const QString& cmdDestinationPath);
auto IsTextAsPaths() const -> bool;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>413</width>
<height>310</height>
<height>293</height>
</rect>
</property>
<property name="windowTitle">
@ -111,8 +111,8 @@
<property name="title">
<string>Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxBinaryDXF">
<property name="enabled">
<bool>false</bool>
@ -122,17 +122,7 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxTextAsPaths">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Text as paths</string>
</property>
</widget>
</item>
<item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxExportUnified">
<property name="enabled">
<bool>false</bool>
@ -145,7 +135,27 @@
</property>
</widget>
</item>
<item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxShowGrainline">
<property name="text">
<string>Show grainline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBoxTextAsPaths">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Text as paths</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxTilesScheme">
<property name="enabled">
<bool>false</bool>

View file

@ -43,6 +43,7 @@
#include "../layout/vplayout.h"
#include "../layout/vpsheet.h"
#include "../vlayout/vtextmanager.h"
#include "../vlayout/vgraphicsfillitem.h"
#include "../vpapplication.h"
@ -167,6 +168,7 @@ VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent)
PaintPiece();
InitLabels();
InitGrainlineItem();
}
//---------------------------------------------------------------------------------------------------------------------
@ -181,7 +183,6 @@ auto VPGraphicsPiece::boundingRect() const -> QRectF
QPainterPath shape;
shape.addPath(m_seamLine);
shape.addPath(m_cuttingLine);
shape.addPath(m_grainline);
shape.addPath(m_internalPaths);
shape.addPath(m_passmarks);
shape.addPath(m_placeLabels);
@ -451,12 +452,45 @@ void VPGraphicsPiece::InitPieceLabel(const QVector<QPointF> &labelShape, const V
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::InitGrainlineItem()
{
delete m_grainlineItem;
VPPiecePtr piece = m_piece.toStrongRef();
if (piece.isNull())
{
return;
}
if(piece->IsGrainlineEnabled())
{
QPainterPath grainline;
QVector<QPointF> grainLinepoints = piece->GetMappedGrainline();
if(!grainLinepoints.isEmpty())
{
grainline.moveTo(ConstFirst(grainLinepoints));
for (int i = 1; i < grainLinepoints.size(); i++)
{
grainline.lineTo(grainLinepoints.at(i));
}
}
m_grainlineItem = new VGraphicsFillItem(this);
m_grainlineItem->setPath(grainline);
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
QPen pen(PieceColor(), settings->GetLayoutLineWidth(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
m_grainlineItem->SetCustomPen(true);
m_grainlineItem->setPen(pen);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::PaintPiece(QPainter *painter)
{
m_seamLine = QPainterPath();
m_cuttingLine = QPainterPath();
m_grainline = QPainterPath();
m_internalPaths = QPainterPath();
m_passmarks = QPainterPath();
m_placeLabels = QPainterPath();
@ -474,9 +508,6 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
// initiliases the cutting line
PaintCuttingLine(painter, piece);
// initialises the grainline
PaintGrainline(painter, piece);
// initialises the internal paths
PaintInternalPaths(painter, piece);
@ -539,35 +570,6 @@ void VPGraphicsPiece::PaintCuttingLine(QPainter *painter, const VPPiecePtr &piec
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::PaintGrainline(QPainter *painter, const VPPiecePtr &piece)
{
if(piece->IsGrainlineEnabled())
{
QVector<QPointF> grainLinepoints = piece->GetMappedGrainline();
if(!grainLinepoints.isEmpty())
{
m_grainline.moveTo(ConstFirst(grainLinepoints));
for (int i = 1; i < grainLinepoints.size(); i++)
{
m_grainline.lineTo(grainLinepoints.at(i));
}
if (painter != nullptr)
{
painter->save();
// here to fill the grainlines arrow. Not wanted for mvp
// later maybe if it's configurable
// painter->setBrush(blackBrush);
painter->setBrush(NoBrush());
painter->drawPath(m_grainline);
painter->restore();
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::PaintInternalPaths(QPainter *painter, const VPPiecePtr &piece)
{
@ -790,6 +792,7 @@ void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece)
prepareGeometryChange();
PaintPiece(); // refresh shapes
InitLabels();
InitGrainlineItem();
emit PieceTransformationChanged();
}
}

View file

@ -40,6 +40,7 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VTextManager;
class VGraphicsFillItem;
class VPGraphicsPiece : public QGraphicsObject
{
@ -92,7 +93,6 @@ private:
QPainterPath m_cuttingLine{};
QPainterPath m_seamLine{};
QPainterPath m_grainline{};
QPainterPath m_internalPaths{};
QPainterPath m_passmarks{};
QPainterPath m_placeLabels{};
@ -113,15 +113,16 @@ private:
bool m_hoverMode{false};
VGraphicsFillItem *m_grainlineItem{nullptr};
QVector<QGraphicsPathItem *> m_labelPathItems{};
QVector<QGraphicsSimpleTextItem *> m_labelTextItems{};
void InitLabels();
void InitPieceLabel(const QVector<QPointF> &labelShape, const VTextManager &tm);
void InitGrainlineItem();
void PaintPiece(QPainter *painter=nullptr);
void PaintSeamLine(QPainter *painter, const VPPiecePtr &piece);
void PaintCuttingLine(QPainter *painter, const VPPiecePtr &piece);
void PaintGrainline(QPainter *painter, const VPPiecePtr &piece);
void PaintInternalPaths(QPainter *painter, const VPPiecePtr &piece);
void PaintPassmarks(QPainter *painter, const VPPiecePtr &piece);
void PaintPlaceLabels(QPainter *painter, const VPPiecePtr &piece);

View file

@ -384,11 +384,8 @@ auto VPApplication::NewMainWindow(const VPCommandLinePtr &cmd) -> VPMainWindow *
{
auto *puzzle = new VPMainWindow(cmd);
m_mainWindows.prepend(puzzle);
if (not cmd->IsTestModeEnabled())
{
puzzle->show();
puzzle->UpdateWindowTitle();
}
puzzle->show();
puzzle->UpdateWindowTitle();
puzzle->InitZoom();
return puzzle;
}
@ -700,13 +697,6 @@ auto VPApplication::StartWithFiles(const VPCommandLinePtr &cmd, const QStringLis
//---------------------------------------------------------------------------------------------------------------------
auto VPApplication::SingleStart(const VPCommandLinePtr &cmd, const QStringList &rawLayouts) -> bool
{
if (cmd->IsTestModeEnabled())
{
qCCritical(pApp, "%s\n", qPrintable(tr("Please, provide one input file.")));
cmd.get()->parser.showHelp(V_EX_USAGE);
return false;
}
NewMainWindow(cmd);
if (not rawLayouts.isEmpty())
{

View file

@ -35,49 +35,12 @@ std::shared_ptr<VPCommandLine> VPCommandLine::instance = nullptr; // NOLINT(cppc
#define translate(context, source) QCoreApplication::translate((context), source)// NOLINT(cppcoreguidelines-macro-usage)
//------------------------------------------------------------------------------------------------
auto VPCommandLine::IsExportEnabled() const -> bool
{
const bool result = IsOptionSet(LONG_OPTION_EXPORT_FILE);
auto argSize = parser.positionalArguments().size();
if (result && argSize != 1)
{
qCritical() << translate("Puzzle", "Export options can be used with single input file only.") << "/n";
const_cast<VPCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
}
return result;
}
//----------------------------------------------------------------------------------------------
auto VPCommandLine::OptionExportFile() const -> QString
{
QString path;
if (IsExportEnabled())
{
path = OptionValue(LONG_OPTION_EXPORT_FILE);
}
return path;
}
//---------------------------------------------------------------------------------------------------------------------
auto VPCommandLine::OptionRawLayouts() const -> QStringList
{
return OptionValues(LONG_OPTION_RAW_LAYOUT);
}
//--------------------------------------------------------------------------------------------
auto VPCommandLine::IsTestModeEnabled() const -> bool
{
const bool r = IsOptionSet(LONG_OPTION_TEST);
if (r && parser.positionalArguments().size() != 1)
{
qCritical() << translate("VCommandLine", "Test option can be used with single input file only.") << "/n";
const_cast<VPCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
}
return r;
}
//--------------------------------------------------------------------------------------------
auto VPCommandLine::IsGuiEnabled() const -> bool
{
@ -128,8 +91,6 @@ void VPCommandLine::ProcessInstance(VPCommandLinePtr &instance, const QStringLis
instance.reset(new VPCommandLine);
}
instance->parser.process(arguments);
instance->isGuiEnabled = not (instance->IsGuiEnabled() || instance->IsExportEnabled());
}
//-------------------------------------------------------------------------------------------
@ -138,51 +99,9 @@ void VPCommandLine::InitCommandLineOptions()
//keep in mind order here - that is how user will see it, so group-up for usability
//=================================================================================================================
parser.addOptions({
{{SINGLE_OPTION_EXPORT_FILE, LONG_OPTION_EXPORT_FILE},
translate("VCommandLine", "The filename of exported layout file. Use it to enable console export mode."),
translate("VCommandLine", "The filename of layout file")},
{{SINGLE_OPTION_RAW_LAYOUT, LONG_OPTION_RAW_LAYOUT},
translate("VCommandLine", "Load pattern pieces from the raw layout data file."),
translate("VCommandLine", "The raw layout data file")},
{{SINGLE_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT},
translate("VCommandLine", "Number corresponding to output format (default = 0, export mode): <not defined>"),
translate("VCommandLine", "Format number"), QChar('0')},
{LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
{LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
//=================================================================================================================
{{SINGLE_OPTION_CROP_LENGTH, LONG_OPTION_CROP_LENGTH},
translate("VCommandLine", "Auto crop unused length (export mode).")},
{LONG_OPTION_CROP_WIDTH,
translate("VCommandLine", "Auto crop unused width (export mode).")},
//=================================================================================================================
{LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
translate("VCommandLine", "Number corresponding to tiled pdf page template (default = 0, export mode with "
"tiled pdf format): <not defined>"),
translate("VCommandLine", "Template number"), QChar('0')},
{LONG_OPTION_TILED_PDF_LEFT_MARGIN,
translate("VCommandLine","Tiled page left margin in current units like 3.0 (export mode). If not set will be "
"used default value 1 cm."),
translate("VCommandLine", "The left margin")},
{LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
translate("VCommandLine", "Tiled page right margin in current units like 3.0 (export mode). If not set will "
"be used default value 1 cm."),
translate("VCommandLine", "The right margin")},
{LONG_OPTION_TILED_PDF_TOP_MARGIN,
translate("VCommandLine", "Tiled page top margin in current units like 3.0 (export mode). If not set will be "
"used value default value 1 cm."),
translate("VCommandLine", "The top margin")},
{LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
translate("VCommandLine", "Tiled page bottom margin in current units like 3.0 (export mode). If not set will "
"be used value default value 1 cm."),
translate("VCommandLine", "The bottom margin")},
{LONG_OPTION_TILED_PDF_LANDSCAPE,
translate("VCommandLine", "Set tiled page orienatation to landscape (export mode). Default value if not set "
"portrait.")},
//=================================================================================================================
{{SINGLE_OPTION_TEST, LONG_OPTION_TEST},
translate("VCommandLine", "Run the program in a test mode. The program in this mode loads a single layout "
"file and silently quit without showing the main window. The key have priority "
"before key '%1'.").arg(LONG_OPTION_EXPORT_FILE)},
{LONG_OPTION_NO_HDPI_SCALING,
translate("VCommandLine", "Disable high dpi scaling. Call this option if has problem with scaling (by default "
"scaling enabled). Alternatively you can use the %1 environment variable.")

View file

@ -44,18 +44,9 @@ class VPCommandLine: public QObject
public:
~VPCommandLine() override = default;
/** @brief if user enabled export from cmd */
auto IsExportEnabled() const -> bool;
/** @brief path to export file or empty string if not */
auto OptionExportFile() const -> QString;
/** @brief list with paths to the raw layout data files */
auto OptionRawLayouts() const -> QStringList;
/** @brief if user enabled test mode from cmd */
auto IsTestModeEnabled() const -> bool;
/** @brief if gui enabled or not */
auto IsGuiEnabled() const -> bool;
@ -77,7 +68,7 @@ private:
Q_DISABLE_COPY_MOVE(VPCommandLine) // NOLINT
static VPCommandLinePtr instance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
QCommandLineParser parser{};
bool isGuiEnabled{false};
bool isGuiEnabled{true};
friend class VPApplication;
/** @brief add options to the QCommandLineParser that there are in the cmd can be */

View file

@ -29,33 +29,9 @@
#include <QStringList>
const QString LONG_OPTION_EXPORT_FILE = QStringLiteral("exportFile"); // NOLINT
const QString SINGLE_OPTION_EXPORT_FILE = QStringLiteral("e"); // NOLINT
const QString LONG_OPTION_TEST = QStringLiteral("test"); // NOLINT
const QString SINGLE_OPTION_TEST = QStringLiteral("t"); // NOLINT
const QString LONG_OPTION_RAW_LAYOUT = QStringLiteral("rawLayout"); // NOLINT
const QString SINGLE_OPTION_RAW_LAYOUT = QStringLiteral("r"); // NOLINT
const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format"); // NOLINT
const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f"); // NOLINT
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf"); // NOLINT
const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths"); // NOLINT
const QString LONG_OPTION_CROP_LENGTH = QStringLiteral("crop"); // NOLINT
const QString SINGLE_OPTION_CROP_LENGTH = QStringLiteral("c"); // NOLINT
const QString LONG_OPTION_CROP_WIDTH = QStringLiteral("cropWidth"); // NOLINT
const QString LONG_OPTION_TILED_PDF_PAGE_TEMPLATE = QStringLiteral("tiledPageformat"); // NOLINT
const QString LONG_OPTION_TILED_PDF_LEFT_MARGIN = QStringLiteral("tiledlmargin"); // NOLINT
const QString LONG_OPTION_TILED_PDF_RIGHT_MARGIN = QStringLiteral("tiledrmargin"); // NOLINT
const QString LONG_OPTION_TILED_PDF_TOP_MARGIN = QStringLiteral("tiledtmargin"); // NOLINT
const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN = QStringLiteral("tiledbmargin"); // NOLINT
const QString LONG_OPTION_TILED_PDF_LANDSCAPE = QStringLiteral("tiledLandscape"); // NOLINT
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief AllKeys return list with all command line keys (short and long forms). Used for testing on conflicts.
@ -65,24 +41,7 @@ auto AllKeys() -> QStringList
{
return
{
LONG_OPTION_EXPORT_FILE,
SINGLE_OPTION_EXPORT_FILE,
LONG_OPTION_TEST,
SINGLE_OPTION_TEST,
LONG_OPTION_RAW_LAYOUT,
SINGLE_OPTION_RAW_LAYOUT,
LONG_OPTION_EXP2FORMAT,
SINGLE_OPTION_EXP2FORMAT,
LONG_OPTION_BINARYDXF,
LONG_OPTION_TEXT2PATHS,
LONG_OPTION_CROP_LENGTH,
SINGLE_OPTION_CROP_LENGTH,
LONG_OPTION_CROP_WIDTH,
LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
LONG_OPTION_TILED_PDF_LEFT_MARGIN,
LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
LONG_OPTION_TILED_PDF_TOP_MARGIN,
LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
LONG_OPTION_TILED_PDF_LANDSCAPE
SINGLE_OPTION_RAW_LAYOUT
};
}

View file

@ -31,33 +31,9 @@
#include <QString>
extern const QString LONG_OPTION_EXPORT_FILE;
extern const QString SINGLE_OPTION_EXPORT_FILE;
extern const QString LONG_OPTION_TEST;
extern const QString SINGLE_OPTION_TEST;
extern const QString LONG_OPTION_RAW_LAYOUT;
extern const QString SINGLE_OPTION_RAW_LAYOUT;
extern const QString LONG_OPTION_EXP2FORMAT;
extern const QString SINGLE_OPTION_EXP2FORMAT;
extern const QString LONG_OPTION_BINARYDXF;
extern const QString LONG_OPTION_TEXT2PATHS;
extern const QString LONG_OPTION_CROP_LENGTH;
extern const QString SINGLE_OPTION_CROP_LENGTH;
extern const QString LONG_OPTION_CROP_WIDTH;
extern const QString LONG_OPTION_TILED_PDF_PAGE_TEMPLATE;
extern const QString LONG_OPTION_TILED_PDF_LEFT_MARGIN;
extern const QString LONG_OPTION_TILED_PDF_RIGHT_MARGIN;
extern const QString LONG_OPTION_TILED_PDF_TOP_MARGIN;
extern const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN;
extern const QString LONG_OPTION_TILED_PDF_LANDSCAPE;
auto AllKeys() -> QStringList;
#endif // VPCOMMANDS_H

View file

@ -293,6 +293,7 @@ struct VPExportData
bool textAsPaths{false};
bool exportUnified{true};
bool showTilesScheme{false};
bool showGrainline{true};
};
//---------------------------------------------------------------------------------------------------------------------
@ -419,10 +420,6 @@ auto VPMainWindow::LoadFile(const QString& path) -> bool
if (not QFileInfo::exists(path))
{
qCCritical(pWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path)));
if (m_cmd->IsTestModeEnabled())
{
QCoreApplication::exit(V_EX_NOINPUT);
}
return false;
}
@ -470,11 +467,6 @@ auto VPMainWindow::LoadFile(const QString& path) -> bool
qCCritical(pWindow, "%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(tr("Unable to read a layout file. %1").arg(fileReader.errorString())));
lock.reset();
if (m_cmd->IsTestModeEnabled())
{
QCoreApplication::exit(V_EX_NOINPUT);
}
return false;
}
}
@ -2376,6 +2368,7 @@ void VPMainWindow::ExportScene(const VPExportData &data)
exporter.SetYScale(data.yScale);
exporter.SetDescription(m_layout->LayoutSettings().GetDescription());
exporter.SetBinaryDxfFormat(data.isBinaryDXF);
exporter.SetShowGrainline(data.showGrainline);
QList<VPSheetPtr> sheets = data.sheets;
@ -2413,17 +2406,17 @@ void VPMainWindow::ExportScene(const VPExportData &data)
case LayoutExportFormats::SVG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToSVG(sheet->SceneData()->Scene());
exporter.ExportToSVG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::PDF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPDF(sheet->SceneData()->Scene());
exporter.ExportToPDF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::PNG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPNG(sheet->SceneData()->Scene());
exporter.ExportToPNG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::OBJ:
exporter.ExportToOBJ(sheet->SceneData()->Scene());
@ -2431,12 +2424,12 @@ void VPMainWindow::ExportScene(const VPExportData &data)
case LayoutExportFormats::PS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPS(sheet->SceneData()->Scene());
exporter.ExportToPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::EPS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToEPS(sheet->SceneData()->Scene());
exporter.ExportToEPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
case LayoutExportFormats::DXF_AC1006_Flat:
exporter.SetDxfVersion(DRW::AC1006);
@ -2477,7 +2470,7 @@ void VPMainWindow::ExportScene(const VPExportData &data)
case LayoutExportFormats::TIF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToTIF(sheet->SceneData()->Scene());
exporter.ExportToTIF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
break;
default:
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
@ -2565,11 +2558,12 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin
}
}
sheet->SceneData()->PrepareForExport();
sheet->SceneData()->PrepareForExport(); // Go first because recreates pieces
VLayoutExporter::PrepareGrainlineForExport(sheet->SceneData()->GraphicsPiecesAsItems(), data.showGrainline);
QRectF imageRect = sheet->GetMarginsRect();
sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer.data(), imageRect),
imageRect, Qt::IgnoreAspectRatio);
sheet->SceneData()->CleanAfterExport();
sheet->SceneData()->CleanAfterExport(); // Will restore the grainlines automatically
firstPage = false;
}
@ -2602,7 +2596,7 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
bool firstPage = true;
for (const auto& sheet : data.sheets)
{
if (not GeneratePdfTiledFile(sheet, data.showTilesScheme, &painter, printer, firstPage))
if (not GeneratePdfTiledFile(sheet, data.showTilesScheme, data.showGrainline, &painter, printer, firstPage))
{
break;
}
@ -2620,7 +2614,8 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
QPainter painter;
bool firstPage = true;
if (not GeneratePdfTiledFile(data.sheets.at(i), data.showTilesScheme, &painter, printer, firstPage))
if (not GeneratePdfTiledFile(data.sheets.at(i), data.showTilesScheme, data.showGrainline, &painter, printer,
firstPage))
{
break;
}
@ -2629,18 +2624,25 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
}
//---------------------------------------------------------------------------------------------------------------------
auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter,
const QSharedPointer<QPrinter> &printer, bool &firstPage) -> bool
auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, bool showGrainline,
QPainter *painter, const QSharedPointer<QPrinter> &printer,
bool &firstPage) -> bool
{
SCASSERT(not sheet.isNull())
SCASSERT(painter != nullptr)
SCASSERT(not printer.isNull())
sheet->SceneData()->PrepareForExport();
sheet->SceneData()->PrepareForExport(); // Go first because recreates pieces
VLayoutExporter::PrepareGrainlineForExport(sheet->SceneData()->GraphicsPiecesAsItems(), showGrainline);
m_layout->TileFactory()->RefreshTileInfos();
m_layout->TileFactory()->RefreshWatermarkData();
sheet->SceneData()->SetTextAsPaths(false);
auto Clean = qScopeGuard([sheet]()
{
sheet->SceneData()->CleanAfterExport(); // Will restore the grainlines automatically
});
if (showTilesScheme)
{
SetPrinterTiledPageSettings(printer, m_layout, sheet, sheet->GetSheetOrientation(), true);
@ -2695,8 +2697,6 @@ auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesS
}
}
sheet->SceneData()->CleanAfterExport();
return true;
}
@ -4144,6 +4144,7 @@ void VPMainWindow::on_ExportLayout()
data.textAsPaths = dialog.IsTextAsPaths();
data.exportUnified = dialog.IsExportUnified();
data.showTilesScheme = dialog.IsTilesScheme();
data.showGrainline = dialog.IsShowGrainline();
ExportData(data);
}
@ -4194,6 +4195,7 @@ void VPMainWindow::on_ExportSheet()
data.textAsPaths = dialog.IsTextAsPaths();
data.exportUnified = dialog.IsExportUnified();
data.showTilesScheme = dialog.IsTilesScheme();
data.showGrainline = dialog.IsShowGrainline();
ExportData(data);
}

View file

@ -479,7 +479,7 @@ private:
static void ExportUnifiedPdfFile(const VPExportData &data);
static void GenerateUnifiedPdfFile(const VPExportData &data, const QString &name);
void ExportPdfTiledFile(const VPExportData &data);
auto GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter,
auto GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, bool showGrainline, QPainter *painter,
const QSharedPointer<QPrinter> &printer, bool &firstPage) -> bool;
void UpdateScaleConnection() const;

View file

@ -54,6 +54,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1S
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, (QLatin1String("layout/pieceGap"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, (QLatin1String("layout/exportFormat"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, (QLatin1String("layout/lineWidth"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
int cachedLineWidth = -1;
} // namespace
@ -340,3 +341,15 @@ void VPSettings::SetLayoutLineWidth(int width)
cachedLineWidth = qBound(1, width, 10);
setValue(*settingLayoutLineWidth, cachedLineWidth);
}
//---------------------------------------------------------------------------------------------------------------------
bool VPSettings::GetShowGrainline() const
{
return value(*settingLayoutShowGrainline, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VPSettings::SetShowGrainline(bool value)
{
setValue(*settingLayoutShowGrainline, value);
}

View file

@ -103,6 +103,9 @@ public:
auto GetLayoutLineWidth() const -> int;
void SetLayoutLineWidth(int width);
bool GetShowGrainline() const;
void SetShowGrainline(bool value);
private:
Q_DISABLE_COPY_MOVE(VPSettings) // NOLINT
};

View file

@ -328,6 +328,12 @@ auto VCommandLine::IsBinaryDXF() const -> bool
return IsOptionSet(LONG_OPTION_BINARYDXF);
}
//---------------------------------------------------------------------------------------------------------------------
auto VCommandLine::IsNoGrainline() const -> bool
{
return IsOptionSet(LONG_OPTION_NOGRAINLINE);
}
//---------------------------------------------------------------------------------------------------------------------
auto VCommandLine::IsTextAsPaths() const -> bool
{
@ -621,6 +627,7 @@ void VCommandLine::InitCommandLineOptions()
DialogSaveLayout::MakeHelpFormatList(),
translate("VCommandLine", "Format number"), QChar('0')},
{LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
{LONG_OPTION_NOGRAINLINE, translate("VCommandLine", "Show/hide grainline when export layout.")},
{LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
{LONG_OPTION_EXPORTONLYDETAILS,
translate("VCommandLine", "Export only details. Export details as they positioned in the details mode. Any "

View file

@ -83,6 +83,7 @@ public:
auto OptExportType() const -> int;
auto IsBinaryDXF() const -> bool;
auto IsNoGrainline() const -> bool;
auto IsTextAsPaths() const -> bool;
auto IsExportOnlyDetails() const -> bool;
auto IsCSVWithHeader() const -> bool;

View file

@ -277,6 +277,104 @@ auto DialogSaveLayout::IsBinaryDXFFormat() const -> bool
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::SetShowGrainline(bool show)
{
switch(Format())
{
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::SVG:
case LayoutExportFormats::PDF:
case LayoutExportFormats::PDFTiled:
case LayoutExportFormats::PNG:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::TIF:
ui->checkBoxShowGrainline->setChecked(show);
break;
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:
case LayoutExportFormats::RLD:
case LayoutExportFormats::NC:
case LayoutExportFormats::OBJ:
default:
ui->checkBoxShowGrainline->setChecked(true);
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::IsShowGrainline() const -> bool
{
switch(Format())
{
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::SVG:
case LayoutExportFormats::PDF:
case LayoutExportFormats::PDFTiled:
case LayoutExportFormats::PNG:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::TIF:
return ui->checkBoxShowGrainline->isChecked();
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:
case LayoutExportFormats::RLD:
case LayoutExportFormats::NC:
case LayoutExportFormats::OBJ:
default:
return true;
}
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::MakeHelpFormatList() -> QString
{
@ -414,18 +512,10 @@ void DialogSaveLayout::ShowExample()
ui->groupBoxPaperFormat->setEnabled(false);
ui->groupBoxMargins->setEnabled(false);
ui->checkBoxTextAsPaths->setEnabled(true);
ui->checkBoxShowGrainline->setEnabled(m_mode == Draw::Layout);
switch(currentFormat)
{
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:
@ -445,6 +535,7 @@ void DialogSaveLayout::ShowExample()
case LayoutExportFormats::DXF_AC1024_ASTM:
case LayoutExportFormats::DXF_AC1027_ASTM:
ui->checkBoxBinaryDXF->setEnabled(true);
ui->checkBoxShowGrainline->setEnabled(false);
break;
case LayoutExportFormats::PDFTiled:
ui->groupBoxPaperFormat->setEnabled(true);
@ -452,14 +543,26 @@ void DialogSaveLayout::ShowExample()
break;
case LayoutExportFormats::RLD:
ui->checkBoxTextAsPaths->setEnabled(false);
ui->checkBoxShowGrainline->setEnabled(false);
break;
case LayoutExportFormats::NC:
case LayoutExportFormats::OBJ:
ui->checkBoxShowGrainline->setEnabled(false);
break;
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::SVG:
case LayoutExportFormats::PDF:
case LayoutExportFormats::PNG:
case LayoutExportFormats::OBJ:
case LayoutExportFormats::PS:
case LayoutExportFormats::EPS:
case LayoutExportFormats::NC:
case LayoutExportFormats::TIF:
default:
break;
@ -768,6 +871,7 @@ void DialogSaveLayout::ReadSettings()
else
{
SelectFormat(static_cast<LayoutExportFormats>(settings->GetLayoutExportFormat()));
SetShowGrainline(settings->GetShowGrainline());
}
}
@ -819,6 +923,7 @@ void DialogSaveLayout::WriteSettings() const
else
{
settings->SetLayoutExportFormat(static_cast<qint8>(Format()));
settings->SetShowGrainline(IsShowGrainline());
}
}

View file

@ -56,6 +56,9 @@ public:
void SetBinaryDXFFormat(bool binary);
auto IsBinaryDXFFormat() const -> bool;
void SetShowGrainline(bool show);
auto IsShowGrainline() const -> bool;
static auto MakeHelpFormatList() -> QString;
void SetDestinationPath(const QString& cmdDestinationPath);

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<height>391</height>
<width>544</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
@ -129,6 +129,19 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowGrainline">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Show grainline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -2523,7 +2523,7 @@ void MainWindow::ExportDraw(const QString &fileName)
exporter.SetImageRect(rect);
exporter.SetOffset(rect.topLeft()); // Correct positions to fit SVG view rect
exporter.ExportToSVG(m_sceneDraw);
exporter.ExportToSVG(m_sceneDraw, QList<QGraphicsItem *>());
m_sceneDraw->SetOriginsVisible(true);
@ -6655,6 +6655,7 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
m_dialogSaveLayout->SetShowGrainline(!expParams->IsNoGrainline());
m_dialogSaveLayout->SetTextAsPaths(expParams->IsTextAsPaths());
m_dialogSaveLayout->SetXScale(expParams->ExportXScale());
m_dialogSaveLayout->SetYScale(expParams->ExportYScale());
@ -6693,6 +6694,7 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
m_dialogSaveLayout->SetShowGrainline(!expParams->IsNoGrainline());
m_dialogSaveLayout->SetXScale(expParams->ExportXScale());
m_dialogSaveLayout->SetYScale(expParams->ExportYScale());

View file

@ -1116,6 +1116,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
exporter.SetDescription(doc->GetDescription().toHtmlEscaped());
exporter.SetIgnorePrinterMargins(ignorePrinterFields);
exporter.SetBinaryDxfFormat(m_dialogSaveLayout->IsBinaryDXFFormat());
exporter.SetShowGrainline(m_dialogSaveLayout->IsShowGrainline());
for (int i=0; i < scenes.size(); ++i)
{
@ -1141,18 +1142,18 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
paper->setVisible(false);
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToSVG(scene);
exporter.ExportToSVG(scene, details.at(i));
paper->setVisible(true);
break;
case LayoutExportFormats::PDF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPDF(scene);
exporter.ExportToPDF(scene, details.at(i));
break;
case LayoutExportFormats::PNG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPNG(scene);
exporter.ExportToPNG(scene, details.at(i));
break;
case LayoutExportFormats::OBJ:
paper->setVisible(false);
@ -1162,12 +1163,12 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
case LayoutExportFormats::PS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPS(scene);
exporter.ExportToPS(scene, details.at(i));
break;
case LayoutExportFormats::EPS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToEPS(scene);
exporter.ExportToEPS(scene, details.at(i));
break;
case LayoutExportFormats::DXF_AC1006_Flat:
paper->setVisible(false);
@ -1226,7 +1227,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
case LayoutExportFormats::TIF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToTIF(scene);
exporter.ExportToTIF(scene, details.at(i));
break;
default:
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;

View file

@ -44,8 +44,17 @@ void VGraphicsFillItem::paint(QPainter* painter, const QStyleOptionGraphicsItem*
Q_UNUSED(widget)
painter->save();
QPen pen = painter->pen();
pen.setWidthF(width);
QPen pen;
if (m_customPen)
{
pen = this->pen();
}
else
{
pen = painter->pen();
pen.setWidthF(width);
}
painter->setPen(pen);
painter->setBrush(painter->pen().color());

View file

@ -32,6 +32,8 @@
#include <QGraphicsPathItem>
#include <QPainter>
#include "../vmisc/def.h"
class VGraphicsFillItem : public QGraphicsPathItem
{
public:
@ -49,13 +51,20 @@ public:
* @param option unused
* @param widget unused
*/
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
int type() const override {return Type;}
enum { Type = UserType + static_cast<int>(Layout::GrainlineItem)};
auto GetWidth() const -> qreal;
void SetWidth(const qreal &value);
auto CustomPen() const -> bool;
void SetCustomPen(bool newCustomPen);
private:
qreal width{1};
bool m_customPen{false};
};
//---------------------------------------------------------------------------------------------------------------------
@ -70,4 +79,15 @@ inline void VGraphicsFillItem::SetWidth(const qreal &value)
width = value;
}
//---------------------------------------------------------------------------------------------------------------------
inline auto VGraphicsFillItem::CustomPen() const -> bool
{
return m_customPen;
}
//---------------------------------------------------------------------------------------------------------------------
inline void VGraphicsFillItem::SetCustomPen(bool newCustomPen)
{
m_customPen = newCustomPen;
}
#endif // VGRAPHICSFILLITEM_H

View file

@ -49,6 +49,7 @@
#include "../vmisc/vabstractvalapplication.h"
#include "../ifc/exception/vexception.h"
#include "vprintlayout.h"
#include "vgraphicsfillitem.h"
namespace
{
@ -67,7 +68,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, PDFTOPS, (QLatin1String("pdftops"))) //
*
* @param placeholder placeholder that will be appended to each QGraphicsSimpleTextItem item's text string.
*/
void PrepareTextForDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
void PrepareDetailsForDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
{
for (auto *item : paperItems)
{
@ -94,7 +95,7 @@ void PrepareTextForDXF(const QString &placeholder, const QList<QGraphicsItem *>
*
* @param placeholder placeholder that will be removed from each QGraphicsSimpleTextItem item's text string.
*/
void RestoreTextAfterDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
void RestoreDetailsAfterDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
{
for (auto *item : paperItems)
{
@ -116,8 +117,22 @@ void RestoreTextAfterDXF(const QString &placeholder, const QList<QGraphicsItem *
} // namespace
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToSVG(QGraphicsScene *scene) const
auto VLayoutExporter::IsShowGrainline() const -> bool
{
return m_showGrainline;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::SetShowGrainline(bool show)
{
m_showGrainline = show;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToSVG(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
PrepareGrainlineForExport(details, m_showGrainline);
QSvgGenerator generator;
generator.setFileName(m_fileName);
@ -145,11 +160,15 @@ void VLayoutExporter::ExportToSVG(QGraphicsScene *scene) const
painter.scale(m_xScale, m_yScale);
scene->render(&painter, m_imageRect, m_imageRect, Qt::IgnoreAspectRatio);
painter.end();
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToPNG(QGraphicsScene *scene) const
void VLayoutExporter::ExportToPNG(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
PrepareGrainlineForExport(details, m_showGrainline);
// Create the image with the exact size of the shrunk scene
QSize drawingSize;
drawingSize.setWidth(qFloor(m_imageRect.width() * m_xScale + m_margins.left() + m_margins.right()));
@ -167,11 +186,15 @@ void VLayoutExporter::ExportToPNG(QGraphicsScene *scene) const
scene->render(&painter, m_imageRect, m_imageRect, Qt::IgnoreAspectRatio);
image.save(m_fileName);
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToTIF(QGraphicsScene *scene) const
void VLayoutExporter::ExportToTIF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
PrepareGrainlineForExport(details, m_showGrainline);
// Create the image with the exact size of the shrunk scene
QSize drawingSize;
drawingSize.setWidth(qFloor(m_imageRect.width() * m_xScale + m_margins.left() + m_margins.right()));
@ -197,14 +220,17 @@ void VLayoutExporter::ExportToTIF(QGraphicsScene *scene) const
if (not writer.write(image))
{ // failed to save file
qCritical() << qUtf8Printable(tr("Can't save file '%1'. Error: %2.").arg(m_fileName, writer.errorString()));
RestoreGrainlineAfterExport(details);
return;
}
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene) const
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
ExportToPDF(scene, m_fileName);
ExportToPDF(scene, details, m_fileName);
}
//---------------------------------------------------------------------------------------------------------------------
@ -222,25 +248,25 @@ void VLayoutExporter::ExportToOBJ(QGraphicsScene *scene) const
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToPS(QGraphicsScene *scene) const
void VLayoutExporter::ExportToPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
QTemporaryFile tmp;
if (tmp.open())
{
const QString fileName = m_fileName;
ExportToPDF(scene, tmp.fileName());
ExportToPDF(scene, details, tmp.fileName());
PdfToPs(QStringList{tmp.fileName(), fileName});
}
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToEPS(QGraphicsScene *scene) const
void VLayoutExporter::ExportToEPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
QTemporaryFile tmp;
if (tmp.open())
{
const QString fileName = m_fileName;
ExportToPDF(scene, tmp.fileName());
ExportToPDF(scene, details, tmp.fileName());
PdfToPs(QStringList{QStringLiteral("-eps"), tmp.fileName(), fileName});
}
}
@ -248,7 +274,8 @@ void VLayoutExporter::ExportToEPS(QGraphicsScene *scene) const
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
PrepareTextForDXF(endStringPlaceholder, details);
PrepareDetailsForDXF(endStringPlaceholder, details);
PrepareGrainlineForExport(details, m_showGrainline);
VDxfPaintDevice generator;
generator.SetFileName(m_fileName);
@ -270,7 +297,8 @@ void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphi
}
}
RestoreTextAfterDXF(endStringPlaceholder, details);
RestoreDetailsAfterDXF(endStringPlaceholder, details);
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
@ -411,8 +439,11 @@ void VLayoutExporter::PdfToPs(const QStringList &params)
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QString &filename) const
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details,
const QString &filename) const
{
PrepareGrainlineForExport(details, m_showGrainline);
QPrinter printer;
printer.setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
@ -453,6 +484,7 @@ void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QString &filename
if (not painter.begin(&printer))
{ // failed to open file
qCritical() << qUtf8Printable(tr("Can't open file '%1'").arg(m_fileName));
RestoreGrainlineAfterExport(details);
return;
}
painter.setRenderHint(QPainter::Antialiasing, true);
@ -461,6 +493,8 @@ void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QString &filename
painter.scale(m_xScale, m_yScale);
scene->render(&painter, VPrintLayout::SceneTargetRect(&printer, m_imageRect), m_imageRect, Qt::IgnoreAspectRatio);
painter.end();
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
@ -607,3 +641,35 @@ QString VLayoutExporter::ExportFormatSuffix(LayoutExportFormats format)
return QString();
}
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::PrepareGrainlineForExport(const QList<QGraphicsItem *> &items, bool showGrainline)
{
for (auto *item : items)
{
QList<QGraphicsItem *> pieceChildren = item->childItems();
for (auto *child : qAsConst(pieceChildren))
{
if (child->type() == VGraphicsFillItem::Type)
{
child->setVisible(showGrainline);
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::RestoreGrainlineAfterExport(const QList<QGraphicsItem *> &items)
{
for (auto *item : items)
{
QList<QGraphicsItem *> pieceChildren = item->childItems();
for (auto *child : qAsConst(pieceChildren))
{
if (child->type() == VGraphicsFillItem::Type)
{
child->setVisible(true);
}
}
}
}

View file

@ -76,16 +76,19 @@ public:
auto BinaryDxfFormat() const -> bool;
void SetBinaryDxfFormat(bool binaryFormat);
auto IsShowGrainline() const -> bool;
void SetShowGrainline(bool show);
auto DxfVersion() const -> int;
void SetDxfVersion(int dxfVersion);
void ExportToSVG(QGraphicsScene *scene) const;
void ExportToPNG(QGraphicsScene *scene) const;
void ExportToTIF(QGraphicsScene *scene) const;
void ExportToPDF(QGraphicsScene *scene) const;
void ExportToSVG(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToPNG(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToTIF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToOBJ(QGraphicsScene *scene) const;
void ExportToPS(QGraphicsScene *scene) const;
void ExportToEPS(QGraphicsScene *scene) const;
void ExportToPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToEPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToAAMADXF(const QVector<VLayoutPiece> &details) const;
void ExportToASTMDXF(const QVector<VLayoutPiece> &details) const;
@ -93,10 +96,11 @@ public:
static auto SupportPDFConversion() -> bool;
static QString ExportFormatDescription(LayoutExportFormats format);
static QString ExportFormatSuffix(LayoutExportFormats format);
static void PdfToPs(const QStringList &params);
static void PrepareGrainlineForExport(const QList<QGraphicsItem *> &items, bool showGrainline);
static void RestoreGrainlineAfterExport(const QList<QGraphicsItem *> &items);
auto offset() const -> QPointF;
void SetOffset(const QPointF &newOffset);
@ -112,10 +116,11 @@ private:
QPen m_pen{};
bool m_ignorePrinterMargins{false};
bool m_binaryDxfFormat{false};
bool m_showGrainline{true};
int m_dxfVersion{0};
QPointF m_offset{};
void ExportToPDF(QGraphicsScene *scene, const QString &filename) const;
void ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details, const QString &filename) const;
};
//---------------------------------------------------------------------------------------------------------------------

View file

@ -48,6 +48,7 @@ const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format");
const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f");
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
const QString LONG_OPTION_NOGRAINLINE = QStringLiteral("noGrainline"); // NOLINT
const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths");
const QString LONG_OPTION_EXPORTONLYDETAILS = QStringLiteral("exportOnlyDetails");
const QString LONG_OPTION_EXPORTSUCHDETAILS = QStringLiteral("exportSuchDetails");
@ -149,6 +150,7 @@ QStringList AllKeys()
LONG_OPTION_PAGETEMPLATE, SINGLE_OPTION_PAGETEMPLATE,
LONG_OPTION_EXP2FORMAT, SINGLE_OPTION_EXP2FORMAT,
LONG_OPTION_BINARYDXF,
LONG_OPTION_NOGRAINLINE,
LONG_OPTION_TEXT2PATHS,
LONG_OPTION_EXPORTONLYDETAILS,
LONG_OPTION_EXPORTSUCHDETAILS,

View file

@ -47,6 +47,7 @@ extern const QString LONG_OPTION_EXP2FORMAT;
extern const QString SINGLE_OPTION_EXP2FORMAT;
extern const QString LONG_OPTION_BINARYDXF;
extern const QString LONG_OPTION_NOGRAINLINE;
extern const QString LONG_OPTION_TEXT2PATHS;
extern const QString LONG_OPTION_EXPORTONLYDETAILS;
extern const QString LONG_OPTION_EXPORTSUCHDETAILS;

View file

@ -274,6 +274,12 @@ enum class Vis : ToolVisHolderType
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
};
enum class Layout : ToolVisHolderType
{
GrainlineItem = static_cast<ToolVisHolderType>(Vis::LAST_ONE_DO_NOT_USE),
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
};
enum class VarType : qint8 { Measurement, MeasurementSeparator, Increment, IncrementSeparator, LineLength, CurveLength,
CurveCLength, LineAngle, CurveAngle, ArcRadius, PieceExternalArea, PieceSeamLineArea,
Unknown };

View file

@ -77,6 +77,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPreferOneSheetSolution, // NOLINT
(QLatin1String("layout/preferOneSheetSolution")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFields, (QLatin1String("layout/fields"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIgnoreFields, (QLatin1String("layout/ignoreFields"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingStripOptimization, (QLatin1String("layout/stripOptimization"))) // NOLINT
@ -971,6 +972,18 @@ void VValentinaSettings::SetBackgroundImageDefOpacity(int value)
setValue(*settingPatternBackgroundImageDefOpacity, qBound(0, value, 100));
}
//---------------------------------------------------------------------------------------------------------------------
bool VValentinaSettings::GetShowGrainline() const
{
return value(*settingLayoutShowGrainline, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VValentinaSettings::SetShowGrainline(bool value)
{
setValue(*settingLayoutShowGrainline, value);
}
//---------------------------------------------------------------------------------------------------------------------
template<typename T>
T VValentinaSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const

View file

@ -235,6 +235,9 @@ public:
auto GetBackgroundImageDefOpacity() const -> int;
void SetBackgroundImageDefOpacity(int value);
bool GetShowGrainline() const;
void SetShowGrainline(bool value);
private:
Q_DISABLE_COPY_MOVE(VValentinaSettings) // NOLINT