Compare commits

..

No commits in common. "872e50814d962f8eea037d739521d93e73773d98" and "64acbfff4c204d2384f34a18ba327ccb914c36b7" have entirely different histories.

36 changed files with 357 additions and 501 deletions

View file

@ -22,7 +22,6 @@
- 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 "10 April, 2023" "puzzle man page"
.TH puzzle 1 "23 March, 2020" "puzzle man page"
.SH NAME
Puzzle \- Valentina's manual layout
.SH SYNOPSIS
@ -15,8 +15,34 @@ 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 "10 April, 2023" "valentina man page"
.TH valentina 1 "3 February, 2021" "valentina man page"
.SH NAME
Valentina \- Pattern making program.
.SH SYNOPSIS
@ -136,8 +136,6 @@ 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,4 +16,3 @@ 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 "10 April, 2023" "puzzle man page"
.TH puzzle 1 "23 March, 2020" "puzzle man page"
.SH NAME
Puzzle \- Valentina's manual layout
.SH SYNOPSIS
@ -15,8 +15,34 @@ 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 "10 April, 2023" "valentina man page"
.TH valentina 1 "3 February, 2021" "valentina man page"
.SH NAME
Valentina \- Pattern making program.
.SH SYNOPSIS
@ -136,8 +136,6 @@ 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,62 +250,6 @@ 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)
{
@ -500,10 +444,18 @@ 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:
@ -523,11 +475,9 @@ 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);
@ -538,21 +488,10 @@ 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;
@ -641,7 +580,6 @@ void DialogSaveManualLayout::ReadSettings()
{
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
SelectFormat(static_cast<LayoutExportFormats>(settings->GetLayoutExportFormat()));
SetShowGrainline(settings->GetShowGrainline());
}
//---------------------------------------------------------------------------------------------------------------------
@ -654,5 +592,4 @@ void DialogSaveManualLayout::WriteSettings() const
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetLayoutExportFormat(static_cast<qint8>(Format()));
settings->SetShowGrainline(IsShowGrainline());
}

View file

@ -54,9 +54,6 @@ 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>293</height>
<height>310</height>
</rect>
</property>
<property name="windowTitle">
@ -111,8 +111,8 @@
<property name="title">
<string>Options</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="checkBoxBinaryDXF">
<property name="enabled">
<bool>false</bool>
@ -122,7 +122,17 @@
</property>
</widget>
</item>
<item row="2" column="0">
<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>
<widget class="QCheckBox" name="checkBoxExportUnified">
<property name="enabled">
<bool>false</bool>
@ -135,27 +145,7 @@
</property>
</widget>
</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">
<item>
<widget class="QCheckBox" name="checkBoxTilesScheme">
<property name="enabled">
<bool>false</bool>

View file

@ -43,7 +43,6 @@
#include "../layout/vplayout.h"
#include "../layout/vpsheet.h"
#include "../vlayout/vtextmanager.h"
#include "../vlayout/vgraphicsfillitem.h"
#include "../vpapplication.h"
@ -168,7 +167,6 @@ VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent)
PaintPiece();
InitLabels();
InitGrainlineItem();
}
//---------------------------------------------------------------------------------------------------------------------
@ -183,6 +181,7 @@ 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);
@ -452,45 +451,12 @@ 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();
@ -508,6 +474,9 @@ 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);
@ -570,6 +539,35 @@ 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)
{
@ -792,7 +790,6 @@ void VPGraphicsPiece::on_RefreshPiece(const VPPiecePtr &piece)
prepareGeometryChange();
PaintPiece(); // refresh shapes
InitLabels();
InitGrainlineItem();
emit PieceTransformationChanged();
}
}

View file

@ -40,7 +40,6 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VTextManager;
class VGraphicsFillItem;
class VPGraphicsPiece : public QGraphicsObject
{
@ -93,6 +92,7 @@ private:
QPainterPath m_cuttingLine{};
QPainterPath m_seamLine{};
QPainterPath m_grainline{};
QPainterPath m_internalPaths{};
QPainterPath m_passmarks{};
QPainterPath m_placeLabels{};
@ -113,16 +113,15 @@ 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,8 +384,11 @@ 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->InitZoom();
return puzzle;
}
@ -697,6 +700,13 @@ 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,12 +35,49 @@ 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
{
@ -91,6 +128,8 @@ void VPCommandLine::ProcessInstance(VPCommandLinePtr &instance, const QStringLis
instance.reset(new VPCommandLine);
}
instance->parser.process(arguments);
instance->isGuiEnabled = not (instance->IsGuiEnabled() || instance->IsExportEnabled());
}
//-------------------------------------------------------------------------------------------
@ -99,9 +138,51 @@ 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,9 +44,18 @@ 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;
@ -68,7 +77,7 @@ private:
Q_DISABLE_COPY_MOVE(VPCommandLine) // NOLINT
static VPCommandLinePtr instance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
QCommandLineParser parser{};
bool isGuiEnabled{true};
bool isGuiEnabled{false};
friend class VPApplication;
/** @brief add options to the QCommandLineParser that there are in the cmd can be */

View file

@ -29,9 +29,33 @@
#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.
@ -41,7 +65,24 @@ 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
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
};
}

View file

@ -31,9 +31,33 @@
#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,7 +293,6 @@ struct VPExportData
bool textAsPaths{false};
bool exportUnified{true};
bool showTilesScheme{false};
bool showGrainline{true};
};
//---------------------------------------------------------------------------------------------------------------------
@ -420,6 +419,10 @@ 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;
}
@ -467,6 +470,11 @@ 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;
}
}
@ -2368,7 +2376,6 @@ 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;
@ -2406,17 +2413,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(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToSVG(sheet->SceneData()->Scene());
break;
case LayoutExportFormats::PDF:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPDF(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToPDF(sheet->SceneData()->Scene());
break;
case LayoutExportFormats::PNG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPNG(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToPNG(sheet->SceneData()->Scene());
break;
case LayoutExportFormats::OBJ:
exporter.ExportToOBJ(sheet->SceneData()->Scene());
@ -2424,12 +2431,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(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToPS(sheet->SceneData()->Scene());
break;
case LayoutExportFormats::EPS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToEPS(sheet->SceneData()->Scene(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToEPS(sheet->SceneData()->Scene());
break;
case LayoutExportFormats::DXF_AC1006_Flat:
exporter.SetDxfVersion(DRW::AC1006);
@ -2470,7 +2477,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(), sheet->SceneData()->GraphicsPiecesAsItems());
exporter.ExportToTIF(sheet->SceneData()->Scene());
break;
default:
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
@ -2558,12 +2565,11 @@ void VPMainWindow::GenerateUnifiedPdfFile(const VPExportData &data, const QStrin
}
}
sheet->SceneData()->PrepareForExport(); // Go first because recreates pieces
VLayoutExporter::PrepareGrainlineForExport(sheet->SceneData()->GraphicsPiecesAsItems(), data.showGrainline);
sheet->SceneData()->PrepareForExport();
QRectF imageRect = sheet->GetMarginsRect();
sheet->SceneData()->Scene()->render(&painter, VPrintLayout::SceneTargetRect(printer.data(), imageRect),
imageRect, Qt::IgnoreAspectRatio);
sheet->SceneData()->CleanAfterExport(); // Will restore the grainlines automatically
sheet->SceneData()->CleanAfterExport();
firstPage = false;
}
@ -2596,7 +2602,7 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
bool firstPage = true;
for (const auto& sheet : data.sheets)
{
if (not GeneratePdfTiledFile(sheet, data.showTilesScheme, data.showGrainline, &painter, printer, firstPage))
if (not GeneratePdfTiledFile(sheet, data.showTilesScheme, &painter, printer, firstPage))
{
break;
}
@ -2614,8 +2620,7 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
QPainter painter;
bool firstPage = true;
if (not GeneratePdfTiledFile(data.sheets.at(i), data.showTilesScheme, data.showGrainline, &painter, printer,
firstPage))
if (not GeneratePdfTiledFile(data.sheets.at(i), data.showTilesScheme, &painter, printer, firstPage))
{
break;
}
@ -2624,25 +2629,18 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
}
//---------------------------------------------------------------------------------------------------------------------
auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, bool showGrainline,
QPainter *painter, const QSharedPointer<QPrinter> &printer,
bool &firstPage) -> bool
auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter,
const QSharedPointer<QPrinter> &printer, bool &firstPage) -> bool
{
SCASSERT(not sheet.isNull())
SCASSERT(painter != nullptr)
SCASSERT(not printer.isNull())
sheet->SceneData()->PrepareForExport(); // Go first because recreates pieces
VLayoutExporter::PrepareGrainlineForExport(sheet->SceneData()->GraphicsPiecesAsItems(), showGrainline);
sheet->SceneData()->PrepareForExport();
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);
@ -2697,6 +2695,8 @@ auto VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesS
}
}
sheet->SceneData()->CleanAfterExport();
return true;
}
@ -4144,7 +4144,6 @@ void VPMainWindow::on_ExportLayout()
data.textAsPaths = dialog.IsTextAsPaths();
data.exportUnified = dialog.IsExportUnified();
data.showTilesScheme = dialog.IsTilesScheme();
data.showGrainline = dialog.IsShowGrainline();
ExportData(data);
}
@ -4195,7 +4194,6 @@ 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, bool showGrainline, QPainter *painter,
auto GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter,
const QSharedPointer<QPrinter> &printer, bool &firstPage) -> bool;
void UpdateScaleConnection() const;

View file

@ -54,7 +54,6 @@ 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
@ -341,15 +340,3 @@ 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,9 +103,6 @@ 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,12 +328,6 @@ 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
{
@ -627,7 +621,6 @@ 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,7 +83,6 @@ 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,104 +277,6 @@ 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
{
@ -512,10 +414,18 @@ 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:
@ -535,7 +445,6 @@ 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);
@ -543,26 +452,14 @@ 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;
@ -871,7 +768,6 @@ void DialogSaveLayout::ReadSettings()
else
{
SelectFormat(static_cast<LayoutExportFormats>(settings->GetLayoutExportFormat()));
SetShowGrainline(settings->GetShowGrainline());
}
}
@ -923,7 +819,6 @@ void DialogSaveLayout::WriteSettings() const
else
{
settings->SetLayoutExportFormat(static_cast<qint8>(Format()));
settings->SetShowGrainline(IsShowGrainline());
}
}

View file

@ -56,9 +56,6 @@ 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>544</width>
<height>401</height>
<width>493</width>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
@ -129,19 +129,6 @@
</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, QList<QGraphicsItem *>());
exporter.ExportToSVG(m_sceneDraw);
m_sceneDraw->SetOriginsVisible(true);
@ -6655,7 +6655,6 @@ 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());
@ -6694,7 +6693,6 @@ 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,7 +1116,6 @@ 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)
{
@ -1142,18 +1141,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, details.at(i));
exporter.ExportToSVG(scene);
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, details.at(i));
exporter.ExportToPDF(scene);
break;
case LayoutExportFormats::PNG:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPNG(scene, details.at(i));
exporter.ExportToPNG(scene);
break;
case LayoutExportFormats::OBJ:
paper->setVisible(false);
@ -1163,12 +1162,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, details.at(i));
exporter.ExportToPS(scene);
break;
case LayoutExportFormats::EPS:
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToEPS(scene, details.at(i));
exporter.ExportToEPS(scene);
break;
case LayoutExportFormats::DXF_AC1006_Flat:
paper->setVisible(false);
@ -1227,7 +1226,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, details.at(i));
exporter.ExportToTIF(scene);
break;
default:
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;

View file

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

View file

@ -32,8 +32,6 @@
#include <QGraphicsPathItem>
#include <QPainter>
#include "../vmisc/def.h"
class VGraphicsFillItem : public QGraphicsPathItem
{
public:
@ -51,20 +49,13 @@ public:
* @param option unused
* @param widget unused
*/
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
int type() const override {return Type;}
enum { Type = UserType + static_cast<int>(Layout::GrainlineItem)};
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
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};
};
//---------------------------------------------------------------------------------------------------------------------
@ -79,15 +70,4 @@ 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,7 +49,6 @@
#include "../vmisc/vabstractvalapplication.h"
#include "../ifc/exception/vexception.h"
#include "vprintlayout.h"
#include "vgraphicsfillitem.h"
namespace
{
@ -68,7 +67,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 PrepareDetailsForDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
void PrepareTextForDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
{
for (auto *item : paperItems)
{
@ -95,7 +94,7 @@ void PrepareDetailsForDXF(const QString &placeholder, const QList<QGraphicsItem
*
* @param placeholder placeholder that will be removed from each QGraphicsSimpleTextItem item's text string.
*/
void RestoreDetailsAfterDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
void RestoreTextAfterDXF(const QString &placeholder, const QList<QGraphicsItem *> &paperItems)
{
for (auto *item : paperItems)
{
@ -117,22 +116,8 @@ void RestoreDetailsAfterDXF(const QString &placeholder, const QList<QGraphicsIte
} // namespace
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutExporter::IsShowGrainline() const -> bool
void VLayoutExporter::ExportToSVG(QGraphicsScene *scene) const
{
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);
@ -160,15 +145,11 @@ void VLayoutExporter::ExportToSVG(QGraphicsScene *scene, const QList<QGraphicsIt
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 QList<QGraphicsItem *> &details) const
void VLayoutExporter::ExportToPNG(QGraphicsScene *scene) 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()));
@ -186,15 +167,11 @@ void VLayoutExporter::ExportToPNG(QGraphicsScene *scene, const QList<QGraphicsIt
scene->render(&painter, m_imageRect, m_imageRect, Qt::IgnoreAspectRatio);
image.save(m_fileName);
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToTIF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
void VLayoutExporter::ExportToTIF(QGraphicsScene *scene) 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()));
@ -220,17 +197,14 @@ void VLayoutExporter::ExportToTIF(QGraphicsScene *scene, const QList<QGraphicsIt
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 QList<QGraphicsItem *> &details) const
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene) const
{
ExportToPDF(scene, details, m_fileName);
ExportToPDF(scene, m_fileName);
}
//---------------------------------------------------------------------------------------------------------------------
@ -248,25 +222,25 @@ void VLayoutExporter::ExportToOBJ(QGraphicsScene *scene) const
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
void VLayoutExporter::ExportToPS(QGraphicsScene *scene) const
{
QTemporaryFile tmp;
if (tmp.open())
{
const QString fileName = m_fileName;
ExportToPDF(scene, details, tmp.fileName());
ExportToPDF(scene, tmp.fileName());
PdfToPs(QStringList{tmp.fileName(), fileName});
}
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToEPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
void VLayoutExporter::ExportToEPS(QGraphicsScene *scene) const
{
QTemporaryFile tmp;
if (tmp.open())
{
const QString fileName = m_fileName;
ExportToPDF(scene, details, tmp.fileName());
ExportToPDF(scene, tmp.fileName());
PdfToPs(QStringList{QStringLiteral("-eps"), tmp.fileName(), fileName});
}
}
@ -274,8 +248,7 @@ void VLayoutExporter::ExportToEPS(QGraphicsScene *scene, const QList<QGraphicsIt
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const
{
PrepareDetailsForDXF(endStringPlaceholder, details);
PrepareGrainlineForExport(details, m_showGrainline);
PrepareTextForDXF(endStringPlaceholder, details);
VDxfPaintDevice generator;
generator.SetFileName(m_fileName);
@ -297,8 +270,7 @@ void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphi
}
}
RestoreDetailsAfterDXF(endStringPlaceholder, details);
RestoreGrainlineAfterExport(details);
RestoreTextAfterDXF(endStringPlaceholder, details);
}
//---------------------------------------------------------------------------------------------------------------------
@ -439,11 +411,8 @@ void VLayoutExporter::PdfToPs(const QStringList &params)
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details,
const QString &filename) const
void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QString &filename) const
{
PrepareGrainlineForExport(details, m_showGrainline);
QPrinter printer;
printer.setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
QCoreApplication::applicationVersion());
@ -484,7 +453,6 @@ void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsIt
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);
@ -493,8 +461,6 @@ void VLayoutExporter::ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsIt
painter.scale(m_xScale, m_yScale);
scene->render(&painter, VPrintLayout::SceneTargetRect(&printer, m_imageRect), m_imageRect, Qt::IgnoreAspectRatio);
painter.end();
RestoreGrainlineAfterExport(details);
}
//---------------------------------------------------------------------------------------------------------------------
@ -641,35 +607,3 @@ 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,19 +76,16 @@ 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 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 ExportToSVG(QGraphicsScene *scene) const;
void ExportToPNG(QGraphicsScene *scene) const;
void ExportToTIF(QGraphicsScene *scene) const;
void ExportToPDF(QGraphicsScene *scene) const;
void ExportToOBJ(QGraphicsScene *scene) const;
void ExportToPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToEPS(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToPS(QGraphicsScene *scene) const;
void ExportToEPS(QGraphicsScene *scene) const;
void ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details) const;
void ExportToAAMADXF(const QVector<VLayoutPiece> &details) const;
void ExportToASTMDXF(const QVector<VLayoutPiece> &details) const;
@ -96,11 +93,10 @@ 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);
@ -116,11 +112,10 @@ 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 QList<QGraphicsItem *> &details, const QString &filename) const;
void ExportToPDF(QGraphicsScene *scene, const QString &filename) const;
};
//---------------------------------------------------------------------------------------------------------------------

View file

@ -48,7 +48,6 @@ 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");
@ -150,7 +149,6 @@ 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,7 +47,6 @@ 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,12 +274,6 @@ 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,7 +77,6 @@ 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
@ -972,18 +971,6 @@ 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,9 +235,6 @@ public:
auto GetBackgroundImageDefOpacity() const -> int;
void SetBackgroundImageDefOpacity(int value);
bool GetShowGrainline() const;
void SetShowGrainline(bool value);
private:
Q_DISABLE_COPY_MOVE(VValentinaSettings) // NOLINT