Compare commits

...

11 Commits

Author SHA1 Message Date
Roman Telezhynskyi 5ea7817a02 New option Show mirror line.
Make showing a symmetry line optional. In some cases users don't need it.
2024-04-05 19:54:48 +03:00
Roman Telezhynskyi 812414f0ea Change direction of sheet grainline to avoid user confusion. 2024-04-05 18:17:56 +03:00
Roman Telezhynskyi 34ed181558 Refactoring. 2024-04-05 18:17:14 +03:00
Roman Telezhynskyi 35c99ddf3c Update flipping status when import a piece. 2024-04-05 17:13:35 +03:00
Roman Telezhynskyi 74eb3765bc Fix default tab. 2024-04-05 15:36:59 +03:00
Roman Telezhynskyi 8a2177663c When hide seam line also hide built-in notches. 2024-04-05 15:36:40 +03:00
Roman Telezhynskyi 68555a2d9e Force piece update after import. 2024-04-05 15:28:42 +03:00
Roman Telezhynskyi 6a2b48050f Fix DXF font size. 2024-04-04 19:45:54 +03:00
Roman Telezhynskyi ebf678888e Fix exporting full piece. 2024-04-04 19:00:10 +03:00
Roman Telezhynskyi b3e6365e92 Use the init-statement to declare a variable inside the if statement. 2024-04-04 10:27:15 +03:00
Roman Telezhynskyi f50aec80c3 Separate filters for qbs, qmake and sonar tasks. 2024-04-03 21:00:12 +03:00
36 changed files with 2195 additions and 215 deletions

View File

@ -8,16 +8,22 @@ env:
### Task templates
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
filter_template: &FILTER_TEMPLATE
skip: "!changesInclude('.cirrus.yml', '**.{h,hpp,cpp,c,pro,pri,ts,ui,png,qbs,js}')"
# https://cirrus-ci.org/guide/writing-tasks/#supported-functions
qbs_task_filter: &QBS_TASK_FILTER
skip: "!changesInclude('.cirrus.yml', '**.{h,hpp,cpp,c,ts,ui,png,qbs,js}')"
qmake_task_filter: &QMAKE_TASK_FILTER
skip: "!changesInclude('.cirrus.yml', '**.{h,hpp,cpp,c,pro,pri,ts,ui,png}')"
sonar_task_filter: &SONAR_TASK_FILTER
skip: "!changesInclude('**.{h,hpp,cpp,c}')"
regular_task_template: &REGULER_TASK_TEMPLATE
<< : *FILTER_TEMPLATE
ccache_cache:
folder: "/tmp/ccache_dir"
linux_qt6_task_template: &LINUX_QT6_TASK_TEMPLATE
<< : *QBS_TASK_FILTER
install_script:
- bash -c "$PACKAGE_MANAGER_INSTALL -y qt6-base-dev qt6-l10n-tools libqt6svg6-dev qt6-base-dev-tools qmake6 libxerces-c-dev poppler-utils libgl1-mesa-dev"
- git fetch --tags
@ -44,6 +50,7 @@ linux_qt6_task_template: &LINUX_QT6_TASK_TEMPLATE
- ccache -s
linux_qt6_sonar_task_template: &LINUX_QT6_TASK_SONAR_TEMPLATE
<< : *QBS_TASK_FILTER
install_script:
- bash -c "$PACKAGE_MANAGER_INSTALL -y qt6-base-dev qt6-l10n-tools libqt6svg6-dev qt6-base-dev-tools qmake6 libxerces-c-dev poppler-utils libgl1-mesa-dev"
- git fetch --tags
@ -79,6 +86,7 @@ linux_qt6_sonar_task_template: &LINUX_QT6_TASK_SONAR_TEMPLATE
- ccache -s
linux_qt5_qmake_task_template: &LINUX_QT5_QMAKE_TASK_TEMPLATE
<< : *QMAKE_TASK_FILTER
install_script:
- bash -c "$PACKAGE_MANAGER_INSTALL qtbase5-dev libqt5svg5-dev qttools5-dev-tools libqt5xmlpatterns5-dev libqt5core5a libqt5gui5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5xml5 libqt5xmlpatterns5 poppler-utils"
- git fetch --tags
@ -101,6 +109,7 @@ linux_qt5_qmake_task_template: &LINUX_QT5_QMAKE_TASK_TEMPLATE
- ccache -s
linux_qt5_qbs_task_template: &LINUX_QT5_QBS_TASK_TEMPLATE
<< : *QBS_TASK_FILTER
install_script:
- bash -c "$PACKAGE_MANAGER_INSTALL qtbase5-dev libqt5svg5-dev qttools5-dev-tools libqt5xmlpatterns5-dev libqt5core5a libqt5gui5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5xml5 libqt5xmlpatterns5 poppler-utils"
- git fetch --tags
@ -127,6 +136,7 @@ linux_qt5_qbs_task_template: &LINUX_QT5_QBS_TASK_TEMPLATE
- ccache -s
appimage_task_template: &APPIMAGE_TASK_TEMPLATE
<< : *QBS_TASK_FILTER
pip_cache:
folder: ${PIP_CACHE_DIR}
conan_cache:
@ -192,7 +202,8 @@ linux_task:
COMPILER_REGEX: clang
matrix:
- name: 'latest Clang [Qt5 QMake]'
<< : *LINUX_QT5_QMAKE_TASK_TEMPLATE
<< : *QMAKE_TASK_FILTER
<< : *LINUX_QT5_QMAKE_TASK_TEMPLATE
env:
QT_SELECT: "qt5"
container:
@ -223,7 +234,8 @@ linux_task:
COMPILER_REGEX: "gcc|g\\+\\+"
matrix:
- name: 'GCC 13 [Qt5 QMake]'
<< : *LINUX_QT5_QMAKE_TASK_TEMPLATE
<< : *QMAKE_TASK_FILTER
<< : *LINUX_QT5_QMAKE_TASK_TEMPLATE
env:
QT_SELECT: "qt5"
container:
@ -238,7 +250,7 @@ linux_task:
PIP_CACHE_DIR: ${HOME}/.cache/pip
matrix:
- name: 'AppImage'
<< : *APPIMAGE_TASK_TEMPLATE
<< : *APPIMAGE_TASK_TEMPLATE
env:
ACCESS_TOKEN: ENCRYPTED[81e0b2381ffb628b73f5c94f834010e6631191e0ad03cdd0850d440fb2737a74b68131d842030f010c1bf73ab4cdc1ae]
DEPLOY: "true"
@ -288,6 +300,7 @@ linux_task:
folder: "${HOME}/.sonar/cache"
macos_task_template: &MACOS_TASK_TEMPLATE
<< : *QBS_TASK_FILTER
<< : *REGULER_TASK_TEMPLATE
timeout_in: 120m
env:

View File

@ -132,6 +132,7 @@ void VPLayout::AddPiece(const VPPiecePtr &piece)
if (not oldPiece.isNull())
{
oldPiece->Update(piece);
emit PieceTransformationChanged(oldPiece);
}
else
{

View File

@ -174,6 +174,14 @@ void VPPiece::Update(const VPPiecePtr &piece)
SetFoldLineSVGFontFamily(piece->GetFoldLineSVGFontFamily());
SetFoldLineHeight(piece->GetFoldLineHeight());
SetFoldLineWidth(piece->GetFoldLineWidth());
SetForceFlipping(piece->IsForceFlipping());
SetForbidFlipping(piece->IsForbidFlipping());
SetShowMirrorLine(piece->IsShowMirrorLine());
if ((IsForceFlipping() && !IsVerticallyFlipped()) || (IsForbidFlipping() && IsVerticallyFlipped()))
{
FlipVertically();
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -247,7 +255,7 @@ void VPPiece::RotateToGrainline(const VPTransformationOrigon &origin)
return;
}
QLineF fabricGrainline(grainline.p1().x(), grainline.p1().y(), grainline.p1().x() + 100, grainline.p1().y());
QLineF fabricGrainline(grainline.p1().x(), grainline.p1().y(), grainline.p1().x() - 100, grainline.p1().y());
if (sheet->GrainlineOrientation() == GrainlineType::Vertical)
{
fabricGrainline.setAngle(fabricGrainline.angle() - 90);

View File

@ -843,6 +843,11 @@ void VPGraphicsPiece::PaintPassmarks(QPainter *painter, const VPPiecePtr &piece)
QVector<VLayoutPassmark> const passmarks = piece->GetMappedPassmarks();
for (const auto &passmark : passmarks)
{
if (piece->IsHideMainPath() && passmark.isBuiltIn)
{
continue;
}
QPainterPath passmarkPath;
for (const auto &line : passmark.lines)
{
@ -949,7 +954,7 @@ void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece
if (not piece->IsSeamAllowance() || piece->IsSeamAllowanceBuiltIn())
{
QLineF const seamMirrorLine = piece->GetMappedSeamMirrorLine();
if (!seamMirrorLine.isNull())
if (!seamMirrorLine.isNull() && piece->IsShowMirrorLine())
{
QPainterPath mirrorPath;
mirrorPath.moveTo(seamMirrorLine.p1());
@ -961,7 +966,7 @@ void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece
else if (not piece->IsSeamAllowanceBuiltIn())
{
QLineF const seamAllowanceMirrorLine = piece->GetMappedSeamAllowanceMirrorLine();
if (!seamAllowanceMirrorLine.isNull())
if (!seamAllowanceMirrorLine.isNull() && piece->IsShowMirrorLine())
{
QPainterPath mirrorPath;
mirrorPath.moveTo(seamAllowanceMirrorLine.p1());

View File

@ -808,6 +808,25 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
}
});
connect(ui->checkBoxShowMirrorLine, &QCheckBox::toggled, this,
[this](bool checked)
{
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
if (not selectedPiece.isNull())
{
if (selectedPiece->IsShowMirrorLine() != checked)
{
selectedPiece->SetShowMirrorLine(checked);
LayoutWasSaved(false);
emit m_layout->PieceTransformationChanged(selectedPiece);
}
}
}
});
connect(ui->checkBoxCurrentPieceVerticallyFlipped, &QCheckBox::toggled, this,
[this](bool checked)
{
@ -1314,14 +1333,12 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
ui->groupBoxCurrentPieceInfo->setVisible(false);
ui->groupBoxPieceTransformation->setVisible(false);
ui->groupBoxCurrentPieceSeamline->setVisible(false);
ui->groupBoxCurrentPieceGeometry->setVisible(false);
}
else if (selectedPieces.count() == 1)
{
ui->groupBoxCurrentPieceInfo->setVisible(true);
ui->groupBoxPieceTransformation->setVisible(true);
ui->groupBoxCurrentPieceSeamline->setVisible(true);
ui->groupBoxCurrentPieceGeometry->setVisible(true);
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
@ -1338,6 +1355,9 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
QLineF const seamMirrorLine = selectedPiece->GetSeamMirrorLine();
SetCheckBoxValue(ui->checkBoxShowFullPiece, !seamMirrorLine.isNull() ? selectedPiece->IsShowFullPiece() : true);
ui->checkBoxShowFullPiece->setEnabled(!seamMirrorLine.isNull());
SetCheckBoxValue(ui->checkBoxShowMirrorLine,
!seamMirrorLine.isNull() ? selectedPiece->IsShowMirrorLine() : true);
ui->checkBoxShowMirrorLine->setEnabled(!seamMirrorLine.isNull());
const bool disableFlipping = selectedPiece->IsForbidFlipping() || selectedPiece->IsForceFlipping();
ui->checkBoxCurrentPieceVerticallyFlipped->setDisabled(disableFlipping);
@ -1357,7 +1377,6 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
// show the content "multiple pieces selected"
ui->groupBoxCurrentPieceInfo->setVisible(false);
ui->groupBoxPieceTransformation->setVisible(true);
ui->groupBoxCurrentPieceSeamline->setVisible(false);
ui->groupBoxCurrentPieceGeometry->setVisible(false);
if (not ui->checkBoxRelativeTranslation->isChecked())
@ -2233,24 +2252,26 @@ void VPMainWindow::RotatePiecesToGrainline()
QList<VPSheetPtr> const sheets = m_layout->GetAllSheets();
for (const auto &sheet : sheets)
{
if (not sheet.isNull())
if (sheet.isNull())
{
QList<VPPiecePtr> const pieces = sheet->GetPieces();
for (const auto &piece : pieces)
continue;
}
QList<VPPiecePtr> const pieces = sheet->GetPieces();
for (const auto &piece : pieces)
{
if (not piece.isNull() && piece->IsGrainlineEnabled())
{
if (not piece.isNull() && piece->IsGrainlineEnabled())
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
VPTransformationOrigon origin;
origin.custom = true;
VPTransformationOrigon origin;
origin.custom = true;
QT_WARNING_POP
QT_WARNING_POP
piece->RotateToGrainline(origin);
emit m_layout->PieceTransformationChanged(piece);
}
piece->RotateToGrainline(origin);
emit m_layout->PieceTransformationChanged(piece);
}
}
}

View File

@ -219,7 +219,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="iconSize">
<size>
@ -280,7 +280,7 @@
<x>0</x>
<y>0</y>
<width>378</width>
<height>736</height>
<height>721</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -596,25 +596,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceSeamline">
<property name="title">
<string>Seamline</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceShowSeamline">
<property name="text">
<string>Show Seamline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceGeometry">
<property name="title">
@ -634,6 +615,26 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceShowSeamline">
<property name="text">
<string>Show Seamline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowMirrorLine">
<property name="text">
<string>Show mirror line</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceVerticallyFlipped">
<property name="text">
@ -2415,7 +2416,6 @@
<tabstop>scrollAreaTiles</tabstop>
<tabstop>lineEditCurrentPieceName</tabstop>
<tabstop>plainTextEditCurrentPieceUUID</tabstop>
<tabstop>checkBoxCurrentPieceShowSeamline</tabstop>
<tabstop>checkBoxCurrentPieceVerticallyFlipped</tabstop>
<tabstop>doubleSpinBoxCurrentPieceAngle</tabstop>
<tabstop>doubleSpinBoxCurrentPieceBoxPositionX</tabstop>
@ -2434,8 +2434,8 @@
</resources>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupSheetOrientation"/>
<buttongroup name="buttonGroupRotationDirection"/>
<buttongroup name="buttonGroupSheetOrientation"/>
<buttongroup name="buttonGroupTileOrientation"/>
</buttongroups>
</ui>

View File

@ -962,6 +962,7 @@ void VPLayoutFileReader::ReadMirrorLines(const VPPiecePtr &piece)
ReadAttributeInt(attribs, ML::AttrAlignment, QString::number(static_cast<int>(Qt::AlignHCenter))));
piece->SetFoldLineLabel(ReadAttributeEmptyString(attribs, ML::AttrFoldLineLabel));
piece->SetFoldLineOutlineFont(FontFromString(ReadAttributeEmptyString(attribs, ML::AttrFont)));
piece->SetShowMirrorLine(ReadAttributeBool(attribs, ML::AttrVisible, trueStr));
if (QStringList const svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(','_L1);
!svgFontData.isEmpty())

View File

@ -406,6 +406,8 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
ML::AttrSVGFont,
QStringLiteral("%1,%2").arg(piece->GetFoldLineSVGFontFamily()).arg(piece->GetFoldLineSvgFontSize()),
[piece](const QString &) { return piece->GetFoldLineLabel().isEmpty(); });
SetAttributeOrRemoveIf<bool>(ML::AttrVisible, piece->IsShowMirrorLine(),
[](bool visible) noexcept { return visible; });
if (!seamMirrorLine.isNull())
{

View File

@ -4612,8 +4612,7 @@ void TMainWindow::SetDimensionBases()
{
SCASSERT(control != nullptr)
const qint32 i = control->findData(value);
if (i != -1)
if (const qint32 i = control->findData(value); i != -1)
{
control->setCurrentIndex(i);
}

View File

@ -379,8 +379,7 @@ auto DialogIncrements::GetCustomName() const -> QString
auto DialogIncrements::ClearIncrementName(const QString &name) -> QString
{
QString clear = name;
const auto index = clear.indexOf(CustomIncrSign);
if (index == 0)
if (const auto index = clear.indexOf(CustomIncrSign); index == 0)
{
clear.remove(0, 1);
}
@ -1296,8 +1295,7 @@ void DialogIncrements::InitIncrementUnits(QComboBox *combo)
combo->addItem(units, QVariant(static_cast<int>(IncrUnits::Pattern)));
combo->addItem(tr("Degrees"), QVariant(static_cast<int>(IncrUnits::Degrees)));
int const i = combo->findData(current);
if (i != -1)
if (int const i = combo->findData(current); i != -1)
{
combo->setCurrentIndex(i);
}
@ -1787,8 +1785,7 @@ void DialogIncrements::SaveIncrFormula()
QString const text = textEdit->toPlainText();
QSharedPointer<VIncrement> const incr = m_data->GetVariable<VIncrement>(nameField->text());
QTableWidgetItem *formulaField = table->item(row, 2);
if (formulaField->text() == text)
if (QTableWidgetItem *formulaField = table->item(row, 2); formulaField->text() == text)
{
QTableWidgetItem *result = table->item(row, 1);
if (incr->IsSpecialUnits())
@ -2065,8 +2062,7 @@ void DialogIncrements::showEvent(QShowEvent *event)
}
// do your init stuff here
const QSize sz = VAbstractApplication::VApp()->Settings()->GetIncrementsDialogSize();
if (not sz.isEmpty())
if (const QSize sz = VAbstractApplication::VApp()->Settings()->GetIncrementsDialogSize(); not sz.isEmpty())
{
resize(sz);
}

View File

@ -457,8 +457,7 @@ void DialogLayoutSettings::FindTemplate()
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
{
ui->comboBoxTemplates->blockSignals(true);
const int index = ui->comboBoxTemplates->findData(i);
if (index != -1)
if (const int index = ui->comboBoxTemplates->findData(i); index != -1)
{
ui->comboBoxTemplates->setCurrentIndex(index);
}
@ -468,8 +467,7 @@ void DialogLayoutSettings::FindTemplate()
}
ui->comboBoxTemplates->blockSignals(true);
const int index = ui->comboBoxTemplates->findData(max);
if (index != -1)
if (const int index = ui->comboBoxTemplates->findData(max); index != -1)
{
ui->comboBoxTemplates->setCurrentIndex(index);
}
@ -573,8 +571,7 @@ void DialogLayoutSettings::showEvent(QShowEvent *event)
}
// do your init stuff here
const QSize sz = VAbstractApplication::VApp()->Settings()->GetLayoutSettingsDialogSize();
if (not sz.isEmpty())
if (const QSize sz = VAbstractApplication::VApp()->Settings()->GetLayoutSettingsDialogSize(); not sz.isEmpty())
{
resize(sz);
}
@ -689,8 +686,8 @@ void DialogLayoutSettings::DialogAccepted()
}
else
{
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (printer.isNull())
if (QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
printer.isNull())
{
m_generator->SetPrinterFields(true, GetFields());
}
@ -701,11 +698,10 @@ void DialogLayoutSettings::DialogAccepted()
if (fields.left() < minFields.left() || fields.right() < minFields.right() ||
fields.top() < minFields.top() || fields.bottom() < minFields.bottom())
{
QMessageBox::StandardButton answer;
answer = QMessageBox::question(this, tr("Wrong fields."),
tr("Margins go beyond printing. \n\nApply settings anyway?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (answer == QMessageBox::No)
if (QMessageBox::StandardButton answer = QMessageBox::question(
this, tr("Wrong fields."), tr("Margins go beyond printing. \n\nApply settings anyway?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
answer == QMessageBox::No)
{
SetMinMargins(fields, minFields);
m_generator->SetPrinterFields(true, GetFields());
@ -764,8 +760,8 @@ void DialogLayoutSettings::RestoreDefaults()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::PrinterMargins()
{
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (not printer.isNull())
if (QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
not printer.isNull())
{
SetFields(GetPrinterFields(QSharedPointer<QPrinter>(new QPrinter(printer))));
}
@ -958,8 +954,8 @@ auto DialogLayoutSettings::GetTemplateSize(const PaperSizeTemplate &tmpl, const
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::MinPrinterFields() const -> QMarginsF
{
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (not printer.isNull())
if (QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
not printer.isNull())
{
return GetMinPrinterFields(QSharedPointer<QPrinter>(new QPrinter(printer)));
}
@ -970,8 +966,8 @@ auto DialogLayoutSettings::MinPrinterFields() const -> QMarginsF
//---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::GetDefPrinterFields() const -> QMarginsF
{
QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
if (not printer.isNull())
if (QPrinterInfo const printer = QPrinterInfo::printerInfo(ui->comboBoxPrinter->currentText());
not printer.isNull())
{
return GetPrinterFields(QSharedPointer<QPrinter>(new QPrinter(printer)));
}

View File

@ -101,9 +101,9 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *patt
ui->comboBoxLabelLanguage->addItem(QLocale(name).nativeLanguageName(), name);
}
int const index =
ui->comboBoxLabelLanguage->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
if (index != -1)
if (int const index = ui->comboBoxLabelLanguage->findData(
VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
index != -1)
{
ui->comboBoxLabelLanguage->setCurrentIndex(index);
}
@ -288,10 +288,10 @@ void DialogPatternProperties::SaveDescription()
m_doc->SetPassmarkWidthVariable(ui->lineEditPassmarkWidth->text());
m_doc->SetDefaultPieceLabelPath(ui->lineEditPieceLabelPath->text());
const bool lengthChanged = m_oldPassmarkLength != ui->lineEditPassmarkLength->text();
const bool widthChanged = m_oldPassmarkWidth != ui->lineEditPassmarkWidth->text();
if (lengthChanged || widthChanged)
if (const bool lengthChanged = m_oldPassmarkLength != ui->lineEditPassmarkLength->text();
lengthChanged || widthChanged)
{
emit UpddatePieces();

View File

@ -608,8 +608,8 @@ void VWidgetBackgroundImages::ResetImageTransformationSettings()
}
else if (ui->tabWidgetImageTransformation->indexOf(ui->tabScale) == index)
{ // scale
int const unitIndex = ui->comboBoxScaleUnit->findData(QVariant(static_cast<int>(ScaleUnit::Percent)));
if (unitIndex != -1)
if (int const unitIndex = ui->comboBoxScaleUnit->findData(QVariant(static_cast<int>(ScaleUnit::Percent)));
unitIndex != -1)
{
ui->comboBoxScaleUnit->setCurrentIndex(unitIndex);
}
@ -725,8 +725,7 @@ void VWidgetBackgroundImages::ImagePositionChanged(const QUuid &id)
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
{
QUuid const curentId = item->data(Qt::UserRole).toUuid();
if (curentId != id)
if (QUuid const curentId = item->data(Qt::UserRole).toUuid(); curentId != id)
{
return;
}
@ -972,8 +971,7 @@ auto VWidgetBackgroundImages::ImageWidth() const -> qreal
{
qreal width = 0;
int const row = ui->tableWidget->currentRow();
if (row != -1)
if (int const row = ui->tableWidget->currentRow(); row != -1)
{
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)
@ -992,8 +990,7 @@ auto VWidgetBackgroundImages::ImageHeight() const -> qreal
{
qreal height = 0;
int const row = ui->tableWidget->currentRow();
if (row != -1)
if (int const row = ui->tableWidget->currentRow(); row != -1)
{
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item != nullptr)

View File

@ -305,8 +305,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
QAction *actionDeletePiece = nullptr;
VToolSeamAllowance *toolPiece = nullptr;
QTableWidgetItem *selectedItem = ui->tableWidget->itemAt(pos);
if (selectedItem)
if (QTableWidgetItem *selectedItem = ui->tableWidget->itemAt(pos); selectedItem)
{
QTableWidgetItem *item = ui->tableWidget->item(selectedItem->row(), PieceColumn::InLayout);
const quint32 id = item->data(Qt::UserRole).toUInt();

View File

@ -104,8 +104,7 @@ void VWidgetGroups::SetMultipleGroupsVisibility(const QVector<vidtype> &groups,
continue;
}
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item)
if (QTableWidgetItem *item = ui->tableWidget->item(row, 0); item)
{
const QString resource = QStringLiteral("icon");
item->setIcon(i.value()
@ -134,8 +133,8 @@ auto VWidgetGroups::FilterGroups(const QMap<quint32, VGroupData> &groups) -> QMa
while (i != groups.constEnd())
{
const VGroupData &data = i.value();
QSet<QString> const groupCategories = ConvertToSet<QString>(data.tags);
if (filterCategories.intersects(groupCategories))
if (QSet<QString> const groupCategories = ConvertToSet<QString>(data.tags);
filterCategories.intersects(groupCategories))
{
filtered.insert(i.key(), data);
}

View File

@ -310,8 +310,7 @@ void WarningNotUniquePieceName(const QHash<quint32, VPiece> *allDetails)
while (i != allDetails->constEnd())
{
const QString pieceName = i.value().GetName();
if (not uniqueNames.contains(pieceName))
if (const QString pieceName = i.value().GetName(); not uniqueNames.contains(pieceName))
{
uniqueNames.insert(pieceName);
}
@ -419,11 +418,11 @@ MainWindow::MainWindow(QWidget *parent)
asking = true;
m_mChangesAsked = true;
m_measurementsSyncTimer->stop();
const auto answer = QMessageBox::question(
this, tr("Measurements"),
tr("Measurements were changed. Do you want to sync measurements now?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (answer == QMessageBox::Yes)
if (const auto answer = QMessageBox::question(
this, tr("Measurements"),
tr("Measurements were changed. Do you want to sync measurements now?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
answer == QMessageBox::Yes)
{
SyncMeasurements();
}
@ -564,8 +563,7 @@ void MainWindow::AddPP(const QString &PPName)
SetEnableTool(true);
SetEnableWidgets(true);
const qint32 index = m_comboBoxDraws->findText(PPName);
if (index != -1)
if (const qint32 index = m_comboBoxDraws->findText(PPName); index != -1)
{ // -1 for not found
m_comboBoxDraws->setCurrentIndex(index);
}
@ -836,8 +834,8 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
emit EnableItemMove(false);
m_currentTool = m_lastUsedTool = t;
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
if (settings->GetPointerMode() == VToolPointerMode::ToolIcon)
if (VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->GetPointerMode() == VToolPointerMode::ToolIcon)
{
const QString resource = QStringLiteral("toolcursor");
auto cursorResource = VTheme::GetResourceName(resource, cursor);
@ -2203,8 +2201,7 @@ void MainWindow::ShowMeasurements()
void MainWindow::MeasurementsChanged(const QString &path)
{
m_mChanges = false;
QFileInfo const checkFile(path);
if (checkFile.exists())
if (QFileInfo const checkFile(path); checkFile.exists())
{
m_mChanges = true;
m_mChangesAsked = false;
@ -2498,8 +2495,7 @@ void MainWindow::SetDimensionBases()
control->blockSignals(true);
const qint32 i = control->findData(value);
if (i != -1)
if (const qint32 i = control->findData(value); i != -1)
{
control->setCurrentIndex(i);
}
@ -2684,8 +2680,7 @@ auto MainWindow::SavePatternAs(const QString &fileName) -> bool
return result;
}
const QString oldFilePath = VAbstractValApplication::VApp()->GetPatternPath();
if (not oldFilePath.isEmpty())
if (const QString oldFilePath = VAbstractValApplication::VApp()->GetPatternPath(); not oldFilePath.isEmpty())
{
qCDebug(vMainWindow, "Updating restore file list.");
QStringList restoreFiles = VAbstractValApplication::VApp()->ValentinaSettings()->GetRestoreFileList();
@ -2941,8 +2936,7 @@ void MainWindow::ToolBarDraws()
[this]()
{
QString draw = doc->GetNameActivPP();
bool const ok = PatternPieceName(draw);
if (not ok)
if (bool const ok = PatternPieceName(draw); not ok)
{
return;
}
@ -4251,9 +4245,8 @@ void MainWindow::on_actionCreateManualLayout_triggered()
DialogLayoutScale layoutScale(false, this);
layoutScale.SetXScale(1);
layoutScale.SetYScale(1);
int const res = layoutScale.exec();
if (res == QDialog::Rejected)
if (int const res = layoutScale.exec(); res == QDialog::Rejected)
{
return;
}
@ -4378,8 +4371,7 @@ void MainWindow::ActionExportFontCorrections()
const QString dirPath = settings->GetPathFontCorrections();
bool usedNotExistedDir = false;
QDir const directory(dirPath);
if (not directory.exists())
if (QDir const directory(dirPath); not directory.exists())
{
usedNotExistedDir = directory.mkpath(QChar('.'));
}
@ -4503,8 +4495,7 @@ void MainWindow::FileClosedCorrect()
VAbstractValApplication::VApp()->ValentinaSettings()->SetRestoreFileList(restoreFiles);
// Remove autosave file
QFile autofile(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix);
if (autofile.exists())
if (QFile autofile(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix); autofile.exists())
{
autofile.remove();
}
@ -4752,8 +4743,7 @@ void MainWindow::on_actionNew_triggered()
qCDebug(vMainWindow, "Generated PP name: %s", qUtf8Printable(patternPieceName));
qCDebug(vMainWindow, "First PP");
DialogNewPattern newPattern(pattern, patternPieceName, this);
if (newPattern.exec() == QDialog::Accepted)
if (DialogNewPattern newPattern(pattern, patternPieceName, this); newPattern.exec() == QDialog::Accepted)
{
patternPieceName = newPattern.name();
VAbstractValApplication::VApp()->SetPatternUnits(newPattern.PatternUnit());
@ -4813,8 +4803,7 @@ void MainWindow::DimensionABaseChanged()
if (not VFuzzyComparePossibleNulls(oldValue, m_currentDimensionA))
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
if (dimensions.size() > 1)
if (const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values(); dimensions.size() > 1)
{
MeasurementDimension_p dimension = dimensions.at(1);
InitDimensionGradation(1, dimension, m_dimensionB);
@ -4839,9 +4828,7 @@ void MainWindow::DimensionBBaseChanged()
if (not VFuzzyComparePossibleNulls(oldValue, m_currentDimensionB))
{
const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values();
if (dimensions.size() > 2)
if (const QList<MeasurementDimension_p> dimensions = m_m->Dimensions().values(); dimensions.size() > 2)
{
const MeasurementDimension_p &dimension = dimensions.at(2);
InitDimensionGradation(2, dimension, m_dimensionC);
@ -6635,8 +6622,8 @@ auto MainWindow::GetUnlokedRestoreFileList() -> QStringList
{
QStringList restoreFiles;
// Take all files that need to be restored
QStringList files = VAbstractValApplication::VApp()->ValentinaSettings()->GetRestoreFileList();
if (not files.empty())
if (QStringList files = VAbstractValApplication::VApp()->ValentinaSettings()->GetRestoreFileList();
not files.empty())
{
restoreFiles.reserve(files.size());
for (auto &file : files)
@ -6779,8 +6766,7 @@ void MainWindow::ExportDrawAs(bool checked)
return;
}
QFileInfo const f(fileName);
if (f.suffix().isEmpty() || f.suffix() != "svg"_L1)
if (QFileInfo const f(fileName); f.suffix().isEmpty() || f.suffix() != "svg"_L1)
{
fileName += ".svg"_L1;
}
@ -6977,9 +6963,10 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
const QString text = tr("The measurements file <br/><br/> <b>%1</b> <br/><br/> could not be found. Do you "
"want to update the file location?")
.arg(path);
QMessageBox::StandardButton const res = QMessageBox::question(this, tr("Loading measurements file"), text,
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (res == QMessageBox::No)
if (QMessageBox::StandardButton const res = QMessageBox::question(
this, tr("Loading measurements file"), text, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
res == QMessageBox::No)
{
return {};
}
@ -6998,8 +6985,7 @@ auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QStri
{
QString dirPath;
const QDir patternDir = QFileInfo(patternPath).absoluteDir();
QString measurements = table.fileName();
if (patternDir.exists(measurements))
if (QString measurements = table.fileName(); patternDir.exists(measurements))
{
selectedName = measurements;
dirPath = patternDir.absolutePath();
@ -7209,8 +7195,7 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
}
listDetails = PrepareDetailsForLayout(details);
const bool exportOnlyDetails = expParams->IsExportOnlyDetails();
if (exportOnlyDetails)
if (const bool exportOnlyDetails = expParams->IsExportOnlyDetails(); exportOnlyDetails)
{
try
{
@ -7314,8 +7299,7 @@ auto MainWindow::DoFMExport(const VCommandLinePtr &expParams) -> bool
return false;
}
QFileInfo const info(filePath);
if (info.isRelative())
if (QFileInfo const info(filePath); info.isRelative())
{
filePath = QDir::currentPath() + '/'_L1 + filePath;
}
@ -7496,9 +7480,7 @@ void MainWindow::ProcessCMD()
VAbstractValApplication::VApp()->SetUserMaterials(cmd->OptUserMaterials());
const bool loaded = LoadPattern(args.constFirst(), cmd->OptMeasurePath());
if (not loaded)
if (const bool loaded = LoadPattern(args.constFirst(), cmd->OptMeasurePath()); not loaded)
{
return; // process only one input file
}

View File

@ -499,9 +499,8 @@ void MainWindowsNoGUI::ExportFMeasurementsToCSV()
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails)
{
const LayoutExportFormats format = m_dialogSaveLayout->Format();
if (format == LayoutExportFormats::DXF_AAMA || format == LayoutExportFormats::DXF_ASTM ||
if (const LayoutExportFormats format = m_dialogSaveLayout->Format();
format == LayoutExportFormats::DXF_AAMA || format == LayoutExportFormats::DXF_ASTM ||
format == LayoutExportFormats::RLD || format == LayoutExportFormats::HPGL ||
format == LayoutExportFormats::HPGL2)
{
@ -554,9 +553,9 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes, c
}
VAbstractValApplication::VApp()->ValentinaSettings()->SetPathLayout(path);
const LayoutExportFormats format = m_dialogSaveLayout->Format();
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
if (const LayoutExportFormats format = m_dialogSaveLayout->Format();
format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
{
const QString name = path + '/'_L1 + m_dialogSaveLayout->FileName() + '1'_L1;
PdfTiledFile(name);
@ -927,8 +926,8 @@ auto MainWindowsNoGUI::RecentFileList() const -> QStringList
auto MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const -> QIcon
{
QImage image;
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutSettings->LayoutPapers().at(i));
if (paper)
if (auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutSettings->LayoutPapers().at(i)); paper)
{
if (quality == PreviewQuatilty::Fast)
{

View File

@ -152,6 +152,7 @@ struct VPieceFoldLineData
{
quint32 p1{NULL_ID};
quint32 p2{NULL_ID};
bool mirrorLineVisible{true};
QString heightFormula{};
QString widthFormula{};
QString centerFormula{};
@ -173,6 +174,8 @@ auto ParsePieceMirrorLine(const QDomElement &domElement) -> VPieceFoldLineData
data.p1 = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrMirrorLineP1, NULL_ID_STR);
data.p2 = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrMirrorLineP2, NULL_ID_STR);
data.mirrorLineVisible =
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrMirrorLineVisible, trueStr);
data.heightFormula = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrFoldLineHeightFormula);
data.widthFormula = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrFoldLineWidthFormula);
data.centerFormula = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrFoldLineCenterFormula);
@ -1173,6 +1176,7 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
VPieceFoldLineData const data = futureMirrorLine.result();
detail.SetMirrorLineStartPoint(data.p1);
detail.SetMirrorLineEndPoint(data.p2);
detail.SetShowMirrorLine(data.mirrorLineVisible);
detail.SetManualFoldHeight(data.manualHeight);
detail.SetManualFoldWidth(data.manualWidth);
detail.SetManualFoldCenter(data.manualCenter);

View File

@ -70,6 +70,7 @@
<file>schema/pattern/v0.9.2.xsd</file>
<file>schema/pattern/v0.9.3.xsd</file>
<file>schema/pattern/v0.9.4.xsd</file>
<file>schema/pattern/v0.9.5.xsd</file>
<file>schema/multisize_measurements/v0.3.0.xsd</file>
<file>schema/multisize_measurements/v0.4.0.xsd</file>
<file>schema/multisize_measurements/v0.4.1.xsd</file>
@ -106,6 +107,7 @@
<file>schema/layout/v0.1.6.xsd</file>
<file>schema/layout/v0.1.7.xsd</file>
<file>schema/layout/v0.1.8.xsd</file>
<file>schema/layout/v0.1.9.xsd</file>
<file>schema/known_measurements/v1.0.0.xsd</file>
</qresource>
</RCC>

View File

@ -0,0 +1,648 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="layout">
<xs:complexType>
<xs:sequence>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element type="units" name="unit"/>
<xs:element type="xs:string" name="title"/>
<xs:element type="xs:string" name="description"/>
<xs:element name="control">
<xs:complexType>
<xs:attribute type="xs:boolean" name="warningSuperposition"/>
<xs:attribute type="xs:boolean" name="warningOutOfBound"/>
<xs:attribute type="xs:boolean" name="stickyEdges"/>
<xs:attribute type="xs:boolean" name="followGrainline"/>
<xs:attribute type="xs:boolean" name="boundaryTogetherWithNotches"/>
<xs:attribute type="xs:float" name="piecesGap"/>
<xs:attribute type="xs:boolean" name="cutOnFold"/>
</xs:complexType>
</xs:element>
<xs:element name="tiles">
<xs:complexType>
<xs:sequence>
<xs:element name="size">
<xs:complexType>
<xs:attribute type="xs:float" name="width" use="required"/>
<xs:attribute type="xs:float" name="length" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="margin">
<xs:complexType>
<xs:attribute type="xs:float" name="top"/>
<xs:attribute type="xs:float" name="right"/>
<xs:attribute type="xs:float" name="bottom"/>
<xs:attribute type="xs:float" name="left"/>
<xs:attribute type="xs:boolean" name="ignoreMargins"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="visible"/>
<xs:attribute type="xs:string" name="matchingMarks"/>
<xs:attribute type="xs:boolean" name="printScheme"/>
<xs:attribute type="xs:boolean" name="tileNumber"/>
</xs:complexType>
</xs:element>
<xs:element name="scale">
<xs:complexType>
<xs:attribute type="LayoutScale" name="xScale"/>
<xs:attribute type="LayoutScale" name="yScale"/>
</xs:complexType>
</xs:element>
<xs:element name="watermark">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="showPreview" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="unplacedPieces">
<xs:complexType>
<xs:sequence>
<xs:element name="piece" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="seamLine">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="3" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="seamAllowance">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="LinePathOrEmpty">
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="ArrowDirection" name="arrowDirection" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="notches">
<xs:complexType>
<xs:sequence>
<xs:element name="notch" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
<xs:attribute type="NotchType" name="type" use="optional"/>
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
<xs:attribute type="LinesPath" name="path" use="optional"/>
<xs:attribute type="xs:boolean" name="clockwiseOpening" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="internalPaths">
<xs:complexType>
<xs:sequence>
<xs:element name="internalPath" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="2" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="cut" use="optional"/>
<xs:attribute type="CurvePenStyle" name="penStyle" use="optional"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="markers">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="marker" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="Transformation" name="transform" use="required"/>
<xs:attribute type="MarkerType" name="type" use="required"/>
<xs:attribute type="PointPath" name="center" use="required"/>
<xs:attribute type="RectPath" name="box" use="required"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="labels">
<xs:complexType>
<xs:sequence>
<xs:element name="pieceLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="xs:unsignedInt" name="alignment" use="optional"/>
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="shape" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="patternLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="xs:unsignedInt" name="alignment" use="optional"/>
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="shape" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mirrorLine" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="LinePathOrEmpty" name="seamLine"/>
<xs:element type="LinePathOrEmpty" name="seamAllowance"/>
</xs:sequence>
<xs:attribute name="type" type="foldLineType" use="optional"/>
<xs:attribute name="height" type="xs:double" use="optional"/>
<xs:attribute name="width" type="xs:double" use="optional"/>
<xs:attribute name="center" type="xs:double" use="optional"/>
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
<xs:attribute name="label" type="xs:string" use="optional"/>
<xs:attribute type="xs:string" name="font" use="optional"/>
<xs:attribute type="xs:string" name="svgFont" use="optional"/>
<xs:attribute type="xs:boolean" name="visible" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="uid" type="uuid" use="required"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="verticallyFlipped"/>
<xs:attribute type="xs:boolean" name="horizontallyFlipped"/>
<xs:attribute type="xs:boolean" name="forbidFlipping"/>
<xs:attribute type="xs:boolean" name="forceFlipping"/>
<xs:attribute type="xs:boolean" name="followGrainline"/>
<xs:attribute type="xs:boolean" name="sewLineOnDrawing"/>
<xs:attribute type="Transformation" name="transform"/>
<xs:attribute type="xs:string" name="gradationLabel"/>
<xs:attribute type="xs:unsignedInt" name="copyNumber"/>
<xs:attribute type="xs:boolean" name="showSeamline"/>
<xs:attribute type="xs:float" name="xScale"/>
<xs:attribute type="xs:float" name="yScale"/>
<xs:attribute type="xs:boolean" name="showFullPiece"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sheets">
<xs:complexType>
<xs:sequence>
<xs:element name="sheet" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element name="size">
<xs:complexType>
<xs:attribute type="xs:float" name="width" use="required"/>
<xs:attribute type="xs:float" name="length" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="margin">
<xs:complexType>
<xs:attribute type="xs:float" name="top"/>
<xs:attribute type="xs:float" name="right"/>
<xs:attribute type="xs:float" name="bottom"/>
<xs:attribute type="xs:float" name="left"/>
<xs:attribute type="xs:boolean" name="ignoreMargins"/>
</xs:complexType>
</xs:element>
<xs:element name="pieces">
<xs:complexType>
<xs:sequence>
<xs:element name="piece" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="seamLine">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="3" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="seamAllowance">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="LinePathOrEmpty">
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="ArrowDirection" name="arrowDirection" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="notches">
<xs:complexType>
<xs:sequence>
<xs:element name="notch" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
<xs:attribute type="NotchType" name="type" use="optional"/>
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
<xs:attribute type="LinesPath" name="path" use="optional"/>
<xs:attribute type="xs:boolean" name="clockwiseOpening" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="internalPaths">
<xs:complexType>
<xs:sequence>
<xs:element name="internalPath" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="2" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="cut" use="optional"/>
<xs:attribute type="CurvePenStyle" name="penStyle" use="optional"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="markers">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="marker" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="Transformation" name="transform" use="required"/>
<xs:attribute type="MarkerType" name="type" use="required"/>
<xs:attribute type="PointPath" name="center" use="required"/>
<xs:attribute type="RectPath" name="box" use="required"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="labels">
<xs:complexType>
<xs:sequence>
<xs:element name="pieceLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="PathNotEmpty" name="shape" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="patternLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="PathNotEmpty" name="shape" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mirrorLine" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="LinePathOrEmpty" name="seamLine"/>
<xs:element type="LinePathOrEmpty" name="seamAllowance"/>
</xs:sequence>
<xs:attribute name="type" type="foldLineType" use="optional"/>
<xs:attribute name="height" type="xs:double" use="optional"/>
<xs:attribute name="width" type="xs:double" use="optional"/>
<xs:attribute name="center" type="xs:double" use="optional"/>
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
<xs:attribute name="label" type="xs:string" use="optional"/>
<xs:attribute type="xs:string" name="font" use="optional"/>
<xs:attribute type="xs:string" name="svgFont" use="optional"/>
<xs:attribute type="xs:boolean" name="visible" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="uid" type="uuid" use="required"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="verticallyFlipped"/>
<xs:attribute type="xs:boolean" name="horizontallyFlipped"/>
<xs:attribute type="xs:boolean" name="forbidFlipping"/>
<xs:attribute type="xs:boolean" name="forceFlipping"/>
<xs:attribute type="xs:boolean" name="followGrainline"/>
<xs:attribute type="xs:boolean" name="sewLineOnDrawing"/>
<xs:attribute type="Transformation" name="transform"/>
<xs:attribute type="xs:string" name="gradationLabel"/>
<xs:attribute type="xs:unsignedInt" name="copyNumber"/>
<xs:attribute type="xs:boolean" name="showSeamline"/>
<xs:attribute type="xs:float" name="xScale"/>
<xs:attribute type="xs:float" name="yScale"/>
<xs:attribute type="xs:float" name="zValue"/>
<xs:attribute type="xs:boolean" name="showFullPiece"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="GrainlineType" name="grainlineType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="formatVersion" name="version" use="required"/>
</xs:complexType>
</xs:element>
<!--Types-->
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">
<xs:restriction base="xs:string">
<xs:pattern value="|\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ArrowDirection">
<xs:restriction base="xs:string">
<xs:enumeration value="oneWayUp"/>
<xs:enumeration value="oneWayDown"/>
<xs:enumeration value="twoWaysUpDown"/>
<xs:enumeration value="fourWays"/>
<xs:enumeration value="twoWaysUpLeft"/>
<xs:enumeration value="twoWaysUpRight"/>
<xs:enumeration value="twoWaysDownLeft"/>
<xs:enumeration value="twoWaysDownRight"/>
<xs:enumeration value="threeWaysUpDownLeft"/>
<xs:enumeration value="threeWaysUpDownRight"/>
<xs:enumeration value="threeWaysUpLeftRight"/>
<xs:enumeration value="threeWaysDownLeftRight"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="NotchType">
<xs:restriction base="xs:unsignedInt">
<!--OneLine-->
<xs:enumeration value="0"/>
<!--TwoLines-->
<xs:enumeration value="1"/>
<!--ThreeLines-->
<xs:enumeration value="2"/>
<!--TMark-->
<xs:enumeration value="3"/>
<!--VMark-->
<xs:enumeration value="4"/>
<!--VMark2-->
<xs:enumeration value="5"/>
<!--UMark-->
<xs:enumeration value="6"/>
<!--BoxMark-->
<xs:enumeration value="7"/>
<!--CheckMark-->
<xs:enumeration value="8"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="CurvePenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="hair"/>
<xs:enumeration value="dashLine"/>
<xs:enumeration value="dotLine"/>
<xs:enumeration value="dashDotLine"/>
<xs:enumeration value="dashDotDotLine"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="MarkerType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--Segment-->
<xs:enumeration value="1"/><!--Rectangle-->
<xs:enumeration value="2"/><!--Cross-->
<xs:enumeration value="3"/><!--Tshaped-->
<xs:enumeration value="4"/><!--Doubletree-->
<xs:enumeration value="5"/><!--Corner-->
<xs:enumeration value="6"/><!--Triangle-->
<xs:enumeration value="7"/><!--Hshaped-->
<xs:enumeration value="8"/><!--Button-->
<xs:enumeration value="9"/><!--Circle-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AlignmentType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--default (no aligns)-->
<xs:enumeration value="1"/><!--aligns with the left edge-->
<xs:enumeration value="2"/><!--aligns with the right edge-->
<xs:enumeration value="4"/><!--Centers horizontally in the available space-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Transformation">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?;){8,}[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PathNotEmpty">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?\s){0,}[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PathOrEmpty">
<xs:restriction base="xs:string">
<xs:pattern value="|([-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?\s){0,}[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LinePathOrEmpty">
<xs:restriction base="xs:string">
<xs:pattern value="|[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LinePath">
<xs:restriction base="xs:string">
<xs:pattern value="[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LinesPath">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?\*){0,}[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PointPath">
<xs:restriction base="xs:string">
<xs:pattern value="[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RectPath">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?;){3,}[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="GrainlineType">
<xs:restriction base="xs:string">
<xs:enumeration value="horizontal"/>
<xs:enumeration value="vertical"/>
<xs:enumeration value="notFixed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LayoutScale">
<xs:restriction base="xs:float">
<xs:minInclusive value="0.01"/>
<xs:maxInclusive value="3"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="foldLineType">
<xs:restriction base="xs:string">
<xs:enumeration value="2ArrowsTextAbove"/><!--Same as default-->
<xs:enumeration value="2ArrowsTextUnder"/>
<xs:enumeration value="2Arrows"/>
<xs:enumeration value="text"/>
<xs:enumeration value="3dots"/>
<xs:enumeration value="3X"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

File diff suppressed because it is too large Load Diff

View File

@ -157,6 +157,7 @@ const QString VAbstractPattern::AttrDimensionB = QStringLiteral("dimensionB");
const QString VAbstractPattern::AttrDimensionC = QStringLiteral("dimensionC");
const QString VAbstractPattern::AttrMirrorLineP1 = QStringLiteral("p1");
const QString VAbstractPattern::AttrMirrorLineP2 = QStringLiteral("p2");
const QString VAbstractPattern::AttrMirrorLineVisible = QStringLiteral("visible");
const QString VAbstractPattern::AttrFoldLineHeightFormula = QStringLiteral("height");
const QString VAbstractPattern::AttrFoldLineWidthFormula = QStringLiteral("width");
const QString VAbstractPattern::AttrFoldLineCenterFormula = QStringLiteral("center");

View File

@ -391,6 +391,7 @@ public:
static const QString AttrDimensionC;
static const QString AttrMirrorLineP1;
static const QString AttrMirrorLineP2;
static const QString AttrMirrorLineVisible;
static const QString AttrFoldLineHeightFormula;
static const QString AttrFoldLineWidthFormula;
static const QString AttrFoldLineCenterFormula;

View File

@ -45,8 +45,8 @@ using namespace Qt::Literals::StringLiterals;
*/
const QString VLayoutConverter::LayoutMinVerStr = QStringLiteral("0.1.0");
const QString VLayoutConverter::LayoutMaxVerStr = QStringLiteral("0.1.8");
const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout/v0.1.8.xsd");
const QString VLayoutConverter::LayoutMaxVerStr = QStringLiteral("0.1.9");
const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout/v0.1.9.xsd");
// VLayoutConverter::LayoutMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
// VLayoutConverter::LayoutMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -152,7 +152,8 @@ auto VLayoutConverter::XSDSchemas() -> QHash<unsigned int, QString>
std::make_pair(FormatVersion(0, 1, 5), QStringLiteral("://schema/layout/v0.1.5.xsd")),
std::make_pair(FormatVersion(0, 1, 6), QStringLiteral("://schema/layout/v0.1.6.xsd")),
std::make_pair(FormatVersion(0, 1, 7), QStringLiteral("://schema/layout/v0.1.7.xsd")),
std::make_pair(FormatVersion(0, 1, 8), CurrentSchema),
std::make_pair(FormatVersion(0, 1, 8), QStringLiteral("://schema/layout/v0.1.8.xsd")),
std::make_pair(FormatVersion(0, 1, 9), CurrentSchema),
};
return schemas;
@ -193,10 +194,11 @@ void VLayoutConverter::ApplyPatches()
ToV0_1_7();
Q_FALLTHROUGH();
case (FormatVersion(0, 1, 7)):
ToV0_1_8();
case (FormatVersion(0, 1, 8)):
ToV0_1_9();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 1, 8)):
case (FormatVersion(0, 1, 9)):
break;
default:
InvalidVersion(m_ver);
@ -437,11 +439,11 @@ void VLayoutConverter::ToV0_1_7()
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::ToV0_1_8()
void VLayoutConverter::ToV0_1_9()
{
// TODO. Delete if minimal supported version is 0.1.8
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 8), "Time to refactor the code.");
// TODO. Delete if minimal supported version is 0.1.9
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 9), "Time to refactor the code.");
SetVersion(QStringLiteral("0.1.8"));
SetVersion(QStringLiteral("0.1.9"));
Save();
}

View File

@ -47,7 +47,7 @@ public:
static const QString LayoutMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned LayoutMinVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 8);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 9);
static auto XSDSchemas() -> QHash<unsigned, QString>;
@ -77,7 +77,7 @@ protected:
void ToV0_1_3();
void ToV0_1_5();
void ToV0_1_7();
void ToV0_1_8();
void ToV0_1_9();
private:
Q_DISABLE_COPY_MOVE(VLayoutConverter) // NOLINT

View File

@ -62,8 +62,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4"); // NOLINT
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.9.4"); // NOLINT
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.9.4.xsd"); // NOLINT
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.9.5"); // NOLINT
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.9.5.xsd"); // NOLINT
// VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
// VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -265,7 +265,8 @@ auto VPatternConverter::XSDSchemas() -> QHash<unsigned int, QString>
std::make_pair(FormatVersion(0, 9, 1), QStringLiteral("://schema/pattern/v0.9.1.xsd")),
std::make_pair(FormatVersion(0, 9, 2), QStringLiteral("://schema/pattern/v0.9.2.xsd")),
std::make_pair(FormatVersion(0, 9, 3), QStringLiteral("://schema/pattern/v0.9.3.xsd")),
std::make_pair(FormatVersion(0, 9, 4), CurrentSchema)};
std::make_pair(FormatVersion(0, 9, 4), QStringLiteral("://schema/pattern/v0.9.4.xsd")),
std::make_pair(FormatVersion(0, 9, 5), CurrentSchema)};
return schemas;
}
@ -386,10 +387,11 @@ void VPatternConverter::ApplyPatches()
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 2)):
case (FormatVersion(0, 9, 3)):
ToV0_9_4();
case (FormatVersion(0, 9, 4)):
ToV0_9_5();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 4)):
case (FormatVersion(0, 9, 5)):
break;
default:
InvalidVersion(m_ver);
@ -407,7 +409,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
auto VPatternConverter::IsReadOnly() const -> bool
{
// Check if attribute readOnly was not changed in file format
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 4), "Check attribute readOnly.");
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 5), "Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
// For now position is the same for all supported format versions.
@ -583,12 +585,12 @@ void VPatternConverter::ToV0_9_2()
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_9_4()
void VPatternConverter::ToV0_9_5()
{
// TODO. Delete if minimal supported version is 0.9.4
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 4), "Time to refactor the code.");
// TODO. Delete if minimal supported version is 0.9.5
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 5), "Time to refactor the code.");
SetVersion(QStringLiteral("0.9.4"));
SetVersion(QStringLiteral("0.9.5"));
Save();
}
@ -1035,8 +1037,8 @@ auto VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, co
// TODO. Delete if minimal supported version is 0.2.0
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
auto *cal = new qmu::QmuTokenParser(formula, false, false); // Eval formula
QMap<vsizetype, QString> tokens = cal->GetTokens(); // Tokens (variables, measurements)
auto *cal = new qmu::QmuTokenParser(formula, false, false); // Eval formula
QMap<vsizetype, QString> tokens = cal->GetTokens(); // Tokens (variables, measurements)
delete cal;
QList<vsizetype> tKeys = tokens.keys(); // Take all tokens positions

View File

@ -54,7 +54,7 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 5);
static auto XSDSchemas() -> QHash<unsigned, QString>;
@ -91,7 +91,7 @@ private:
void ToV0_9_0();
void ToV0_9_1();
void ToV0_9_2();
void ToV0_9_4();
void ToV0_9_5();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -915,7 +915,7 @@ void VDxfEngine::ExportAAMADraw(const QSharedPointer<dx_ifaceBlock> &detailBlock
if (detail.IsShowFullPiece())
{
const QLineF mirrorLine = detail.GetMappedSeamAllowanceMirrorLine();
if (not mirrorLine.isNull())
if (not mirrorLine.isNull() && detail.IsShowMirrorLine())
{
if (DRW_Entity *e = AAMALine(mirrorLine, *layer8))
{
@ -1166,12 +1166,12 @@ void VDxfEngine::ExportPieceText(const QSharedPointer<dx_ifaceBlock> &detailBloc
const QFont fnt = LineFont(tl, tm.GetFont());
QFontMetrics const fm(fnt);
if (dY + fm.height() > dH)
if (dY + fm.height() * scale / 2 > dH)
{
break;
}
dY += fm.height();
dY += fm.height() * scale / 2;
const qreal dX = LineAlign(tl, tl.m_qsText, fm, dW);
QTransform const lineMatrix = LineMatrix(detail, labelShape.at(0), angle, QPointF(dX, dY), maxLineWidth);
@ -1183,7 +1183,7 @@ void VDxfEngine::ExportPieceText(const QSharedPointer<dx_ifaceBlock> &detailBloc
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
textLine->secPoint =
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
textLine->height = FromPixel(fm.ascent() * scale, m_varInsunits);
textLine->height = FromPixel(fm.ascent() * scale / 2, m_varInsunits);
textLine->layer = *layer1;
textLine->text = tl.m_qsText.toStdString();
textLine->style = m_input->AddFont(fnt);
@ -1235,7 +1235,7 @@ void VDxfEngine::ExportAnnotationText(const QSharedPointer<dx_ifaceBlock> &detai
qreal const width = fm.horizontalAdvance(labelData.label);
QLineF base(pos, QPointF(pos.x() + 100, pos.y()));
base.setAngle(base.angle() - 90);
base.setAngle(base.angle() - 180);
base.setLength(height);
pos = base.p2();
@ -1262,7 +1262,7 @@ void VDxfEngine::ExportAnnotationText(const QSharedPointer<dx_ifaceBlock> &detai
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
text->secPoint =
DRW_Coord(FromPixel(pos.x(), m_varInsunits), FromPixel(GetSize().height() - pos.y(), m_varInsunits), 0);
text->height = FromPixel(height, m_varInsunits);
text->height = FromPixel(height / 2, m_varInsunits);
text->layer = layer;
text->text = labelData.label.toStdString();
text->style = m_input->AddFont(labelData.font);
@ -1776,7 +1776,7 @@ void VDxfEngine::ExportASTMMirrorLine(const QSharedPointer<dx_ifaceBlock> &detai
if (DRW_Entity *e = AAMALine(mirrorLine, layer))
{
if (isShowFullPiece)
if (isShowFullPiece && detail.IsShowMirrorLine())
{
e->lineType = dx_iface::QtPenStyleToString(Qt::DashDotLine);
}

View File

@ -531,7 +531,8 @@ void VHPGLEngine::PlotPlaceLabels(QTextStream &out, const VLayoutPiece &detail)
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point)
{ return VAbstractPiece::MapPoint(point, matrix); });
}
PlotShape(shape);
@ -603,7 +604,7 @@ void VHPGLEngine::PlotMirrorLine(QTextStream &out, const VLayoutPiece &detail)
if (detail.IsShowFullPiece())
{
const QLineF mirrorLine = detail.GetMappedSeamAllowanceMirrorLine();
if (not mirrorLine.isNull())
if (not mirrorLine.isNull() && detail.IsShowMirrorLine())
{
PlotPath(out, CastToPoint(ConvertPath<QPointF>({mirrorLine.p1(), mirrorLine.p2()})), Qt::DashDotLine);
}

View File

@ -1598,6 +1598,18 @@ void VAbstractPiece::SetFoldLineLabelAlignment(int alignment)
d->m_foldLineLabelAlignment = alignment;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsShowMirrorLine() const
{
return d->m_showMirrorLine;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPiece::SetShowMirrorLine(bool show)
{
d->m_showMirrorLine = show;
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::GetUUID() const -> QUuid
{

View File

@ -135,6 +135,9 @@ public:
auto GetFoldLineLabelAlignment() const -> int;
void SetFoldLineLabelAlignment(int alignment);
auto IsShowMirrorLine() const -> bool;
void SetShowMirrorLine(bool show);
auto GetUUID() const -> QUuid;
void SetUUID(const QUuid &uuid);
void SetUUID(const QString &uuid);

View File

@ -73,6 +73,7 @@ public:
bool m_foldLineLabelFontBold{false}; // NOLINT (misc-non-private-member-variables-in-classes)
QString m_foldLineLabel{}; // NOLINT (misc-non-private-member-variables-in-classes)
int m_foldLineLabelAlignment{Qt::AlignHCenter}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_showMirrorLine{true}; // NOLINT (misc-non-private-member-variables-in-classes)
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
FoldLineType m_foldLineType{FoldLineType::TwoArrowsTextAbove};
@ -81,7 +82,7 @@ private:
Q_DISABLE_ASSIGN_MOVE(VAbstractPieceData) // NOLINT
static constexpr quint32 streamHeader = 0x05CDD73A; // CRC-32Q string "VAbstractPieceData"
static constexpr quint16 classVersion = 6;
static constexpr quint16 classVersion = 7;
};
QT_WARNING_POP
@ -124,6 +125,9 @@ inline auto operator<<(QDataStream &dataStream, const VAbstractPieceData &piece)
dataStream << piece.m_foldLineLabel;
dataStream << piece.m_foldLineLabelAlignment;
// Added in classVersion = 7
dataStream << piece.m_showMirrorLine;
return dataStream;
}
@ -197,6 +201,11 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD
dataStream >> piece.m_foldLineLabelAlignment;
}
if (actualClassVersion >= 7)
{
dataStream >> piece.m_showMirrorLine;
}
return dataStream;
}

View File

@ -669,6 +669,7 @@ auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pat
det.SetShowFullPiece(piece.IsShowFullPiece());
det.SetSeamMirrorLine(piece.SeamMirrorLine(pattern));
det.SetSeamAllowanceMirrorLine(piece.SeamAllowanceMirrorLine(pattern));
det.SetShowMirrorLine(piece.IsShowMirrorLine());
det.SetId(id);
if (not futureSeamAllowanceValid.result())
@ -2243,7 +2244,7 @@ auto VLayoutPiece::GetMainPathItem() const -> QGraphicsPathItem *
QPainterPath path;
// contour
QVector<VLayoutPoint> const points = GetMappedContourPoints();
QVector<VLayoutPoint> const points = GetMappedFullContourPoints();
path.moveTo(points.at(0));
for (qint32 i = 1; i < points.count(); ++i)

View File

@ -763,6 +763,8 @@ void DialogSeamAllowance::InitFold(const VPiece &piece)
uiTabPaths->checkBoxShowFullPiece->setChecked(piece.IsShowFullPiece());
}
uiTabPaths->checkBoxShowMirrorLine->setChecked(piece.IsShowMirrorLine());
InitMirrorLine();
{
@ -1070,7 +1072,7 @@ void DialogSeamAllowance::DetailUUIDChanged()
if (edit)
{
static QRegularExpression const re("^$|^{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-"
"[0-9a-fA-F]{12}}$");
"[0-9a-fA-F]{12}}$");
QRegularExpressionMatch const match = re.match(edit->text());
if (match.hasMatch())
@ -3268,6 +3270,7 @@ auto DialogSeamAllowance::CreatePiece() const -> VPiece
piece.GetPieceLabelData().SetFontSize(uiTabLabels->comboBoxPieceLabelSize->currentData().toInt());
piece.SetMirrorLineStartPoint(GetMirrorLineStartPoint());
piece.SetMirrorLineEndPoint(GetMirrorLineEndPoint());
piece.SetShowMirrorLine(uiTabPaths->checkBoxShowMirrorLine->isChecked());
piece.SetShowFullPiece(
!piece.SeamAllowanceMirrorLine(data).isNull() ? uiTabPaths->checkBoxShowFullPiece->isChecked() : true);
piece.SetManualFoldHeight(uiTabFoldLine->groupBoxManualHeight->isChecked());
@ -5428,12 +5431,11 @@ void DialogSeamAllowance::EditPatternLabel()
{
if (m_patternLabelDataChanged && m_askSavePatternLabelData)
{
QMessageBox::StandardButton const answer = QMessageBox::question(
this, tr("Save label data."),
tr("Label data were changed. Do you want to save them before editing label template?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (answer == QMessageBox::Yes)
if (QMessageBox::StandardButton const answer = QMessageBox::question(
this, tr("Save label data."),
tr("Label data were changed. Do you want to save them before editing label template?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
answer == QMessageBox::Yes)
{
SavePatternLabelData();
}

View File

@ -203,27 +203,41 @@
<property name="title">
<string>Mirror line</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelMLStartPoint">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelMLStartPoint">
<property name="text">
<string>Start point:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMLStartPoint"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelMLEndPoint">
<property name="text">
<string>End point:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxMLEndPoint"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowMirrorLine">
<property name="text">
<string>Start point:</string>
<string>Show mirror line</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMLStartPoint"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelMLEndPoint">
<property name="text">
<string>End point:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxMLEndPoint"/>
</item>
</layout>
</widget>
</item>

View File

@ -819,6 +819,8 @@ void VToolSeamAllowance::AddMirrorLine(VAbstractPattern *doc, QDomElement &domEl
[](const QString &label) noexcept { return label.isEmpty(); });
doc->SetAttributeOrRemoveIf<int>(domData, VDomDocument::AttrAlignment, piece.GetFoldLineLabelAlignment(),
[](int alignment) noexcept { return alignment == Qt::AlignHCenter; });
doc->SetAttributeOrRemoveIf<bool>(domData, VAbstractPattern::AttrMirrorLineVisible, piece.IsShowMirrorLine(),
[](bool visible) noexcept { return visible; });
domElement.appendChild(domData);
}
@ -1776,7 +1778,7 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
[this, detail]()
{
QLineF const mirrorLine = detail.SeamAllowanceMirrorLine(getData());
if (detail.IsShowFullPiece() && !mirrorLine.isNull())
if (detail.IsShowFullPiece() && detail.IsShowMirrorLine() && !mirrorLine.isNull())
{
QPainterPath path;
path.moveTo(mirrorLine.p1());
@ -2525,8 +2527,8 @@ auto VToolSeamAllowance::IsGrainlinePositionValid() const -> bool
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
QVector<QPointF> contourPoints;
detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn()
? CastTo(detail.SeamAllowancePoints(getData()), contourPoints)
: CastTo(detail.MainPathPoints(getData()), contourPoints);
? CastTo(detail.FullSeamAllowancePoints(getData()), contourPoints)
: CastTo(detail.FullMainPathPoints(getData()), contourPoints);
return grainLine.IsPositionValid(contourPoints);
}