diff --git a/share/translations/seamly2d_cs_CZ.ts b/share/translations/seamly2d_cs_CZ.ts
index 78b428d837e3..ad85567a4322 100644
--- a/share/translations/seamly2d_cs_CZ.ts
+++ b/share/translations/seamly2d_cs_CZ.ts
@@ -6928,12 +6928,7 @@ Chcete uložit své změny?
-
-
-
-
-
-
+
@@ -8314,7 +8309,12 @@ Chcete uložit své změny?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_de_DE.ts b/share/translations/seamly2d_de_DE.ts
index 002322e1de44..8da1dd90cfe0 100644
--- a/share/translations/seamly2d_de_DE.ts
+++ b/share/translations/seamly2d_de_DE.ts
@@ -6934,12 +6934,7 @@ Sollen die Änderungen gespeichert werden?
Nur lesen
-
-
- Enthält Informationen über Schritte und interne Variablen
-
-
-
+
Individuell laden
@@ -8315,7 +8310,12 @@ Sollen die Änderungen gespeichert werden?
Layout exportieren (E, L)
-
+
+
+
+
+
+
Alt+M
diff --git a/share/translations/seamly2d_el_GR.ts b/share/translations/seamly2d_el_GR.ts
index f225ff044de5..87e06c134a2b 100644
--- a/share/translations/seamly2d_el_GR.ts
+++ b/share/translations/seamly2d_el_GR.ts
@@ -6928,12 +6928,7 @@ Do you want to save your changes?
μόνο για ανάγνωση
-
-
-
-
-
-
+
Φόρτωση Ατομικών
@@ -8314,7 +8309,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_en_CA.ts b/share/translations/seamly2d_en_CA.ts
index 02b4927a9c79..cb81ebb92fb8 100644
--- a/share/translations/seamly2d_en_CA.ts
+++ b/share/translations/seamly2d_en_CA.ts
@@ -6931,12 +6931,7 @@ Do you want to save your changes?
read only
-
-
- Contains information about increments and internal variables
-
-
-
+
Load Individual
@@ -8317,7 +8312,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_en_GB.ts b/share/translations/seamly2d_en_GB.ts
index 68836b1a2b4b..942647fd6e8e 100644
--- a/share/translations/seamly2d_en_GB.ts
+++ b/share/translations/seamly2d_en_GB.ts
@@ -6931,12 +6931,7 @@ Do you want to save your changes?
-
-
-
-
-
-
+
@@ -8317,7 +8312,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_en_IN.ts b/share/translations/seamly2d_en_IN.ts
index ab54549d9f59..ef92456937fc 100644
--- a/share/translations/seamly2d_en_IN.ts
+++ b/share/translations/seamly2d_en_IN.ts
@@ -6931,12 +6931,7 @@ Do you want to save your changes?
read only
-
-
- Contains information about increments and internal variables
-
-
-
+
Load Individual
@@ -8317,7 +8312,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_en_US.ts b/share/translations/seamly2d_en_US.ts
index d1017029fb19..771a5e45a007 100644
--- a/share/translations/seamly2d_en_US.ts
+++ b/share/translations/seamly2d_en_US.ts
@@ -6931,12 +6931,7 @@ Do you want to save your changes?
-
-
-
-
-
-
+
@@ -8317,7 +8312,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_es_ES.ts b/share/translations/seamly2d_es_ES.ts
index a45c9e7492a1..3aa482fe78d1 100644
--- a/share/translations/seamly2d_es_ES.ts
+++ b/share/translations/seamly2d_es_ES.ts
@@ -6975,12 +6975,7 @@ Do you want to save your changes?
sólo lectura
-
-
- Contiene información sobre incrementos y variables internas
-
-
-
+
Cargar medidas individuales
@@ -8351,7 +8346,12 @@ Do you want to save your changes?
Exportar Maquetación (E, L)
-
+
+
+
+
+
+
Alt+M
diff --git a/share/translations/seamly2d_fi_FI.ts b/share/translations/seamly2d_fi_FI.ts
index 93acdcbc5941..17e609ca08ea 100644
--- a/share/translations/seamly2d_fi_FI.ts
+++ b/share/translations/seamly2d_fi_FI.ts
@@ -6928,12 +6928,7 @@ Haluatko tallentaa muutokset?
-
-
-
-
-
-
+
@@ -8314,7 +8309,12 @@ Haluatko tallentaa muutokset?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_fr_FR.ts b/share/translations/seamly2d_fr_FR.ts
index 3d03927bcaee..be5c6ff2e685 100644
--- a/share/translations/seamly2d_fr_FR.ts
+++ b/share/translations/seamly2d_fr_FR.ts
@@ -6931,12 +6931,7 @@ Voulez-vous sauvegarder les changements?
Lecture seule
-
-
-
-
-
-
+
@@ -8317,7 +8312,12 @@ Voulez-vous sauvegarder les changements?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_he_IL.ts b/share/translations/seamly2d_he_IL.ts
index 662b8d9dddc1..e7ca5f1fe335 100644
--- a/share/translations/seamly2d_he_IL.ts
+++ b/share/translations/seamly2d_he_IL.ts
@@ -6927,12 +6927,7 @@ Do you want to save your changes?
-
-
-
-
-
-
+
@@ -8313,7 +8308,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_id_ID.ts b/share/translations/seamly2d_id_ID.ts
index c7c8891e4614..3abe5f2a7a28 100644
--- a/share/translations/seamly2d_id_ID.ts
+++ b/share/translations/seamly2d_id_ID.ts
@@ -6928,12 +6928,7 @@ Apakah anda ingin menyimpan perubahan anda?
-
-
-
-
-
-
+
@@ -8314,7 +8309,12 @@ Apakah anda ingin menyimpan perubahan anda?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_it_IT.ts b/share/translations/seamly2d_it_IT.ts
index de3a8ca2a94c..5072da9239dd 100644
--- a/share/translations/seamly2d_it_IT.ts
+++ b/share/translations/seamly2d_it_IT.ts
@@ -6931,12 +6931,7 @@ Vuoi salvare i cambiamenti?
-
-
-
-
-
-
+
@@ -8317,7 +8312,12 @@ Vuoi salvare i cambiamenti?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_nl_NL.ts b/share/translations/seamly2d_nl_NL.ts
index 15c04fc86520..f223de1f045c 100644
--- a/share/translations/seamly2d_nl_NL.ts
+++ b/share/translations/seamly2d_nl_NL.ts
@@ -6936,12 +6936,7 @@ Wil je de veranderingen opslaan?
alleen lezen
-
-
- Bevat informatie over vergroten/verkleinen en interne variabelen
-
-
-
+
Laad individueel
@@ -8322,7 +8317,12 @@ Wil je de veranderingen opslaan?
Exporteer Opmaak (E, L)
-
+
+
+
+
+
+
Alt+M
diff --git a/share/translations/seamly2d_pt_BR.ts b/share/translations/seamly2d_pt_BR.ts
index f8ec9cfd19ae..2f7ebb4a6300 100644
--- a/share/translations/seamly2d_pt_BR.ts
+++ b/share/translations/seamly2d_pt_BR.ts
@@ -6927,12 +6927,7 @@ Do you want to save your changes?
-
-
-
-
-
-
+
@@ -8313,7 +8308,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_ro_RO.ts b/share/translations/seamly2d_ro_RO.ts
index a58d02a0474c..64abefdc00dd 100644
--- a/share/translations/seamly2d_ro_RO.ts
+++ b/share/translations/seamly2d_ro_RO.ts
@@ -6927,12 +6927,7 @@ Do you want to save your changes?
-
-
-
-
-
-
+
@@ -8313,7 +8308,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_ru_RU.ts b/share/translations/seamly2d_ru_RU.ts
index 8c39f0717217..97da7f2d9253 100644
--- a/share/translations/seamly2d_ru_RU.ts
+++ b/share/translations/seamly2d_ru_RU.ts
@@ -6955,12 +6955,7 @@ Do you want to save your changes?
только для чтения
-
-
- Содержит информацию о прибавках и внутренних переменных
-
-
-
+
Загрузить индивидуальные
@@ -8341,7 +8336,12 @@ Do you want to save your changes?
Экспортировать Макет (E, L)
-
+
+
+
+
+
+
Alt+M
diff --git a/share/translations/seamly2d_uk_UA.ts b/share/translations/seamly2d_uk_UA.ts
index 801cf745e2f3..454a160ae475 100644
--- a/share/translations/seamly2d_uk_UA.ts
+++ b/share/translations/seamly2d_uk_UA.ts
@@ -6930,12 +6930,7 @@ Do you want to save your changes?
тільки читання
-
-
- Містить інформацію про прибавки і внутрішні змінні
-
-
-
+
Завантажити індивідуальні
@@ -8316,7 +8311,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/share/translations/seamly2d_zh_CN.ts b/share/translations/seamly2d_zh_CN.ts
index bde70ce7c6c6..fd778c87eed3 100644
--- a/share/translations/seamly2d_zh_CN.ts
+++ b/share/translations/seamly2d_zh_CN.ts
@@ -6927,12 +6927,7 @@ Do you want to save your changes?
-
-
-
-
-
-
+
@@ -8313,7 +8308,12 @@ Do you want to save your changes?
-
+
+
+
+
+
+
diff --git a/src/app/seamly2d/dialogs/dialogvariables.cpp b/src/app/seamly2d/dialogs/dialogvariables.cpp
index 9ca632a4821f..a97f9606ba9b 100644
--- a/src/app/seamly2d/dialogs/dialogvariables.cpp
+++ b/src/app/seamly2d/dialogs/dialogvariables.cpp
@@ -193,13 +193,13 @@ void DialogVariables::fillCustomVariables(bool freshCall)
ui->variables_TableWidget->blockSignals(true);
ui->variables_TableWidget->clearContents();
- const QMap > variables = data->variablesData();
- QMap >::const_iterator i;
+ const QMap > variables = data->variablesData();
+ QMap >::const_iterator i;
QMap map;
//Sorting QHash by id
for (i = variables.constBegin(); i != variables.constEnd(); ++i)
{
- QSharedPointer variable = i.value();
+ QSharedPointer variable = i.value();
map.insert(variable->getIndex(), i.key());
}
@@ -209,7 +209,7 @@ void DialogVariables::fillCustomVariables(bool freshCall)
while (iMap.hasNext())
{
iMap.next();
- QSharedPointer variable = variables.value(iMap.value());
+ QSharedPointer variable = variables.value(iMap.value());
currentRow++;
addCell(ui->variables_TableWidget, variable->GetName(), currentRow, 0, Qt::AlignVCenter); // name
@@ -523,7 +523,7 @@ void DialogVariables::enablePieces(bool enabled)
//---------------------------------------------------------------------------------------------------------------------
void DialogVariables::localUpdateTree()
{
- doc->LiteParseIncrements();
+ doc->LiteParseVariables();
fillCustomVariables();
}
@@ -688,7 +688,7 @@ void DialogVariables::moveUp()
}
const QTableWidgetItem *name = ui->variables_TableWidget->item(row, 0);
- doc->MoveUpIncrement(name->text());
+ doc->moveVariableUp(name->text());
hasChanges = true;
localUpdateTree();
@@ -707,7 +707,7 @@ void DialogVariables::moveDown()
}
const QTableWidgetItem *name = ui->variables_TableWidget->item(row, 0);
- doc->MoveDownIncrement(name->text());
+ doc->moveVariableDown(name->text());
hasChanges = true;
localUpdateTree();
@@ -741,8 +741,8 @@ void DialogVariables::saveCustomVariableName(const QString &text)
newName = tempName;
}
- doc->setIncrementName(name->text(), newName);
- QVector expressions = doc->ListIncrementExpressions();
+ doc->setVariableName(name->text(), newName);
+ QVector expressions = doc->listVariableExpressions();
doc->replaceNameInFormula(expressions, name->text(), newName);
renameCache(name->text(), newName);
@@ -765,7 +765,7 @@ void DialogVariables::saveCustomVariableDescription()
}
const QTableWidgetItem *name = ui->variables_TableWidget->item(row, 0);
- doc->setIncrementDescription(name->text(), ui->description_PlainTextEdit->toPlainText());
+ doc->setVariableDescription(name->text(), ui->description_PlainTextEdit->toPlainText());
localUpdateTree();
@@ -810,7 +810,7 @@ void DialogVariables::saveCustomVariableFormula()
return;
}
- QSharedPointer variable = data->GetVariable(name->text());
+ QSharedPointer variable = data->getVariable(name->text());
if (not evalVariableFormula(text, true, variable->GetData(), ui->calculatedValue_Label))
{
return;
@@ -819,7 +819,7 @@ void DialogVariables::saveCustomVariableFormula()
try
{
const QString formula = qApp->translateVariables()->FormulaFromUser(text, qApp->Settings()->getOsSeparator());
- doc->SetIncrementFormula(name->text(), formula);
+ doc->setVariableFormula(name->text(), formula);
}
catch (qmu::QmuParserError &error) // Just in case something bad will happen
{
@@ -848,7 +848,7 @@ void DialogVariables::Fx()
}
const QTableWidgetItem *name = ui->variables_TableWidget->item(row, 0);
- QSharedPointer variable = data->GetVariable(name->text());
+ QSharedPointer variable = data->getVariable(name->text());
EditFormulaDialog *dialog = new EditFormulaDialog(variable->GetData(), NULL_ID, this);
dialog->setWindowTitle(tr("Edit variable"));
@@ -861,7 +861,7 @@ void DialogVariables::Fx()
{
// Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer.
const QTableWidgetItem *name = ui->variables_TableWidget->item(row, 0);
- doc->SetIncrementFormula(name->text(), dialog->GetFormula());
+ doc->setVariableFormula(name->text(), dialog->GetFormula());
hasChanges = true;
localUpdateTree();
@@ -944,7 +944,7 @@ void DialogVariables::showEvent(QShowEvent *event)
}
// do your init stuff here
- const QSize sz = qApp->Settings()->GetIncrementsDialogSize();
+ const QSize sz = qApp->Settings()->getVariablesDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@@ -961,7 +961,7 @@ void DialogVariables::resizeEvent(QResizeEvent *event)
// dialog creating, which would
if (isInitialized)
{
- qApp->Settings()->SetIncrementsDialogSize(size());
+ qApp->Settings()->setVariablesDialogSize(size());
}
DialogTool::resizeEvent(event);
}
@@ -975,11 +975,11 @@ void DialogVariables::showCustomVariableDetails()
// name
const QTableWidgetItem *name = ui->variables_TableWidget->item(ui->variables_TableWidget->currentRow(), 0);
- QSharedPointer variable;
+ QSharedPointer variable;
try
{
- variable = data->GetVariable(name->text());
+ variable = data->getVariable(name->text());
}
catch(const VExceptionBadId &error)
{
diff --git a/src/app/seamly2d/dialogs/dialogvariables.h b/src/app/seamly2d/dialogs/dialogvariables.h
index a972e980b865..6f5d5e55b220 100644
--- a/src/app/seamly2d/dialogs/dialogvariables.h
+++ b/src/app/seamly2d/dialogs/dialogvariables.h
@@ -67,7 +67,7 @@ namespace Ui
}
/**
- * @brief The DialogVariables class show dialog increments. Tables of all variables in program will be here.
+ * @brief The DialogVariables class show Variables dialog. Tables of all variables in program will be here.
*/
class DialogVariables : public DialogTool
{
diff --git a/src/app/seamly2d/mainwindow.cpp b/src/app/seamly2d/mainwindow.cpp
index 6970cf1f15f6..c0c257c461fe 100644
--- a/src/app/seamly2d/mainwindow.cpp
+++ b/src/app/seamly2d/mainwindow.cpp
@@ -1852,14 +1852,14 @@ void MainWindow::exportToCSVData(const QString &fileName, const DialogExportToCS
csv.setHeaderText(2, tr("Formula"));
}
- const QMap > increments = pattern->variablesData();
- QMap >::const_iterator i;
+ const QMap> customVariables = pattern->variablesData();
+ QMap>::const_iterator i;
QMap map;
//Sorting QHash by id
- for (i = increments.constBegin(); i != increments.constEnd(); ++i)
+ for (i = customVariables.constBegin(); i != customVariables.constEnd(); ++i)
{
- QSharedPointer incr = i.value();
- map.insert(incr->getIndex(), i.key());
+ QSharedPointer variable = i.value();
+ map.insert(variable->getIndex(), i.key());
}
qint32 currentRow = -1;
@@ -1867,22 +1867,22 @@ void MainWindow::exportToCSVData(const QString &fileName, const DialogExportToCS
while (iMap.hasNext())
{
iMap.next();
- QSharedPointer incr = increments.value(iMap.value());
+ QSharedPointer variable = customVariables.value(iMap.value());
currentRow++;
csv.insertRow(currentRow);
- csv.setText(currentRow, 0, incr->GetName()); // name
- csv.setText(currentRow, 1, qApp->LocaleToString(*incr->GetValue())); // calculated value
+ csv.setText(currentRow, 0, variable->GetName()); // name
+ csv.setText(currentRow, 1, qApp->LocaleToString(*variable->GetValue())); // calculated value
QString formula;
try
{
- formula = qApp->translateVariables()->FormulaToUser(incr->GetFormula(), qApp->Settings()->getOsSeparator());
+ formula = qApp->translateVariables()->FormulaToUser(variable->GetFormula(), qApp->Settings()->getOsSeparator());
}
catch (qmu::QmuParserError &error)
{
Q_UNUSED(error)
- formula = incr->GetFormula();
+ formula = variable->GetFormula();
}
csv.setText(currentRow, 2, formula); // formula
diff --git a/src/app/seamly2d/mainwindow.ui b/src/app/seamly2d/mainwindow.ui
index 7262423cf236..81880d337e58 100644
--- a/src/app/seamly2d/mainwindow.ui
+++ b/src/app/seamly2d/mainwindow.ui
@@ -2778,7 +2778,7 @@
Variables table
- Contains information about increments and internal variables
+ Contains information about custom and internal variables
Ctrl+T
diff --git a/src/app/seamly2d/xml/vpattern.cpp b/src/app/seamly2d/xml/vpattern.cpp
index 4844bff26f74..e7d2c862d8a3 100644
--- a/src/app/seamly2d/xml/vpattern.cpp
+++ b/src/app/seamly2d/xml/vpattern.cpp
@@ -139,7 +139,7 @@ void VPattern::CreateEmptyFile()
patternElement.appendChild(createElement(TagNotes));
patternElement.appendChild(createElement(TagMeasurements));
- patternElement.appendChild(createElement(TagIncrements));
+ patternElement.appendChild(createElement(TagVariables));
this->appendChild(patternElement);
insertBefore(createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""), this->firstChild());
@@ -177,7 +177,7 @@ void VPattern::Parse(const Document &parse)
SCASSERT(draftScene != nullptr)
SCASSERT(pieceScene != nullptr)
- QStringList tags = QStringList() << TagDraftBlock << TagIncrements << TagDescription << TagNotes
+ QStringList tags = QStringList() << TagDraftBlock << TagVariables << TagDescription << TagNotes
<< TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
<< TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
<< TagPatternLabel;
@@ -212,9 +212,9 @@ void VPattern::Parse(const Document &parse)
}
parseDraftBlockElement(domElement, parse);
break;
- case 1: // TagIncrements
- qCDebug(vXML, "Tag increments.");
- ParseIncrementsElement(domElement);
+ case 1: // TagVariables
+ qCDebug(vXML, "Tag variables.");
+ parseVariablesElement(domElement);
break;
case 2: // TagDescription
qCDebug(vXML, "Tag description.");
@@ -438,22 +438,22 @@ bool VPattern::SaveDocument(const QString &fileName, QString &error)
}
//---------------------------------------------------------------------------------------------------------------------
-void VPattern::LiteParseIncrements()
+void VPattern::LiteParseVariables()
{
try
{
emit setGuiEnabled(true);
- VContainer::ClearUniqueIncrementNames();
- data->ClearVariables(VarType::Increment);
+ VContainer::clearUniqueVariableNames();
+ data->ClearVariables(VarType::Variable);
- const QDomNodeList tags = elementsByTagName(TagIncrements);
+ const QDomNodeList tags = elementsByTagName(TagVariables);
if (not tags.isEmpty())
{
const QDomNode domElement = tags.at(0);
if (not domElement.isNull())
{
- ParseIncrementsElement(domElement);
+ parseVariablesElement(domElement);
}
}
}
@@ -3109,26 +3109,26 @@ qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok)
}
//---------------------------------------------------------------------------------------------------------------------
-QDomElement VPattern::MakeEmptyIncrement(const QString &name)
+QDomElement VPattern::createEmptyVariable(const QString &name)
{
- QDomElement element = createElement(TagIncrement);
- SetAttribute(element, IncrementName, name);
- SetAttribute(element, IncrementFormula, QString("0"));
- SetAttribute(element, IncrementDescription, QString(""));
+ QDomElement element = createElement(TagVariable);
+ SetAttribute(element, VariableName, name);
+ SetAttribute(element, VariableFormula, QString("0"));
+ SetAttribute(element, VariableDescription, QString(""));
return element;
}
//---------------------------------------------------------------------------------------------------------------------
-QDomElement VPattern::FindIncrement(const QString &name) const
+QDomElement VPattern::findVariable(const QString &name) const
{
- QDomNodeList list = elementsByTagName(TagIncrement);
+ QDomNodeList list = elementsByTagName(TagVariable);
for (int i=0; i < list.size(); ++i)
{
const QDomElement domElement = list.at(i).toElement();
if (domElement.isNull() == false)
{
- const QString parameter = domElement.attribute(IncrementName);
+ const QString parameter = domElement.attribute(VariableName);
if (parameter == name)
{
return domElement;
@@ -3429,10 +3429,10 @@ void VPattern::ParsePathElement(VMainGraphicsScene *scene, QDomElement &domEleme
//---------------------------------------------------------------------------------------------------------------------
/**
- * @brief ParseIncrementsElement parse increments tag.
+ * @brief parseVariablesElement parse variables tag.
* @param node tag in xml tree.
*/
-void VPattern::ParseIncrementsElement(const QDomNode &node)
+void VPattern::parseVariablesElement(const QDomNode &node)
{
int index = 0;
QDomNode domNode = node.firstChild();
@@ -3443,25 +3443,25 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
- if (domElement.tagName() == TagIncrement)
+ if (domElement.tagName() == TagVariable)
{
- const QString name = GetParametrString(domElement, IncrementName, "");
+ const QString name = GetParametrString(domElement, VariableName, "");
QString desc;
try
{
- desc = GetParametrString(domElement, IncrementDescription);
+ desc = GetParametrString(domElement, VariableDescription);
}
catch (VExceptionEmptyParameter &error)
{
Q_UNUSED(error)
}
- const QString formula = GetParametrString(domElement, IncrementFormula, "0");
+ const QString formula = GetParametrString(domElement, VariableFormula, "0");
bool ok = false;
const qreal value = EvalFormula(data, formula, &ok);
- data->AddVariable(name, new VIncrement(data, name, static_cast(index), value, formula, ok,
+ data->AddVariable(name, new CustomVariable(data, name, static_cast(index), value, formula, ok,
desc));
++index;
}
@@ -3474,9 +3474,9 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
//---------------------------------------------------------------------------------------------------------------------
void VPattern::addEmptyCustomVariable(const QString &name)
{
- const QDomElement element = MakeEmptyIncrement(name);
+ const QDomElement element = createEmptyVariable(name);
- const QDomNodeList list = elementsByTagName(TagIncrements);
+ const QDomNodeList list = elementsByTagName(TagVariables);
list.at(0).appendChild(element);
emit patternChanged(false);
}
@@ -3484,10 +3484,10 @@ void VPattern::addEmptyCustomVariable(const QString &name)
//---------------------------------------------------------------------------------------------------------------------
void VPattern::addEmptyCustomVariableAfter(const QString &after, const QString &name)
{
- const QDomElement element = MakeEmptyIncrement(name);
- const QDomElement sibling = FindIncrement(after);
+ const QDomElement element = createEmptyVariable(name);
+ const QDomElement sibling = findVariable(after);
- const QDomNodeList list = elementsByTagName(TagIncrements);
+ const QDomNodeList list = elementsByTagName(TagVariables);
if (sibling.isNull())
{
@@ -3503,21 +3503,21 @@ void VPattern::addEmptyCustomVariableAfter(const QString &after, const QString &
//---------------------------------------------------------------------------------------------------------------------
void VPattern::removeCustomVariable(const QString &name)
{
- const QDomNodeList list = elementsByTagName(TagIncrements);
- list.at(0).removeChild(FindIncrement(name));
+ const QDomNodeList list = elementsByTagName(TagVariables);
+ list.at(0).removeChild(findVariable(name));
emit patternChanged(false);
}
//---------------------------------------------------------------------------------------------------------------------
-void VPattern::MoveUpIncrement(const QString &name)
+void VPattern::moveVariableUp(const QString &name)
{
- const QDomElement node = FindIncrement(name);
+ const QDomElement node = findVariable(name);
if (not node.isNull())
{
- const QDomElement prSibling = node.previousSiblingElement(TagIncrement);
+ const QDomElement prSibling = node.previousSiblingElement(TagVariable);
if (not prSibling.isNull())
{
- const QDomNodeList list = elementsByTagName(TagIncrements);
+ const QDomNodeList list = elementsByTagName(TagVariables);
list.at(0).insertBefore(node, prSibling);
}
}
@@ -3525,15 +3525,15 @@ void VPattern::MoveUpIncrement(const QString &name)
}
//---------------------------------------------------------------------------------------------------------------------
-void VPattern::MoveDownIncrement(const QString &name)
+void VPattern::moveVariableDown(const QString &name)
{
- const QDomElement node = FindIncrement(name);
+ const QDomElement node = findVariable(name);
if (not node.isNull())
{
- const QDomElement nextSibling = node.nextSiblingElement(TagIncrement);
+ const QDomElement nextSibling = node.nextSiblingElement(TagVariable);
if (not nextSibling.isNull())
{
- const QDomNodeList list = elementsByTagName(TagIncrements);
+ const QDomNodeList list = elementsByTagName(TagVariables);
list.at(0).insertAfter(node, nextSibling);
}
}
@@ -3541,34 +3541,34 @@ void VPattern::MoveDownIncrement(const QString &name)
}
//---------------------------------------------------------------------------------------------------------------------
-void VPattern::setIncrementName(const QString &name, const QString &text)
+void VPattern::setVariableName(const QString &name, const QString &text)
{
- QDomElement node = FindIncrement(name);
+ QDomElement node = findVariable(name);
if (not node.isNull())
{
- SetAttribute(node, IncrementName, text);
+ SetAttribute(node, VariableName, text);
emit patternChanged(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
-void VPattern::SetIncrementFormula(const QString &name, const QString &text)
+void VPattern::setVariableFormula(const QString &name, const QString &text)
{
- QDomElement node = FindIncrement(name);
+ QDomElement node = findVariable(name);
if (not node.isNull())
{
- SetAttribute(node, IncrementFormula, text);
+ SetAttribute(node, VariableFormula, text);
emit patternChanged(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
-void VPattern::setIncrementDescription(const QString &name, const QString &text)
+void VPattern::setVariableDescription(const QString &name, const QString &text)
{
- QDomElement node = FindIncrement(name);
+ QDomElement node = findVariable(name);
if (not node.isNull())
{
- SetAttribute(node, IncrementDescription, text);
+ SetAttribute(node, VariableDescription, text);
emit patternChanged(false);
}
}
@@ -3950,7 +3950,7 @@ void VPattern::PrepareForParse(const Document &parse)
else if (parse == Document::LiteParse)
{
VContainer::ClearUniqueNames();
- data->ClearVariables(VarType::Increment);
+ data->ClearVariables(VarType::Variable);
data->ClearVariables(VarType::LineAngle);
data->ClearVariables(VarType::LineLength);
data->ClearVariables(VarType::CurveLength);
diff --git a/src/app/seamly2d/xml/vpattern.h b/src/app/seamly2d/xml/vpattern.h
index 4d95e3ab5ac9..ed55f608b6d5 100644
--- a/src/app/seamly2d/xml/vpattern.h
+++ b/src/app/seamly2d/xml/vpattern.h
@@ -93,12 +93,12 @@ class VPattern : public VAbstractPattern
void addEmptyCustomVariable(const QString &name);
void addEmptyCustomVariableAfter(const QString &after, const QString &name);
void removeCustomVariable(const QString &name);
- void MoveUpIncrement(const QString &name);
- void MoveDownIncrement(const QString &name);
+ void moveVariableUp(const QString &name);
+ void moveVariableDown(const QString &name);
- void setIncrementName(const QString &name, const QString &text);
- void SetIncrementFormula(const QString &name, const QString &text);
- void setIncrementDescription(const QString &name, const QString &text);
+ void setVariableName(const QString &name, const QString &text);
+ void setVariableFormula(const QString &name, const QString &text);
+ void setVariableDescription(const QString &name, const QString &text);
void replaceNameInFormula(QVector &expressions, const QString &name, const QString &newName);
@@ -119,7 +119,7 @@ class VPattern : public VAbstractPattern
bool isReadOnly() const;
void SetReadOnly(bool rOnly);
- void LiteParseIncrements();
+ void LiteParseVariables();
static const QString AttrReadOnly;
@@ -165,7 +165,7 @@ public slots:
void ParsePathElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
- void ParseIncrementsElement(const QDomNode &node);
+ void parseVariablesElement(const QDomNode &node);
void PrepareForParse(const Document &parse);
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
@@ -242,8 +242,8 @@ public slots:
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
- QDomElement MakeEmptyIncrement(const QString &name);
- QDomElement FindIncrement(const QString &name) const;
+ QDomElement createEmptyVariable(const QString &name);
+ QDomElement findVariable(const QString &name) const;
void GarbageCollector();
};
diff --git a/src/app/seamlyme/tmainwindow.cpp b/src/app/seamlyme/tmainwindow.cpp
index 4428cf99620d..9710c7478524 100644
--- a/src/app/seamlyme/tmainwindow.cpp
+++ b/src/app/seamlyme/tmainwindow.cpp
@@ -1507,7 +1507,7 @@ void TMainWindow::Fx()
try
{
// Translate to internal look.
- meash = data->GetVariable(nameField->data(Qt::UserRole).toString());
+ meash = data->getVariable(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &exception)
@@ -1746,7 +1746,7 @@ void TMainWindow::ShowNewMData(bool fresh)
try
{
// Translate to internal look.
- meash = data->GetVariable(nameField->data(Qt::UserRole).toString());
+ meash = data->getVariable(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &exception)
@@ -1877,7 +1877,7 @@ void TMainWindow::SaveMName(const QString &text)
try
{
// Translate to internal look.
- meash = data->GetVariable(nameField->data(Qt::UserRole).toString());
+ meash = data->getVariable(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &exception)
@@ -1957,7 +1957,7 @@ void TMainWindow::SaveMValue()
try
{
// Translate to internal look.
- meash = data->GetVariable(nameField->data(Qt::UserRole).toString());
+ meash = data->getVariable(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &exception)
@@ -2117,7 +2117,7 @@ void TMainWindow::SaveMFullName()
try
{
// Translate to internal look.
- meash = data->GetVariable(nameField->data(Qt::UserRole).toString());
+ meash = data->getVariable(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &exception)
diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index 07b96ecc9863..37025fc85ef1 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -57,5 +57,6 @@
schema/pattern/v0.6.8.xsd
schema/individual_size_measurements/v0.3.4.xsd
schema/multi_size_measurements/v0.4.5.xsd
+ schema/pattern/v0.6.9.xsd
diff --git a/src/libs/ifc/schema/pattern/v0.6.9.xsd b/src/libs/ifc/schema/pattern/v0.6.9.xsd
new file mode 100644
index 000000000000..83018603ccfd
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.6.9.xsd
@@ -0,0 +1,1007 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index 8b5ca6ccc987..13fc78516b09 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -90,8 +90,8 @@ const QString VAbstractPattern::TagDescription = QStringLiteral("descri
const QString VAbstractPattern::TagNotes = QStringLiteral("notes");
const QString VAbstractPattern::TagImage = QStringLiteral("image");
const QString VAbstractPattern::TagMeasurements = QStringLiteral("measurements");
-const QString VAbstractPattern::TagIncrements = QStringLiteral("increments");
-const QString VAbstractPattern::TagIncrement = QStringLiteral("increment");
+const QString VAbstractPattern::TagVariables = QStringLiteral("variables");
+const QString VAbstractPattern::TagVariable = QStringLiteral("variable");
const QString VAbstractPattern::TagDraftBlock = QStringLiteral("draftBlock");
const QString VAbstractPattern::TagGroups = QStringLiteral("groups");
const QString VAbstractPattern::TagGroup = QStringLiteral("group");
@@ -217,9 +217,9 @@ const QString VAbstractPattern::AttrDefHeight = QStringLiteral("defHei
const QString VAbstractPattern::AttrDefSize = QStringLiteral("defSize");
const QString VAbstractPattern::AttrExtension = QStringLiteral("extension");
-const QString VAbstractPattern::IncrementName = QStringLiteral("name");
-const QString VAbstractPattern::IncrementFormula = QStringLiteral("formula");
-const QString VAbstractPattern::IncrementDescription = QStringLiteral("description");
+const QString VAbstractPattern::VariableName = QStringLiteral("name");
+const QString VAbstractPattern::VariableFormula = QStringLiteral("formula");
+const QString VAbstractPattern::VariableDescription = QStringLiteral("description");
const QString VAbstractPattern::NodeArc = QStringLiteral("NodeArc");
const QString VAbstractPattern::NodeElArc = QStringLiteral("NodeElArc");
@@ -276,10 +276,10 @@ QStringList VAbstractPattern::ListMeasurements() const
QSet measurements;
QSet others;
- const QStringList increments = ListIncrements();
- for (int i=0; i < increments.size(); ++i)
+ const QStringList variables = listVariables();
+ for (int i=0; i < variables.size(); ++i)
{
- others.insert(increments.at(i));
+ others.insert(variables.at(i));
}
const QVector expressions = ListExpressions();
@@ -1807,17 +1807,17 @@ int VAbstractPattern::getActiveDraftBlockIndex() const
}
//---------------------------------------------------------------------------------------------------------------------
-QStringList VAbstractPattern::ListIncrements() const
+QStringList VAbstractPattern::listVariables() const
{
- QStringList increments;
- const QDomNodeList list = elementsByTagName(TagIncrement);
+ QStringList variables;
+ const QDomNodeList list = elementsByTagName(TagVariable);
for (int i=0; i < list.size(); ++i)
{
const QDomElement dom = list.at(i).toElement();
try
{
- increments.append(GetParametrString(dom, IncrementName));
+ variables.append(GetParametrString(dom, VariableName));
}
catch (VExceptionEmptyParameter &error)
{
@@ -1825,7 +1825,7 @@ QStringList VAbstractPattern::ListIncrements() const
}
}
- return increments;
+ return variables;
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1840,7 +1840,7 @@ QVector VAbstractPattern::ListExpressions() const
list << ListArcExpressions();
list << ListElArcExpressions();
list << ListSplineExpressions();
- list << ListIncrementExpressions();
+ list << listVariableExpressions();
list << ListOperationExpressions();
list << ListPathExpressions();
list << ListPieceExpressions();
@@ -1955,15 +1955,15 @@ QVector VAbstractPattern::ListPathPointExpressions() const
}
//---------------------------------------------------------------------------------------------------------------------
-QVector VAbstractPattern::ListIncrementExpressions() const
+QVector VAbstractPattern::listVariableExpressions() const
{
QVector expressions;
- const QDomNodeList list = elementsByTagName(TagIncrement);
+ const QDomNodeList list = elementsByTagName(TagVariable);
for (int i=0; i < list.size(); ++i)
{
const QDomElement dom = list.at(i).toElement();
- ReadExpressionAttribute(expressions, dom, IncrementFormula);
+ ReadExpressionAttribute(expressions, dom, VariableFormula);
}
return expressions;
diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h
index 396252ca8c13..9a716e0d0b81 100644
--- a/src/libs/ifc/xml/vabstractpattern.h
+++ b/src/libs/ifc/xml/vabstractpattern.h
@@ -118,7 +118,7 @@ class VAbstractPattern : public QObject, public VDomDocument
QStringList ListMeasurements() const;
QVector ListExpressions() const;
- QVector ListIncrementExpressions() const;
+ QVector listVariableExpressions() const;
virtual void CreateEmptyFile()=0;
@@ -282,8 +282,8 @@ class VAbstractPattern : public QObject, public VDomDocument
static const QString TagImage;
static const QString TagNotes;
static const QString TagMeasurements;
- static const QString TagIncrements;
- static const QString TagIncrement;
+ static const QString TagVariables;
+ static const QString TagVariable;
static const QString TagDraftBlock;
static const QString TagGroups;
static const QString TagGroup;
@@ -409,9 +409,9 @@ class VAbstractPattern : public QObject, public VDomDocument
static const QString AttrDefSize;
static const QString AttrExtension;
- static const QString IncrementName;
- static const QString IncrementFormula;
- static const QString IncrementDescription;
+ static const QString VariableName;
+ static const QString VariableFormula;
+ static const QString VariableDescription;
static const QString NodeArc;
static const QString NodeElArc;
@@ -522,7 +522,7 @@ public slots:
private:
Q_DISABLE_COPY(VAbstractPattern)
- QStringList ListIncrements() const;
+ QStringList listVariables() const;
QVector ListPointExpressions() const;
QVector ListArcExpressions() const;
QVector ListElArcExpressions() const;
diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h
index ba554461a755..9110ac617fc9 100644
--- a/src/libs/ifc/xml/vdomdocument.h
+++ b/src/libs/ifc/xml/vdomdocument.h
@@ -87,11 +87,11 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
* information is stored in XML format. By parsing a VDomDocument, the contained
* pattern is rendered to a Seamly2D graphics scene (VMainGraphicsScene).
*
- * A sewing pattern consists of zero or more increments and one
+ * A sewing pattern consists of zero or more custom variables and one
* or more pattern pieces.
*
- * An increment is an auxiliary variable that is calculated from regular measurement
- * variables (that belong to the multisize measurements table). Increments are used to
+ * A custom variable is an auxiliary variable that is calculated from regular measurement
+ * variables (that belong to the multisize measurements table). Variables are used to
* create a graduation schema for the sewing pattern.
*
* A pattern piece contains
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index 9e059b32aed0..26cd16ddfdcf 100644
--- a/src/libs/ifc/xml/vpatternconverter.cpp
+++ b/src/libs/ifc/xml/vpatternconverter.cpp
@@ -92,8 +92,8 @@ Q_LOGGING_CATEGORY(PatternConverter, "patternConverter")
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
-const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.8");
-const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.8.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.9");
+const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.9.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@@ -132,6 +132,8 @@ static const QString strColor = QStringLiteral("color");
static const QString strMeasurements = QStringLiteral("measurements");
static const QString strIncrement = QStringLiteral("increment");
static const QString strIncrements = QStringLiteral("increments");
+static const QString strVariable = QStringLiteral("variable");
+static const QString strVariables = QStringLiteral("variables");
static const QString strModeling = QStringLiteral("modeling");
static const QString strTools = QStringLiteral("tools");
static const QString strIdTool = QStringLiteral("idTool");
@@ -342,7 +344,9 @@ QString VPatternConverter::getSchema(int ver) const
case (0x000607):
return QStringLiteral("://schema/pattern/v0.6.7.xsd");;
case (0x000608):
- qCDebug(PatternConverter, "Current schema - ://schema/pattern/v0.6.8.xsd");
+ return QStringLiteral("://schema/pattern/v0.6.8.xsd");;
+ case (0x000609):
+ qCDebug(PatternConverter, "Current schema - ://schema/pattern/v0.6.9.xsd");
return CurrentSchema;
default:
InvalidVersion(ver);
@@ -525,6 +529,10 @@ void VPatternConverter::applyPatches()
ValidateXML(getSchema(0x000608), m_convertedFileName);
V_FALLTHROUGH
case (0x000608):
+ toVersion0_6_9();
+ ValidateXML(getSchema(0x000609), m_convertedFileName);
+ V_FALLTHROUGH
+ case (0x000609):
break;
default:
InvalidVersion(m_ver);
@@ -543,7 +551,7 @@ void VPatternConverter::downgradeToCurrentMaxVersion()
bool VPatternConverter::isReadOnly() const
{
// Check if attribute readOnly was not changed in file format
- Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 8),
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 9),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@@ -1335,6 +1343,40 @@ void VPatternConverter::toVersion0_6_8()
Save();
}
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::toVersion0_6_9()
+{
+ // TODO. Delete if minimal supported version is 0.6.9
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 9),
+ "Time to refactor the code.");
+
+ setVersion(QStringLiteral("0.6.9"));
+
+ // Convert increments to variables
+ const QDomNodeList variablesList = elementsByTagName(strIncrements);
+ for (int i=0; i < variablesList.size(); ++i)
+ {
+ QDomElement element = variablesList.at(i).toElement();
+ if (!element.isNull())
+ {
+ element.setTagName(strVariables);
+ }
+ }
+
+ // Convert increment to variable
+ const QDomNodeList variableList = elementsByTagName(strIncrement);
+ for (int i=0; i < variableList.size(); ++i)
+ {
+ QDomElement element = variableList.at(i).toElement();
+ if (!element.isNull())
+ {
+ element.setTagName(strVariable);
+ }
+ }
+
+ Save();
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{
diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h
index 523e69f92a77..e6ae65024c3d 100644
--- a/src/libs/ifc/xml/vpatternconverter.h
+++ b/src/libs/ifc/xml/vpatternconverter.h
@@ -80,20 +80,20 @@ class VPatternConverter : public VAbstractConverter
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
- static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 8);
+ static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 9);
protected:
- virtual int minVer() const Q_DECL_OVERRIDE;
- virtual int maxVer() const Q_DECL_OVERRIDE;
+ virtual int minVer() const override;
+ virtual int maxVer() const override;
- virtual QString minVerStr() const Q_DECL_OVERRIDE;
- virtual QString maxVerStr() const Q_DECL_OVERRIDE;
+ virtual QString minVerStr() const override;
+ virtual QString maxVerStr() const override;
- virtual QString getSchema(int ver) const Q_DECL_OVERRIDE;
- virtual void applyPatches() Q_DECL_OVERRIDE;
- virtual void downgradeToCurrentMaxVersion() Q_DECL_OVERRIDE;
+ virtual QString getSchema(int ver) const override;
+ virtual void applyPatches() override;
+ virtual void downgradeToCurrentMaxVersion() override;
- virtual bool isReadOnly() const Q_DECL_OVERRIDE;
+ virtual bool isReadOnly() const override;
private:
Q_DISABLE_COPY(VPatternConverter)
@@ -141,6 +141,7 @@ class VPatternConverter : public VAbstractConverter
void toVersion0_6_6();
void toVersion0_6_7();
void toVersion0_6_8();
+ void toVersion0_6_9();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();
diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h
index 08d71542b0c3..e485a40f3b10 100644
--- a/src/libs/vmisc/def.h
+++ b/src/libs/vmisc/def.h
@@ -293,7 +293,7 @@ enum class Vis : ToolVisHolderType
LAST_ONE_DO_NOT_USE //add new types above this, this constant must be last and never used
};
-enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle,
+enum class VarType : char { Measurement, Variable, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle,
ArcRadius, Unknown };
static const int heightStep = 6;
diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp
index dfa3ccb6a5d5..12df38f4dc58 100644
--- a/src/libs/vmisc/vcommonsettings.cpp
+++ b/src/libs/vmisc/vcommonsettings.cpp
@@ -212,7 +212,7 @@ const QString settingGeneralWindowState = QStringLiteral("windo
const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString settingToolSeamAllowanceDialogSize = QStringLiteral("toolSeamAllowanceDialogSize");
-const QString settingIncrementsDialogSize = QStringLiteral("toolIncrementsDialogSize");
+const QString settingVariablesDialogSize = QStringLiteral("toolVariablesDialogSize");
const QString settingFormulaWizardDialogSize = QStringLiteral("formulaWizardDialogSize");
const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
@@ -1399,15 +1399,15 @@ void VCommonSettings::SetFormulaWizardDialogSize(const QSize &sz)
}
//---------------------------------------------------------------------------------------------------------------------
-QSize VCommonSettings::GetIncrementsDialogSize() const
+QSize VCommonSettings::getVariablesDialogSize() const
{
- return value(settingIncrementsDialogSize, QSize(0, 0)).toSize();
+ return value(settingVariablesDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
-void VCommonSettings::SetIncrementsDialogSize(const QSize &sz)
+void VCommonSettings::setVariablesDialogSize(const QSize &sz)
{
- setValue(settingIncrementsDialogSize, sz);
+ setValue(settingVariablesDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h
index d688f00aacd5..f40ba73ea24e 100644
--- a/src/libs/vmisc/vcommonsettings.h
+++ b/src/libs/vmisc/vcommonsettings.h
@@ -321,8 +321,8 @@ class VCommonSettings : public QSettings
QSize GetFormulaWizardDialogSize() const;
void SetFormulaWizardDialogSize(const QSize& sz);
- QSize GetIncrementsDialogSize() const;
- void SetIncrementsDialogSize(const QSize& sz);
+ QSize getVariablesDialogSize() const;
+ void setVariablesDialogSize(const QSize& sz);
int GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(int value);
diff --git a/src/libs/vpatterndb/variables.h b/src/libs/vpatterndb/variables.h
index b04dd98af0dc..541f7828142b 100644
--- a/src/libs/vpatterndb/variables.h
+++ b/src/libs/vpatterndb/variables.h
@@ -54,7 +54,7 @@
#include "variables/vinternalvariable.h"
#include "variables/measurement_variable.h"
-#include "variables/vincrement.h"
+#include "variables/custom_variable.h"
#include "variables/vcurvelength.h"
#include "variables/vlinelength.h"
#include "variables/vlineangle.h"
diff --git a/src/libs/vpatterndb/variables/vincrement.cpp b/src/libs/vpatterndb/variables/custom_variable.cpp
similarity index 53%
rename from src/libs/vpatterndb/variables/vincrement.cpp
rename to src/libs/vpatterndb/variables/custom_variable.cpp
index 4e7d0d29c6dc..11b01cb6e42b 100644
--- a/src/libs/vpatterndb/variables/vincrement.cpp
+++ b/src/libs/vpatterndb/variables/custom_variable.cpp
@@ -1,27 +1,26 @@
-/***************************************************************************
- * *
- * Copyright (C) 2017 Seamly, LLC *
- * *
- * https://github.com/fashionfreedom/seamly2d *
- * *
- ***************************************************************************
- **
- ** Seamly2D is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Seamly2D is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Seamly2D. If not, see .
- **
- **************************************************************************
+// @file custom_variable.cpp
+// @author Douglas S Caskey
+// @date 2 Apr, 2024
+//
+// @copyright
+// Copyright (C) 2017 - 2024 Seamly, LLC
+// https://github.com/fashionfreedom/seamly2d
+//
+// @brief
+// Seamly2D is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Seamly2D is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Seamly2D. If not, see .
- ************************************************************************
+/************************************************************************
**
** @file vincrementtablerow.cpp
** @author Roman Telezhynskyi
@@ -49,63 +48,66 @@
**
*************************************************************************/
-#include "vincrement.h"
+#include "custom_variable.h"
+#include "custom_variable_p.h"
#include "../vmisc/def.h"
#include "vvariable.h"
-#include "vincrement_p.h"
#ifdef Q_COMPILER_RVALUE_REFS
-VIncrement &VIncrement::operator=(VIncrement &&incr) Q_DECL_NOTHROW { Swap(incr); return *this; }
+CustomVariable &CustomVariable::operator=(CustomVariable &&variable) Q_DECL_NOTHROW { Swap(variable); return *this; }
#endif
-void VIncrement::Swap(VIncrement &incr) Q_DECL_NOTHROW
-{ VVariable::Swap(incr); std::swap(d, incr.d); }
+void CustomVariable::Swap(CustomVariable &variable) Q_DECL_NOTHROW
+{ VVariable::Swap(variable); std::swap(d, variable.d); }
//---------------------------------------------------------------------------------------------------------------------
/**
- * @brief VIncrement create enpty increment
+ * @brief CustomVariable create enpty variable
*/
-VIncrement::VIncrement()
- :VVariable(), d(new VIncrementData)
+CustomVariable::CustomVariable()
+ : VVariable()
+ , d(new CustomVariableData)
{
- SetType(VarType::Increment);
+ SetType(VarType::Variable);
}
//---------------------------------------------------------------------------------------------------------------------
/**
- * @brief VIncrementTableRow create increment
- * @param name increment's name
+ * @brief CustomVariableTableRow create variable
+ * @param name variable's name
* @param base value
- * @param description description of increment
+ * @param description description of variable
*/
-VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula,
+CustomVariable::CustomVariable(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula,
bool ok, const QString &description)
- :VVariable(name, description), d(new VIncrementData(data, index, formula, ok))
+ : VVariable(name, description)
+ , d(new CustomVariableData(data, index, formula, ok))
{
- SetType(VarType::Increment);
+ SetType(VarType::Variable);
VInternalVariable::SetValue(base);
}
//---------------------------------------------------------------------------------------------------------------------
-VIncrement::VIncrement(const VIncrement &incr)
- :VVariable(incr), d(incr.d)
+CustomVariable::CustomVariable(const CustomVariable &variable)
+ : VVariable(variable)
+ , d(variable.d)
{}
//---------------------------------------------------------------------------------------------------------------------
-VIncrement &VIncrement::operator=(const VIncrement &incr)
+CustomVariable &CustomVariable::operator=(const CustomVariable &variable)
{
- if ( &incr == this )
+ if ( &variable == this )
{
return *this;
}
- VVariable::operator=(incr);
- d = incr.d;
+ VVariable::operator=(variable);
+ d = variable.d;
return *this;
}
//---------------------------------------------------------------------------------------------------------------------
-VIncrement::~VIncrement()
+CustomVariable::~CustomVariable()
{}
//---------------------------------------------------------------------------------------------------------------------
@@ -113,25 +115,25 @@ VIncrement::~VIncrement()
* @brief getIndex return index of row
* @return index
*/
-quint32 VIncrement::getIndex() const
+quint32 CustomVariable::getIndex() const
{
return d->index;
}
//---------------------------------------------------------------------------------------------------------------------
-QString VIncrement::GetFormula() const
+QString CustomVariable::GetFormula() const
{
return d->formula;
}
//---------------------------------------------------------------------------------------------------------------------
-bool VIncrement::IsFormulaOk() const
+bool CustomVariable::IsFormulaOk() const
{
return d->formulaOk;
}
//---------------------------------------------------------------------------------------------------------------------
-VContainer *VIncrement::GetData()
+VContainer *CustomVariable::GetData()
{
return &d->data;
}
diff --git a/src/libs/vpatterndb/variables/custom_variable.h b/src/libs/vpatterndb/variables/custom_variable.h
new file mode 100644
index 000000000000..6b92a54b9867
--- /dev/null
+++ b/src/libs/vpatterndb/variables/custom_variable.h
@@ -0,0 +1,96 @@
+// @file custom_variable.h
+// @author Douglas S Caskey
+// @date 2 Apr, 2024
+//
+// @copyright
+// Copyright (C) 2017 - 2024 Seamly, LLC
+// https://github.com/fashionfreedom/seamly2d
+//
+// @brief
+// Seamly2D is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Seamly2D is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Seamly2D. If not, see .
+
+/************************************************************************
+ **
+ ** @file vincrementtablerow.h
+ ** @author Roman Telezhynskyi
+ ** @date November 15, 2013
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013-2015 Seamly2D project
+ ** All Rights Reserved.
+ **
+ ** Seamly2D is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Seamly2D is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Seamly2D. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef CUSTOM_VARIABLE_H
+#define CUSTOM_VARIABLE_H
+
+#include
+#include
+#include
+#include
+#include
+
+#include "vvariable.h"
+
+class CustomVariableData;
+class VContainer;
+
+/**
+ * @brief The CustomVariable class keep data row of variables table
+ */
+class CustomVariable :public VVariable
+{
+public:
+ CustomVariable();
+ CustomVariable(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, bool ok,
+ const QString &description = QString());
+ CustomVariable(const CustomVariable &variable);
+
+ virtual ~CustomVariable() override;
+
+ CustomVariable &operator=(const CustomVariable &variable);
+
+#ifdef Q_COMPILER_RVALUE_REFS
+ CustomVariable &operator=(CustomVariable &&variable) Q_DECL_NOTHROW;
+#endif
+
+ void Swap(CustomVariable &variable) Q_DECL_NOTHROW;
+ quint32 getIndex() const;
+ QString GetFormula() const;
+ bool IsFormulaOk() const;
+ VContainer *GetData();
+
+private:
+ QSharedDataPointer d;
+};
+
+Q_DECLARE_TYPEINFO(CustomVariable, Q_MOVABLE_TYPE);
+
+#endif // CUSTOM_VARIABLE_H
diff --git a/src/libs/vpatterndb/variables/custom_variable_p.h b/src/libs/vpatterndb/variables/custom_variable_p.h
new file mode 100644
index 000000000000..25e87cb41bb7
--- /dev/null
+++ b/src/libs/vpatterndb/variables/custom_variable_p.h
@@ -0,0 +1,107 @@
+// @file custom_variable_p.h
+// @author Douglas S Caskey
+// @date 2 Apr, 2024
+//
+// @copyright
+// Copyright (C) 2017 - 2024 Seamly, LLC
+// https://github.com/fashionfreedom/seamly2d
+//
+// @brief
+// Seamly2D is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Seamly2D is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Seamly2D. If not, see .
+
+/************************************************************************
+ **
+ ** @file vincrement_p.h
+ ** @author Roman Telezhynskyi
+ ** @date 20 8, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013-2015 Seamly2D project
+ ** All Rights Reserved.
+ **
+ ** Seamly2D is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Seamly2D is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Seamly2D. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef CUSTOM_VARIABLE_P_H
+#define CUSTOM_VARIABLE_P_H
+
+#include
+
+#include "../ifc/ifcdef.h"
+#include "../vcontainer.h"
+#include "../vmisc/diagnostic.h"
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_GCC("-Weffc++")
+QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
+
+class CustomVariableData : public QSharedData
+{
+public:
+
+ CustomVariableData()
+ : index(NULL_ID)
+ , formula(QString())
+ , formulaOk(false)
+ , data(VContainer(nullptr, nullptr))
+ {}
+
+ CustomVariableData(VContainer *data, quint32 index, const QString &formula, bool ok)
+ : index(index)
+ , formula(formula)
+ , formulaOk(ok)
+ , data(*data)
+ {}
+
+ CustomVariableData(const CustomVariableData &variable)
+ : QSharedData(variable)
+ , index(variable.index)
+ , formula(variable.formula)
+ , formulaOk(variable.formulaOk)
+ , data(variable.data)
+ {}
+
+ virtual ~CustomVariableData();
+
+ /** @brief id each variable have unique identificator */
+ quint32 index;
+ QString formula;
+ bool formulaOk;
+ VContainer data;
+
+private:
+ CustomVariableData &operator=(const CustomVariableData &) Q_DECL_EQ_DELETE;
+};
+
+CustomVariableData::~CustomVariableData()
+{}
+
+QT_WARNING_POP
+
+#endif // CUSTOM_VARIABLE_P_H
diff --git a/src/libs/vpatterndb/variables/vincrement.h b/src/libs/vpatterndb/variables/vincrement.h
deleted file mode 100644
index c04012c9759a..000000000000
--- a/src/libs/vpatterndb/variables/vincrement.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/***************************************************************************
- * *
- * Copyright (C) 2017 Seamly, LLC *
- * *
- * https://github.com/fashionfreedom/seamly2d *
- * *
- ***************************************************************************
- **
- ** Seamly2D is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Seamly2D is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Seamly2D. If not, see .
- **
- **************************************************************************
-
- ************************************************************************
- **
- ** @file vincrementtablerow.h
- ** @author Roman Telezhynskyi
- ** @date November 15, 2013
- **
- ** @brief
- ** @copyright
- ** This source code is part of the Valentine project, a pattern making
- ** program, whose allow create and modeling patterns of clothing.
- ** Copyright (C) 2013-2015 Seamly2D project
- ** All Rights Reserved.
- **
- ** Seamly2D is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Seamly2D is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Seamly2D. If not, see .
- **
- *************************************************************************/
-
-#ifndef VINCREMENTTABLEROW_H
-#define VINCREMENTTABLEROW_H
-
-#include
-#include
-#include
-#include
-#include
-
-#include "vvariable.h"
-
-class VIncrementData;
-class VContainer;
-
-/**
- * @brief The VIncrement class keep data row of increment table
- */
-class VIncrement :public VVariable
-{
-public:
- VIncrement();
- VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, bool ok,
- const QString &description = QString());
- VIncrement(const VIncrement &incr);
-
- virtual ~VIncrement() Q_DECL_OVERRIDE;
-
- VIncrement &operator=(const VIncrement &incr);
-#ifdef Q_COMPILER_RVALUE_REFS
- VIncrement &operator=(VIncrement &&incr) Q_DECL_NOTHROW;
-#endif
-
- void Swap(VIncrement &incr) Q_DECL_NOTHROW;
-
- quint32 getIndex() const;
- QString GetFormula() const;
- bool IsFormulaOk() const;
- VContainer *GetData();
-
-private:
- QSharedDataPointer d;
-};
-
-Q_DECLARE_TYPEINFO(VIncrement, Q_MOVABLE_TYPE);
-
-#endif // VINCREMENTTABLEROW_H
diff --git a/src/libs/vpatterndb/variables/vincrement_p.h b/src/libs/vpatterndb/variables/vincrement_p.h
deleted file mode 100644
index 8f239db8ccde..000000000000
--- a/src/libs/vpatterndb/variables/vincrement_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/***************************************************************************
- * *
- * Copyright (C) 2017 Seamly, LLC *
- * *
- * https://github.com/fashionfreedom/seamly2d *
- * *
- ***************************************************************************
- **
- ** Seamly2D is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Seamly2D is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Seamly2D. If not, see .
- **
- **************************************************************************
-
- ************************************************************************
- **
- ** @file vincrement_p.h
- ** @author Roman Telezhynskyi
- ** @date 20 8, 2014
- **
- ** @brief
- ** @copyright
- ** This source code is part of the Valentine project, a pattern making
- ** program, whose allow create and modeling patterns of clothing.
- ** Copyright (C) 2013-2015 Seamly2D project
- ** All Rights Reserved.
- **
- ** Seamly2D is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Seamly2D is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Seamly2D. If not, see .
- **
- *************************************************************************/
-
-#ifndef VINCREMENT_P_H
-#define VINCREMENT_P_H
-
-#include
-
-#include "../ifc/ifcdef.h"
-#include "../vcontainer.h"
-#include "../vmisc/diagnostic.h"
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_GCC("-Weffc++")
-QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
-
-class VIncrementData : public QSharedData
-{
-public:
-
- VIncrementData()
- :index(NULL_ID), formula(QString()), formulaOk(false), data(VContainer(nullptr, nullptr))
- {}
-
- VIncrementData(VContainer *data, quint32 index, const QString &formula, bool ok)
- :index(index), formula(formula), formulaOk(ok), data(*data)
- {}
-
- VIncrementData(const VIncrementData &incr)
- :QSharedData(incr), index(incr.index), formula(incr.formula), formulaOk(incr.formulaOk), data(incr.data)
- {}
-
- virtual ~VIncrementData();
-
- /** @brief id each increment have unique identificator */
- quint32 index;
- QString formula;
- bool formulaOk;
- VContainer data;
-
-private:
- VIncrementData &operator=(const VIncrementData &) Q_DECL_EQ_DELETE;
-};
-
-VIncrementData::~VIncrementData()
-{}
-
-QT_WARNING_POP
-
-#endif // VINCREMENT_P_H
diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp
index d0ccbace080c..955ebebae696 100644
--- a/src/libs/vpatterndb/vcontainer.cpp
+++ b/src/libs/vpatterndb/vcontainer.cpp
@@ -72,7 +72,7 @@
#include "variables/vcurveangle.h"
#include "variables/vcurvelength.h"
#include "variables/vcurveclength.h"
-#include "variables/vincrement.h"
+#include "variables/custom_variable.h"
#include "variables/vlineangle.h"
#include "variables/vlinelength.h"
#include "variables/measurement_variable.h"
@@ -298,7 +298,7 @@ void VContainer::ClearForFullParse()
d->pieces->clear();
d->piecePaths->clear();
- ClearVariables(VarType::Increment);
+ ClearVariables(VarType::Variable);
ClearVariables(VarType::LineAngle);
ClearVariables(VarType::LineLength);
ClearVariables(VarType::CurveLength);
@@ -540,9 +540,9 @@ const QMap > VContainer::DataMeasur
}
//---------------------------------------------------------------------------------------------------------------------
-const QMap > VContainer::variablesData() const
+const QMap > VContainer::variablesData() const
{
- return DataVar(VarType::Increment);
+ return DataVar(VarType::Variable);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -618,7 +618,7 @@ const QMap > VContainer::DataVar(const VarType &type)
{
if (i.value()->GetType() == type)
{
- QSharedPointer var = GetVariable(i.key());
+ QSharedPointer var = getVariable(i.key());
map.insert(d->trVars->VarToUser(i.key()), var);
}
}
@@ -632,7 +632,7 @@ void VContainer::ClearUniqueNames()
}
//---------------------------------------------------------------------------------------------------------------------
-void VContainer::ClearUniqueIncrementNames()
+void VContainer::clearUniqueVariableNames()
{
const QList list = uniqueNames.values();
ClearUniqueNames();
diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h
index 9c16ef0cbc07..dae25a57121f 100644
--- a/src/libs/vpatterndb/vcontainer.h
+++ b/src/libs/vpatterndb/vcontainer.h
@@ -118,7 +118,7 @@ class VContainerData : public QSharedData //-V690
QHash > gObjects;
/**
- * @brief variables container for measurements, increments, lines lengths, lines angles, arcs lengths, curve lengths
+ * @brief variables container for measurements, custom variables, lines lengths, lines angles, arcs lengths, curve lengths
*/
QHash> variables;
@@ -159,7 +159,7 @@ class VContainer
VPiece GetPiece(quint32 id) const;
VPiecePath GetPiecePath(quint32 id) const;
template
- QSharedPointer GetVariable(QString name) const;
+ QSharedPointer getVariable(QString name) const;
static quint32 getId();
static quint32 getNextId();
static void UpdateId(quint32 newId);
@@ -195,7 +195,7 @@ class VContainer
void ClearCalculationGObjects();
void ClearVariables(const VarType &type = VarType::Unknown);
static void ClearUniqueNames();
- static void ClearUniqueIncrementNames();
+ static void clearUniqueVariableNames();
static void setSize(qreal size);
static void setHeight(qreal height);
@@ -211,7 +211,7 @@ class VContainer
const QHash> *DataVariables() const;
const QMap > DataMeasurements() const;
- const QMap > variablesData() const;
+ const QMap > variablesData() const;
const QMap > lineLengthsData() const;
const QMap > curveLengthsData() const;
const QMap > controlPointLengthsData() const;
@@ -295,12 +295,12 @@ const QSharedPointer VContainer::GeometricObject(const quint32 &id) const
//---------------------------------------------------------------------------------------------------------------------
/**
-* @brief GetVariable return varible by name
+* @brief getVariable return varible by name
* @param name variable's name
* @return variable
*/
template
-QSharedPointer VContainer::GetVariable(QString name) const
+QSharedPointer VContainer::getVariable(QString name) const
{
SCASSERT(name.isEmpty()==false)
if (d->variables.contains(name))
diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri
index dd77c100567e..e09c979d6ef0 100644
--- a/src/libs/vpatterndb/vpatterndb.pri
+++ b/src/libs/vpatterndb/vpatterndb.pri
@@ -2,6 +2,7 @@
# This need for corect working file translations.pro
SOURCES += \
+ $$PWD/variables/custom_variable.cpp \
$$PWD/variables/measurement_variable.cpp \
$$PWD/vcontainer.cpp \
$$PWD/calculator.cpp \
@@ -11,7 +12,6 @@ SOURCES += \
$$PWD/variables/vcurveangle.cpp \
$$PWD/variables/vcurvelength.cpp \
$$PWD/variables/vcurvevariable.cpp \
- $$PWD/variables/vincrement.cpp \
$$PWD/variables/vinternalvariable.cpp \
$$PWD/variables/vlineangle.cpp \
$$PWD/variables/vlinelength.cpp \
@@ -31,6 +31,8 @@ SOURCES += \
*msvc*:SOURCES += $$PWD/stable.cpp
HEADERS += \
+ $$PWD/variables/custom_variable.h \
+ $$PWD/variables/custom_variable_p.h \
$$PWD/variables/measurement_variable.h \
$$PWD/variables/measurement_variable_p.h \
$$PWD/vcontainer.h \
@@ -46,8 +48,6 @@ HEADERS += \
$$PWD/variables/vcurvelength.h \
$$PWD/variables/vcurvevariable.h \
$$PWD/variables/vcurvevariable_p.h \
- $$PWD/variables/vincrement.h \
- $$PWD/variables/vincrement_p.h \
$$PWD/variables/vinternalvariable.h \
$$PWD/variables/vinternalvariable_p.h \
$$PWD/variables/vlineangle.h \
diff --git a/src/libs/vtools/dialogs/support/edit_formula_dialog.cpp b/src/libs/vtools/dialogs/support/edit_formula_dialog.cpp
index 46e4215eabcf..9b80f6cd68be 100644
--- a/src/libs/vtools/dialogs/support/edit_formula_dialog.cpp
+++ b/src/libs/vtools/dialogs/support/edit_formula_dialog.cpp
@@ -92,7 +92,7 @@
#include "../vpatterndb/variables/varcradius.h"
#include "../vpatterndb/variables/vcurveangle.h"
#include "../vpatterndb/variables/vcurvelength.h"
-#include "../vpatterndb/variables/vincrement.h"
+#include "../vpatterndb/variables/custom_variable.h"
#include "../vpatterndb/variables/vlineangle.h"
#include "../vpatterndb/variables/vlinelength.h"
#include "../vpatterndb/variables/measurement_variable.h"
@@ -212,7 +212,7 @@ void EditFormulaDialog::valueChanged(int row)
case VariableTab::Measurements:
{
const QString name = qApp->translateVariables()->VarFromUser(item->text());
- const QSharedPointer measurements = data->GetVariable(name);
+ const QSharedPointer measurements = data->getVariable(name);
const QString desc = (measurements->getGuiText() == "") ? "" : QString("\nDescription: %1").arg(measurements->getGuiText());
setDescription(item->text(), *data->DataVariables()->value(name)->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Measurement"), desc);
@@ -220,7 +220,7 @@ void EditFormulaDialog::valueChanged(int row)
}
case VariableTab::Custom:
{
- const QSharedPointer variables = data->GetVariable(item->text());
+ const QSharedPointer variables = data->getVariable(item->text());
const QString desc =(variables->GetDescription() == "") ? "" : QString("\nDescription: %1").arg(variables->GetDescription());
setDescription(item->text(), *data->DataVariables()->value(item->text())->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Custom Variable"), desc);
@@ -229,35 +229,35 @@ void EditFormulaDialog::valueChanged(int row)
case VariableTab::LineLengths:
{
setDescription(item->text(),
- *data->GetVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
+ *data->getVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Line length"), "");
break;
}
case VariableTab::CurveLengths:
{
setDescription(item->text(),
- *data->GetVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
+ *data->getVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Curve length"), "");
break;
}
case VariableTab::LineAngles:
{
setDescription(item->text(),
- *data->GetVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
+ *data->getVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
degreeSymbol, tr("Line Angle"), "");
break;
}
case VariableTab::ArcRadii:
{
setDescription(item->text(),
- *data->GetVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
+ *data->getVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
UnitsToStr(qApp->patternUnit(), true), tr("Arc radius"), "");
break;
}
case VariableTab::CurveAngles:
{
setDescription(item->text(),
- *data->GetVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
+ *data->getVariable(qApp->translateVariables()->VarFromUser(item->text()))->GetValue(),
degreeSymbol, tr("Curve angle"), "");
break;
}
diff --git a/src/libs/vtools/dialogs/tools/piece/dialoginternalpath.cpp b/src/libs/vtools/dialogs/tools/piece/dialoginternalpath.cpp
index e914fcfaea72..5aed4da642c1 100644
--- a/src/libs/vtools/dialogs/tools/piece/dialoginternalpath.cpp
+++ b/src/libs/vtools/dialogs/tools/piece/dialoginternalpath.cpp
@@ -617,7 +617,7 @@ void DialogInternalPath::evaluateDefaultWidth()
if (m_saWidth >= 0)
{
VContainer *locData = const_cast (data);
- locData->AddVariable(currentSeamAllowance, new VIncrement(locData, currentSeamAllowance, 0, m_saWidth,
+ locData->AddVariable(currentSeamAllowance, new CustomVariable(locData, currentSeamAllowance, 0, m_saWidth,
QString().setNum(m_saWidth), true,
tr("Current seam allowance")));
diff --git a/src/libs/vtools/dialogs/tools/piece/pattern_piece_dialog.cpp b/src/libs/vtools/dialogs/tools/piece/pattern_piece_dialog.cpp
index 559b8b2e0448..b88a6cf86805 100644
--- a/src/libs/vtools/dialogs/tools/piece/pattern_piece_dialog.cpp
+++ b/src/libs/vtools/dialogs/tools/piece/pattern_piece_dialog.cpp
@@ -2164,7 +2164,7 @@ void PatternPieceDialog::evaluateDefaultWidth()
if (m_saWidth >= 0)
{
VContainer *locData = const_cast (data);
- locData->AddVariable(currentSeamAllowance, new VIncrement(locData, currentSeamAllowance, 0, m_saWidth,
+ locData->AddVariable(currentSeamAllowance, new CustomVariable(locData, currentSeamAllowance, 0, m_saWidth,
QString().setNum(m_saWidth), true,
tr("Current seam allowance")));
diff --git a/src/libs/vtools/tools/pattern_piece_tool.cpp b/src/libs/vtools/tools/pattern_piece_tool.cpp
index c517d2e0e103..4483c12e4fc2 100644
--- a/src/libs/vtools/tools/pattern_piece_tool.cpp
+++ b/src/libs/vtools/tools/pattern_piece_tool.cpp
@@ -148,7 +148,7 @@ PatternPieceTool *PatternPieceTool::Create(quint32 id, VPiece newPiece, QString
{
if (typeCreation == Source::FromGui || typeCreation == Source::FromTool)
{
- data->AddVariable(currentSeamAllowance, new VIncrement(data, currentSeamAllowance, 0, newPiece.GetSAWidth(),
+ data->AddVariable(currentSeamAllowance, new CustomVariable(data, currentSeamAllowance, 0, newPiece.GetSAWidth(),
width, true, tr("Current seam allowance")));
id = data->AddPiece(newPiece);
}
@@ -157,7 +157,7 @@ PatternPieceTool *PatternPieceTool::Create(quint32 id, VPiece newPiece, QString
const qreal calcWidth = CheckFormula(id, width, data);
newPiece.setSeamAllowanceWidthFormula(width, calcWidth);
- data->AddVariable(currentSeamAllowance, new VIncrement(data, currentSeamAllowance, 0, calcWidth,
+ data->AddVariable(currentSeamAllowance, new CustomVariable(data, currentSeamAllowance, 0, calcWidth,
width, true, tr("Current seam allowance")));
data->UpdatePiece(id, newPiece);