diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index b63d04664..48e31b428 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -61,7 +61,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par doc(doc), formulaBaseHeight(0), search(), - hasChanges(false) + hasChanges(false), + renameList() { ui->setupUi(this); @@ -466,6 +467,64 @@ void DialogIncrements::LocalUpdateTree() //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::UpdateTree() { + FillIncrements(); + + search->RefreshList(ui->lineEditFind->text()); +} + +//--------------------------------------------------------------------------------------------------------------------- +bool DialogIncrements::IncrementUsed(const QString &name) const +{ + const QVector expressions = doc->ListExpressions(); + + for(int i = 0; i < expressions.size(); ++i) + { + if (expressions.at(i).expression.indexOf(name) != -1) + { + // Eval formula + try + { + QScopedPointer cal(new qmu::QmuTokenParser(expressions.at(i).expression, false, + false)); + + // Tokens (variables, measurements) + if (cal->GetTokens().values().contains(name)) + { + return true; + } + } + catch (const qmu::QmuParserError &) + { + // Do nothing. Because we not sure if used. A formula is broken. + } + } + } + return false; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogIncrements::CacheRename(const QString &name, const QString &newName) +{ + for (int i = 0; i < renameList.size(); ++i) + { + if (renameList.at(i).second == name) + { + renameList[i].second = newName; + return; + } + } + + renameList.append(qMakePair(name, newName)); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief FullUpdateFromFile update information in tables form file + */ +void DialogIncrements::FullUpdateFromFile() +{ + hasChanges = false; + ui->tableWidgetLines->clearContents(); ui->tableWidgetSplines->clearContents(); ui->tableWidgetAnglesCurves->clearContents(); @@ -483,51 +542,18 @@ void DialogIncrements::UpdateTree() search->RefreshList(ui->lineEditFind->text()); } -//--------------------------------------------------------------------------------------------------------------------- -bool DialogIncrements::IncrementUsed(const QString &name) const -{ - const QStringList expressions = doc->ListExpressions(); - - for(int i = 0; i < expressions.size(); ++i) - { - if (expressions.at(i).indexOf(name) != -1) - { - // Eval formula - try - { - QScopedPointer cal(new qmu::QmuTokenParser(expressions.at(i), false, false)); - - // Tokens (variables, measurements) - if (cal->GetTokens().values().contains(name)) - { - return true; - } - } - catch (const qmu::QmuParserError &) - { - // Do nothing. Because we not sure if used. A formula is broken. - } - } - } - return false; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief FullUpdateFromFile update information in tables form file - */ -void DialogIncrements::FullUpdateFromFile() -{ - hasChanges = false; - - UpdateTree(); -} - //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::RefreshPattern() { if (hasChanges) { + QVector expressions = doc->ListExpressions(); + for (int i = 0; i < renameList.size(); ++i) + { + doc->ReplaceNameInFormula(expressions, renameList.at(i).first, renameList.at(i).second); + } + renameList.clear(); + const int row = ui->tableWidgetIncrement->currentRow(); doc->LiteParseTree(Document::LiteParse); @@ -663,6 +689,9 @@ void DialogIncrements::SaveIncrName(const QString &text) } doc->SetIncrementName(nameField->text(), newName); + QVector expressions = doc->ListIncrementExpressions(); + doc->ReplaceNameInFormula(expressions, nameField->text(), newName); + CacheRename(nameField->text(), newName); hasChanges = true; LocalUpdateTree(); @@ -832,6 +861,7 @@ void DialogIncrements::closeEvent(QCloseEvent *event) ui->lineEditName->blockSignals(true); ui->plainTextEditDescription->blockSignals(true); + emit UpdateProperties(); emit DialogClosed(QDialog::Accepted); event->accept(); } @@ -942,7 +972,6 @@ void DialogIncrements::ShowIncrementDetails() ui->lineEditName->blockSignals(true); ui->lineEditName->setText(ClearIncrementName(incr->GetName())); ui->lineEditName->blockSignals(false); - ui->lineEditName->setReadOnly(IncrementUsed(incr->GetName())); ui->plainTextEditDescription->blockSignals(true); ui->plainTextEditDescription->setPlainText(incr->GetDescription()); diff --git a/src/app/valentina/dialogs/dialogincrements.h b/src/app/valentina/dialogs/dialogincrements.h index 125c42b0b..e0a0bd17d 100644 --- a/src/app/valentina/dialogs/dialogincrements.h +++ b/src/app/valentina/dialogs/dialogincrements.h @@ -33,6 +33,8 @@ #include "../xml/vpattern.h" #include "../vmisc/vtablesearch.h" +#include + class VIndividualMeasurements; namespace Ui @@ -50,6 +52,9 @@ public: DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr); virtual ~DialogIncrements() Q_DECL_OVERRIDE; +signals: + void UpdateProperties(); + protected: virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; virtual void changeEvent ( QEvent * event) Q_DECL_OVERRIDE; @@ -88,6 +93,8 @@ private: bool hasChanges; + QVector> renameList; + template void FillTable(const QMap &varTable, QTableWidget *table); @@ -115,6 +122,8 @@ private: void UpdateTree(); bool IncrementUsed(const QString &name) const; + + void CacheRename(const QString &name, const QString &newName); }; #endif // DIALOGINCREMENTS_H diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 6a071c5ad..ba7a2d66d 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3919,6 +3919,8 @@ void MainWindow::CreateActions() if (checked) { dialogTable = new DialogIncrements(pattern, doc, this); + connect(dialogTable.data(), &DialogIncrements::UpdateProperties, toolOptions, + &VToolOptionsPropertyBrowser::RefreshOptions); connect(dialogTable.data(), &DialogIncrements::DialogClosed, this, [this]() { ui->actionTable->setChecked(false); diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 02538aa87..733ee5cb7 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -44,6 +44,7 @@ #include "../vmisc/vmath.h" #include "../vmisc/projectversion.h" #include "../qmuparser/qmuparsererror.h" +#include "../qmuparser/qmutokenparser.h" #include "../vgeometry/varc.h" #include "../vgeometry/vellipticalarc.h" #include "../vgeometry/vsplinepath.h" @@ -3509,6 +3510,63 @@ void VPattern::SetIncrementDescription(const QString &name, const QString &text) } } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::ReplaceNameInFormula(QVector &expressions, const QString &name, const QString &newName) +{ + const int bias = name.length() - newName.length(); + + for(int i = 0; i < expressions.size(); ++i) + { + if (expressions.at(i).expression.indexOf(name) != -1) + { + QMap tokens; + + // Eval formula + try + { + QScopedPointer cal(new qmu::QmuTokenParser(expressions.at(i).expression, false, + false)); + tokens = cal->GetTokens();// Tokens (variables, measurements) + + } + catch (const qmu::QmuParserError &) + { + continue;// Because we not sure if used. A formula is broken. + } + + QList tValues = tokens.values(); + if (not tValues.contains(name)) + { + continue; + } + + QList tKeys = tokens.keys();// Take all tokens positions + QString newFormula = expressions.at(i).expression; + + for (int i = 0; i < tKeys.size(); ++i) + { + if (tValues.at(i) != name) + { + continue; + } + + newFormula.replace(tKeys.at(i), name.length(), newName); + + if (bias != 0) + {// Translated token has different length than original. Position next tokens need to be corrected. + VTranslateVars::BiasTokens(tKeys.at(i), bias, tokens); + tKeys = tokens.keys(); + tValues = tokens.values(); + } + } + + expressions[i].expression = newFormula; + expressions[i].element.setAttribute(expressions.at(i).attribute, newFormula); + emit patternChanged(false); + } + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief GenerateLabel create label for pattern piece of point. diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index c88599b77..2ce56e4e6 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -79,6 +79,8 @@ public: void SetIncrementFormula(const QString &name, const QString &text); void SetIncrementDescription(const QString &name, const QString &text); + void ReplaceNameInFormula(QVector &expressions, const QString &name, const QString &newName); + virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const Q_DECL_OVERRIDE; virtual QString GenerateSuffix() const Q_DECL_OVERRIDE; diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index a98b44577..c1092679a 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -194,6 +194,28 @@ const QString VAbstractPattern::NodeSplinePath = QStringLiteral("NodeSplinePath" QHash VAbstractPattern::tools = QHash(); +namespace +{ +void ReadExpressionAttribute(QVector &expressions, const QDomElement &element, const QString &attribute) +{ + VFormulaField formula; + try + { + formula.expression = VDomDocument::GetParametrString(element, attribute); + } + catch (VExceptionEmptyParameter &e) + { + Q_UNUSED(e) + return; + } + + formula.element = element; + formula.attribute = attribute; + + expressions.append(formula); +} +} + //--------------------------------------------------------------------------------------------------------------------- VAbstractPattern::VAbstractPattern(QObject *parent) : QObject(parent), @@ -218,17 +240,18 @@ QStringList VAbstractPattern::ListMeasurements() const others.insert(increments.at(i)); } - const QStringList expressions = ListExpressions(); + const QVector expressions = ListExpressions(); for (int i=0; i < expressions.size(); ++i) { - QScopedPointer cal(new qmu::QmuTokenParser(expressions.at(i), false, false));// Eval formula + // Eval formula + QScopedPointer cal(new qmu::QmuTokenParser(expressions.at(i).expression, false, false)); const QMap tokens = cal->GetTokens();// Tokens (variables, measurements) delete cal.take(); const QList tValues = tokens.values(); for (int j = 0; j < tValues.size(); ++j) { - if (tValues.at(j) == QLatin1String("-")) + if (tValues.at(j) == QChar('-')) { continue; } @@ -1613,9 +1636,9 @@ QStringList VAbstractPattern::ListIncrements() const } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListExpressions() const +QVector VAbstractPattern::ListExpressions() const { - QStringList list; + QVector list; // If new tool bring absolutely new type and has formula(s) create new method to cover it. // Note. Tool Union Details also contains formulas, but we don't use them for union and keep only to simplifying @@ -1633,333 +1656,180 @@ QStringList VAbstractPattern::ListExpressions() const } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListPointExpressions() const +QVector VAbstractPattern::ListPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment a number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(TagPoint); for (int i=0; i < list.size(); ++i) { const QDomElement dom = list.at(i).toElement(); // Each tag can contains several attributes. - try - { - expressions.append(GetParametrString(dom, AttrLength)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrAngle)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - try - { - expressions.append(GetParametrString(dom, AttrC1Radius)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrC2Radius)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrCRadius)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrRadius)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + ReadExpressionAttribute(expressions, dom, AttrLength); + ReadExpressionAttribute(expressions, dom, AttrAngle); + ReadExpressionAttribute(expressions, dom, AttrC1Radius); + ReadExpressionAttribute(expressions, dom, AttrC2Radius); + ReadExpressionAttribute(expressions, dom, AttrCRadius); + ReadExpressionAttribute(expressions, dom, AttrRadius); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListArcExpressions() const +QVector VAbstractPattern::ListArcExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(TagArc); for (int i=0; i < list.size(); ++i) { const QDomElement dom = list.at(i).toElement(); - try - { - expressions.append(GetParametrString(dom, AttrAngle1)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrAngle2)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrRadius)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrLength)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + // Each tag can contains several attributes. + ReadExpressionAttribute(expressions, dom, AttrAngle1); + ReadExpressionAttribute(expressions, dom, AttrAngle2); + ReadExpressionAttribute(expressions, dom, AttrRadius); + ReadExpressionAttribute(expressions, dom, AttrLength); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListElArcExpressions() const +QVector VAbstractPattern::ListElArcExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(TagElArc); for (int i=0; i < list.size(); ++i) { const QDomElement dom = list.at(i).toElement(); - try - { - expressions.append(GetParametrString(dom, AttrRadius1)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrRadius2)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrAngle1)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrAngle2)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrRotationAngle)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + // Each tag can contains several attributes. + ReadExpressionAttribute(expressions, dom, AttrRadius1); + ReadExpressionAttribute(expressions, dom, AttrRadius2); + ReadExpressionAttribute(expressions, dom, AttrAngle1); + ReadExpressionAttribute(expressions, dom, AttrAngle2); + ReadExpressionAttribute(expressions, dom, AttrRotationAngle); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListSplineExpressions() const +QVector VAbstractPattern::ListSplineExpressions() const { - QStringList expressions; + QVector expressions; expressions << ListPathPointExpressions(); return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListPathPointExpressions() const +QVector VAbstractPattern::ListPathPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); for (int i=0; i < list.size(); ++i) { const QDomElement dom = list.at(i).toElement(); - try - { - expressions.append(GetParametrString(dom, AttrKAsm1)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrKAsm2)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrAngle)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + // Each tag can contains several attributes. + ReadExpressionAttribute(expressions, dom, AttrKAsm1); + ReadExpressionAttribute(expressions, dom, AttrKAsm2); + ReadExpressionAttribute(expressions, dom, AttrAngle); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListIncrementExpressions() const +QVector VAbstractPattern::ListIncrementExpressions() const { - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(TagIncrement); for (int i=0; i < list.size(); ++i) { const QDomElement dom = list.at(i).toElement(); - try - { - expressions.append(GetParametrString(dom, IncrementFormula)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + ReadExpressionAttribute(expressions, dom, IncrementFormula); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListOperationExpressions() const +QVector VAbstractPattern::ListOperationExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(TagOperation); for (int i=0; i < list.size(); ++i) { const QDomElement dom = list.at(i).toElement(); // Each tag can contains several attributes. - try - { - expressions.append(GetParametrString(dom, AttrAngle)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(dom, AttrLength)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + ReadExpressionAttribute(expressions, dom, AttrAngle); + ReadExpressionAttribute(expressions, dom, AttrLength); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListNodesExpressions(const QDomElement &nodes) const -{ - QStringList expressions; - VPiecePath path; - if (not nodes.isNull()) - { - path = ParsePathNodes(nodes); - } - - for(int i = 0; i < path.CountNodes(); ++i) - { - expressions.append(path.at(i).GetFormulaSABefore()); - expressions.append(path.at(i).GetFormulaSAAfter()); - } - return expressions; -} - -//--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListPathExpressions() const +QVector VAbstractPattern::ListNodesExpressions(const QDomElement &nodes) const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; + + const QDomNodeList nodeList = nodes.childNodes(); + for (qint32 i = 0; i < nodeList.size(); ++i) + { + const QDomElement element = nodeList.at(i).toElement(); + if (not element.isNull() && element.tagName() == VAbstractPattern::TagNode) + { + ReadExpressionAttribute(expressions, element, VAbstractPattern::AttrSABefore); + ReadExpressionAttribute(expressions, element, VAbstractPattern::AttrSAAfter); + } + } + return expressions; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector VAbstractPattern::ListPathExpressions() const +{ + // Check if new tool doesn't bring new attribute with a formula. + // If no just increment number. + // If new tool bring absolutely new type and has formula(s) create new method to cover it. + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); + + QVector expressions; const QDomNodeList list = elementsByTagName(TagPath); for (int i=0; i < list.size(); ++i) { @@ -1976,43 +1846,28 @@ QStringList VAbstractPattern::ListPathExpressions() const } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListGrainlineExpressions(const QDomElement &element) const +QVector VAbstractPattern::ListGrainlineExpressions(const QDomElement &element) const { - QStringList expressions; + QVector expressions; if (not element.isNull()) { // Each tag can contains several attributes. - try - { - expressions.append(GetParametrString(element, AttrRotation)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } - - try - { - expressions.append(GetParametrString(element, AttrLength)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + ReadExpressionAttribute(expressions, element, AttrRotation); + ReadExpressionAttribute(expressions, element, AttrLength); } return expressions; } //--------------------------------------------------------------------------------------------------------------------- -QStringList VAbstractPattern::ListPieceExpressions() const +QVector VAbstractPattern::ListPieceExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 53); - QStringList expressions; + QVector expressions; const QDomNodeList list = elementsByTagName(TagDetail); for (int i=0; i < list.size(); ++i) { @@ -2023,14 +1878,7 @@ QStringList VAbstractPattern::ListPieceExpressions() const } // Each tag can contains several attributes. - try - { - expressions.append(GetParametrString(dom, AttrWidth)); - } - catch (VExceptionEmptyParameter &e) - { - Q_UNUSED(e) - } + ReadExpressionAttribute(expressions, dom, AttrWidth); expressions << ListNodesExpressions(dom.firstChildElement(TagNodes)); expressions << ListGrainlineExpressions(dom.firstChildElement(TagGrainline)); diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 60f98c158..b7b285052 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -60,6 +60,18 @@ enum class AxisType : char {VerticalAxis = 1, HorizontalAxis = 2}; class VContainer; class VDataTool; +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Weffc++") + +struct VFormulaField +{ + QString expression; + QDomElement element; + QString attribute; +}; + +QT_WARNING_POP + class VAbstractPattern : public QObject, public VDomDocument { Q_OBJECT @@ -68,7 +80,8 @@ public: virtual ~VAbstractPattern() Q_DECL_EQ_DEFAULT; QStringList ListMeasurements() const; - QStringList ListExpressions() const; + QVector ListExpressions() const; + QVector ListIncrementExpressions() const; virtual void CreateEmptyFile()=0; @@ -388,17 +401,16 @@ private: Q_DISABLE_COPY(VAbstractPattern) QStringList ListIncrements() const; - QStringList ListPointExpressions() const; - QStringList ListArcExpressions() const; - QStringList ListElArcExpressions() const; - QStringList ListSplineExpressions() const; - QStringList ListPathPointExpressions() const; - QStringList ListIncrementExpressions() const; - QStringList ListOperationExpressions() const; - QStringList ListNodesExpressions(const QDomElement &nodes) const; - QStringList ListPathExpressions() const; - QStringList ListGrainlineExpressions(const QDomElement &element) const; - QStringList ListPieceExpressions() const; + QVector ListPointExpressions() const; + QVector ListArcExpressions() const; + QVector ListElArcExpressions() const; + QVector ListSplineExpressions() const; + QVector ListPathPointExpressions() const; + QVector ListOperationExpressions() const; + QVector ListNodesExpressions(const QDomElement &nodes) const; + QVector ListPathExpressions() const; + QVector ListGrainlineExpressions(const QDomElement &element) const; + QVector ListPieceExpressions() const; bool IsVariable(const QString& token) const; bool IsPostfixOperator(const QString& token) const; diff --git a/src/libs/vpatterndb/vtranslatevars.h b/src/libs/vpatterndb/vtranslatevars.h index b95eeef97..a8a8213d9 100644 --- a/src/libs/vpatterndb/vtranslatevars.h +++ b/src/libs/vpatterndb/vtranslatevars.h @@ -65,6 +65,8 @@ public: QMap GetFunctions() const; + static void BiasTokens(int position, int bias, QMap &tokens); + private: Q_DISABLE_COPY(VTranslateVars) QMap PMSystemNames; @@ -86,7 +88,7 @@ private: const qmu::QmuTranslation &book); void CorrectionsPositions(int position, int bias, QMap &tokens, QMap &numbers) const; - static void BiasTokens(int position, int bias, QMap &tokens); + }; #endif // VTRANSLATEVARS_H