From 10ba3eacbb9b404430019ef530edb50b5abfa549 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 29 Jul 2014 15:19:11 +0300 Subject: [PATCH] Don't show internal variable if we created her. --HG-- branch : develop --- src/app/container/calculator.cpp | 24 ++++++------ src/app/container/vcontainer.cpp | 39 ++++++------------- src/app/container/vcontainer.h | 16 ++++---- src/app/dialogs/app/dialoghistory.cpp | 2 +- src/app/dialogs/app/dialogincrements.cpp | 9 +++-- src/app/dialogs/app/dialogincrements.h | 3 +- src/app/dialogs/tools/dialogalongline.cpp | 7 ++-- src/app/dialogs/tools/dialogalongline.h | 2 +- src/app/dialogs/tools/dialogarc.cpp | 8 ++-- src/app/dialogs/tools/dialogarc.h | 2 +- src/app/dialogs/tools/dialogbisector.cpp | 4 +- src/app/dialogs/tools/dialogbisector.h | 2 +- src/app/dialogs/tools/dialogcutarc.cpp | 4 +- src/app/dialogs/tools/dialogcutarc.h | 2 +- src/app/dialogs/tools/dialogcutspline.cpp | 6 +-- src/app/dialogs/tools/dialogcutspline.h | 2 +- src/app/dialogs/tools/dialogcutsplinepath.cpp | 4 +- src/app/dialogs/tools/dialogcutsplinepath.h | 2 +- src/app/dialogs/tools/dialogdetail.cpp | 4 +- src/app/dialogs/tools/dialogdetail.h | 2 +- .../dialogs/tools/dialogeditwrongformula.cpp | 4 +- .../dialogs/tools/dialogeditwrongformula.h | 2 +- src/app/dialogs/tools/dialogendline.cpp | 6 +-- src/app/dialogs/tools/dialogendline.h | 2 +- src/app/dialogs/tools/dialogheight.cpp | 4 +- src/app/dialogs/tools/dialogheight.h | 2 +- src/app/dialogs/tools/dialogline.cpp | 6 +-- src/app/dialogs/tools/dialogline.h | 2 +- src/app/dialogs/tools/dialoglineintersect.cpp | 4 +- src/app/dialogs/tools/dialoglineintersect.h | 2 +- src/app/dialogs/tools/dialognormal.cpp | 4 +- src/app/dialogs/tools/dialognormal.h | 2 +- .../dialogs/tools/dialogpointofcontact.cpp | 6 +-- src/app/dialogs/tools/dialogpointofcontact.h | 2 +- .../tools/dialogpointofintersection.cpp | 4 +- .../dialogs/tools/dialogpointofintersection.h | 2 +- src/app/dialogs/tools/dialogshoulderpoint.cpp | 4 +- src/app/dialogs/tools/dialogshoulderpoint.h | 2 +- src/app/dialogs/tools/dialogsinglepoint.cpp | 4 +- src/app/dialogs/tools/dialogsinglepoint.h | 2 +- src/app/dialogs/tools/dialogspline.cpp | 6 +-- src/app/dialogs/tools/dialogspline.h | 2 +- src/app/dialogs/tools/dialogsplinepath.cpp | 4 +- src/app/dialogs/tools/dialogsplinepath.h | 2 +- src/app/dialogs/tools/dialogtool.cpp | 32 ++++++++++----- src/app/dialogs/tools/dialogtool.h | 17 +++++--- src/app/dialogs/tools/dialogtriangle.cpp | 4 +- src/app/dialogs/tools/dialogtriangle.h | 2 +- src/app/dialogs/tools/dialoguniondetails.cpp | 4 +- src/app/dialogs/tools/dialoguniondetails.h | 2 +- src/app/mainwindow.cpp | 4 +- src/app/tools/drawTools/vdrawtool.cpp | 6 ++- src/app/tools/drawTools/vdrawtool.h | 4 +- src/app/tools/drawTools/vtoolalongline.cpp | 2 +- src/app/tools/drawTools/vtoolarc.cpp | 6 +-- src/app/tools/drawTools/vtoolbisector.cpp | 2 +- src/app/tools/drawTools/vtoolcutarc.cpp | 2 +- src/app/tools/drawTools/vtoolcutspline.cpp | 2 +- .../tools/drawTools/vtoolcutsplinepath.cpp | 2 +- src/app/tools/drawTools/vtoolendline.cpp | 2 +- src/app/tools/drawTools/vtoolnormal.cpp | 2 +- .../tools/drawTools/vtoolpointofcontact.cpp | 2 +- .../tools/drawTools/vtoolshoulderpoint.cpp | 2 +- src/app/tools/vabstracttool.cpp | 1 - src/app/tools/vtooldetail.cpp | 2 +- 65 files changed, 165 insertions(+), 161 deletions(-) diff --git a/src/app/container/calculator.cpp b/src/app/container/calculator.cpp index 960649bfc..83d56e4f6 100644 --- a/src/app/container/calculator.cpp +++ b/src/app/container/calculator.cpp @@ -154,16 +154,16 @@ void Calculator::InitVariables(const VContainer *data) num +=2; } - const QMap lengthLines = data->DataLengthLines(); + const QMap lengthLines = data->DataLengthLines(); num += lengthLines.size(); - const QMap lengthSplines = data->DataLengthSplines(); + const QMap lengthSplines = data->DataLengthSplines(); num += lengthSplines.size(); - const QMap lengthArcs = data->DataLengthArcs(); + const QMap lengthArcs = data->DataLengthArcs(); num += lengthArcs.size(); - const QMap lineAngles = data->DataLineAngles(); + const QMap lineAngles = data->DataLineAngles(); num += lineAngles.size(); const QMap measurements = data->DataMeasurements(); @@ -187,10 +187,10 @@ void Calculator::InitVariables(const VContainer *data) } { - QMap::const_iterator i = lengthLines.constBegin(); + QMap::const_iterator i = lengthLines.constBegin(); while (i != lengthLines.constEnd()) { - vVarVal[j] = i.value(); + vVarVal[j] = *i.value()->GetValue(); DefineVar(i.key(), &vVarVal[j]); ++j; ++i; @@ -198,10 +198,10 @@ void Calculator::InitVariables(const VContainer *data) } { - QMap::const_iterator i = lengthSplines.constBegin(); + QMap::const_iterator i = lengthSplines.constBegin(); while (i != lengthSplines.constEnd()) { - vVarVal[j] = i.value(); + vVarVal[j] = *i.value()->GetValue(); DefineVar(i.key(), &vVarVal[j]); ++j; ++i; @@ -209,10 +209,10 @@ void Calculator::InitVariables(const VContainer *data) } { - QMap::const_iterator i = lengthArcs.constBegin(); + QMap::const_iterator i = lengthArcs.constBegin(); while (i != lengthArcs.constEnd()) { - vVarVal[j] = i.value(); + vVarVal[j] = *i.value()->GetValue(); DefineVar(i.key(), &vVarVal[j]); ++j; ++i; @@ -220,10 +220,10 @@ void Calculator::InitVariables(const VContainer *data) } { - QMap::const_iterator i = lineAngles.constBegin(); + QMap::const_iterator i = lineAngles.constBegin(); while (i != lineAngles.constEnd()) { - vVarVal[j] = i.value(); + vVarVal[j] = *i.value()->GetValue(); DefineVar(i.key(), &vVarVal[j]); ++j; ++i; diff --git a/src/app/container/vcontainer.cpp b/src/app/container/vcontainer.cpp index 89e42c9ed..535130565 100644 --- a/src/app/container/vcontainer.cpp +++ b/src/app/container/vcontainer.cpp @@ -445,37 +445,37 @@ void VContainer::RemoveIncrement(const QString &name) //--------------------------------------------------------------------------------------------------------------------- const QMap VContainer::DataMeasurements() const { - return DataTableVar(VarType::Measurement); + return DataVar(VarType::Measurement); } //--------------------------------------------------------------------------------------------------------------------- const QMap VContainer::DataIncrements() const { - return DataTableVar(VarType::Increment); + return DataVar(VarType::Increment); } //--------------------------------------------------------------------------------------------------------------------- -const QMap VContainer::DataLengthLines() const +const QMap VContainer::DataLengthLines() const { - return DataVar(VarType::LengthLine); + return DataVar(VarType::LengthLine); } //--------------------------------------------------------------------------------------------------------------------- -const QMap VContainer::DataLengthSplines() const +const QMap VContainer::DataLengthSplines() const { - return DataVar(VarType::LengthSpline); + return DataVar(VarType::LengthSpline); } //--------------------------------------------------------------------------------------------------------------------- -const QMap VContainer::DataLengthArcs() const +const QMap VContainer::DataLengthArcs() const { - return DataVar(VarType::LengthArc); + return DataVar(VarType::LengthArc); } //--------------------------------------------------------------------------------------------------------------------- -const QMap VContainer::DataLineAngles() const +const QMap VContainer::DataLineAngles() const { - return DataVar(VarType::LineAngle); + return DataVar(VarType::LineAngle); } //--------------------------------------------------------------------------------------------------------------------- @@ -505,26 +505,9 @@ void VContainer::CopyVar(const VContainer &data, const QString &name) AddVariable(name, var); } -//--------------------------------------------------------------------------------------------------------------------- -QMap VContainer::DataVar(const VarType &type) const -{ - QHashIterator i(variables); - QMap map; - //Sorting QHash by id - while (i.hasNext()) - { - i.next(); - if(i.value()->GetType() == type) - { - map.insert(qApp->VarToUser(i.key()), *i.value()->GetValue()); - } - } - return map; -} - //--------------------------------------------------------------------------------------------------------------------- template -const QMap VContainer::DataTableVar(const VarType &type) const +const QMap VContainer::DataVar(const VarType &type) const { QHashIterator i(variables); QMap map; diff --git a/src/app/container/vcontainer.h b/src/app/container/vcontainer.h index 3d6f94782..4384396a9 100644 --- a/src/app/container/vcontainer.h +++ b/src/app/container/vcontainer.h @@ -170,12 +170,12 @@ public: const QHash *DataDetails() const; const QHash *DataVariables() const; - const QMap DataMeasurements() const; - const QMap DataIncrements() const; - const QMap DataLengthLines() const; - const QMap DataLengthSplines() const; - const QMap DataLengthArcs() const; - const QMap DataLineAngles() const; + const QMap DataMeasurements() const; + const QMap DataIncrements() const; + const QMap DataLengthLines() const; + const QMap DataLengthSplines() const; + const QMap DataLengthArcs() const; + const QMap DataLineAngles() const; private: @@ -217,10 +217,8 @@ private: template void CopyVar(const VContainer &data, const QString &name); - QMap DataVar(const VarType &type) const; - template - const QMap DataTableVar(const VarType &type) const; + const QMap DataVar(const VarType &type) const; }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/app/dialoghistory.cpp b/src/app/dialogs/app/dialoghistory.cpp index 2b563e297..07e89cdd1 100644 --- a/src/app/dialogs/app/dialoghistory.cpp +++ b/src/app/dialogs/app/dialoghistory.cpp @@ -45,7 +45,7 @@ * @param parent parent widget */ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), + :DialogTool(data, 0, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), cursorToolRecordRow(0) { ui->setupUi(this); diff --git a/src/app/dialogs/app/dialogincrements.cpp b/src/app/dialogs/app/dialogincrements.cpp index aa38c284c..acfa9826c 100644 --- a/src/app/dialogs/app/dialogincrements.cpp +++ b/src/app/dialogs/app/dialogincrements.cpp @@ -49,7 +49,7 @@ * @param parent parent widget */ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr) + :DialogTool(data, 0, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr) { ui->setupUi(this); @@ -287,16 +287,17 @@ void DialogIncrements::FillIncrements() } //--------------------------------------------------------------------------------------------------------------------- -void DialogIncrements::FillTable(const QMap varTable, QTableWidget *table) +template +void DialogIncrements::FillTable(const QMap varTable, QTableWidget *table) { SCASSERT(table != nullptr); qint32 currentRow = -1; - QMapIterator i(varTable); + QMapIterator i(varTable); while (i.hasNext()) { i.next(); - qreal length = i.value(); + qreal length = *i.value()->GetValue(); currentRow++; table->setRowCount ( varTable.size() ); diff --git a/src/app/dialogs/app/dialogincrements.h b/src/app/dialogs/app/dialogincrements.h index b702b120d..9211c3144 100644 --- a/src/app/dialogs/app/dialogincrements.h +++ b/src/app/dialogs/app/dialogincrements.h @@ -94,7 +94,8 @@ private: void FillMeasurements(); void FillIncrements(); - void FillTable(const QMap varTable, QTableWidget *table); + template + void FillTable(const QMap varTable, QTableWidget *table); void FillLengthLines(); void FillLengthSplines(); void FillLengthArcs(); diff --git a/src/app/dialogs/tools/dialogalongline.cpp b/src/app/dialogs/tools/dialogalongline.cpp index aa076d02c..63ba47dfc 100644 --- a/src/app/dialogs/tools/dialogalongline.cpp +++ b/src/app/dialogs/tools/dialogalongline.cpp @@ -40,9 +40,10 @@ * @param data container with data * @param parent parent widget */ -DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), typeLine(QString()), - formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr), prepare(false) +DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()), + typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), formulaBaseHeight(0), line(nullptr), + prepare(false) { ui->setupUi(this); InitVariables(ui); diff --git a/src/app/dialogs/tools/dialogalongline.h b/src/app/dialogs/tools/dialogalongline.h index 55ad7974c..87fa5a017 100644 --- a/src/app/dialogs/tools/dialogalongline.h +++ b/src/app/dialogs/tools/dialogalongline.h @@ -45,7 +45,7 @@ class DialogAlongLine : public DialogTool { Q_OBJECT public: - DialogAlongLine(const VContainer *data, QWidget *parent = nullptr); + DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogAlongLine(); QString getPointName() const; void setPointName(const QString &value); diff --git a/src/app/dialogs/tools/dialogarc.cpp b/src/app/dialogs/tools/dialogarc.cpp index 5213efff6..000663474 100644 --- a/src/app/dialogs/tools/dialogarc.cpp +++ b/src/app/dialogs/tools/dialogarc.cpp @@ -41,8 +41,8 @@ * @param data container with data * @param parent parent widget */ -DialogArc::DialogArc(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), +DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()), f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0) { @@ -357,8 +357,8 @@ void DialogArc::ShowLineAngles() disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); ui->listWidget->clear(); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); - const QMap lineAnglesTable = data->DataLineAngles(); - QMapIterator i(lineAnglesTable); + const QMap lineAnglesTable = data->DataLineAngles(); + QMapIterator i(lineAnglesTable); while (i.hasNext()) { i.next(); diff --git a/src/app/dialogs/tools/dialogarc.h b/src/app/dialogs/tools/dialogarc.h index e61b16026..5a36d31e9 100644 --- a/src/app/dialogs/tools/dialogarc.h +++ b/src/app/dialogs/tools/dialogarc.h @@ -43,7 +43,7 @@ class DialogArc : public DialogTool { Q_OBJECT public: - DialogArc(const VContainer *data, QWidget *parent = nullptr); + DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogArc(); quint32 GetCenter() const; diff --git a/src/app/dialogs/tools/dialogbisector.cpp b/src/app/dialogs/tools/dialogbisector.cpp index 92dc8adb5..ed44ead31 100644 --- a/src/app/dialogs/tools/dialogbisector.cpp +++ b/src/app/dialogs/tools/dialogbisector.cpp @@ -41,8 +41,8 @@ * @param data container with data * @param parent parent widget */ -DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()), +DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()), typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0), formulaBaseHeight(0), line(nullptr), prepare(false) { diff --git a/src/app/dialogs/tools/dialogbisector.h b/src/app/dialogs/tools/dialogbisector.h index 288daf43e..4ca0d8320 100644 --- a/src/app/dialogs/tools/dialogbisector.h +++ b/src/app/dialogs/tools/dialogbisector.h @@ -46,7 +46,7 @@ class DialogBisector : public DialogTool Q_OBJECT public: - DialogBisector(const VContainer *data, QWidget *parent = nullptr); + DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogBisector(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogcutarc.cpp b/src/app/dialogs/tools/dialogcutarc.cpp index 02d4b35bf..8b0d6249c 100644 --- a/src/app/dialogs/tools/dialogcutarc.cpp +++ b/src/app/dialogs/tools/dialogcutarc.cpp @@ -38,8 +38,8 @@ * @param data container with data * @param parent parent widget */ -DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) - : DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0), +DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent) + : DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0), formulaBaseHeight(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialogcutarc.h b/src/app/dialogs/tools/dialogcutarc.h index b429900ea..00aa81a0d 100644 --- a/src/app/dialogs/tools/dialogcutarc.h +++ b/src/app/dialogs/tools/dialogcutarc.h @@ -44,7 +44,7 @@ class DialogCutArc : public DialogTool Q_OBJECT public: - DialogCutArc(const VContainer *data, QWidget *parent = nullptr); + DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogCutArc(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogcutspline.cpp b/src/app/dialogs/tools/dialogcutspline.cpp index 9d1b44daf..bad101f75 100644 --- a/src/app/dialogs/tools/dialogcutspline.cpp +++ b/src/app/dialogs/tools/dialogcutspline.cpp @@ -38,9 +38,9 @@ * @param data container with data * @param parent parent widget */ -DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0), - formulaBaseHeight(0) +DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), + splineId(0), formulaBaseHeight(0) { ui->setupUi(this); InitVariables(ui); diff --git a/src/app/dialogs/tools/dialogcutspline.h b/src/app/dialogs/tools/dialogcutspline.h index 55fa71024..cbb0e1ad2 100644 --- a/src/app/dialogs/tools/dialogcutspline.h +++ b/src/app/dialogs/tools/dialogcutspline.h @@ -43,7 +43,7 @@ class DialogCutSpline : public DialogTool { Q_OBJECT public: - DialogCutSpline(const VContainer *data, QWidget *parent = nullptr); + DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogCutSpline(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogcutsplinepath.cpp b/src/app/dialogs/tools/dialogcutsplinepath.cpp index 57330a59c..47c98819b 100644 --- a/src/app/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/app/dialogs/tools/dialogcutsplinepath.cpp @@ -38,8 +38,8 @@ * @param data container with data * @param parent parent widget */ -DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()), +DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()), splinePathId(0), formulaBaseHeight(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialogcutsplinepath.h b/src/app/dialogs/tools/dialogcutsplinepath.h index ae0ceb93f..d38fd00c6 100644 --- a/src/app/dialogs/tools/dialogcutsplinepath.h +++ b/src/app/dialogs/tools/dialogcutsplinepath.h @@ -43,7 +43,7 @@ class DialogCutSplinePath : public DialogTool { Q_OBJECT public: - DialogCutSplinePath(const VContainer *data, QWidget *parent = nullptr); + DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogCutSplinePath(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogdetail.cpp b/src/app/dialogs/tools/dialogdetail.cpp index 4ac6f265d..70ee365ec 100644 --- a/src/app/dialogs/tools/dialogdetail.cpp +++ b/src/app/dialogs/tools/dialogdetail.cpp @@ -42,8 +42,8 @@ * @param data container with data * @param parent parent widget */ -DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(), details(VDetail()), supplement(true), closed(true) +DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(), details(VDetail()), supplement(true), closed(true) { ui.setupUi(this); labelEditNamePoint = ui.labelEditNameDetail; diff --git a/src/app/dialogs/tools/dialogdetail.h b/src/app/dialogs/tools/dialogdetail.h index b9ebc8c74..417ee1c09 100644 --- a/src/app/dialogs/tools/dialogdetail.h +++ b/src/app/dialogs/tools/dialogdetail.h @@ -40,7 +40,7 @@ class DialogDetail : public DialogTool { Q_OBJECT public: - DialogDetail(const VContainer *data, QWidget *parent = nullptr); + DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); VDetail getDetails() const; void setDetails(const VDetail &value); diff --git a/src/app/dialogs/tools/dialogeditwrongformula.cpp b/src/app/dialogs/tools/dialogeditwrongformula.cpp index 28fe4afe6..b4be365da 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.cpp +++ b/src/app/dialogs/tools/dialogeditwrongformula.cpp @@ -30,8 +30,8 @@ #include "ui_dialogeditwrongformula.h" //--------------------------------------------------------------------------------------------------------------------- -DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0) +DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0) { ui->setupUi(this); InitVariables(ui); diff --git a/src/app/dialogs/tools/dialogeditwrongformula.h b/src/app/dialogs/tools/dialogeditwrongformula.h index f1459f69d..c275e93f5 100644 --- a/src/app/dialogs/tools/dialogeditwrongformula.h +++ b/src/app/dialogs/tools/dialogeditwrongformula.h @@ -48,7 +48,7 @@ class DialogEditWrongFormula : public DialogTool { Q_OBJECT public: - explicit DialogEditWrongFormula(const VContainer *data, QWidget *parent = nullptr); + explicit DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogEditWrongFormula(); QString getFormula() const; diff --git a/src/app/dialogs/tools/dialogendline.cpp b/src/app/dialogs/tools/dialogendline.cpp index 305f71c24..ab5179705 100644 --- a/src/app/dialogs/tools/dialogendline.cpp +++ b/src/app/dialogs/tools/dialogendline.cpp @@ -41,9 +41,9 @@ * @param data container with data * @param parent parent widget */ -DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), formula(QString()), - angle(0), basePointId(0), formulaBaseHeight(0), line(nullptr), prepare(false) +DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), + formula(QString()), angle(0), basePointId(0), formulaBaseHeight(0), line(nullptr), prepare(false) { ui->setupUi(this); InitVariables(ui); diff --git a/src/app/dialogs/tools/dialogendline.h b/src/app/dialogs/tools/dialogendline.h index d986a4d6e..c645a6acc 100644 --- a/src/app/dialogs/tools/dialogendline.h +++ b/src/app/dialogs/tools/dialogendline.h @@ -45,7 +45,7 @@ class DialogEndLine : public DialogTool { Q_OBJECT public: - DialogEndLine(const VContainer *data, QWidget *parent = nullptr); + DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogEndLine(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogheight.cpp b/src/app/dialogs/tools/dialogheight.cpp index 92c75c8bd..5c4497c80 100644 --- a/src/app/dialogs/tools/dialogheight.cpp +++ b/src/app/dialogs/tools/dialogheight.cpp @@ -39,8 +39,8 @@ * @param data container with data * @param parent parent widget */ -DialogHeight::DialogHeight(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()), +DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()), typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialogheight.h b/src/app/dialogs/tools/dialogheight.h index b6ab8bbf8..c627124ed 100644 --- a/src/app/dialogs/tools/dialogheight.h +++ b/src/app/dialogs/tools/dialogheight.h @@ -43,7 +43,7 @@ class DialogHeight : public DialogTool { Q_OBJECT public: - DialogHeight(const VContainer *data, QWidget *parent = nullptr); + DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogHeight(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogline.cpp b/src/app/dialogs/tools/dialogline.cpp index 3ce595cd1..81ff0240c 100644 --- a/src/app/dialogs/tools/dialogline.cpp +++ b/src/app/dialogs/tools/dialogline.cpp @@ -42,9 +42,9 @@ * @param data container with data * @param parent parent widget */ -DialogLine::DialogLine(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()), - line(nullptr) +DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), + typeLine(QString()), line(nullptr) { ui->setupUi(this); InitOkCancelApply(ui); diff --git a/src/app/dialogs/tools/dialogline.h b/src/app/dialogs/tools/dialogline.h index 0be7ca272..2a967c4de 100644 --- a/src/app/dialogs/tools/dialogline.h +++ b/src/app/dialogs/tools/dialogline.h @@ -45,7 +45,7 @@ class DialogLine : public DialogTool { Q_OBJECT public: - DialogLine(const VContainer *data, QWidget *parent = nullptr); + DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogLine(); quint32 getFirstPoint() const; diff --git a/src/app/dialogs/tools/dialoglineintersect.cpp b/src/app/dialogs/tools/dialoglineintersect.cpp index 653f2c6ab..8b8390d67 100644 --- a/src/app/dialogs/tools/dialoglineintersect.cpp +++ b/src/app/dialogs/tools/dialoglineintersect.cpp @@ -38,8 +38,8 @@ * @param data container with data * @param parent parent widget */ -DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), +DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()), p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialoglineintersect.h b/src/app/dialogs/tools/dialoglineintersect.h index 937268449..cde6b04d4 100644 --- a/src/app/dialogs/tools/dialoglineintersect.h +++ b/src/app/dialogs/tools/dialoglineintersect.h @@ -43,7 +43,7 @@ class DialogLineIntersect : public DialogTool { Q_OBJECT public: - DialogLineIntersect(const VContainer *data, QWidget *parent = nullptr); + DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogLineIntersect(); quint32 getP1Line1() const; diff --git a/src/app/dialogs/tools/dialognormal.cpp b/src/app/dialogs/tools/dialognormal.cpp index 344a30046..168e41559 100644 --- a/src/app/dialogs/tools/dialognormal.cpp +++ b/src/app/dialogs/tools/dialognormal.cpp @@ -35,8 +35,8 @@ * @param data container with data * @param parent parent widget */ -DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), +DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0), formulaBaseHeight(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialognormal.h b/src/app/dialogs/tools/dialognormal.h index b27f78fd0..ca7c29d86 100644 --- a/src/app/dialogs/tools/dialognormal.h +++ b/src/app/dialogs/tools/dialognormal.h @@ -43,7 +43,7 @@ class DialogNormal : public DialogTool { Q_OBJECT public: - DialogNormal(const VContainer *data, QWidget *parent = nullptr); + DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogNormal(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogpointofcontact.cpp b/src/app/dialogs/tools/dialogpointofcontact.cpp index cc66f70a1..66588a248 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.cpp +++ b/src/app/dialogs/tools/dialogpointofcontact.cpp @@ -37,9 +37,9 @@ * @param data container with data * @param parent parent widget */ -DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()), radius(QString()), - center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(0) +DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfContact), number(0), pointName(QString()), + radius(QString()), center(0), firstPoint(0), secondPoint(0), formulaBaseHeight(0) { ui->setupUi(this); InitVariables(ui); diff --git a/src/app/dialogs/tools/dialogpointofcontact.h b/src/app/dialogs/tools/dialogpointofcontact.h index 1931ea2dc..58869cedf 100644 --- a/src/app/dialogs/tools/dialogpointofcontact.h +++ b/src/app/dialogs/tools/dialogpointofcontact.h @@ -43,7 +43,7 @@ class DialogPointOfContact : public DialogTool { Q_OBJECT public: - DialogPointOfContact(const VContainer *data, QWidget *parent = nullptr); + DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); QString getPointName() const; void setPointName(const QString &value); diff --git a/src/app/dialogs/tools/dialogpointofintersection.cpp b/src/app/dialogs/tools/dialogpointofintersection.cpp index 1ca31a278..9ede6d9d0 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.cpp +++ b/src/app/dialogs/tools/dialogpointofintersection.cpp @@ -38,8 +38,8 @@ * @param data container with data * @param parent parent widget */ -DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), +DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), firstPointId(0), secondPointId(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialogpointofintersection.h b/src/app/dialogs/tools/dialogpointofintersection.h index 9e20fb92f..3460ab146 100644 --- a/src/app/dialogs/tools/dialogpointofintersection.h +++ b/src/app/dialogs/tools/dialogpointofintersection.h @@ -43,7 +43,7 @@ class DialogPointOfIntersection : public DialogTool { Q_OBJECT public: - DialogPointOfIntersection(const VContainer *data, QWidget *parent = nullptr); + DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogPointOfIntersection(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogshoulderpoint.cpp b/src/app/dialogs/tools/dialogshoulderpoint.cpp index 4f050134b..0288353f5 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/app/dialogs/tools/dialogshoulderpoint.cpp @@ -41,8 +41,8 @@ * @param data container with data * @param parent parent widget */ -DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), +DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()), typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0), line (nullptr), prepare(false) { diff --git a/src/app/dialogs/tools/dialogshoulderpoint.h b/src/app/dialogs/tools/dialogshoulderpoint.h index a64da204b..bf90cae69 100644 --- a/src/app/dialogs/tools/dialogshoulderpoint.h +++ b/src/app/dialogs/tools/dialogshoulderpoint.h @@ -45,7 +45,7 @@ class DialogShoulderPoint : public DialogTool { Q_OBJECT public: - DialogShoulderPoint(const VContainer *data, QWidget *parent = nullptr); + DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogShoulderPoint(); QString getPointName() const; diff --git a/src/app/dialogs/tools/dialogsinglepoint.cpp b/src/app/dialogs/tools/dialogsinglepoint.cpp index d40ca3192..7990b43e4 100644 --- a/src/app/dialogs/tools/dialogsinglepoint.cpp +++ b/src/app/dialogs/tools/dialogsinglepoint.cpp @@ -35,8 +35,8 @@ * @param data container with data * @param parent parent widget */ -DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF()) +DialogSinglePoint::DialogSinglePoint(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF()) { ui->setupUi(this); ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize)); diff --git a/src/app/dialogs/tools/dialogsinglepoint.h b/src/app/dialogs/tools/dialogsinglepoint.h index 2ab0dfacb..bfef831b3 100644 --- a/src/app/dialogs/tools/dialogsinglepoint.h +++ b/src/app/dialogs/tools/dialogsinglepoint.h @@ -43,7 +43,7 @@ class DialogSinglePoint : public DialogTool { Q_OBJECT public: - DialogSinglePoint(const VContainer *data, QWidget *parent = nullptr); + DialogSinglePoint(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogSinglePoint(); void setData(const QString &name, const QPointF &point); QString getName()const; diff --git a/src/app/dialogs/tools/dialogspline.cpp b/src/app/dialogs/tools/dialogspline.cpp index 918aed19c..d9416500c 100644 --- a/src/app/dialogs/tools/dialogspline.cpp +++ b/src/app/dialogs/tools/dialogspline.cpp @@ -38,9 +38,9 @@ * @param data container with data * @param parent parent widget */ -DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), kAsm1(1), - kAsm2(1), kCurve(1) +DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0), + kAsm1(1), kAsm2(1), kCurve(1) { ui->setupUi(this); InitOkCancel(ui); diff --git a/src/app/dialogs/tools/dialogspline.h b/src/app/dialogs/tools/dialogspline.h index 3940d683d..6a6d65cb6 100644 --- a/src/app/dialogs/tools/dialogspline.h +++ b/src/app/dialogs/tools/dialogspline.h @@ -43,7 +43,7 @@ class DialogSpline : public DialogTool { Q_OBJECT public: - DialogSpline(const VContainer *data, QWidget *parent = nullptr); + DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogSpline(); quint32 getP1() const; diff --git a/src/app/dialogs/tools/dialogsplinepath.cpp b/src/app/dialogs/tools/dialogsplinepath.cpp index ea3e0696a..e307f60db 100644 --- a/src/app/dialogs/tools/dialogsplinepath.cpp +++ b/src/app/dialogs/tools/dialogsplinepath.cpp @@ -37,8 +37,8 @@ * @param data container with data * @param parent parent widget */ -DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) +DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) { ui->setupUi(this); InitOkCancel(ui); diff --git a/src/app/dialogs/tools/dialogsplinepath.h b/src/app/dialogs/tools/dialogsplinepath.h index 21405fc06..b25576cdc 100644 --- a/src/app/dialogs/tools/dialogsplinepath.h +++ b/src/app/dialogs/tools/dialogsplinepath.h @@ -44,7 +44,7 @@ class DialogSplinePath : public DialogTool { Q_OBJECT public: - DialogSplinePath(const VContainer *data, QWidget *parent = nullptr); + DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogSplinePath(); VSplinePath GetPath() const; diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 265ea53da..d752667d8 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -56,21 +56,18 @@ * @param data container with data * @param parent parent widget */ -DialogTool::DialogTool(const VContainer *data, QWidget *parent) +DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent) :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true), timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr), listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr), labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr), radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr), - radioButtonLengthCurve(nullptr), lineStyles(QStringList()), okColor(QColor(76, 76, 76)), errorColor(Qt::red), - associatedTool(nullptr) + radioButtonLengthCurve(nullptr), lineStyles(VAbstractTool::Styles()), okColor(QColor(76, 76, 76)), + errorColor(Qt::red), associatedTool(nullptr), toolId(toolId) { SCASSERT(data != nullptr); timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); - //Keep synchronize with VAbstractTool styles list!!! - lineStyles<setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint); } @@ -1046,6 +1043,18 @@ void DialogTool::UpdateList() } } +//--------------------------------------------------------------------------------------------------------------------- +quint32 DialogTool::GetToolId() const +{ + return toolId; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogTool::SetToolId(const quint32 &value) +{ + toolId = value; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ShowVariable show variables in list @@ -1062,9 +1071,12 @@ void DialogTool::ShowVariable(const QMap var) while (iMap.hasNext()) { iMap.next(); - QListWidgetItem *item = new QListWidgetItem(iMap.key()); - item->setFont(QFont("Times", 12, QFont::Bold)); - listWidget->addItem(item); + if (iMap.value()->Filter(toolId) == false) + {// If we create this variable don't show + QListWidgetItem *item = new QListWidgetItem(iMap.key()); + item->setFont(QFont("Times", 12, QFont::Bold)); + listWidget->addItem(item); + } } connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->setCurrentRow (0); @@ -1086,5 +1098,5 @@ void DialogTool::ShowDialog(bool click) void DialogTool::SetAssociatedTool(VAbstractTool *tool) { this->associatedTool=tool; - this->data = tool->getData(); + SetToolId(tool->getId()); } diff --git a/src/app/dialogs/tools/dialogtool.h b/src/app/dialogs/tools/dialogtool.h index 1bb92399d..3cd351772 100644 --- a/src/app/dialogs/tools/dialogtool.h +++ b/src/app/dialogs/tools/dialogtool.h @@ -55,11 +55,16 @@ class DialogTool : public QDialog { Q_OBJECT public: - DialogTool(const VContainer *data, QWidget *parent = nullptr); + DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); virtual ~DialogTool() {} + VAbstractTool* GetAssociatedTool(); void SetAssociatedTool(VAbstractTool* tool); + virtual void ShowDialog(bool click); + + quint32 GetToolId() const; + void SetToolId(const quint32 &value); signals: /** * @brief DialogClosed signal dialog closed @@ -183,6 +188,11 @@ protected: QStringList lineStyles; const QColor okColor; const QColor errorColor; + /** + * @brief associatedTool vdrawtool associated with opened dialog. + */ + VAbstractTool *associatedTool; + quint32 toolId; virtual void closeEvent ( QCloseEvent * event ); virtual void showEvent( QShowEvent *event ); @@ -300,10 +310,7 @@ protected: plainTextEditFormula = ui->plainTextEditFormula; labelEditFormula = ui->labelEditFormula; } - /** - * @brief associatedTool vdrawtool associated with opened dialog. - */ - VAbstractTool* associatedTool; + void ChangeColor(QWidget *widget, const QColor &color); void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id); virtual void ShowVisualization(){} diff --git a/src/app/dialogs/tools/dialogtriangle.cpp b/src/app/dialogs/tools/dialogtriangle.cpp index a5924b5f3..4d7fbc04d 100644 --- a/src/app/dialogs/tools/dialogtriangle.cpp +++ b/src/app/dialogs/tools/dialogtriangle.cpp @@ -37,8 +37,8 @@ * @param data container with data * @param parent parent widget */ -DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0), +DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0), axisP2Id(0), firstPointId(0), secondPointId(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialogtriangle.h b/src/app/dialogs/tools/dialogtriangle.h index 406a22cc8..ff4f14595 100644 --- a/src/app/dialogs/tools/dialogtriangle.h +++ b/src/app/dialogs/tools/dialogtriangle.h @@ -43,7 +43,7 @@ class DialogTriangle : public DialogTool { Q_OBJECT public: - DialogTriangle(const VContainer *data, QWidget *parent = nullptr); + DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogTriangle(); quint32 getAxisP1Id() const; diff --git a/src/app/dialogs/tools/dialoguniondetails.cpp b/src/app/dialogs/tools/dialoguniondetails.cpp index 1fc05b387..db8a9157b 100644 --- a/src/app/dialogs/tools/dialoguniondetails.cpp +++ b/src/app/dialogs/tools/dialoguniondetails.cpp @@ -37,8 +37,8 @@ * @param data container with data * @param parent parent widget */ -DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent) : - DialogTool(data, parent), ui(new Ui::DialogUnionDetails), indexD1(0), indexD2(0), d1(0), d2(0), numberD(0), +DialogUnionDetails::DialogUnionDetails(const VContainer *data, const quint32 &toolId, QWidget *parent) + :DialogTool(data, toolId, parent), ui(new Ui::DialogUnionDetails), indexD1(0), indexD2(0), d1(0), d2(0), numberD(0), numberP(0), p1(0), p2(0) { ui->setupUi(this); diff --git a/src/app/dialogs/tools/dialoguniondetails.h b/src/app/dialogs/tools/dialoguniondetails.h index 6766ad651..c92f36958 100644 --- a/src/app/dialogs/tools/dialoguniondetails.h +++ b/src/app/dialogs/tools/dialoguniondetails.h @@ -43,7 +43,7 @@ class DialogUnionDetails : public DialogTool { Q_OBJECT public: - DialogUnionDetails(const VContainer *data, QWidget *parent = nullptr); + DialogUnionDetails(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); ~DialogUnionDetails(); quint32 getD1() const; diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 0438a7d4c..e93ca807b 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -259,7 +259,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons QCursor cur(pixmap, 2, 3); view->setCursor(cur); helpLabel->setText(toolTip); - dialogTool = new Dialog(pattern, this); + dialogTool = new Dialog(pattern, 0, this); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); @@ -297,7 +297,7 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur QCursor cur(pixmap, 2, 3); view->setCursor(cur); helpLabel->setText(toolTip); - dialogTool = new Dialog(pattern, this); + dialogTool = new Dialog(pattern, 0, this); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot); diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp index 2de9b874d..3d3ee74b3 100644 --- a/src/app/tools/drawTools/vdrawtool.cpp +++ b/src/app/tools/drawTools/vdrawtool.cpp @@ -173,12 +173,14 @@ void VDrawTool::SetFactor(qreal factor) * * Try calculate formula. If find error show dialog that allow user try fix formula. If user can't throw exception. In * successes case return result calculation and fixed formula string. If formula ok don't touch formula. + * + * @param toolId[in] tool's id. * @param formula [in|out] string with formula. * @param data [in] container with variables. Need for math parser. * @throw QmuParserError. * @return result of calculation formula. */ -qreal VDrawTool::CheckFormula(QString &formula, VContainer *data) +qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContainer *data) { SCASSERT(data != nullptr) qreal result = 0; @@ -206,7 +208,7 @@ qreal VDrawTool::CheckFormula(QString &formula, VContainer *data) delete dialogUndo; if (resultUndo == UndoButton::Fix) { - DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, qApp->getMainWindow()); + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, qApp->getMainWindow()); dialog->setFormula(formula); if (dialog->exec() == QDialog::Accepted) { diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h index ea63f156a..eeb750398 100644 --- a/src/app/tools/drawTools/vdrawtool.h +++ b/src/app/tools/drawTools/vdrawtool.h @@ -55,7 +55,7 @@ public: virtual void setDialog() {} virtual void DialogLinkDestroy(); void ignoreContextMenu(bool enable); - static qreal CheckFormula(QString &formula, VContainer *data); + static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data); public slots: virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ChangedActivDraw(const QString &newName); @@ -118,7 +118,7 @@ protected: QAction *selectedAction = menu.exec(event->screenPos()); if (selectedAction == actionOption) { - dialog = new Dialog(getData(), qApp->getMainWindow()); + dialog = new Dialog(getData(), id, qApp->getMainWindow()); dialog->setModal(true); connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk); diff --git a/src/app/tools/drawTools/vtoolalongline.cpp b/src/app/tools/drawTools/vtoolalongline.cpp index 74f0c37b0..cc37bf935 100644 --- a/src/app/tools/drawTools/vtoolalongline.cpp +++ b/src/app/tools/drawTools/vtoolalongline.cpp @@ -253,7 +253,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa const VPointF *secondPoint = data->GeometricObject(secondPointId); QLineF line = QLineF(firstPoint->toQPointF(), secondPoint->toQPointF()); - line.setLength(qApp->toPixel(CheckFormula(formula, data))); + line.setLength(qApp->toPixel(CheckFormula(_id, formula, data))); quint32 id = _id; if (typeCreation == Source::FromGui) diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp index 53d430e6c..c6a620691 100644 --- a/src/app/tools/drawTools/vtoolarc.cpp +++ b/src/app/tools/drawTools/vtoolarc.cpp @@ -129,10 +129,10 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra { qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; - calcRadius = qApp->toPixel(CheckFormula(radius, data)); + calcRadius = qApp->toPixel(CheckFormula(_id, radius, data)); - calcF1 = CheckFormula(f1, data); - calcF2 = CheckFormula(f2, data); + calcF1 = CheckFormula(_id, f1, data); + calcF2 = CheckFormula(_id, f2, data); VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); diff --git a/src/app/tools/drawTools/vtoolbisector.cpp b/src/app/tools/drawTools/vtoolbisector.cpp index b11231fea..2dfe5a3e1 100644 --- a/src/app/tools/drawTools/vtoolbisector.cpp +++ b/src/app/tools/drawTools/vtoolbisector.cpp @@ -176,7 +176,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const const VPointF *secondPoint = data->GeometricObject(secondPointId); const VPointF *thirdPoint = data->GeometricObject(thirdPointId); - const qreal result = CheckFormula(formula, data); + const qreal result = CheckFormula(_id, formula, data); QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), thirdPoint->toQPointF(), qApp->toPixel(result)); diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp index 93befec9b..c483ab478 100644 --- a/src/app/tools/drawTools/vtoolcutarc.cpp +++ b/src/app/tools/drawTools/vtoolcutarc.cpp @@ -127,7 +127,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS { const VArc *arc = data->GeometricObject(arcId); - const qreal result = CheckFormula(formula, data); + const qreal result = CheckFormula(_id, formula, data); VArc arc1; VArc arc2; diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp index 093229f37..a25fa0961 100644 --- a/src/app/tools/drawTools/vtoolcutspline.cpp +++ b/src/app/tools/drawTools/vtoolcutspline.cpp @@ -121,7 +121,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString { const VSpline *spl = data->GeometricObject(splineId); - const qreal result = CheckFormula(formula, data); + const qreal result = CheckFormula(_id, formula, data); QPointF spl1p2, spl1p3, spl2p2, spl2p3; QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp index b898dbf71..7de3c9161 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp @@ -125,7 +125,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt const VSplinePath *splPath = data->GeometricObject(splinePathId); SCASSERT(splPath != nullptr); - const qreal result = CheckFormula(formula, data); + const qreal result = CheckFormula(_id, formula, data); quint32 id = _id; QPointF spl1p2, spl1p3, spl2p2, spl2p3; diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp index 878b81a05..1325f0326 100644 --- a/src/app/tools/drawTools/vtoolendline.cpp +++ b/src/app/tools/drawTools/vtoolendline.cpp @@ -138,7 +138,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const VPointF *basePoint = data->GeometricObject(basePointId); QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y())); - line.setLength(qApp->toPixel(CheckFormula(formula, data))); + line.setLength(qApp->toPixel(CheckFormula(_id, formula, data))); line.setAngle(angle); quint32 id = _id; if (typeCreation == Source::FromGui) diff --git a/src/app/tools/drawTools/vtoolnormal.cpp b/src/app/tools/drawTools/vtoolnormal.cpp index 3fbdf754e..743e75c80 100644 --- a/src/app/tools/drawTools/vtoolnormal.cpp +++ b/src/app/tools/drawTools/vtoolnormal.cpp @@ -138,7 +138,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin const VPointF *firstPoint = data->GeometricObject(firstPointId); const VPointF *secondPoint = data->GeometricObject(secondPointId); - const qreal result = CheckFormula(formula, data); + const qreal result = CheckFormula(_id, formula, data); QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), qApp->toPixel(result), angle); diff --git a/src/app/tools/drawTools/vtoolpointofcontact.cpp b/src/app/tools/drawTools/vtoolpointofcontact.cpp index a1b4dd096..328186e80 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/app/tools/drawTools/vtoolpointofcontact.cpp @@ -171,7 +171,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad const VPointF *firstP = data->GeometricObject(firstPointId); const VPointF *secondP = data->GeometricObject(secondPointId); - const qreal result = CheckFormula(radius, data); + const qreal result = CheckFormula(_id, radius, data); QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(), firstP->toQPointF(), secondP->toQPointF()); diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.cpp b/src/app/tools/drawTools/vtoolshoulderpoint.cpp index ee44b8d15..00e38760f 100644 --- a/src/app/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/app/tools/drawTools/vtoolshoulderpoint.cpp @@ -176,7 +176,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu const VPointF *secondPoint = data->GeometricObject(p2Line); const VPointF *shoulderPoint = data->GeometricObject(pShoulder); - const qreal result = CheckFormula(formula, data); + const qreal result = CheckFormula(_id, formula, data); QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), shoulderPoint->toQPointF(), qApp->toPixel(result)); diff --git a/src/app/tools/vabstracttool.cpp b/src/app/tools/vabstracttool.cpp index 2d71ce587..a757a3d5e 100644 --- a/src/app/tools/vabstracttool.cpp +++ b/src/app/tools/vabstracttool.cpp @@ -326,7 +326,6 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre */ const QStringList VAbstractTool::Styles() { - //Keep synchronize with DialogTool lineStyles list!!! QStringList styles{TypeLineNone, TypeLineLine, TypeLineDashLine, TypeLineDotLine, TypeLineDashDotLine, TypeLineDashDotDotLine}; return styles; diff --git a/src/app/tools/vtooldetail.cpp b/src/app/tools/vtooldetail.cpp index edc65d882..747b3f185 100644 --- a/src/app/tools/vtooldetail.cpp +++ b/src/app/tools/vtooldetail.cpp @@ -405,7 +405,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) QAction *selectedAction = menu.exec(event->screenPos()); if (selectedAction == actionOption) { - dialog = new DialogDetail(getData(), qApp->getMainWindow()); + dialog = new DialogDetail(getData(), id, qApp->getMainWindow()); dialog->setModal(true); connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject, dialog, &DialogTool::ChosenObject);