Resolved issue #929. New variable type: Separator.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-01-16 16:24:41 +02:00
parent 194aac3813
commit e91c92d4a9
18 changed files with 379 additions and 140 deletions

View File

@ -7,6 +7,7 @@
- New command line option --landscapeOrientation. - New command line option --landscapeOrientation.
- Added ability to search measurements by regex. - Added ability to search measurements by regex.
- [#927] Freeze prefix language on pattern/project creation. - [#927] Freeze prefix language on pattern/project creation.
- [#929] New variable type: Separator.
# Version 0.6.2 (unreleased) # Version 0.6.2 (unreleased)
- [#903] Bug in tool Cut Spline path. - [#903] Bug in tool Cut Spline path.

View File

@ -44,6 +44,7 @@
#include <QSettings> #include <QSettings>
#include <QTableWidgetItem> #include <QTableWidgetItem>
#include <QtNumeric> #include <QtNumeric>
#include <QMenu>
#define DIALOG_MAX_FORMULA_HEIGHT 64 #define DIALOG_MAX_FORMULA_HEIGHT 64
@ -107,16 +108,18 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile); connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
ui->lineEditName->setValidator( new QRegularExpressionValidator(QRegularExpression( auto validator = new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^$|")+NameRegExp()), this);
QLatin1String("^$|")+NameRegExp()), this)); ui->lineEditName->setValidator(validator);
ui->lineEditNamePC->setValidator( new QRegularExpressionValidator(QRegularExpression( ui->lineEditNamePC->setValidator(validator);
QLatin1String("^$|")+NameRegExp()), this));
connect(ui->tableWidgetIncrement, &QTableWidget::itemSelectionChanged, this, connect(ui->tableWidgetIncrement, &QTableWidget::itemSelectionChanged, this,
&DialogIncrements::ShowIncrementDetails); &DialogIncrements::ShowIncrementDetails);
connect(ui->tableWidgetPC, &QTableWidget::itemSelectionChanged, this, connect(ui->tableWidgetPC, &QTableWidget::itemSelectionChanged, this,
&DialogIncrements::ShowIncrementDetails); &DialogIncrements::ShowIncrementDetails);
InitIncrementVarTypeMenu();
InitPreviewCalculationVarTypeMenu();
connect(ui->toolButtonAdd, &QToolButton::clicked, this, &DialogIncrements::AddIncrement); connect(ui->toolButtonAdd, &QToolButton::clicked, this, &DialogIncrements::AddIncrement);
connect(ui->toolButtonAddPC, &QToolButton::clicked, this, &DialogIncrements::AddIncrement); connect(ui->toolButtonAddPC, &QToolButton::clicked, this, &DialogIncrements::AddIncrement);
connect(ui->toolButtonRemove, &QToolButton::clicked, this, &DialogIncrements::RemoveIncrement); connect(ui->toolButtonRemove, &QToolButton::clicked, this, &DialogIncrements::RemoveIncrement);
@ -181,13 +184,13 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
*/ */
void DialogIncrements::FillIncrements(bool freshCall) void DialogIncrements::FillIncrements(bool freshCall)
{ {
FillIncrementsTable(ui->tableWidgetIncrement, data->DataIncrements(), false, freshCall); FillIncrementsTable(ui->tableWidgetIncrement, data->DataIncrementsWithSeparators(), false, freshCall);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::FillPreviewCalculations(bool freshCall) void DialogIncrements::FillPreviewCalculations(bool freshCall)
{ {
FillIncrementsTable(ui->tableWidgetPC, data->DataIncrements(), true, freshCall); FillIncrementsTable(ui->tableWidgetPC, data->DataIncrementsWithSeparators(), true, freshCall);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -553,6 +556,33 @@ void DialogIncrements::EnableDetails(QTableWidget *table, bool enabled)
ui->plainTextEditDescriptionPC->setEnabled(enabled); ui->plainTextEditDescriptionPC->setEnabled(enabled);
ui->plainTextEditFormulaPC->setEnabled(enabled); ui->plainTextEditFormulaPC->setEnabled(enabled);
} }
if (table->rowCount() > 0)
{
const QTableWidgetItem *nameField = table->item(table->currentRow(), 0);
SCASSERT(nameField != nullptr)
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text());
const bool isSeparator = incr->GetIncrementType() == IncrementType::Separator;
if (table == ui->tableWidgetIncrement)
{
ui->labelCalculated->setVisible(not isSeparator);
ui->labelCalculatedValue->setVisible(not isSeparator);
ui->labelFormula->setVisible(not isSeparator);
ui->plainTextEditFormula->setVisible(not isSeparator);
ui->pushButtonGrow->setVisible(not isSeparator);
ui->toolButtonExpr->setVisible(not isSeparator);
}
else if (table == ui->tableWidgetPC)
{
ui->labelCalculatedPC->setVisible(not isSeparator);
ui->labelCalculatedValuePC->setVisible(not isSeparator);
ui->labelFormulaPC->setVisible(not isSeparator);
ui->plainTextEditFormulaPC->setVisible(not isSeparator);
ui->pushButtonGrowPC->setVisible(not isSeparator);
ui->toolButtonExprPC->setVisible(not isSeparator);
}
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -692,6 +722,54 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::InitIncrementVarTypeMenu()
{
auto varTypeMenu = ui->toolButtonAdd->menu();
if (varTypeMenu == nullptr)
{
varTypeMenu = new QMenu(this);
}
else
{
varTypeMenu->clear();
}
QAction *action = varTypeMenu->addAction(tr("Increment"));
action->setData(true); // Increments tab
connect(action, &QAction::triggered, this, &DialogIncrements::AddIncrement);
action = varTypeMenu->addAction(tr("Separator"));
action->setData(true); // Increments tab
connect(action, &QAction::triggered, this, &DialogIncrements::AddSeparator);
ui->toolButtonAdd->setMenu(varTypeMenu);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::InitPreviewCalculationVarTypeMenu()
{
auto varTypeMenu = ui->toolButtonAddPC->menu();
if (varTypeMenu == nullptr)
{
varTypeMenu = new QMenu(this);
}
else
{
varTypeMenu->clear();
}
QAction *action = varTypeMenu->addAction(tr("Preview calculation"));
action->setData(false); // Preview calculation tab
connect(action, &QAction::triggered, this, &DialogIncrements::AddIncrement);
action = varTypeMenu->addAction(tr("Separator"));
action->setData(false); // Preview calculation tab
connect(action, &QAction::triggered, this, &DialogIncrements::AddSeparator);
ui->toolButtonAddPC->setMenu(varTypeMenu);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief FullUpdateFromFile update information in tables form file * @brief FullUpdateFromFile update information in tables form file
@ -765,10 +843,10 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
//Sorting QHash by id //Sorting QHash by id
for (i = increments.constBegin(); i != increments.constEnd(); ++i) for (i = increments.constBegin(); i != increments.constEnd(); ++i)
{ {
QSharedPointer<VIncrement> incr = i.value(); const QSharedPointer<VIncrement>& incr = i.value();
if (takePreviewCalculations == incr->IsPreviewCalculation()) if (takePreviewCalculations == incr->IsPreviewCalculation())
{ {
map.insert(incr->getIndex(), i.key()); map.insert(incr->GetIndex(), i.key());
} }
} }
@ -778,16 +856,30 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
while (iMap.hasNext()) while (iMap.hasNext())
{ {
iMap.next(); iMap.next();
QSharedPointer<VIncrement> incr = increments.value(iMap.value()); const QSharedPointer<VIncrement> &incr = increments.value(iMap.value());
currentRow++; ++currentRow;
AddCell(table, incr->GetName(), currentRow, 0, Qt::AlignVCenter); // name if (incr->GetType() == VarType::Increment)
AddCell(table, qApp->LocaleToString(*incr->GetValue()), currentRow, 1, {
Qt::AlignHCenter | Qt::AlignVCenter, incr->IsFormulaOk()); // calculated value AddCell(table, incr->GetName(), currentRow, 0, Qt::AlignVCenter); // name
AddCell(table, qApp->LocaleToString(*incr->GetValue()), currentRow, 1, Qt::AlignCenter,
incr->IsFormulaOk()); // calculated value
QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(), qApp->Settings()->GetOsSeparator()); QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(), qApp->Settings()->GetOsSeparator());
AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula
if (table->columnSpan(currentRow, 1) > 1)
{
table->setSpan(currentRow, 1, 1, 1);
}
}
else if (incr->GetType() == VarType::IncrementSeparator)
{
AddCell(table, incr->GetName(), currentRow, 0, Qt::AlignVCenter); // name
AddCell(table, incr->GetDescription(), currentRow, 1, Qt::AlignCenter); // name
table->setSpan(currentRow, 1, 1, 2);
}
} }
if (freshCall) if (freshCall)
@ -807,51 +899,80 @@ void DialogIncrements::AddIncrement()
{ {
qCDebug(vDialog, "Add new increment"); qCDebug(vDialog, "Add new increment");
QToolButton *button = qobject_cast<QToolButton *>(sender()); auto *button = qobject_cast<QToolButton *>(sender());
QTableWidget *table = nullptr; auto *action = qobject_cast<QAction *>(sender());
bool incrementMode = true;
if (button == ui->toolButtonAdd) if (button == ui->toolButtonAdd || ((action != nullptr) && action->data().toBool()))
{ {
table = ui->tableWidgetIncrement; incrementMode = true;
} }
else if (button == ui->toolButtonAddPC) else if (button == ui->toolButtonAddPC || ((action != nullptr) && not action->data().toBool()))
{ {
table = ui->tableWidgetPC; incrementMode = false;
} }
else else
{ {
return; return;
} }
QTableWidget *table = incrementMode ? ui->tableWidgetIncrement : ui->tableWidgetPC;
const QString name = GetCustomName(); const QString name = GetCustomName();
qint32 currentRow = -1; qint32 currentRow = -1;
if (table->currentRow() == -1) if (table->currentRow() == -1)
{ {
currentRow = table->rowCount(); currentRow = table->rowCount();
incrementMode ? doc->AddEmptyIncrement(name) : doc->AddEmptyPreviewCalculation(name);
if (button == ui->toolButtonAdd)
{
doc->AddEmptyIncrement(name);
}
else if (button == ui->toolButtonAddPC)
{
doc->AddEmptyPreviewCalculation(name);
}
} }
else else
{ {
currentRow = table->currentRow()+1; currentRow = table->currentRow()+1;
const QTableWidgetItem *nameField = table->item(table->currentRow(), 0); const QTableWidgetItem *nameField = table->item(table->currentRow(), 0);
if (button == ui->toolButtonAdd) incrementMode ? doc->AddEmptyIncrementAfter(nameField->text(), name) :
{ doc->AddEmptyPreviewCalculationAfter(nameField->text(), name);
doc->AddEmptyIncrementAfter(nameField->text(), name); }
}
else if (button == ui->toolButtonAddPC) hasChanges = true;
{ LocalUpdateTree();
doc->AddEmptyPreviewCalculationAfter(nameField->text(), name);
} table->selectRow(currentRow);
table->repaint(); // Force repain to fix paint artifacts on Mac OS X
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::AddSeparator()
{
qCDebug(vDialog, "Add new increment");
auto *action = qobject_cast<QAction *>(sender());
if (action == nullptr)
{
return;
}
const bool incrementMode = action->data().toBool();
QTableWidget *table = incrementMode ? ui->tableWidgetIncrement : ui->tableWidgetPC;
const QString name = GetCustomName();
qint32 currentRow = -1;
const IncrementType type = IncrementType::Separator;
if (table->currentRow() == -1)
{
currentRow = table->rowCount();
incrementMode ? doc->AddEmptyIncrement(name, type) : doc->AddEmptyPreviewCalculation(name, type);
}
else
{
currentRow = table->currentRow()+1;
const QTableWidgetItem *nameField = table->item(table->currentRow(), 0);
incrementMode ? doc->AddEmptyIncrementAfter(nameField->text(), name, type) :
doc->AddEmptyPreviewCalculationAfter(nameField->text(), name, type);
} }
hasChanges = true; hasChanges = true;
@ -905,22 +1026,14 @@ void DialogIncrements::RemoveIncrement()
hasChanges = true; hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
if (table->rowCount() > 0) table->rowCount() > 0 ? table->selectRow(0) : EnableDetails(table, false);
{
table->selectRow(0);
}
else
{
EnableDetails(table, false);
}
table->repaint(); // Force repain to fix paint artifacts on Mac OS X table->repaint(); // Force repain to fix paint artifacts on Mac OS X
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::MoveUp() void DialogIncrements::MoveUp()
{ {
QToolButton *button = qobject_cast<QToolButton *>(sender()); auto *button = qobject_cast<QToolButton *>(sender());
QTableWidget *table = nullptr; QTableWidget *table = nullptr;
@ -1166,6 +1279,11 @@ void DialogIncrements::SaveIncrFormula()
} }
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text()); QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text());
if (incr->GetIncrementType() == IncrementType::Separator)
{
return;
}
if (not EvalIncrementFormula(text, true, incr->GetData(), labelCalculatedValue)) if (not EvalIncrementFormula(text, true, incr->GetData(), labelCalculatedValue))
{ {
return; return;
@ -1334,6 +1452,8 @@ void DialogIncrements::changeEvent(QEvent *event)
{ {
// retranslate designer form (single inheritance approach) // retranslate designer form (single inheritance approach)
ui->retranslateUi(this); ui->retranslateUi(this);
InitIncrementVarTypeMenu();
InitPreviewCalculationVarTypeMenu();
FullUpdateFromFile(); FullUpdateFromFile();
} }
// remember to call base class implementation // remember to call base class implementation

View File

@ -69,6 +69,7 @@ protected:
private slots: private slots:
void ShowIncrementDetails(); void ShowIncrementDetails();
void AddIncrement(); void AddIncrement();
void AddSeparator();
void RemoveIncrement(); void RemoveIncrement();
void MoveUp(); void MoveUp();
void MoveDown(); void MoveDown();
@ -139,6 +140,9 @@ private:
void CacheRename(const QString &name, const QString &newName); void CacheRename(const QString &name, const QString &newName);
void ShowTableIncrementDetails(QTableWidget *table); void ShowTableIncrementDetails(QTableWidget *table);
void InitIncrementVarTypeMenu();
void InitPreviewCalculationVarTypeMenu();
}; };
#endif // DIALOGINCREMENTS_H #endif // DIALOGINCREMENTS_H

View File

@ -35,9 +35,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Search preview calculations by term. &lt;/p&gt;&lt;p&gt;Prepend &amp;quot;/r/&amp;quot; to the front of the search string to search preview calculations by regex.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="tabPosition"> <property name="tabPosition">
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
@ -278,6 +275,9 @@
<iconset theme="list-add"> <iconset theme="list-add">
<normaloff>.</normaloff>.</iconset> <normaloff>.</normaloff>.</iconset>
</property> </property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignLeft"> <item alignment="Qt::AlignLeft">
@ -511,6 +511,9 @@
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEditFindPC"> <widget class="QLineEdit" name="lineEditFindPC">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Search preview calculations by term. &lt;/p&gt;&lt;p&gt;Prepend &amp;quot;/r/&amp;quot; to the front of the search string to search preview calculations by regex.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="placeholderText"> <property name="placeholderText">
<string>Search</string> <string>Search</string>
</property> </property>
@ -720,6 +723,9 @@
<iconset theme="list-add"> <iconset theme="list-add">
<normaloff>.</normaloff>.</iconset> <normaloff>.</normaloff>.</iconset>
</property> </property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignLeft"> <item alignment="Qt::AlignLeft">
@ -756,7 +762,7 @@
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="labelCalculated_2"> <widget class="QLabel" name="labelCalculatedPC">
<property name="text"> <property name="text">
<string>Calculated value:</string> <string>Calculated value:</string>
</property> </property>
@ -770,7 +776,7 @@
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="labelFormula_2"> <widget class="QLabel" name="labelFormulaPC">
<property name="text"> <property name="text">
<string>Formula:</string> <string>Formula:</string>
</property> </property>
@ -1202,8 +1208,8 @@
<tabstop>tableWidgetSplines</tabstop> <tabstop>tableWidgetSplines</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../../../libs/vmisc/share/resources/icon.qrc"/>
<include location="../../../libs/vmisc/share/resources/theme.qrc"/> <include location="../../../libs/vmisc/share/resources/theme.qrc"/>
<include location="../../../libs/vmisc/share/resources/icon.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -1541,7 +1541,7 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
const QSharedPointer<VIncrement> incr = i.value(); const QSharedPointer<VIncrement> incr = i.value();
if (incr->IsPreviewCalculation() == save) if (incr->IsPreviewCalculation() == save)
{ {
map.insert(incr->getIndex(), i.key()); map.insert(incr->GetIndex(), i.key());
} }
} }

View File

@ -436,7 +436,10 @@ void VPattern::LiteParseIncrements()
emit SetEnabledGUI(true); emit SetEnabledGUI(true);
data->ClearUniqueIncrementNames(); data->ClearUniqueIncrementNames();
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 9, "Check that you used all types");
data->ClearVariables(VarType::Increment); data->ClearVariables(VarType::Increment);
data->ClearVariables(VarType::IncrementSeparator);
QDomNodeList tags = elementsByTagName(TagIncrements); QDomNodeList tags = elementsByTagName(TagIncrements);
if (not tags.isEmpty()) if (not tags.isEmpty())
@ -3294,12 +3297,14 @@ qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QDomElement VPattern::MakeEmptyIncrement(const QString &name) QDomElement VPattern::MakeEmptyIncrement(const QString &name, IncrementType type)
{ {
QDomElement element = createElement(TagIncrement); QDomElement element = createElement(TagIncrement);
SetAttribute(element, AttrName, name); SetAttribute(element, AttrName, name);
SetAttribute(element, AttrFormula, QChar('0')); if (type != IncrementType::Increment)
SetAttribute(element, AttrDescription, QString()); {
SetAttribute(element, AttrType, IncrementTypeToString(type));
}
return element; return element;
} }
@ -3311,7 +3316,7 @@ QDomElement VPattern::FindIncrement(const QString &name) const
for (int i=0; i < list.size(); ++i) for (int i=0; i < list.size(); ++i)
{ {
const QDomElement domElement = list.at(i).toElement(); const QDomElement domElement = list.at(i).toElement();
if (domElement.isNull() == false) if (not domElement.isNull())
{ {
const QString parameter = domElement.attribute(AttrName); const QString parameter = domElement.attribute(AttrName);
if (parameter == name) if (parameter == name)
@ -3374,9 +3379,9 @@ void VPattern::GarbageCollector(bool commit)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::NewEmptyIncrement(const QString &type, const QString &name) void VPattern::NewEmptyIncrement(const QString &type, const QString &name, IncrementType varType)
{ {
const QDomElement element = MakeEmptyIncrement(name); const QDomElement element = MakeEmptyIncrement(name, varType);
const QDomNodeList list = elementsByTagName(type); const QDomNodeList list = elementsByTagName(type);
list.at(0).appendChild(element); list.at(0).appendChild(element);
@ -3384,9 +3389,10 @@ void VPattern::NewEmptyIncrement(const QString &type, const QString &name)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name) void VPattern::NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name,
IncrementType varType)
{ {
const QDomElement element = MakeEmptyIncrement(name); const QDomElement element = MakeEmptyIncrement(name, varType);
const QDomElement sibling = FindIncrement(after); const QDomElement sibling = FindIncrement(after);
const QDomNodeList list = elementsByTagName(type); const QDomNodeList list = elementsByTagName(type);
@ -3763,26 +3769,31 @@ void VPattern::ParseIncrementsElement(const QDomNode &node, const Document &pars
{ {
int index = 0; int index = 0;
QDomNode domNode = node.firstChild(); QDomNode domNode = node.firstChild();
while (domNode.isNull() == false) while (not domNode.isNull())
{ {
if (domNode.isElement()) if (domNode.isElement())
{ {
const QDomElement domElement = domNode.toElement(); const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false) if (not domElement.isNull())
{ {
if (domElement.tagName() == TagIncrement) if (domElement.tagName() == TagIncrement)
{ {
const QString name = GetParametrString(domElement, AttrName, QString()); const QString name = GetParametrString(domElement, AttrName, QString());
const QString desc = GetParametrEmptyString(domElement, AttrDescription); const QString desc = GetParametrEmptyString(domElement, AttrDescription);
const QString formula = GetParametrString(domElement, AttrFormula, QChar('0')); const IncrementType type = StringToIncrementType(GetParametrString(domElement, AttrType,
strTypeIncrement));
const QString formula = (type == IncrementType::Separator) ?
QChar('0') : GetParametrString(domElement, AttrFormula, QChar('0'));
bool ok = false; bool ok = false;
const qreal value = EvalFormula(data, formula, &ok); const qreal value = EvalFormula(data, formula, &ok);
VIncrement *increment = new VIncrement(data, name, static_cast<quint32>(index), value, formula, ok, VIncrement *increment = new VIncrement(data, name, type);
desc); increment->SetIndex(static_cast<quint32>(index++));
increment->SetFormula(value, formula, ok);
increment->SetDescription(desc);
increment->SetPreviewCalculation(node.toElement().tagName() == TagPreviewCalculations); increment->SetPreviewCalculation(node.toElement().tagName() == TagPreviewCalculations);
data->AddVariable(name, increment); data->AddVariable(name, increment);
++index;
} }
} }
} }
@ -3796,27 +3807,27 @@ void VPattern::ParseIncrementsElement(const QDomNode &node, const Document &pars
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::AddEmptyIncrement(const QString &name) void VPattern::AddEmptyIncrement(const QString &name, IncrementType type)
{ {
NewEmptyIncrement(TagIncrements, name); NewEmptyIncrement(TagIncrements, name, type);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::AddEmptyPreviewCalculation(const QString &name) void VPattern::AddEmptyPreviewCalculation(const QString &name, IncrementType type)
{ {
NewEmptyIncrement(TagPreviewCalculations, name); NewEmptyIncrement(TagPreviewCalculations, name, type);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::AddEmptyIncrementAfter(const QString &after, const QString &name) void VPattern::AddEmptyIncrementAfter(const QString &after, const QString &name, IncrementType type)
{ {
NewEmptyIncrementAfter(TagIncrements, after, name); NewEmptyIncrementAfter(TagIncrements, after, name, type);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::AddEmptyPreviewCalculationAfter(const QString &after, const QString &name) void VPattern::AddEmptyPreviewCalculationAfter(const QString &after, const QString &name, IncrementType type)
{ {
NewEmptyIncrementAfter(TagPreviewCalculations, after, name); NewEmptyIncrementAfter(TagPreviewCalculations, after, name, type);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -4273,7 +4284,7 @@ void VPattern::PrepareForParse(const Document &parse)
} }
else if (parse == Document::LiteParse || parse == Document::FullLiteParse) else if (parse == Document::LiteParse || parse == Document::FullLiteParse)
{ {
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types"); Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 9, "Check that you used all types");
QVector<VarType> types({VarType::LineAngle, QVector<VarType> types({VarType::LineAngle,
VarType::LineLength, VarType::LineLength,
VarType::CurveLength, VarType::CurveLength,
@ -4283,6 +4294,7 @@ void VPattern::PrepareForParse(const Document &parse)
if (parse == Document::FullLiteParse) if (parse == Document::FullLiteParse)
{ {
types.append(VarType::Increment); types.append(VarType::Increment);
types.append(VarType::IncrementSeparator);
} }
data->ClearVariables(types); data->ClearVariables(types);

View File

@ -72,11 +72,13 @@ public:
QRectF ActiveDrawBoundingRect() const; QRectF ActiveDrawBoundingRect() const;
void AddEmptyIncrement(const QString &name); void AddEmptyIncrement(const QString &name, IncrementType type = IncrementType::Increment);
void AddEmptyPreviewCalculation(const QString &name); void AddEmptyPreviewCalculation(const QString &name, IncrementType type = IncrementType::Increment);
void AddEmptyIncrementAfter(const QString &after, const QString &name); void AddEmptyIncrementAfter(const QString &after, const QString &name,
void AddEmptyPreviewCalculationAfter(const QString &after, const QString &name); IncrementType type = IncrementType::Increment);
void AddEmptyPreviewCalculationAfter(const QString &after, const QString &name,
IncrementType type = IncrementType::Increment);
void RemoveIncrement(const QString &name); void RemoveIncrement(const QString &name);
void RemovePreviewCalculation(const QString &name); void RemovePreviewCalculation(const QString &name);
@ -240,11 +242,11 @@ private:
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const; qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
QDomElement MakeEmptyIncrement(const QString &name); QDomElement MakeEmptyIncrement(const QString &name, IncrementType type);
QDomElement FindIncrement(const QString &name) const; QDomElement FindIncrement(const QString &name) const;
void NewEmptyIncrement(const QString &type, const QString &name); void NewEmptyIncrement(const QString &type, const QString &name, IncrementType varType);
void NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name); void NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name, IncrementType varType);
void RemoveIncrement(const QString &type, const QString &name); void RemoveIncrement(const QString &type, const QString &name);
void MoveUpIncrement(const QString &type, const QString &name); void MoveUpIncrement(const QString &type, const QString &name);
void MoveDownIncrement(const QString &type, const QString &name); void MoveDownIncrement(const QString &type, const QString &name);

View File

@ -140,9 +140,10 @@
<xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded"> <xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType> <xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"/> <xs:attribute name="description" type="xs:string"/>
<xs:attribute name="name" type="shortName" use="required"/> <xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/> <xs:attribute name="formula" type="xs:string"/>
<xs:attribute name="type" type="incrementType"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
@ -153,9 +154,10 @@
<xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded"> <xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType> <xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"/> <xs:attribute name="description" type="xs:string"/>
<xs:attribute name="name" type="shortName" use="required"/> <xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/> <xs:attribute name="formula" type="xs:string"/>
<xs:attribute name="type" type="incrementType"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
@ -1096,4 +1098,10 @@
<xs:enumeration value="bs"/> <xs:enumeration value="bs"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="incrementType">
<xs:restriction base="xs:string">
<xs:enumeration value="increment"/>
<xs:enumeration value="separator"/>
</xs:restriction>
</xs:simpleType>
</xs:schema> </xs:schema>

View File

@ -541,14 +541,16 @@ PassmarkLineType StringToPassmarkLineType(const QString &value)
return PassmarkLineType::OneLine; return PassmarkLineType::OneLine;
} }
const QString strStraightforward = QStringLiteral("straightforward"); const QString strStraightforward = QStringLiteral("straightforward");
const QString strBisector = QStringLiteral("bisector"); const QString strBisector = QStringLiteral("bisector");
const QString strIntersection = QStringLiteral("intersection"); const QString strIntersection = QStringLiteral("intersection");
const QString strIntersectionOnlyLeft = QStringLiteral("intersectionLeft"); const QString strIntersectionOnlyLeft = QStringLiteral("intersectionLeft");
const QString strIntersectionOnlyRight = QStringLiteral("intersectionRight"); const QString strIntersectionOnlyRight = QStringLiteral("intersectionRight");
const QString strIntersection2 = QStringLiteral("intersection2"); const QString strIntersection2 = QStringLiteral("intersection2");
const QString strIntersection2OnlyLeft = QStringLiteral("intersection2Left"); const QString strIntersection2OnlyLeft = QStringLiteral("intersection2Left");
const QString strIntersection2OnlyRight = QStringLiteral("intersection2Right"); const QString strIntersection2OnlyRight = QStringLiteral("intersection2Right");
const QString strTypeIncrement = QStringLiteral("increment");
const QString strTypeSeparator = QStringLiteral("separator");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString PassmarkAngleTypeToString(PassmarkAngleType type) QString PassmarkAngleTypeToString(PassmarkAngleType type)
@ -743,3 +745,36 @@ QDataStream &operator>>(QDataStream &in, CustomSARecord &record)
in >> record.includeType; in >> record.includeType;
return in; return in;
} }
//---------------------------------------------------------------------------------------------------------------------
QString IncrementTypeToString(IncrementType type)
{
switch(type)
{
case IncrementType::Increment:
return strTypeIncrement;
case IncrementType::Separator:
return strTypeSeparator;
default:
break;
}
return strTypeIncrement;
}
//---------------------------------------------------------------------------------------------------------------------
IncrementType StringToIncrementType(const QString &value)
{
const QStringList values { strTypeIncrement, strTypeSeparator };
switch(values.indexOf(value))
{
case 0:
return IncrementType::Increment;
case 1:
return IncrementType::Separator;
default:
break;
}
return IncrementType::Increment;
}

View File

@ -262,8 +262,13 @@ enum class Vis : ToolVisHolderType
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used LAST_ONE_DO_NOT_USE //add new stuffs 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, Increment, IncrementSeparator, LineLength, CurveLength, CurveCLength,
ArcRadius, Unknown }; LineAngle, CurveAngle, ArcRadius, Unknown };
enum class IncrementType : char { Increment, Separator };
QString IncrementTypeToString(IncrementType type);
IncrementType StringToIncrementType(const QString &value);
static const int heightStep = 6; static const int heightStep = 6;
enum class GHeights : unsigned char { ALL, enum class GHeights : unsigned char { ALL,
@ -433,6 +438,8 @@ extern const QString strIntersectionOnlyRight;
extern const QString strIntersection2; extern const QString strIntersection2;
extern const QString strIntersection2OnlyLeft; extern const QString strIntersection2OnlyLeft;
extern const QString strIntersection2OnlyRight; extern const QString strIntersection2OnlyRight;
extern const QString strTypeIncrement;
extern const QString strTypeSeparator;
extern const QString unitMM; extern const QString unitMM;
extern const QString unitCM; extern const QString unitCM;

View File

@ -46,15 +46,11 @@ VIncrement::VIncrement()
/** /**
* @brief VIncrementTableRow create increment * @brief VIncrementTableRow create increment
* @param name increment's name * @param name increment's name
* @param base value
* @param description description of increment
*/ */
VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, VIncrement::VIncrement(VContainer *data, const QString &name, IncrementType incrType)
bool ok, const QString &description) :VVariable(name, QString()), d(new VIncrementData(data, incrType))
:VVariable(name, description), d(new VIncrementData(data, index, formula, ok))
{ {
SetType(VarType::Increment); incrType == IncrementType::Separator ? SetType(VarType::IncrementSeparator) : SetType(VarType::Increment);
VInternalVariable::SetValue(base);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -84,11 +80,19 @@ VIncrement::~VIncrement()
* using. * using.
* @return index * @return index
*/ */
quint32 VIncrement::getIndex() const quint32 VIncrement::GetIndex() const
{ {
return d->index; return d->index;
} }
//---------------------------------------------------------------------------------------------------------------------
void VIncrement::SetFormula(qreal base, const QString &formula, bool ok)
{
VInternalVariable::SetValue(base);
d->formula = formula;
d->formulaOk = ok;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VIncrement::GetFormula() const QString VIncrement::GetFormula() const
{ {
@ -101,12 +105,24 @@ bool VIncrement::IsFormulaOk() const
return d->formulaOk; return d->formulaOk;
} }
//---------------------------------------------------------------------------------------------------------------------
void VIncrement::SetIndex(quint32 index)
{
d->index = index;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VContainer *VIncrement::GetData() VContainer *VIncrement::GetData()
{ {
return d->data.data(); return d->data.data();
} }
//---------------------------------------------------------------------------------------------------------------------
IncrementType VIncrement::GetIncrementType() const
{
return d->incrType;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VIncrement::IsPreviewCalculation() const bool VIncrement::IsPreviewCalculation() const
{ {

View File

@ -47,8 +47,7 @@ class VIncrement :public VVariable
{ {
public: public:
VIncrement(); VIncrement();
VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, bool ok, VIncrement(VContainer *data, const QString &name, IncrementType incrType = IncrementType::Increment);
const QString &description = QString());
VIncrement(const VIncrement &incr); VIncrement(const VIncrement &incr);
virtual ~VIncrement() override; virtual ~VIncrement() override;
@ -61,10 +60,15 @@ public:
inline void Swap(VIncrement &incr) Q_DECL_NOTHROW inline void Swap(VIncrement &incr) Q_DECL_NOTHROW
{ VVariable::Swap(incr); std::swap(d, incr.d); } { VVariable::Swap(incr); std::swap(d, incr.d); }
quint32 getIndex() const; void SetFormula(qreal base, const QString &formula, bool ok);
QString GetFormula() const; QString GetFormula() const;
bool IsFormulaOk() const; bool IsFormulaOk() const;
VContainer *GetData();
void SetIndex(quint32 index);
quint32 GetIndex() const;
VContainer *GetData();
IncrementType GetIncrementType() const;
bool IsPreviewCalculation() const; bool IsPreviewCalculation() const;
void SetPreviewCalculation(bool value); void SetPreviewCalculation(bool value);

View File

@ -44,29 +44,24 @@ class VIncrementData : public QSharedData
public: public:
VIncrementData() VIncrementData()
: index(NULL_ID), : index(NULL_ID)
formula(QString()),
formulaOk(false),
previewCalculation(false),
data()
{} {}
VIncrementData(VContainer *data, quint32 index, const QString &formula, bool ok) VIncrementData(VContainer *data, IncrementType incrType)
: index(index), : data(QSharedPointer<VContainer>(new VContainer(*data))),
formula(formula), incrType(incrType)
formulaOk(ok),
previewCalculation(false),
data(QSharedPointer<VContainer>(new VContainer(*data)))
{ {
// When we create an increment in the dialog it will get neccesary data. Such data must be removed because will // When we create an increment in the dialog it will get neccesary data. Such data must be removed because will
// confuse a user. Increment should not know nothing about internal variables. // confuse a user. Increment should not know nothing about internal variables.
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types"); Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 9, "Check that you used all types");
this->data->ClearVariables(QVector<VarType>({VarType::LineAngle, this->data->ClearVariables(QVector<VarType>({VarType::LineAngle,
VarType::LineLength, VarType::LineLength,
VarType::CurveLength, VarType::CurveLength,
VarType::CurveCLength, VarType::CurveCLength,
VarType::ArcRadius, VarType::ArcRadius,
VarType::CurveAngle})); VarType::CurveAngle,
VarType::IncrementSeparator
}));
} }
VIncrementData(const VIncrementData &incr) VIncrementData(const VIncrementData &incr)
@ -75,7 +70,8 @@ public:
formula(incr.formula), formula(incr.formula),
formulaOk(incr.formulaOk), formulaOk(incr.formulaOk),
previewCalculation(incr.previewCalculation), previewCalculation(incr.previewCalculation),
data(incr.data) data(incr.data),
incrType(incr.incrType)
{} {}
virtual ~VIncrementData(); virtual ~VIncrementData();
@ -83,9 +79,10 @@ public:
/** @brief id each increment have unique identificator */ /** @brief id each increment have unique identificator */
quint32 index; quint32 index;
QString formula; QString formula;
bool formulaOk; bool formulaOk{false};
bool previewCalculation; bool previewCalculation{false};
QSharedPointer<VContainer> data; QSharedPointer<VContainer> data;
IncrementType incrType{IncrementType::Increment};
private: private:
VIncrementData &operator=(const VIncrementData &) Q_DECL_EQ_DELETE; VIncrementData &operator=(const VIncrementData &) Q_DECL_EQ_DELETE;

View File

@ -371,8 +371,9 @@ void VContainer::ClearForFullParse()
d->pieces->clear(); d->pieces->clear();
d->piecePaths->clear(); d->piecePaths->clear();
Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 8, "Check that you used all types"); Q_STATIC_ASSERT_X(static_cast<int>(VarType::Unknown) == 9, "Check that you used all types");
ClearVariables(QVector<VarType>({VarType::Increment, ClearVariables(QVector<VarType>({VarType::Increment,
VarType::IncrementSeparator,
VarType::LineAngle, VarType::LineAngle,
VarType::LineLength, VarType::LineLength,
VarType::CurveLength, VarType::CurveLength,
@ -590,6 +591,22 @@ const QMap<QString, QSharedPointer<VIncrement> > VContainer::DataIncrements() co
return DataVar<VIncrement>(VarType::Increment); return DataVar<VIncrement>(VarType::Increment);
} }
//---------------------------------------------------------------------------------------------------------------------
const QMap<QString, QSharedPointer<VIncrement> > VContainer::DataIncrementsWithSeparators() const
{
QMap<QString, QSharedPointer<VIncrement> > increments = DataVar<VIncrement>(VarType::Increment);
QMap<QString, QSharedPointer<VIncrement> > separators = DataVar<VIncrement>(VarType::IncrementSeparator);
QMap<QString, QSharedPointer<VIncrement>>::const_iterator i = separators.constBegin();
while (i != separators.constEnd())
{
increments.insert(i.key(), i.value());
++i;
}
return increments;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QMap<QString, QSharedPointer<VLengthLine> > VContainer::DataLengthLines() const const QMap<QString, QSharedPointer<VLengthLine> > VContainer::DataLengthLines() const
{ {

View File

@ -202,6 +202,7 @@ public:
const QMap<QString, QSharedPointer<VMeasurement> > DataMeasurements() const; const QMap<QString, QSharedPointer<VMeasurement> > DataMeasurements() const;
const QMap<QString, QSharedPointer<VIncrement> > DataIncrements() const; const QMap<QString, QSharedPointer<VIncrement> > DataIncrements() const;
const QMap<QString, QSharedPointer<VIncrement> > DataIncrementsWithSeparators() const;
const QMap<QString, QSharedPointer<VLengthLine> > DataLengthLines() const; const QMap<QString, QSharedPointer<VLengthLine> > DataLengthLines() const;
const QMap<QString, QSharedPointer<VCurveLength> > DataLengthCurves() const; const QMap<QString, QSharedPointer<VCurveLength> > DataLengthCurves() const;
const QMap<QString, QSharedPointer<VCurveCLength> > DataCurvesCLength() const; const QMap<QString, QSharedPointer<VCurveCLength> > DataCurvesCLength() const;

View File

@ -735,9 +735,12 @@ void DialogPiecePath::EvalWidth()
if (m_saWidth >= 0) if (m_saWidth >= 0)
{ {
VContainer *locData = const_cast<VContainer *> (data); VContainer *locData = const_cast<VContainer *> (data);
locData->AddVariable(currentSeamAllowance, new VIncrement(locData, currentSeamAllowance, 0, m_saWidth,
QString().setNum(m_saWidth), true, auto currentSA = new VIncrement(locData, currentSeamAllowance);
tr("Current seam aloowance"))); currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
currentSA->SetDescription(tr("Current seam allowance"));
locData->AddVariable(currentSeamAllowance, currentSA);
EvalWidthBefore(); EvalWidthBefore();
EvalWidthAfter(); EvalWidthAfter();

View File

@ -2064,9 +2064,12 @@ void DialogSeamAllowance::EvalWidth()
if (m_saWidth >= 0) if (m_saWidth >= 0)
{ {
VContainer *locData = const_cast<VContainer *> (data); VContainer *locData = const_cast<VContainer *> (data);
locData->AddVariable(currentSeamAllowance, new VIncrement(locData, currentSeamAllowance, 0, m_saWidth,
QString().setNum(m_saWidth), true, auto currentSA = new VIncrement(locData, currentSeamAllowance);
tr("Current seam allowance"))); currentSA->SetFormula(m_saWidth, QString().setNum(m_saWidth), true);
currentSA->SetDescription(tr("Current seam allowance"));
locData->AddVariable(currentSeamAllowance, currentSA);
EvalWidthBefore(); EvalWidthBefore();
EvalWidthAfter(); EvalWidthAfter();

View File

@ -116,10 +116,11 @@ VToolSeamAllowance *VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initD
{ {
if (initData.typeCreation == Source::FromGui || initData.typeCreation == Source::FromTool) if (initData.typeCreation == Source::FromGui || initData.typeCreation == Source::FromTool)
{ {
initData.data->AddVariable(currentSeamAllowance, new VIncrement(initData.data, currentSeamAllowance, 0, auto currentSA = new VIncrement(initData.data, currentSeamAllowance);
initData.detail.GetSAWidth(), currentSA->SetFormula(initData.detail.GetSAWidth(), initData.width, true);
initData.width, true, currentSA->SetDescription(tr("Current seam allowance"));
tr("Current seam allowance")));
initData.data->AddVariable(currentSeamAllowance, currentSA);
initData.id = initData.data->AddPiece(initData.detail); initData.id = initData.data->AddPiece(initData.detail);
} }
else else
@ -127,9 +128,11 @@ VToolSeamAllowance *VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initD
const qreal calcWidth = CheckFormula(initData.id, initData.width, initData.data); const qreal calcWidth = CheckFormula(initData.id, initData.width, initData.data);
initData.detail.SetFormulaSAWidth(initData.width, calcWidth); initData.detail.SetFormulaSAWidth(initData.width, calcWidth);
initData.data->AddVariable(currentSeamAllowance, new VIncrement(initData.data, currentSeamAllowance, 0, auto currentSA = new VIncrement(initData.data, currentSeamAllowance);
calcWidth, initData.width, true, currentSA->SetFormula(calcWidth, initData.width, true);
tr("Current seam allowance"))); currentSA->SetDescription(tr("Current seam allowance"));
initData.data->AddVariable(currentSeamAllowance, currentSA);
initData.data->UpdatePiece(initData.id, initData.detail); initData.data->UpdatePiece(initData.id, initData.detail);
if (initData.parse != Document::FullParse) if (initData.parse != Document::FullParse)