From 91ce892ab071ca02f5eec1d4d6fbcdaf2f337030 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 3 Oct 2013 13:39:53 +0300 Subject: [PATCH 01/70] Fixed wrong type base of increment. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 41 ++++++++++++++++++------------------ dialogs/dialogincrements.h | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 7f5847f24..dea7a04d2 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -25,6 +25,7 @@ #include #include "widgets/doubledelegate.h" #include "container/vincrementtablerow.h" +#include DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) : DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc){ @@ -256,7 +257,7 @@ void DialogIncrements::clickedToolButtonAdd(){ }while(data->IncrementTableContains(name)); qint64 id = data->getNextId(); - qint32 base = 0; + qreal base = 0; qreal ksize = 0; qreal kgrowth = 0; QString description = QString("Опис"); @@ -322,7 +323,7 @@ void DialogIncrements::clickedToolButtonRemove(){ &DialogIncrements::cellChanged); } -void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, +void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth, QString description){ QDomNodeList list = doc->elementsByTagName("increments"); QDomElement element = doc->createElement("increment"); @@ -418,37 +419,37 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ void DialogIncrements::InitialStandartTable(){ ui->tableWidgetStandart->setSortingEnabled(false); - ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); - ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); - ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); - ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); - ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); - ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); + ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Позначення"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Розрах. знач."))); + ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Базове знач."))); + ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("В розмірі"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("В рості"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Опис"))); } void DialogIncrements::InitialIncrementTable(){ ui->tableWidgetIncrement->setSortingEnabled(false); - ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem("Позначення")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem("Розрах. знач.")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem("Базове знач.")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem("В розмірі")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem("В рості")); - ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem("Опис")); + ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Позначення"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Розрах. знач."))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Базове знач."))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("В розмірі"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("В рості"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Опис"))); } void DialogIncrements::InitialLinesTable(){ - ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); - ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); + ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); + ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); } void DialogIncrements::InitialSplinesTable(){ - ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); - ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); + ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); + ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); } void DialogIncrements::InitialArcsTable(){ - ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem("Лінія")); - ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem("Довжина")); + ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); + ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); } void DialogIncrements::DialogAccepted(){ diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index b7569b787..ed357e92a 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -59,7 +59,7 @@ private: void FillLengthLines(); void FillLengthSplines(); void FillLengthArcs(); - void AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth, + void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth, QString description); }; From 233e1f7cbc2d29a8fde994a9c1995917e65d423a Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 4 Oct 2013 14:32:42 +0300 Subject: [PATCH 02/70] Replaced Qmap on to Qhash. Better performance. --HG-- branch : develop --- container/vcontainer.cpp | 77 ++++++++++++++++++------------------ container/vcontainer.h | 70 ++++++++++++++++---------------- dialogs/dialogarc.cpp | 4 +- dialogs/dialogincrements.cpp | 35 ++++++++++------ dialogs/dialogtool.cpp | 8 ++-- dialogs/dialogtool.h | 2 +- geometry/varc.cpp | 4 +- geometry/varc.h | 6 +-- geometry/vspline.cpp | 6 +-- geometry/vspline.h | 10 ++--- geometry/vsplinepath.cpp | 4 +- geometry/vsplinepath.h | 6 +-- mainwindow.cpp | 4 +- tools/vtooldetail.cpp | 4 +- xml/vdomdocument.cpp | 16 ++++---- xml/vdomdocument.h | 8 ++-- 16 files changed, 136 insertions(+), 128 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 8f20e2036..65292950e 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -26,15 +26,15 @@ qint64 VContainer::_id = 0; -VContainer::VContainer():base(QMap()), points(QMap()), - modelingPoints(QMap()), - standartTable(QMap()), incrementTable(QMap()), - lengthLines(QMap()), lineAngles(QMap()), splines(QMap()), - modelingSplines(QMap()), - lengthSplines(QMap()), arcs(QMap()), modelingArcs(QMap()), - lengthArcs(QMap()), - splinePaths(QMap()), modelingSplinePaths(QMap()), - details(QMap()){ +VContainer::VContainer():base(QHash()), points(QHash()), + modelingPoints(QHash()), + standartTable(QHash()), incrementTable(QHash()), + lengthLines(QHash()), lineAngles(QHash()), splines(QHash()), + modelingSplines(QHash()), + lengthSplines(QHash()), arcs(QHash()), modelingArcs(QHash()), + lengthArcs(QHash()), + splinePaths(QHash()), modelingSplinePaths(QHash()), + details(QHash()){ SetSize(500); SetGrowth(1760); CreateManTableIGroup (); @@ -45,15 +45,15 @@ VContainer &VContainer::operator =(const VContainer &data){ return *this; } -VContainer::VContainer(const VContainer &data):base(QMap()), points(QMap()), - modelingPoints(QMap()), - standartTable(QMap()), incrementTable(QMap()), - lengthLines(QMap()), lineAngles(QMap()), splines(QMap()), - modelingSplines(QMap()), - lengthSplines(QMap()), arcs(QMap()), modelingArcs(QMap()), - lengthArcs(QMap()), - splinePaths(QMap()), modelingSplinePaths(QMap()), - details(QMap()){ +VContainer::VContainer(const VContainer &data):base(QHash()), points(QHash()), + modelingPoints(QHash()), + standartTable(QHash()), incrementTable(QHash()), + lengthLines(QHash()), lineAngles(QHash()), splines(QHash()), + modelingSplines(QHash()), + lengthSplines(QHash()), arcs(QHash()), modelingArcs(QHash()), + lengthArcs(QHash()), + splinePaths(QHash()), modelingSplinePaths(QHash()), + details(QHash()){ setData(data); } @@ -77,7 +77,7 @@ void VContainer::setData(const VContainer &data){ } template -val VContainer::GetObject(const QMap &obj, key id){ +val VContainer::GetObject(const QHash &obj, key id){ if(obj.contains(id)){ return obj.value(id); } else { @@ -85,7 +85,6 @@ val VContainer::GetObject(const QMap &obj, key id){ } } - VPointF VContainer::GetPoint(qint64 id) const{ return GetObject(points, id); } @@ -377,7 +376,7 @@ QVector VContainer::CheckLoops(const QVector &points) const{ } void VContainer::PrepareDetails(QVector &list) const{ - QMapIterator iDetail(details); + QHashIterator iDetail(details); while (iDetail.hasNext()) { iDetail.next(); list.append(new VItem(ContourPath(iDetail.key()), list.size())); @@ -389,7 +388,7 @@ void VContainer::RemoveIncrementTableRow(const QString& name){ } template -void VContainer::UpdateObject(QMap &obj, const qint64 &id, const val& point){ +void VContainer::UpdateObject(QHash &obj, const qint64 &id, const val& point){ Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); obj[id] = point; UpdateId(id); @@ -567,67 +566,67 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const{ return 0; } -const QMap *VContainer::DataPoints() const{ +const QHash *VContainer::DataPoints() const{ return &points; } -const QMap *VContainer::DataModelingPoints() const{ +const QHash *VContainer::DataModelingPoints() const{ return &modelingPoints; } -const QMap *VContainer::DataSplines() const{ +const QHash *VContainer::DataSplines() const{ return &splines; } -const QMap *VContainer::DataModelingSplines() const{ +const QHash *VContainer::DataModelingSplines() const{ return &modelingSplines; } -const QMap *VContainer::DataArcs() const{ +const QHash *VContainer::DataArcs() const{ return &arcs; } -const QMap *VContainer::DataModelingArcs() const{ +const QHash *VContainer::DataModelingArcs() const{ return &modelingArcs; } -const QMap *VContainer::DataBase() const{ +const QHash *VContainer::DataBase() const{ return &base; } -const QMap *VContainer::DataStandartTable() const{ +const QHash *VContainer::DataStandartTable() const{ return &standartTable; } -const QMap *VContainer::DataIncrementTable() const{ +const QHash *VContainer::DataIncrementTable() const{ return &incrementTable; } -const QMap *VContainer::DataLengthLines() const{ +const QHash *VContainer::DataLengthLines() const{ return &lengthLines; } -const QMap *VContainer::DataLengthSplines() const{ +const QHash *VContainer::DataLengthSplines() const{ return &lengthSplines; } -const QMap *VContainer::DataLengthArcs() const{ +const QHash *VContainer::DataLengthArcs() const{ return &lengthArcs; } -const QMap *VContainer::DataLineAngles() const{ +const QHash *VContainer::DataLineAngles() const{ return &lineAngles; } -const QMap *VContainer::DataSplinePaths() const{ +const QHash *VContainer::DataSplinePaths() const{ return &splinePaths; } -const QMap *VContainer::DataModelingSplinePaths() const{ +const QHash *VContainer::DataModelingSplinePaths() const{ return &modelingSplinePaths; } -const QMap *VContainer::DataDetails() const{ +const QHash *VContainer::DataDetails() const{ return &details; } @@ -648,7 +647,7 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId } template -qint64 VContainer::AddObject(QMap &obj, const val& value){ +qint64 VContainer::AddObject(QHash &obj, const val& value){ qint64 id = getNextId(); obj[id] = value; return id; diff --git a/container/vcontainer.h b/container/vcontainer.h index fce8a378a..c7582b89d 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -122,22 +122,22 @@ public: bool IncrementTableContains(const QString& name); static qint64 getNextId(); void RemoveIncrementTableRow(const QString& name); - const QMap *DataPoints() const; - const QMap *DataModelingPoints() const; - const QMap *DataSplines() const; - const QMap *DataModelingSplines() const; - const QMap *DataArcs() const; - const QMap *DataModelingArcs() const; - const QMap *DataBase() const; - const QMap *DataStandartTable() const; - const QMap *DataIncrementTable() const; - const QMap *DataLengthLines() const; - const QMap *DataLengthSplines() const; - const QMap *DataLengthArcs() const; - const QMap *DataLineAngles() const; - const QMap *DataSplinePaths() const; - const QMap *DataModelingSplinePaths() const; - const QMap *DataDetails() const; + const QHash *DataPoints() const; + const QHash *DataModelingPoints() const; + const QHash *DataSplines() const; + const QHash *DataModelingSplines() const; + const QHash *DataArcs() const; + const QHash *DataModelingArcs() const; + const QHash *DataBase() const; + const QHash *DataStandartTable() const; + const QHash *DataIncrementTable() const; + const QHash *DataLengthLines() const; + const QHash *DataLengthSplines() const; + const QHash *DataLengthArcs() const; + const QHash *DataLineAngles() const; + const QHash *DataSplinePaths() const; + const QHash *DataModelingSplinePaths() const; + const QHash *DataDetails() const; static void UpdateId(qint64 newId); QPainterPath ContourPath(qint64 idDetail) const; QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, @@ -149,26 +149,26 @@ public: void PrepareDetails(QVector & list)const; private: static qint64 _id; - QMap base; - QMap points; - QMap modelingPoints; - QMap standartTable; - QMap incrementTable; - QMap lengthLines; - QMap lineAngles; - QMap splines; - QMap modelingSplines; - QMap lengthSplines; - QMap arcs; - QMap modelingArcs; - QMap lengthArcs; - QMap splinePaths; - QMap modelingSplinePaths; - QMap details; - template static val GetObject(const QMap &obj, key id); - template static void UpdateObject(QMap &obj, const qint64 &id, + QHash base; + QHash points; + QHash modelingPoints; + QHash standartTable; + QHash incrementTable; + QHash lengthLines; + QHash lineAngles; + QHash splines; + QHash modelingSplines; + QHash lengthSplines; + QHash arcs; + QHash modelingArcs; + QHash lengthArcs; + QHash splinePaths; + QHash modelingSplinePaths; + QHash details; + template static val GetObject(const QHash &obj, key id); + template static void UpdateObject(QHash &obj, const qint64 &id, const val& point); - template static qint64 AddObject(QMap &obj, const val& value); + template static qint64 AddObject(QHash &obj, const val& value); void CreateManTableIGroup (); QVector GetReversePoint(const QVector &points)const; qreal GetLengthContour(const QVector &contour, const QVector &newPoints)const; diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index cb547949a..7f77b419c 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -209,8 +209,8 @@ void DialogArc::ShowLineArcs(){ disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); ui->listWidget->clear(); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); - const QMap *lineArcsTable = data->DataLineAngles(); - QMapIterator i(*lineArcsTable); + const QHash *lineArcsTable = data->DataLineAngles(); + QHashIterator i(*lineArcsTable); while (i.hasNext()) { i.next(); QListWidgetItem *item = new QListWidgetItem(i.key()); diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index dea7a04d2..f26012fd1 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -55,9 +55,9 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget } void DialogIncrements::FillStandartTable(){ - const QMap *standartTable = data->DataStandartTable(); + const QHash *standartTable = data->DataStandartTable(); qint32 currentRow = -1; - QMapIterator i(*standartTable); + QHashIterator i(*standartTable); ui->tableWidgetStandart->setRowCount ( standartTable->size() ); while (i.hasNext()) { i.next(); @@ -95,22 +95,31 @@ void DialogIncrements::FillStandartTable(){ } void DialogIncrements::FillIncrementTable(){ - const QMap *incrementTable = data->DataIncrementTable(); - qint32 currentRow = -1; - QMapIterator i(*incrementTable); + const QHash *incrementTable = data->DataIncrementTable(); + QHashIterator i(*incrementTable); + QMap map; + //Sorting QHash by id while (i.hasNext()) { i.next(); VIncrementTableRow cell = i.value(); + map.insert(cell.getId(), i.key()); + } + + qint32 currentRow = -1; + QMapIterator iMap(map); + while (iMap.hasNext()) { + iMap.next(); + VIncrementTableRow cell = incrementTable->value(iMap.value()); currentRow++; ui->tableWidgetIncrement->setRowCount ( incrementTable->size() ); - QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); + QTableWidgetItem *item = new QTableWidgetItem(iMap.value()); item->setTextAlignment(Qt::AlignHCenter); item->setFont(QFont("Times", 12, QFont::Bold)); item->setData(Qt::UserRole, cell.getId()); ui->tableWidgetIncrement->setItem(currentRow, 0, item); - item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(i.key()))); + item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value()))); item->setTextAlignment(Qt::AlignHCenter); // set the item non-editable (view only), and non-selectable Qt::ItemFlags flags = item->flags(); @@ -143,9 +152,9 @@ void DialogIncrements::FillIncrementTable(){ } void DialogIncrements::FillLengthLines(){ - const QMap *linesTable = data->DataLengthLines(); + const QHash *linesTable = data->DataLengthLines(); qint32 currentRow = -1; - QMapIterator i(*linesTable); + QHashIterator i(*linesTable); while (i.hasNext()) { i.next(); qreal length = i.value(); @@ -167,9 +176,9 @@ void DialogIncrements::FillLengthLines(){ } void DialogIncrements::FillLengthSplines(){ - const QMap *splinesTable = data->DataLengthSplines(); + const QHash *splinesTable = data->DataLengthSplines(); qint32 currentRow = -1; - QMapIterator i(*splinesTable); + QHashIterator i(*splinesTable); while (i.hasNext()) { i.next(); qreal length = i.value(); @@ -191,9 +200,9 @@ void DialogIncrements::FillLengthSplines(){ } void DialogIncrements::FillLengthArcs(){ - const QMap *arcsTable = data->DataLengthArcs(); + const QHash *arcsTable = data->DataLengthArcs(); qint32 currentRow = -1; - QMapIterator i(*arcsTable); + QHashIterator i(*arcsTable); while (i.hasNext()) { i.next(); qreal length = i.value(); diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 2c9db774e..f5641e33c 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -58,8 +58,8 @@ void DialogTool::showEvent(QShowEvent *event){ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ box->clear(); if(mode == Draw::Calculation){ - const QMap *points = data->DataPoints(); - QMapIterator i(*points); + const QHash *points = data->DataPoints(); + QHashIterator i(*points); while (i.hasNext()) { i.next(); if(i.key() != id){ @@ -373,12 +373,12 @@ bool DialogTool::CheckObject(const qint64 &id){ } template -void DialogTool::ShowVariable(const QMap *var){ +void DialogTool::ShowVariable(const QHash *var){ Q_CHECK_PTR(listWidget); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); - QMapIterator i(*var); + QHashIterator i(*var); while (i.hasNext()) { i.next(); QListWidgetItem *item = new QListWidgetItem(i.key()); diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index a6168934b..e48d68aa9 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -92,7 +92,7 @@ protected: void FillComboBoxTypeLine(QComboBox *box) const; virtual void CheckState(); QString GetTypeLine(const QComboBox *box)const; - template void ShowVariable(const QMap *var); + template void ShowVariable(const QHash *var); void SetupTypeLine(QComboBox *box, const QString &value); void ChangeCurrentText(QComboBox *box, const QString &value); void ChangeCurrentData(QComboBox *box, const qint64 &value) const; diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 3ab6180c9..214a39a51 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -26,7 +26,7 @@ VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius center(0), points(0), mode(Draw::Calculation), idObject(0){ } -VArc::VArc (const QMap *points, qint64 center, qreal radius, QString formulaRadius, +VArc::VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject) : f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), center(center), points(points), mode(mode), idObject(idObject){ @@ -108,7 +108,7 @@ QPointF VArc::GetP2 () const{ return centerP2.p2(); } -const QMap *VArc::GetDataPoints() const{ +const QHash *VArc::GetDataPoints() const{ return points; } diff --git a/geometry/varc.h b/geometry/varc.h index d0f0b1285..349083a44 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -40,7 +40,7 @@ public: * @param f1 початковий кут в градусах. * @param f2 кінцевий кут в градусах. */ - VArc (const QMap *points, qint64 center, qreal radius, QString formulaRadius, + VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2 , QString formulaF2, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); VArc(const VArc &arc); @@ -84,7 +84,7 @@ public: * @return точку кінця дуги. */ QPointF GetP2 () const; - const QMap *GetDataPoints() const; + const QHash *GetDataPoints() const; /** * @brief GetPath будує шлях по даній дузі. * @return повертає шлях. @@ -119,7 +119,7 @@ private: * @brief center центральна точка дуги. */ qint64 center; - const QMap *points; + const QHash *points; Draw::Draws mode; qint64 idObject; }; diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 69f6ff495..ee19f4a18 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -32,14 +32,14 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 mode(spline.getMode()), idObject(spline.getIdObject()){ } -VSpline::VSpline (const QMap *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, +VSpline::VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points), mode(mode), idObject(idObject){ ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } -VSpline::VSpline (const QMap *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, +VSpline::VSpline (const QHash *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), mode(mode), idObject(idObject){ ModifiSpl ( p1, p2, p3, p4, kCurve); @@ -190,7 +190,7 @@ qreal VSpline::GetKcurve() const{ return kCurve; } -const QMap *VSpline::GetDataPoints() const{ +const QHash *VSpline::GetDataPoints() const{ return points; } diff --git a/geometry/vspline.h b/geometry/vspline.h index 6c7cf59c0..79ee52fe4 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include "container/vpointf.h" /** @@ -50,7 +50,7 @@ public: * @param kAsm1 коефіцієнт довжини першої напрямної. * @param kAsm2 коефіцієнт довжини другої напрямної. */ - VSpline (const QMap *points, qint64 p1, qint64 p4, qreal angle1, + VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); /** @@ -60,7 +60,7 @@ public: * @param p3 друга контролююча точка сплайну. * @param p4 кінцева точка сплайну. */ - VSpline (const QMap *points, qint64 p1, QPointF p2, QPointF p3, + VSpline (const QHash *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); /** @@ -136,7 +136,7 @@ public: qreal GetKasm1() const; qreal GetKasm2() const; qreal GetKcurve() const; - const QMap *GetDataPoints() const; + const QHash *GetDataPoints() const; /** * @brief CrossingSplLine перевіряє перетин сплайну з лінією. * @param line лінія з якою перевіряється перетин. @@ -224,7 +224,7 @@ private: qreal kAsm1; qreal kAsm2; qreal kCurve; - const QMap *points; + const QHash *points; Draw::Draws mode; qint64 idObject; /** diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index 8e3823ee3..a4dd5c176 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -26,7 +26,7 @@ VSplinePath::VSplinePath(): path(QVector()), kCurve(1), mode(Draw: idObject(0){ } -VSplinePath::VSplinePath(const QMap *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector()), +VSplinePath::VSplinePath(const QHash *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector()), kCurve(kCurve), mode(mode), points(points), idObject(idObject){ } @@ -108,7 +108,7 @@ qreal VSplinePath::GetLength() const{ return length; } -const QMap *VSplinePath::GetDataPoints() const{ +const QHash *VSplinePath::GetDataPoints() const{ return points; } diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index c6d6330f9..1036154dd 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -45,7 +45,7 @@ public: /** * @brief VSplinePath конструктор по замовчуванню. */ - VSplinePath(const QMap *points, qreal kCurve = 1, + VSplinePath(const QHash *points, qreal kCurve = 1, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); VSplinePath(const VSplinePath& splPath); /** @@ -60,7 +60,7 @@ public: QVector GetPathPoints() const; QVector GetSplinePath() const; qreal GetLength() const; - const QMap *GetDataPoints() const; + const QHash *GetDataPoints() const; void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; /** @@ -85,7 +85,7 @@ protected: QVector path; qreal kCurve; Draw::Draws mode; - const QMap *points; + const QHash *points; qint64 idObject; }; diff --git a/mainwindow.cpp b/mainwindow.cpp index 65cdfb791..ca34966ea 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -150,7 +150,7 @@ void MainWindow::ActionNewDraw(){ VToolSinglePoint *spoint = new VToolSinglePoint(doc, data, id, Tool::FromGui); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); - QMap* tools = doc->getTools(); + QHash* tools = doc->getTools(); tools->insert(id, spoint); VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); SetEnableTool(true); @@ -214,7 +214,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso template void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail){ - QMap* tools = doc->getTools(); + QHash* tools = doc->getTools(); VToolDetail *det = qobject_cast(tools->value(idDetail)); Q_CHECK_PTR(det); det->AddTool(tool, id, typeTool); diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 06b9d8da7..0f4041dc3 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -30,7 +30,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){ VDetail detail = data->GetDetail(id); - QMap* tools = doc->getTools(); + QHash* tools = doc->getTools(); Q_CHECK_PTR(tools); for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ @@ -248,7 +248,7 @@ void VToolDetail::Create(const qint64 _id, VDetail &newDetail, VMainGraphicsScen scene->addItem(detail); connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(detail, &VToolDetail::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - QMap* tools = doc->getTools(); + QHash* tools = doc->getTools(); tools->insert(id, detail); } } diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 151a6b522..ad6d916a1 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -36,22 +36,22 @@ VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(), - map(QMap()), nameActivDraw(QString()), data(data), - tools(QMap()), history(QVector()), cursor(0), + map(QHash()), nameActivDraw(QString()), data(data), + tools(QHash()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode){ } VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : - QDomDocument(name), map(QMap()), nameActivDraw(QString()), data(data), - tools(QMap()), history(QVector()), cursor(0), + QDomDocument(name), map(QHash()), nameActivDraw(QString()), data(data), + tools(QHash()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode){ } VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : - QDomDocument(doctype), map(QMap()), nameActivDraw(QString()), data(data), - tools(QMap()), history(QVector()), cursor(0), + QDomDocument(doctype), map(QHash()), nameActivDraw(QString()), data(data), + tools(QHash()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode){ } @@ -296,7 +296,7 @@ void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDra } } -QMap *VDomDocument::getTools(){ +QHash *VDomDocument::getTools(){ return &tools; } @@ -1035,7 +1035,7 @@ void VDomDocument::setCurrentData(){ } void VDomDocument::GarbageCollector(){ - QMapIterator t(tools); + QHashIterator t(tools); while (t.hasNext()) { t.next(); VDataTool *tool = t.value(); diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 192bee821..2a28d6d88 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -23,7 +23,7 @@ #define VDOMDOCUMENT_H #include -#include +#include #include #include "widgets/vmaingraphicsscene.h" #include "tools/vdatatool.h" @@ -58,7 +58,7 @@ public: bool appendDraw(const QString& name); void SetNameDraw(const QString& name); void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); - QMap* getTools(); + QHash* getTools(); QVector *getHistory(); qint64 getCursor() const; void setCursor(const qint64 &value); @@ -81,10 +81,10 @@ public slots: void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); private: Q_DISABLE_COPY(VDomDocument) - QMap map; + QHash map; QString nameActivDraw; VContainer *data; - QMap tools; + QHash tools; QVector history; qint64 cursor; QComboBox *comboBoxDraws; From 016e539c6bcf049a6be66d44a7ff0fad56962bed Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 4 Oct 2013 16:22:37 +0300 Subject: [PATCH 03/70] Added safe saveing file of pattern. --HG-- branch : develop --- mainwindow.cpp | 104 +++++++++++++++++++++++++++++++++++-------------- mainwindow.h | 1 + 2 files changed, 76 insertions(+), 29 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index ca34966ea..0905ad7dd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -461,8 +461,8 @@ void MainWindow::showEvent( QShowEvent *event ){ void MainWindow::closeEvent(QCloseEvent *event){ if(changeInFile == true){ QMessageBox msgBox; - msgBox.setText("The pattern has been modified."); - msgBox.setInformativeText("Do you want to save your changes?"); + msgBox.setText(tr("The pattern has been modified.")); + msgBox.setInformativeText(tr("Do you want to save your changes?")); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); msgBox.setIcon(QMessageBox::Question); @@ -475,7 +475,13 @@ void MainWindow::closeEvent(QCloseEvent *event){ } else { ActionSave(); } - event->accept(); + if(changeInFile){ + // We did't save file + event->ignore(); + } else { + // We have successfully saved the file + event->accept(); + } break; case QMessageBox::Discard: // Don't Save was clicked @@ -726,9 +732,9 @@ void MainWindow::ActionDetails(bool checked){ } void MainWindow::ActionSaveAs(){ - QString filters("Lekalo files (*.xml);;All files (*.*)"); - QString defaultFilter("Lekalo files (*.xml)"); - QString fName = QFileDialog::getSaveFileName(this, "Зберегти файл як", QDir::homePath(), + QString filters(tr("Lekalo files (*.xml);;All files (*.*)")); + QString defaultFilter(tr("Lekalo files (*.xml)")); + QString fName = QFileDialog::getSaveFileName(this, tr("Save as"), QDir::homePath(), filters, &defaultFilter); if(fName.isEmpty()) return; @@ -736,35 +742,29 @@ void MainWindow::ActionSaveAs(){ fName.append(".xml"); } fileName = fName; - QFileInfo info(fileName); - QString title(info.fileName()); - title.append("-Valentina"); - setWindowTitle(title); - QFile file(fileName); - if(file.open(QIODevice::WriteOnly| QIODevice::Truncate)){ - doc->GarbageCollector(); - const int Indent = 4; - QTextStream out(&file); - doc->save(out, Indent); - file.close(); - } - ui->actionSave->setEnabled(false); - changeInFile = false; + ActionSave(); } void MainWindow::ActionSave(){ if(!fileName.isEmpty()){ - QFile file(fileName); - if(file.open(QIODevice::WriteOnly| QIODevice::Truncate)){ - doc->GarbageCollector(); - const int Indent = 4; - QTextStream out(&file); - doc->save(out, Indent); - file.close(); + bool result = SafeSaveing(fileName); + if(result){ + ui->actionSave->setEnabled(false); + changeInFile = false; + QFileInfo info(fileName); + QString title(info.fileName()); + title.append("-Valentina"); + setWindowTitle(title); + } else { + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Error saving file. Can't save file.")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setIcon(QMessageBox::Warning); + msgBox.exec(); } - ui->actionSave->setEnabled(false); - changeInFile = false; } } @@ -810,6 +810,10 @@ void MainWindow::haveChange(){ if(!fileName.isEmpty()){ ui->actionSave->setEnabled(true); changeInFile = true; + QFileInfo info(fileName); + QString title(info.fileName()); + title.append("*-Valentina"); + setWindowTitle(title); } } @@ -902,6 +906,48 @@ void MainWindow::MinimumScrollBar(){ verScrollBar->setValue(verScrollBar->minimum()); } +bool MainWindow::SafeSaveing(const QString &fileName) const{ + if(fileName.isEmpty()){ + qWarning()<save(out, Indent); + tempFile.close(); + } + //Replace temp file our + bool result = false; + QFile patternFile(fileName); + // We need here temporary file because we need restore pattern after error of copying temp file. + QTemporaryFile tempOfPattern; + if (tempOfPattern.open()) { + patternFile.copy(tempOfPattern.fileName()); + } + if ( !patternFile.exists() || patternFile.remove() ) { + if ( !tempFile.copy(patternFile.fileName()) ){ + qCritical()< void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail); + bool SafeSaveing(const QString &fileName)const; }; #endif // MAINWINDOW_H From dbc2578c71a8e0495a394037acae855b617923e7 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 4 Oct 2013 17:00:19 +0300 Subject: [PATCH 04/70] Added autosaving file each 5 minutes. --HG-- branch : develop --- mainwindow.cpp | 19 +++++++++++++++++++ mainwindow.h | 1 + 2 files changed, 20 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 0905ad7dd..b76be3b72 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -99,6 +99,11 @@ MainWindow::MainWindow(QWidget *parent) : fileName.clear(); changeInFile = false; + //Autosaving file each 5 minutes + QTimer *timer = new QTimer(this); + timer->setTimerType(Qt::VeryCoarseTimer); + connect(timer, &QTimer::timeout, this, &MainWindow::AutoSavePattern); + timer->start(300000); } void MainWindow::ActionNewDraw(){ @@ -948,6 +953,20 @@ bool MainWindow::SafeSaveing(const QString &fileName) const{ return result; } +void MainWindow::AutoSavePattern(){ + if(!fileName.isEmpty()){ + bool result = SafeSaveing(fileName); + if(result){ + ui->actionSave->setEnabled(false); + changeInFile = false; + QFileInfo info(fileName); + QString title(info.fileName()); + title.append("-Valentina"); + setWindowTitle(title); + } + } +} + MainWindow::~MainWindow(){ CanselTool(); delete ui; diff --git a/mainwindow.h b/mainwindow.h index 188af09cf..4015d654f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -154,6 +154,7 @@ private: void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail); bool SafeSaveing(const QString &fileName)const; + void AutoSavePattern(); }; #endif // MAINWINDOW_H From da8e2c55f9d3b4a9e6415c9e541f817e9187b583 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 4 Oct 2013 19:51:03 +0300 Subject: [PATCH 05/70] Field formula set focus when we add new variable to formula. --HG-- branch : develop --- dialogs/dialogarc.cpp | 2 +- dialogs/dialogdetail.cpp | 4 +-- dialogs/dialoghistory.cpp | 60 ++++++++++++++++++------------------ dialogs/dialogincrements.cpp | 42 ++++++++++++------------- dialogs/dialogtool.cpp | 18 ++++++----- 5 files changed, 64 insertions(+), 62 deletions(-) diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 7f77b419c..2cfea8689 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -153,7 +153,7 @@ void DialogArc::ValChenged(int row){ QListWidgetItem *item = ui->listWidget->item( row ); if(ui->radioButtonLineAngles->isChecked()){ QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text())) - .arg("Значення кута лінії."); + .arg(tr("Value angle of line.")); ui->labelDescription->setText(desc); return; } diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index fc5a36543..3d26e18c5 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -59,7 +59,7 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){ NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour); break; default: - qWarning()<<"Get wrong scene object. Ignore."; + qWarning()<show(); @@ -120,7 +120,7 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No break; } default: - qWarning()<<"Get wrong tools. Ignore."; + qWarning()<GetPoint(tool.getId()).name()); + record = QString(tr("%1 - Base point")).arg(data->GetPoint(tool.getId()).name()); break; case Tool::EndLineTool: domElement = doc->elementById(QString().setNum(tool.getId())); if(domElement.isElement()){ basePointId = domElement.attribute("basePoint", "").toLongLong(); } - record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(), - data->GetPoint(tool.getId()).name()); + record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(basePointId).name(), + data->GetPoint(tool.getId()).name()); break; case Tool::LineTool: domElement = doc->elementById(QString().setNum(tool.getId())); @@ -163,8 +163,8 @@ QString DialogHistory::Record(const VToolRecord &tool){ firstPointId = domElement.attribute("firstPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong(); } - record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(), - data->GetPoint(secondPointId).name()); + record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(firstPointId).name(), + data->GetPoint(secondPointId).name()); break; case Tool::AlongLineTool: domElement = doc->elementById(QString().setNum(tool.getId())); @@ -172,12 +172,12 @@ QString DialogHistory::Record(const VToolRecord &tool){ basePointId = domElement.attribute("firstPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong(); } - record = QString("%3 - Точка на відрізку %1_%2").arg(data->GetPoint(basePointId).name(), - data->GetPoint(secondPointId).name(), - data->GetPoint(tool.getId()).name()); + record = QString(tr("%3 - Point along line %1_%2")).arg(data->GetPoint(basePointId).name(), + data->GetPoint(secondPointId).name(), + data->GetPoint(tool.getId()).name()); break; case Tool::ShoulderPointTool: - record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name()); + record = QString(tr("%1 - Point of soulder")).arg(data->GetPoint(tool.getId()).name()); break; case Tool::NormalTool: domElement = doc->elementById(QString().setNum(tool.getId())); @@ -185,9 +185,9 @@ QString DialogHistory::Record(const VToolRecord &tool){ basePointId = domElement.attribute("firstPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong(); } - record = QString("%3 - Перпендикуляр до відрузку %1_%2").arg(data->GetPoint(basePointId).name(), - data->GetPoint(secondPointId).name(), - data->GetPoint(tool.getId()).name()); + record = QString(tr("%3 - Normal to line %1_%2")).arg(data->GetPoint(basePointId).name(), + data->GetPoint(secondPointId).name(), + data->GetPoint(tool.getId()).name()); break; case Tool::BisectorTool: domElement = doc->elementById(QString().setNum(tool.getId())); @@ -196,10 +196,10 @@ QString DialogHistory::Record(const VToolRecord &tool){ basePointId = domElement.attribute("secondPoint", "").toLongLong(); thirdPointId = domElement.attribute("thirdPoint", "").toLongLong(); } - record = QString("%4 - Бісектриса кута %1_%2_%3").arg(data->GetPoint(firstPointId).name(), - data->GetPoint(basePointId).name(), - data->GetPoint(thirdPointId).name(), - data->GetPoint(tool.getId()).name()); + record = QString(tr("%4 - Bisector of angle %1_%2_%3")).arg(data->GetPoint(firstPointId).name(), + data->GetPoint(basePointId).name(), + data->GetPoint(thirdPointId).name(), + data->GetPoint(tool.getId()).name()); break; case Tool::LineIntersectTool: domElement = doc->elementById(QString().setNum(tool.getId())); @@ -209,28 +209,28 @@ QString DialogHistory::Record(const VToolRecord &tool){ p1Line2 = domElement.attribute("p1Line2", "").toLongLong(); p2Line2 = domElement.attribute("p2Line2", "").toLongLong(); } - record = QString("%5 - Точка перетину відрузку %1_%2 і %3_%4").arg(data->GetPoint(p1Line1).name(), - data->GetPoint(p2Line1).name(), - data->GetPoint(p1Line2).name(), - data->GetPoint(p2Line2).name(), - data->GetPoint(tool.getId()).name()); + record = QString(tr("%5 - Point of intersection lines %1_%2 and %3_%4")).arg(data->GetPoint(p1Line1).name(), + data->GetPoint(p2Line1).name(), + data->GetPoint(p1Line2).name(), + data->GetPoint(p2Line2).name(), + data->GetPoint(tool.getId()).name()); break; case Tool::SplineTool:{ VSpline spl = data->GetSpline(tool.getId()); - record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(), + record = QString(tr("Curve %1_%2")).arg(data->GetPoint(spl.GetP1()).name(), data->GetPoint(spl.GetP4()).name()); } break; case Tool::ArcTool:{ VArc arc = data->GetArc(tool.getId()); - record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name()); + record = QString(tr("Arc with center in point %1")).arg(data->GetPoint(arc.GetCenter()).name()); } break; case Tool::SplinePathTool:{ VSplinePath splPath = data->GetSplinePath(tool.getId()); QVector points = splPath.GetSplinePath(); if(points.size() != 0 ){ - record = QString("Шлях сплайну %1").arg(data->GetPoint(points[0].P()).name()); + record = QString(tr("Curve point %1")).arg(data->GetPoint(points[0].P()).name()); for(qint32 i = 1; i< points.size(); ++i){ QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name()); record.append(name); @@ -245,13 +245,13 @@ QString DialogHistory::Record(const VToolRecord &tool){ firstPointId = domElement.attribute("firstPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong(); } - record = QString("%4 - Точка дотику дуги з центром в точці %1 і відрізку %2_%3").arg(data->GetPoint(center).name(), - data->GetPoint(firstPointId).name(), - data->GetPoint(secondPointId).name(), - data->GetPoint(tool.getId()).name()); + record = QString(tr("%4 - Point of contact arc with center in point %1 and line %2_%3")).arg(data->GetPoint(center).name(), + data->GetPoint(firstPointId).name(), + data->GetPoint(secondPointId).name(), + data->GetPoint(tool.getId()).name()); break; default: - qWarning()<<"Get wrong tool type. Ignore."; + qWarning()<tableWidget->setSortingEnabled(false); ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" ")); - ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Інструмент")); + ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool"))); } void DialogHistory::ShowPoint(){ diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index f26012fd1..7ea38338c 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -261,7 +261,7 @@ void DialogIncrements::clickedToolButtonAdd(){ qint32 num = 1; QString name; do{ - name = QString("Позначення %1").arg(num); + name = QString(tr("Denotation %1")).arg(num); num++; }while(data->IncrementTableContains(name)); @@ -269,7 +269,7 @@ void DialogIncrements::clickedToolButtonAdd(){ qreal base = 0; qreal ksize = 0; qreal kgrowth = 0; - QString description = QString("Опис"); + QString description = QString(tr("Description")); VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description); data->AddIncrementTableRow(name, incrementRow); @@ -302,7 +302,7 @@ void DialogIncrements::clickedToolButtonAdd(){ item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 4, item); - item = new QTableWidgetItem("Опис"); + item = new QTableWidgetItem(tr("Description")); item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 5, item); @@ -428,37 +428,37 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ void DialogIncrements::InitialStandartTable(){ ui->tableWidgetStandart->setSortingEnabled(false); - ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Позначення"))); - ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Розрах. знач."))); - ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Базове знач."))); - ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("В розмірі"))); - ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("В рості"))); - ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Опис"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth"))); + ui->tableWidgetStandart->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description"))); } void DialogIncrements::InitialIncrementTable(){ ui->tableWidgetIncrement->setSortingEnabled(false); - ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Позначення"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Розрах. знач."))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Базове знач."))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("В розмірі"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("В рості"))); - ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Опис"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Denotation"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Calculated value"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Base value"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth"))); + ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description"))); } void DialogIncrements::InitialLinesTable(){ - ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); - ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); + ui->tableWidgetLines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Line"))); + ui->tableWidgetLines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length"))); } void DialogIncrements::InitialSplinesTable(){ - ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); - ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); + ui->tableWidgetSplines->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Curve"))); + ui->tableWidgetSplines->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length"))); } void DialogIncrements::InitialArcsTable(){ - ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Лінія"))); - ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Довжина"))); + ui->tableWidgetArcs->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Arc"))); + ui->tableWidgetArcs->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Length"))); } void DialogIncrements::DialogAccepted(){ diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index f5641e33c..c997d9812 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -52,7 +52,7 @@ void DialogTool::showEvent(QShowEvent *event){ if(isInitialized){ return; } - isInitialized = true;//перший показ вікна вже відбувся + isInitialized = true;//first show windows are held } void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ @@ -69,7 +69,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ } } else { if(idDetail <= 0){ - qWarning()<<"Wrong details id."<GetDetail(idDetail); @@ -93,12 +93,12 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{ QStringList list; - list<<"Лінія"<<"Без лінії"; + list<addItems(list); } QString DialogTool::GetTypeLine(const QComboBox *box) const{ - if(box->currentText()=="Лінія"){ + if(box->currentText()==tr("Line")){ return QString("hair"); } else { return QString("none"); @@ -107,13 +107,13 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const{ void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){ if(value == "hair"){ - qint32 index = box->findText("Лінія"); + qint32 index = box->findText(tr("Line")); if(index != -1){ box->setCurrentIndex(index); } } if(value == "none"){ - qint32 index = box->findText("Без лінії"); + qint32 index = box->findText(tr("No line")); if(index != -1){ box->setCurrentIndex(index); } @@ -140,6 +140,7 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){ QListWidgetItem *item = listWidget->currentItem(); QString val = item->text(); lineEdit->setText(lineEdit->text().append(val)); + lineEdit->setFocus(); } void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ @@ -164,7 +165,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) QString errorMsg; qreal result = cal.eval(edit->text(),&errorMsg); if(!errorMsg.isEmpty()){ - label->setText("Помилка."); + label->setText(tr("Error")); flag = false; } else { label->setText(QString().setNum(result)); @@ -303,6 +304,7 @@ void DialogTool::PutVal(QListWidgetItem *item){ Q_CHECK_PTR(lineEditFormula); QString val = item->text(); lineEditFormula->setText(lineEditFormula->text().append(val)); + lineEditFormula->setFocus(); } void DialogTool::ValChenged(int row){ @@ -343,7 +345,7 @@ void DialogTool::ValChenged(int row){ } if(radioButtonLengthLine->isChecked()){ QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text())) - .arg("Довжина лінії"); + .arg(tr("Line length")); labelDescription->setText(desc); return; } From 1d6582f3749c91ab0adba4fa547214a53ccd3a0f Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 5 Oct 2013 13:51:17 +0300 Subject: [PATCH 06/70] Tooltips. --HG-- branch : develop --- dialogs/dialogalongline.ui | 39 +++++++++++++++++--- dialogs/dialogarc.ui | 48 +++++++++++++++++++++++-- dialogs/dialogbisector.ui | 42 +++++++++++++++++++--- dialogs/dialogendline.ui | 30 ++++++++++++++-- dialogs/dialognormal.ui | 24 +++++++++++-- dialogs/dialogpointofcontact.ui | 21 ++++++++++- dialogs/dialogshoulderpoint.ui | 24 +++++++++++-- dialogs/dialogsinglepoint.ui | 9 +++-- dialogs/dialogsplinepath.ui | 6 +++- mainwindow.ui | 64 +++++++++++++++++++++++++++++++-- 10 files changed, 281 insertions(+), 26 deletions(-) diff --git a/dialogs/dialogalongline.ui b/dialogs/dialogalongline.ui index ee782b6ec..0732ef04b 100644 --- a/dialogs/dialogalongline.ui +++ b/dialogs/dialogalongline.ui @@ -37,10 +37,17 @@ - + + + Formula calculation of length of line + + + + Calculate formula + ... @@ -76,6 +83,9 @@ 0 + + Value of length + _ @@ -101,6 +111,9 @@ + + Put variable into formula + ... @@ -128,7 +141,11 @@ - + + + First point of line + + @@ -142,7 +159,11 @@ - + + + Second point of line + + @@ -156,7 +177,11 @@ - + + + Show line from first point to our point + + @@ -225,7 +250,11 @@ - + + + Variables. Click twice to select. + + diff --git a/dialogs/dialogarc.ui b/dialogs/dialogarc.ui index e8cbd4ad8..56e68895c 100644 --- a/dialogs/dialogarc.ui +++ b/dialogs/dialogarc.ui @@ -44,10 +44,16 @@ 0 + + Formula calculation of radius of arc + + + Put variable into formula + ... @@ -65,6 +71,9 @@ + + Calculate formula + ... @@ -94,6 +103,9 @@ 0 + + Value of radius + _ @@ -124,10 +136,16 @@ 0 + + First angle of arc counterclockwise + + + Put variable into formula + ... @@ -145,6 +163,9 @@ + + Calculate formula + ... @@ -174,6 +195,9 @@ 0 + + Value of first angle + _ @@ -204,10 +228,16 @@ 0 + + Second angle of arc counterclockwise + + + Put variable into formula + ... @@ -225,6 +255,9 @@ + + Calculate formula + ... @@ -254,6 +287,9 @@ 0 + + Value of second angle + _ @@ -281,7 +317,11 @@ - + + + Select point of center of arc + + @@ -363,7 +403,11 @@ - + + + Variables + + diff --git a/dialogs/dialogbisector.ui b/dialogs/dialogbisector.ui index 203e6492d..291d82aba 100644 --- a/dialogs/dialogbisector.ui +++ b/dialogs/dialogbisector.ui @@ -41,10 +41,16 @@ 0 + + Formula calculation of length of bisector + + + Calculate formula + ... @@ -74,6 +80,9 @@ 0 + + Value of length + _ @@ -105,6 +114,9 @@ + + Put variable into formula + ... @@ -138,7 +150,11 @@ - + + + First point of angle + + @@ -158,7 +174,11 @@ - + + + Second point of angle + + @@ -178,7 +198,11 @@ - + + + Third point of angle + + @@ -192,7 +216,11 @@ - + + + Show line from second point to our point + + @@ -264,7 +292,11 @@ - + + + Variables. Click twice to select. + + diff --git a/dialogs/dialogendline.ui b/dialogs/dialogendline.ui index baf7f4979..811e384d8 100644 --- a/dialogs/dialogendline.ui +++ b/dialogs/dialogendline.ui @@ -44,10 +44,16 @@ 0 + + Formula calculation of length of line + + + Calculate formula + ... @@ -77,6 +83,9 @@ 0 + + Value of length + _ @@ -104,7 +113,11 @@ - + + + First point of line + + @@ -335,6 +348,9 @@ 0 + + Angle of line + 360.000000000000000 @@ -356,7 +372,11 @@ - + + + Show line from first point to our point + + @@ -428,7 +448,11 @@ - + + + Variables. Click twice to select. + + diff --git a/dialogs/dialognormal.ui b/dialogs/dialognormal.ui index b01f58aba..5c629bd50 100644 --- a/dialogs/dialognormal.ui +++ b/dialogs/dialognormal.ui @@ -44,10 +44,16 @@ 0 + + Formula calculation of length of normal + + + Calculate formula + ... @@ -77,6 +83,9 @@ 0 + + Value of length + _ @@ -108,6 +117,9 @@ + + Put variable into formula + ... @@ -379,7 +391,11 @@ - + + + Show line from first point to our point + + @@ -451,7 +467,11 @@ - + + + Variables. Click twice to select. + + diff --git a/dialogs/dialogpointofcontact.ui b/dialogs/dialogpointofcontact.ui index ea9af6336..4df4c02f3 100644 --- a/dialogs/dialogpointofcontact.ui +++ b/dialogs/dialogpointofcontact.ui @@ -44,10 +44,16 @@ 0 + + Formula calculation of radius of arc + + + Calculate formula + ... @@ -77,6 +83,9 @@ 0 + + Value of radius + _ @@ -108,6 +117,9 @@ + + Put variable into formula + ... @@ -154,6 +166,9 @@ 0 + + Slect point of center of arc + @@ -292,7 +307,11 @@ - + + + Variables. Click twice to select. + + diff --git a/dialogs/dialogshoulderpoint.ui b/dialogs/dialogshoulderpoint.ui index 1df9dd194..4e0714317 100644 --- a/dialogs/dialogshoulderpoint.ui +++ b/dialogs/dialogshoulderpoint.ui @@ -44,10 +44,16 @@ 0 + + Formula calculation of length of line + + + Calculate formula + ... @@ -77,6 +83,9 @@ 0 + + Value of length + _ @@ -108,6 +117,9 @@ + + Put variable into formula + ... @@ -240,7 +252,11 @@ - + + + Show line from first point to our point + + @@ -312,7 +328,11 @@ - + + + Variables. Click twice to select. + + diff --git a/dialogs/dialogsinglepoint.ui b/dialogs/dialogsinglepoint.ui index 2060d1ef5..d6c3f1aa9 100644 --- a/dialogs/dialogsinglepoint.ui +++ b/dialogs/dialogsinglepoint.ui @@ -9,7 +9,7 @@ 0 0 - 249 + 250 202 @@ -35,8 +35,11 @@ 129 + + Coordinates on the sheet + - Координати + Coordinates @@ -66,7 +69,7 @@ 170 10 - 72 + 81 17 diff --git a/dialogs/dialogsplinepath.ui b/dialogs/dialogsplinepath.ui index 98f66474c..ea251492c 100644 --- a/dialogs/dialogsplinepath.ui +++ b/dialogs/dialogsplinepath.ui @@ -126,7 +126,11 @@ - + + + List of points + + diff --git a/mainwindow.ui b/mainwindow.ui index 90d48db99..e6a48f40e 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -36,8 +36,11 @@ 0 + + + - 4 + 0 @@ -54,6 +57,9 @@ 0 + + Tools for creating points. + Point @@ -63,6 +69,9 @@ false + + Tool point of normal. + ... @@ -86,6 +95,9 @@ false + + Tool point of shoulder. + ... @@ -109,6 +121,9 @@ false + + Tool point on the end line. + ... @@ -132,6 +147,9 @@ false + + Tool point along line. + ... @@ -155,6 +173,9 @@ false + + Tool point of bisector. + ... @@ -178,6 +199,9 @@ false + + Tool point of contact. + ... @@ -213,6 +237,9 @@ 0 + + Tools for creating lines. + Line @@ -222,6 +249,9 @@ false + + Tool line. + ... @@ -245,6 +275,9 @@ false + + Tool point of line intersection. + ... @@ -280,6 +313,9 @@ 0 + + Tools for creating curves. + Curve @@ -289,6 +325,9 @@ false + + Tool curve. + ... @@ -312,6 +351,9 @@ false + + Tool path curve. + ... @@ -347,6 +389,9 @@ 0 + + Tools for creating arcs. + Arc @@ -356,6 +401,9 @@ false + + Tool arc. + ... @@ -382,15 +430,27 @@ 0 0 150 - 427 + 58 + + + 0 + 0 + + + + Tools for creating details. + Detail + + Tool new detail. + ... From 668084adfec81b9c3f9f384afec0a630c5cbec67 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 5 Oct 2013 14:02:28 +0300 Subject: [PATCH 07/70] Deleted metod GarbageCollector. --HG-- branch : develop --- xml/vdomdocument.cpp | 19 ------------------- xml/vdomdocument.h | 1 - 2 files changed, 20 deletions(-) diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index ad6d916a1..161a272c6 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -1034,25 +1034,6 @@ void VDomDocument::setCurrentData(){ } } -void VDomDocument::GarbageCollector(){ - QHashIterator t(tools); - while (t.hasNext()) { - t.next(); - VDataTool *tool = t.value(); - if(tool->referens() <= 0){ - QDomElement domElement = elementById(QString().setNum(t.key())); - if(domElement.isElement()){ - QDomNode parent = domElement.parentNode(); - if(!parent.isNull()){ - parent.removeChild(domElement); - } else { - qWarning()< 0, Q_FUNC_INFO, "id <= 0"); Q_CHECK_PTR(tool); diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 2a28d6d88..e818c519b 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -63,7 +63,6 @@ public: qint64 getCursor() const; void setCursor(const qint64 &value); void setCurrentData(); - void GarbageCollector(); void AddTool(const qint64 &id, VDataTool *tool); void UpdateToolData(const qint64 &id, VContainer *data); void IncrementReferens(qint64 id) const; From c49b12447b0446bccfb04799cbb71efae39b0bf7 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 5 Oct 2013 14:30:56 +0300 Subject: [PATCH 08/70] Tab order for windows. --HG-- branch : develop --- dialogs/dialogalongline.ui | 17 +++++++++++++++++ dialogs/dialogarc.ui | 21 +++++++++++++++++++++ dialogs/dialogbisector.ui | 18 ++++++++++++++++++ dialogs/dialogdetail.ui | 6 ++++++ dialogs/dialogendline.ui | 25 +++++++++++++++++++++++++ dialogs/dialoghistory.ui | 4 ++++ dialogs/dialogincrements.ui | 11 +++++++++++ dialogs/dialogline.ui | 5 +++++ dialogs/dialoglineintersect.ui | 8 ++++++++ dialogs/dialognormal.ui | 26 ++++++++++++++++++++++++++ dialogs/dialogpointofcontact.ui | 17 +++++++++++++++++ dialogs/dialogshoulderpoint.ui | 18 ++++++++++++++++++ dialogs/dialogspline.ui | 10 ++++++++++ dialogs/dialogsplinepath.ui | 10 ++++++++++ mainwindow.ui | 16 +++++++++++++++- 15 files changed, 211 insertions(+), 1 deletion(-) diff --git a/dialogs/dialogalongline.ui b/dialogs/dialogalongline.ui index 0732ef04b..b5a3b3b60 100644 --- a/dialogs/dialogalongline.ui +++ b/dialogs/dialogalongline.ui @@ -277,6 +277,23 @@ + + lineEditFormula + toolButtonEqual + lineEditNamePoint + comboBoxFirstPoint + comboBoxSecondPoint + comboBoxLineType + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + listWidget + toolButtonPutHere + buttonBox + diff --git a/dialogs/dialogarc.ui b/dialogs/dialogarc.ui index 56e68895c..590d45ae8 100644 --- a/dialogs/dialogarc.ui +++ b/dialogs/dialogarc.ui @@ -430,6 +430,27 @@ + + lineEditRadius + lineEditF1 + lineEditF2 + comboBoxBasePoint + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + radioButtonLineAngles + listWidget + toolButtonPutHereRadius + toolButtonPutHereF1 + toolButtonPutHereF2 + toolButtonEqualRadius + toolButtonEqualF1 + toolButtonEqualF2 + buttonBox + diff --git a/dialogs/dialogbisector.ui b/dialogs/dialogbisector.ui index 291d82aba..1425f6b1a 100644 --- a/dialogs/dialogbisector.ui +++ b/dialogs/dialogbisector.ui @@ -322,6 +322,24 @@ + + lineEditFormula + lineEditNamePoint + comboBoxFirstPoint + comboBoxSecondPoint + comboBoxThirdPoint + comboBoxLineType + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + listWidget + toolButtonPutHere + toolButtonEqual + buttonBox + diff --git a/dialogs/dialogdetail.ui b/dialogs/dialogdetail.ui index a88fa06ba..acecad702 100644 --- a/dialogs/dialogdetail.ui +++ b/dialogs/dialogdetail.ui @@ -81,6 +81,12 @@ + + lineEditNameDetail + checkBoxClosed + listWidget + buttonBox + diff --git a/dialogs/dialogendline.ui b/dialogs/dialogendline.ui index 811e384d8..d99626dfe 100644 --- a/dialogs/dialogendline.ui +++ b/dialogs/dialogendline.ui @@ -475,6 +475,31 @@ + + lineEditFormula + comboBoxBasePoint + lineEditNamePoint + doubleSpinBoxAngle + toolButtonArrowRight + toolButtonArrowRightUp + toolButtonArrowUp + toolButtonArrowLeftUp + toolButtonArrowLeft + toolButtonArrowLeftDown + toolButtonArrowDown + toolButtonArrowRightDown + comboBoxLineType + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + listWidget + toolButtonPutHere + toolButtonEqual + buttonBox + diff --git a/dialogs/dialoghistory.ui b/dialogs/dialoghistory.ui index 8730daa26..20eaac344 100644 --- a/dialogs/dialoghistory.ui +++ b/dialogs/dialoghistory.ui @@ -68,6 +68,10 @@ + + tableWidget + buttonBox + diff --git a/dialogs/dialogincrements.ui b/dialogs/dialogincrements.ui index 2de0226b4..a76b4ca69 100644 --- a/dialogs/dialogincrements.ui +++ b/dialogs/dialogincrements.ui @@ -338,6 +338,17 @@ + + tabWidget + tableWidgetStandart + tableWidgetIncrement + toolButtonAdd + toolButtonRemove + tableWidgetLines + tableWidgetSplines + tableWidgetArcs + buttonBox + diff --git a/dialogs/dialogline.ui b/dialogs/dialogline.ui index a449002d8..b575f1d52 100644 --- a/dialogs/dialogline.ui +++ b/dialogs/dialogline.ui @@ -61,6 +61,11 @@ + + comboBoxFirstPoint + comboBoxSecondPoint + buttonBox + diff --git a/dialogs/dialoglineintersect.ui b/dialogs/dialoglineintersect.ui index d67a62b82..8cc5124f8 100644 --- a/dialogs/dialoglineintersect.ui +++ b/dialogs/dialoglineintersect.ui @@ -127,6 +127,14 @@ + + lineEditNamePoint + comboBoxP1Line1 + comboBoxP2Line1 + comboBoxP1Line2 + comboBoxP2Line2 + buttonBox + diff --git a/dialogs/dialognormal.ui b/dialogs/dialognormal.ui index 5c629bd50..7af8b7327 100644 --- a/dialogs/dialognormal.ui +++ b/dialogs/dialognormal.ui @@ -494,6 +494,32 @@ + + lineEditFormula + lineEditNamePoint + comboBoxFirstPoint + comboBoxSecondPoint + doubleSpinBoxAngle + toolButtonArrowRight + toolButtonArrowRightUp + toolButtonArrowUp + toolButtonArrowLeftUp + toolButtonArrowLeft + toolButtonArrowLeftDown + toolButtonArrowDown + toolButtonArrowRightDown + comboBoxLineType + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + listWidget + toolButtonPutHere + toolButtonEqual + buttonBox + diff --git a/dialogs/dialogpointofcontact.ui b/dialogs/dialogpointofcontact.ui index 4df4c02f3..0f6218720 100644 --- a/dialogs/dialogpointofcontact.ui +++ b/dialogs/dialogpointofcontact.ui @@ -334,6 +334,23 @@ + + lineEditFormula + lineEditNamePoint + comboBoxCenter + comboBoxFirstPoint + comboBoxSecondPoint + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + listWidget + toolButtonPutHere + toolButtonEqual + buttonBox + diff --git a/dialogs/dialogshoulderpoint.ui b/dialogs/dialogshoulderpoint.ui index 4e0714317..a6be756bd 100644 --- a/dialogs/dialogshoulderpoint.ui +++ b/dialogs/dialogshoulderpoint.ui @@ -355,6 +355,24 @@ + + lineEditFormula + lineEditNamePoint + comboBoxP1Line + comboBoxP2Line + comboBoxPShoulder + comboBoxLineType + radioButtonSizeGrowth + radioButtonStandartTable + radioButtonIncrements + radioButtonLengthLine + radioButtonLengthArc + radioButtonLengthSpline + listWidget + toolButtonPutHere + toolButtonEqual + buttonBox + diff --git a/dialogs/dialogspline.ui b/dialogs/dialogspline.ui index ce10cb6e7..b347954e9 100644 --- a/dialogs/dialogspline.ui +++ b/dialogs/dialogspline.ui @@ -199,6 +199,16 @@ + + comboBoxP1 + comboBoxP4 + doubleSpinBoxKasm1 + doubleSpinBoxKasm2 + spinBoxAngle1 + spinBoxAngle2 + doubleSpinBoxKcurve + buttonBox + diff --git a/dialogs/dialogsplinepath.ui b/dialogs/dialogsplinepath.ui index ea251492c..68c7c2795 100644 --- a/dialogs/dialogsplinepath.ui +++ b/dialogs/dialogsplinepath.ui @@ -188,6 +188,16 @@ + + comboBoxPoint + doubleSpinBoxKasm1 + spinBoxAngle1 + doubleSpinBoxKasm2 + spinBoxAngle2 + doubleSpinBoxKcurve + listWidget + buttonBox + diff --git a/mainwindow.ui b/mainwindow.ui index e6a48f40e..1a59a2b7b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -40,7 +40,7 @@ - 0 + 4 @@ -728,6 +728,20 @@ + + toolButtonEndLine + toolButtonAlongLine + toolButtonBisector + toolButtonNormal + toolButtonShoulderPoint + toolButtonPointOfContact + toolButtonLine + toolButtonLineIntersect + toolButtonSpline + toolButtonSplinePath + toolButtonArc + toolButtonNewDetail + From 4c14dd868886f64cfe29e2ab38bbd68a097da996 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 5 Oct 2013 15:07:04 +0300 Subject: [PATCH 09/70] Menu for main window. --HG-- branch : develop --- mainwindow.cpp | 12 ++++++++++++ mainwindow.h | 2 ++ mainwindow.ui | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index b76be3b72..ee35f0263 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -104,6 +104,10 @@ MainWindow::MainWindow(QWidget *parent) : timer->setTimerType(Qt::VeryCoarseTimer); connect(timer, &QTimer::timeout, this, &MainWindow::AutoSavePattern); timer->start(300000); + + connect(ui->actionAbout_Qt, &QAction::triggered, this, &MainWindow::AboutQt); + connect(ui->actionAbout_Valentina, &QAction::triggered, this, &MainWindow::About); + connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close); } void MainWindow::ActionNewDraw(){ @@ -443,6 +447,14 @@ void MainWindow::ClosedDialogDetail(int result){ ArrowTool(); } +void MainWindow::About(){ + QMessageBox::about(this, tr("About Valentina"), tr("Valentina v.0.1.0")); +} + +void MainWindow::AboutQt(){ + QMessageBox::aboutQt(this, tr("About Qt")); +} + void MainWindow::tableClosed(){ show(); MinimumScrollBar(); diff --git a/mainwindow.h b/mainwindow.h index 4015d654f..eba55383f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -92,6 +92,8 @@ public slots: void ClosedDialogSplinePath(int result); void ClosedDialogPointOfContact(int result); void ClosedDialogDetail(int result); + void About(); + void AboutQt(); /** * @brief tableClosed Слот, що виконується при отриманні сигналу закриття вікна укладання *деталей моделі. diff --git a/mainwindow.ui b/mainwindow.ui index 1a59a2b7b..f04705dd9 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -494,6 +494,37 @@ 25 + + + File + + + + + + + + + + + Help + + + + + + + Drawing + + + + + + + + + + @@ -726,6 +757,21 @@ Create layout + + + About Qt + + + + + About Valentina + + + + + Exit + + From 565c697a44f92e2132c639a5a3874d4bbdddadea Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 6 Oct 2013 19:22:21 +0300 Subject: [PATCH 10/70] Wrong field will be red. --HG-- branch : develop --- dialogs/dialogalongline.cpp | 2 + dialogs/dialogalongline.ui | 78 ++++++++++++++++++++- dialogs/dialogarc.cpp | 3 + dialogs/dialogarc.ui | 117 ++++++++++++++++++++++++++++++- dialogs/dialogbisector.cpp | 2 + dialogs/dialogbisector.ui | 78 ++++++++++++++++++++- dialogs/dialogdetail.ui | 2 +- dialogs/dialogendline.cpp | 2 + dialogs/dialogendline.ui | 78 ++++++++++++++++++++- dialogs/dialoglineintersect.cpp | 1 + dialogs/dialoglineintersect.ui | 39 ++++++++++- dialogs/dialognormal.cpp | 2 + dialogs/dialognormal.ui | 78 ++++++++++++++++++++- dialogs/dialogpointofcontact.cpp | 2 + dialogs/dialogpointofcontact.ui | 78 ++++++++++++++++++++- dialogs/dialogshoulderpoint.cpp | 2 + dialogs/dialogshoulderpoint.ui | 78 ++++++++++++++++++++- dialogs/dialogsinglepoint.cpp | 1 + dialogs/dialogsinglepoint.ui | 39 ++++++++++- dialogs/dialogtool.cpp | 21 +++++- dialogs/dialogtool.h | 2 + mainwindow.cpp | 2 + mainwindow.ui | 6 +- 23 files changed, 690 insertions(+), 23 deletions(-) diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index 7633d0e30..87cf627c6 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -34,6 +34,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted); diff --git a/dialogs/dialogalongline.ui b/dialogs/dialogalongline.ui index b5a3b3b60..acfb90561 100644 --- a/dialogs/dialogalongline.ui +++ b/dialogs/dialogalongline.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -100,7 +137,44 @@ - + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 2cfea8689..5c5d864a5 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -194,14 +194,17 @@ void DialogArc::CheckState(){ } void DialogArc::EvalRadius(){ + labelEditFormula = ui->labelEditRadius; Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius); } void DialogArc::EvalF1(){ + labelEditFormula = ui->labelEditF1; Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1); } void DialogArc::EvalF2(){ + labelEditFormula = ui->labelEditF2; Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2); } diff --git a/dialogs/dialogarc.ui b/dialogs/dialogarc.ui index 590d45ae8..26d4e43bb 100644 --- a/dialogs/dialogarc.ui +++ b/dialogs/dialogarc.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Radius @@ -116,13 +153,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + First angle degree @@ -208,13 +282,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Second angle degree diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index c03837c6a..83520735d 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -34,6 +34,8 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted); diff --git a/dialogs/dialogbisector.ui b/dialogs/dialogbisector.ui index 1425f6b1a..a4253118a 100644 --- a/dialogs/dialogbisector.ui +++ b/dialogs/dialogbisector.ui @@ -21,13 +21,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -97,13 +134,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogdetail.ui b/dialogs/dialogdetail.ui index acecad702..7f1370ed1 100644 --- a/dialogs/dialogdetail.ui +++ b/dialogs/dialogdetail.ui @@ -28,7 +28,7 @@ - + 0 diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index def24c322..386f37b09 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -39,6 +39,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget * radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted); diff --git a/dialogs/dialogendline.ui b/dialogs/dialogendline.ui index d99626dfe..2b4c079ee 100644 --- a/dialogs/dialogendline.ui +++ b/dialogs/dialogendline.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -141,13 +178,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 795a6f132..5f18a1a31 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -29,6 +29,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod number = 0; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted); + labelEditNamePoint = ui->labelEditNamePoint; flagName = false; QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected); diff --git a/dialogs/dialoglineintersect.ui b/dialogs/dialoglineintersect.ui index 8cc5124f8..25b5f8e95 100644 --- a/dialogs/dialoglineintersect.ui +++ b/dialogs/dialoglineintersect.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index 8e79ee9d4..5d52eb5ee 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -36,6 +36,8 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted); diff --git a/dialogs/dialognormal.ui b/dialogs/dialognormal.ui index 7af8b7327..26d182650 100644 --- a/dialogs/dialognormal.ui +++ b/dialogs/dialognormal.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -100,13 +137,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index 2c7151103..2f0d85b14 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -33,6 +33,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m radioButtonIncrements = ui.radioButtonIncrements; radioButtonLengthLine = ui.radioButtonLengthLine; lineEditFormula = ui.lineEditFormula; + labelEditFormula = ui.labelEditFormula; + labelEditNamePoint = ui.labelEditNamePoint; flagFormula = false; bOk = ui.buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted); diff --git a/dialogs/dialogpointofcontact.ui b/dialogs/dialogpointofcontact.ui index 0f6218720..4e28260b2 100644 --- a/dialogs/dialogpointofcontact.ui +++ b/dialogs/dialogpointofcontact.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Radius @@ -100,13 +137,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index be28ab325..4197aaebe 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -35,6 +35,8 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; lineEditFormula = ui->lineEditFormula; + labelEditFormula = ui->labelEditFormula; + labelEditNamePoint = ui->labelEditNamePoint; flagFormula = false; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted); diff --git a/dialogs/dialogshoulderpoint.ui b/dialogs/dialogshoulderpoint.ui index a6be756bd..f0b4d9e27 100644 --- a/dialogs/dialogshoulderpoint.ui +++ b/dialogs/dialogshoulderpoint.ui @@ -24,13 +24,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Length @@ -100,13 +137,50 @@ - + 0 0 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Name new point diff --git a/dialogs/dialogsinglepoint.cpp b/dialogs/dialogsinglepoint.cpp index b6807a1ec..276dd9542 100644 --- a/dialogs/dialogsinglepoint.cpp +++ b/dialogs/dialogsinglepoint.cpp @@ -33,6 +33,7 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : ui->doubleSpinBoxX->setRange(0,PaperSize/PrintDPI*25.4); ui->doubleSpinBoxY->setRange(0,PaperSize/PrintDPI*25.4); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + labelEditNamePoint = ui->labelEditName; flagName = false; CheckState(); connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted); diff --git a/dialogs/dialogsinglepoint.ui b/dialogs/dialogsinglepoint.ui index d6c3f1aa9..eb2d385d1 100644 --- a/dialogs/dialogsinglepoint.ui +++ b/dialogs/dialogsinglepoint.ui @@ -64,7 +64,7 @@ - + 170 @@ -73,6 +73,43 @@ 17 + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + Point name diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index c997d9812..ccb701f24 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -28,8 +28,8 @@ DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), - lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), - radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), + lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0), + labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), radioButtonLengthLine(0), idDetail(0), mode(mode){ Q_CHECK_PTR(data); timerFormula = new QTimer(this); @@ -146,9 +146,13 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ Q_CHECK_PTR(edit); Q_CHECK_PTR(timer); + Q_CHECK_PTR(labelEditFormula); if(edit->text().isEmpty()){ flag = false; CheckState(); + QPalette palette = labelEditFormula->palette(); + palette.setColor(labelEditFormula->foregroundRole(), Qt::red); + labelEditFormula->setPalette(palette); return; } timer->start(1000); @@ -158,8 +162,11 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) Q_CHECK_PTR(edit); Q_CHECK_PTR(timer); Q_CHECK_PTR(label); + Q_CHECK_PTR(labelEditFormula); + QPalette palette = labelEditFormula->palette(); if(edit->text().isEmpty()){ flag = false; + palette.setColor(labelEditFormula->foregroundRole(), Qt::red); } else { Calculator cal(data); QString errorMsg; @@ -167,13 +174,16 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) if(!errorMsg.isEmpty()){ label->setText(tr("Error")); flag = false; + palette.setColor(labelEditFormula->foregroundRole(), Qt::red); } else { label->setText(QString().setNum(result)); flag = true; + palette.setColor(labelEditFormula->foregroundRole(), QColor(76,76,76)); } } CheckState(); timer->stop(); + labelEditFormula->setPalette(palette); } void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, @@ -207,13 +217,20 @@ void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){ } void DialogTool::NamePointChanged(){ + Q_CHECK_PTR(labelEditNamePoint); QLineEdit* edit = qobject_cast(sender()); if (edit){ QString name = edit->text(); if(name.isEmpty() || name.contains(" ")){ flagName = false; + QPalette palette = labelEditNamePoint->palette(); + palette.setColor(labelEditNamePoint->foregroundRole(), Qt::red); + labelEditNamePoint->setPalette(palette); } else { flagName = true; + QPalette palette = labelEditNamePoint->palette(); + palette.setColor(labelEditNamePoint->foregroundRole(), QColor(76,76,76)); + labelEditNamePoint->setPalette(palette); } } CheckState(); diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index e48d68aa9..b3655df27 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -79,6 +79,8 @@ protected: QListWidget *listWidget; QLabel *labelResultCalculation; QLabel *labelDescription; + QLabel *labelEditNamePoint; + QLabel *labelEditFormula; QRadioButton *radioButtonSizeGrowth; QRadioButton *radioButtonStandartTable; QRadioButton *radioButtonIncrements; diff --git a/mainwindow.cpp b/mainwindow.cpp index ee35f0263..e4a612332 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -108,6 +108,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->actionAbout_Qt, &QAction::triggered, this, &MainWindow::AboutQt); connect(ui->actionAbout_Valentina, &QAction::triggered, this, &MainWindow::About); connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close); + + ui->toolBox->setCurrentIndex(0); } void MainWindow::ActionNewDraw(){ diff --git a/mainwindow.ui b/mainwindow.ui index f04705dd9..5a99c2733 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -40,7 +40,7 @@ - 4 + 0 @@ -303,7 +303,7 @@ 0 0 - 150 + 137 58 @@ -379,7 +379,7 @@ 0 0 - 150 + 137 58 From 296a9e5e93e4d4be67b7509cefa76920e05e97aa Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 7 Oct 2013 12:13:24 +0300 Subject: [PATCH 11/70] Test unique id. --HG-- branch : develop --- Valentina.pro | 6 ++++-- exception/vexceptionemptyparameter.cpp | 6 ++---- exception/vexceptionobjecterror.cpp | 6 ++---- exception/vexceptionuniqueid.cpp | 21 ++++++++++++++++++++ exception/vexceptionuniqueid.h | 24 +++++++++++++++++++++++ exception/vexceptionwrongparameterid.cpp | 6 ++---- mainwindow.cpp | 17 +++++++++++++++- xml/vdomdocument.cpp | 25 +++++++++++++++++++++++- xml/vdomdocument.h | 7 ++++--- 9 files changed, 99 insertions(+), 19 deletions(-) create mode 100644 exception/vexceptionuniqueid.cpp create mode 100644 exception/vexceptionuniqueid.h diff --git a/Valentina.pro b/Valentina.pro index 14e0c70e0..f94c2e337 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -95,7 +95,8 @@ SOURCES += main.cpp\ exception/vexceptionconversionerror.cpp \ exception/vexceptionemptyparameter.cpp \ exception/vexceptionobjecterror.cpp \ - widgets/vapplication.cpp + widgets/vapplication.cpp \ + exception/vexceptionuniqueid.cpp HEADERS += mainwindow.h \ widgets/vmaingraphicsscene.h \ @@ -185,7 +186,8 @@ HEADERS += mainwindow.h \ exception/vexceptionconversionerror.h \ exception/vexceptionemptyparameter.h \ exception/vexceptionobjecterror.h \ - widgets/vapplication.h + widgets/vapplication.h \ + exception/vexceptionuniqueid.h FORMS += mainwindow.ui \ dialogs/dialogsinglepoint.ui \ diff --git a/exception/vexceptionemptyparameter.cpp b/exception/vexceptionemptyparameter.cpp index 72c645724..fb7ee565f 100644 --- a/exception/vexceptionemptyparameter.cpp +++ b/exception/vexceptionemptyparameter.cpp @@ -27,10 +27,8 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS name(name), tagText(QString()), tagName(QString()), lineNumber(-1){ Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "Parameter name is empty"); - if(domElement.isText()){ - QDomText text = domElement.toText(); - tagText = text.data(); - } + QTextStream stream(&tagText); + domElement.save(stream, 4); tagName = domElement.tagName(); lineNumber = domElement.lineNumber(); } diff --git a/exception/vexceptionobjecterror.cpp b/exception/vexceptionobjecterror.cpp index 9c4f36c83..d1a424eff 100644 --- a/exception/vexceptionobjecterror.cpp +++ b/exception/vexceptionobjecterror.cpp @@ -25,10 +25,8 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement): VException(what), tagText(QString()), tagName(QString()), lineNumber(-1), moreInfo(QString()){ Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); - if(domElement.isText()){ - QDomText text = domElement.toText(); - tagText = text.data(); - } + QTextStream stream(&tagText); + domElement.save(stream, 4); tagName = domElement.tagName(); lineNumber = domElement.lineNumber(); } diff --git a/exception/vexceptionuniqueid.cpp b/exception/vexceptionuniqueid.cpp new file mode 100644 index 000000000..51ddf4c82 --- /dev/null +++ b/exception/vexceptionuniqueid.cpp @@ -0,0 +1,21 @@ +#include "vexceptionuniqueid.h" +#include + +VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement) + :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){ + Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + QTextStream stream(&tagText); + domElement.save(stream, 4); + tagName = domElement.tagName(); + lineNumber = domElement.lineNumber(); +} + +QString VExceptionUniqueId::ErrorMessage() const{ + QString error = QString("ExceptionUniqueId: %1").arg(what); + return error; +} + +QString VExceptionUniqueId::DetailedInformation() const{ + QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText); + return detail; +} diff --git a/exception/vexceptionuniqueid.h b/exception/vexceptionuniqueid.h new file mode 100644 index 000000000..1bf1760d4 --- /dev/null +++ b/exception/vexceptionuniqueid.h @@ -0,0 +1,24 @@ +#ifndef VEXCEPTIONUNIQUEID_H +#define VEXCEPTIONUNIQUEID_H + +#include "vexception.h" +#include + +class VExceptionUniqueId : public VException{ +public: + VExceptionUniqueId(const QString &what, const QDomElement &domElement); + VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionUniqueId() noexcept(true){} + virtual QString ErrorMessage() const; + virtual QString DetailedInformation() const; + QString TagText() const {return tagText;} + QString TagName() const {return tagName;} + qint32 LineNumber() const {return lineNumber;} +protected: + QString tagText; + QString tagName; + qint32 lineNumber; +}; + +#endif // VEXCEPTIONUNIQUEID_H diff --git a/exception/vexceptionwrongparameterid.cpp b/exception/vexceptionwrongparameterid.cpp index 31b3d95e4..0da7ea21b 100644 --- a/exception/vexceptionwrongparameterid.cpp +++ b/exception/vexceptionwrongparameterid.cpp @@ -25,10 +25,8 @@ VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, const QDomElement &domElement): VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){ Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); - if(domElement.isText()){ - QDomText text = domElement.toText(); - tagText = text.data(); - } + QTextStream stream(&tagText); + domElement.save(stream, 4); tagName = domElement.tagName(); lineNumber = domElement.lineNumber(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index e4a612332..5a023eff3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -35,6 +35,7 @@ #include "exception/vexceptionconversionerror.h" #include "exception/vexceptionemptyparameter.h" #include "exception/vexceptionwrongparameterid.h" +#include "exception/vexceptionuniqueid.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), tool(Tool::ArrowTool), currentScene(0), sceneDraw(0), @@ -1011,7 +1012,7 @@ void MainWindow::OpenPattern(const QString &fileName){ if(file.open(QIODevice::ReadOnly)){ if(doc->setContent(&file, &errorMsg, &errorLine, &errorColumn)){ disconnect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::currentDrawChanged); + this, &MainWindow::currentDrawChanged); try{ doc->Parse(Document::FullParse, sceneDraw, sceneDetails); } @@ -1070,6 +1071,20 @@ void MainWindow::OpenPattern(const QString &fileName){ Clear(); return; } + catch(const VExceptionUniqueId &e){ + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Error don't unique id.")); + msgBox.setInformativeText(e.ErrorMessage()); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setDetailedText(e.DetailedInformation()); + msgBox.setIcon(QMessageBox::Critical); + msgBox.exec(); + file.close(); + Clear(); + return; + } connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::currentDrawChanged); QString nameDraw = doc->GetNameActivDraw(); diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 161a272c6..10f601a82 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -33,7 +33,7 @@ #include "exception/vexceptionemptyparameter.h" #include "exception/vexceptionbadid.h" #include "exception/vexceptionobjecterror.h" - +#include "exception/vexceptionuniqueid.h" VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(), map(QHash()), nameActivDraw(QString()), data(data), @@ -255,6 +255,7 @@ void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDra Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); if(parse == Document::FullParse){ + TestUniqueId(); data->Clear(); nameActivDraw.clear(); sceneDraw->clear(); @@ -370,6 +371,28 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri return param; } +void VDomDocument::TestUniqueId() const{ + QVector vector; + CollectId(this->documentElement(), vector); +} + +void VDomDocument::CollectId(QDomElement node, QVector &vector) const{ + if (node.hasAttribute("id")) { + qint64 id = GetParametrId(node); + if(vector.contains(id)){ + throw VExceptionUniqueId(tr("This id is not unique."), node); + } + vector.append(id); + } + + for (qint32 i=0; i &vector)const; }; #pragma GCC diagnostic pop From 8a7ace463c7bbdff5495906cd56956a80e818bf5 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 7 Oct 2013 14:11:56 +0300 Subject: [PATCH 12/70] Tooltip for tools. --HG-- branch : develop --- dialogs/dialogalongline.cpp | 5 +-- dialogs/dialogarc.cpp | 1 + dialogs/dialogbisector.cpp | 3 ++ dialogs/dialogdetail.cpp | 1 + dialogs/dialogendline.cpp | 1 + dialogs/dialogline.cpp | 2 ++ dialogs/dialoglineintersect.cpp | 4 +++ dialogs/dialognormal.cpp | 2 ++ dialogs/dialogpointofcontact.cpp | 3 ++ dialogs/dialogshoulderpoint.cpp | 3 ++ dialogs/dialogspline.cpp | 2 ++ dialogs/dialogsplinepath.cpp | 2 ++ dialogs/dialogtool.h | 1 + mainwindow.cpp | 59 +++++++++++++++++++------------- mainwindow.h | 5 +-- 15 files changed, 67 insertions(+), 27 deletions(-) diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index 87cf627c6..4d522963a 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -61,8 +61,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged); } -DialogAlongLine::~DialogAlongLine() -{ +DialogAlongLine::~DialogAlongLine(){ delete ui; } @@ -90,6 +89,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxFirstPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select second point of line")); return; } } @@ -98,6 +98,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxSecondPoint->setCurrentIndex(index); number = 0; + emit ToolTip(""); } if(!isInitialized){ this->show(); diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 5c5d864a5..7b4548ef1 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -134,6 +134,7 @@ void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){ point = data->GetModelingPoint(id); } ChangeCurrentText(ui->comboBoxBasePoint, point.name()); + emit ToolTip(""); this->show(); } } diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index 83520735d..6f6e785ce 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -90,6 +90,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxFirstPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select second point of angle")); return; } } @@ -98,6 +99,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxSecondPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select third point of angle")); return; } } @@ -106,6 +108,7 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxThirdPoint->setCurrentIndex(index); number = 0; + emit ToolTip(""); } if(!isInitialized){ this->show(); diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index 3d26e18c5..8ccb6adf3 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -74,6 +74,7 @@ void DialogDetail::DialogAccepted(){ } details.setName(ui.lineEditNameDetail->text()); emit DialogClosed(QDialog::Accepted); + emit ToolTip(""); } void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){ diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index 386f37b09..fc0530c0a 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -101,6 +101,7 @@ void DialogEndLine::ChoosedObject(qint64 id, Scene::Scenes type){ point = data->GetModelingPoint(id); } ChangeCurrentText(ui->comboBoxBasePoint, point.name()); + emit ToolTip(""); this->show(); } } diff --git a/dialogs/dialogline.cpp b/dialogs/dialogline.cpp index 3c0da94b8..784d6448a 100644 --- a/dialogs/dialogline.cpp +++ b/dialogs/dialogline.cpp @@ -99,6 +99,7 @@ void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxFirstPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select second point")); return; } } @@ -107,6 +108,7 @@ void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxSecondPoint->setCurrentIndex(index); number = 0; + emit ToolTip(""); } if(!isInitialized){ this->show(); diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 5f18a1a31..3388a331e 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -71,6 +71,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){ ui->comboBoxP1Line1->setCurrentIndex(index); p1Line1 = id; number++; + emit ToolTip(tr("Select second point of first line")); return; } } @@ -80,6 +81,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){ ui->comboBoxP2Line1->setCurrentIndex(index); p2Line1 = id; number++; + emit ToolTip(tr("Select first point of second line")); return; } } @@ -89,6 +91,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){ ui->comboBoxP1Line2->setCurrentIndex(index); p1Line2 = id; number++; + emit ToolTip(tr("Select second point of second line")); return; } } @@ -98,6 +101,7 @@ void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){ ui->comboBoxP2Line2->setCurrentIndex(index); p2Line2 = id; number = 0; + emit ToolTip(""); } if(!isInitialized){ flagPoint = CheckIntersecion(); diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index 5d52eb5ee..11cb6805d 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -108,6 +108,7 @@ void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxFirstPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select second point of line")); return; } } @@ -116,6 +117,7 @@ void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxSecondPoint->setCurrentIndex(index); number = 0; + emit ToolTip(""); } if(!isInitialized){ this->show(); diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index 2f0d85b14..67148bb50 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -84,6 +84,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui.comboBoxFirstPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select second point of line")); return; } } @@ -92,6 +93,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui.comboBoxSecondPoint->setCurrentIndex(index); number++; + emit ToolTip(tr("Select point of center of arc")); return; } } @@ -100,6 +102,7 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui.comboBoxCenter->setCurrentIndex(index); number = 0; + emit ToolTip(""); } if(!isInitialized){ this->show(); diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index 4197aaebe..28201e968 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -92,6 +92,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxP1Line->setCurrentIndex(index); number++; + emit ToolTip(tr("Select second point of line")); return; } } @@ -100,6 +101,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxP2Line->setCurrentIndex(index); number++; + emit ToolTip(tr("Select point of shoulder")); return; } } @@ -108,6 +110,7 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxPShoulder->setCurrentIndex(index); number = 0; + emit ToolTip(""); } if(!isInitialized){ this->show(); diff --git a/dialogs/dialogspline.cpp b/dialogs/dialogspline.cpp index c264d0424..c17c3d385 100644 --- a/dialogs/dialogspline.cpp +++ b/dialogs/dialogspline.cpp @@ -67,6 +67,7 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxP1->setCurrentIndex(index); number++; + emit ToolTip(tr("Select last point of curve")); return; } } @@ -75,6 +76,7 @@ void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){ if ( index != -1 ) { // -1 for not found ui->comboBoxP4->setCurrentIndex(index); number = 0; + emit ToolTip(""); index = ui->comboBoxP1->currentIndex(); qint64 p1Id = qvariant_cast(ui->comboBoxP1->itemData(index)); QPointF p1; diff --git a/dialogs/dialogsplinepath.cpp b/dialogs/dialogsplinepath.cpp index aa889010b..0f085895d 100644 --- a/dialogs/dialogsplinepath.cpp +++ b/dialogs/dialogsplinepath.cpp @@ -82,6 +82,7 @@ void DialogSplinePath::ChoosedObject(qint64 id, Scene::Scenes type){ } if(type == Scene::Point){ NewItem(id, 1, 0, 1); + emit ToolTip(tr("Select point of curve path")); this->show(); } } @@ -93,6 +94,7 @@ void DialogSplinePath::DialogAccepted(){ path.append( qvariant_cast(item->data(Qt::UserRole))); } path.setKCurve(ui->doubleSpinBoxKcurve->value()); + emit ToolTip(""); emit DialogClosed(QDialog::Accepted); } diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index b3655df27..630582144 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -43,6 +43,7 @@ public: void setIdDetail(const qint64 &value); signals: void DialogClosed(int result); + void ToolTip(const QString &toolTip); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); void NamePointChanged(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 5a023eff3..c2051691b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -65,7 +65,7 @@ MainWindow::MainWindow(QWidget *parent) : QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); policy.setHorizontalStretch(12); view->setSizePolicy(policy); - helpLabel = new QLabel("Створіть новий файл для початку роботи."); + helpLabel = new QLabel(tr("Create new drawing for start working.")); ui->statusBar->addWidget(helpLabel); connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ActionAroowTool); @@ -204,17 +204,19 @@ void MainWindow::OptionDraw(){ template void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &cursor, - QSharedPointer &dialog, Func closeDialogSlot){ + const QString &toolTip, QSharedPointer &dialog, + Func closeDialogSlot){ if(checked){ CanselTool(); tool = t; QPixmap pixmap(cursor); QCursor cur(pixmap, 2, 3); view->setCursor(cur); - helpLabel->setText("Виберіть точки."); + helpLabel->setText(toolTip); dialog = QSharedPointer(new Dialog(data, mode)); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject); connect(dialog.data(), &Dialog::DialogClosed, this, closeDialogSlot); + connect(dialog.data(), &Dialog::ToolTip, this, &MainWindow::ShowToolTip); connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); } else { if(QToolButton *tButton = qobject_cast< QToolButton * >(this->sender())){ @@ -233,8 +235,8 @@ void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool } void MainWindow::ToolEndLine(bool checked){ - SetToolButton(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", dialogEndLine, - &MainWindow::ClosedDialogEndLine); + SetToolButton(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), + dialogEndLine, &MainWindow::ClosedDialogEndLine); } void MainWindow::ClosedDialogEndLine(int result){ @@ -250,8 +252,8 @@ void MainWindow::ClosedDialogEndLine(int result){ } void MainWindow::ToolLine(bool checked){ - SetToolButton(checked, Tool::LineTool, ":/cursor/line_cursor.png", dialogLine, - &MainWindow::ClosedDialogLine); + SetToolButton(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), + dialogLine, &MainWindow::ClosedDialogLine); } void MainWindow::ClosedDialogLine(int result){ @@ -267,8 +269,8 @@ void MainWindow::ClosedDialogLine(int result){ } void MainWindow::ToolAlongLine(bool checked){ - SetToolButton(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", dialogAlongLine, - &MainWindow::ClosedDialogAlongLine); + SetToolButton(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", tr("Select point"), + dialogAlongLine, &MainWindow::ClosedDialogAlongLine); } void MainWindow::ClosedDialogAlongLine(int result){ @@ -284,7 +286,8 @@ void MainWindow::ClosedDialogAlongLine(int result){ } void MainWindow::ToolShoulderPoint(bool checked){ - SetToolButton(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", dialogShoulderPoint, + SetToolButton(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", + tr("Select first point of line"), dialogShoulderPoint, &MainWindow::ClosedDialogShoulderPoint); } @@ -302,8 +305,8 @@ void MainWindow::ClosedDialogShoulderPoint(int result){ } void MainWindow::ToolNormal(bool checked){ - SetToolButton(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", dialogNormal, - &MainWindow::ClosedDialogNormal); + SetToolButton(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", + tr("Select first point of line"), dialogNormal, &MainWindow::ClosedDialogNormal); } void MainWindow::ClosedDialogNormal(int result){ @@ -319,8 +322,8 @@ void MainWindow::ClosedDialogNormal(int result){ } void MainWindow::ToolBisector(bool checked){ - SetToolButton(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", dialogBisector, - &MainWindow::ClosedDialogBisector); + SetToolButton(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", + tr("Select first point of angle"), dialogBisector, &MainWindow::ClosedDialogBisector); } void MainWindow::ClosedDialogBisector(int result){ @@ -336,7 +339,8 @@ void MainWindow::ClosedDialogBisector(int result){ } void MainWindow::ToolLineIntersect(bool checked){ - SetToolButton(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", dialogLineIntersect, + SetToolButton(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", + tr("Select first point of first line"), dialogLineIntersect, &MainWindow::ClosedDialogLineIntersect); } @@ -345,7 +349,8 @@ void MainWindow::ClosedDialogLineIntersect(int result){ if(mode == Draw::Calculation){ VToolLineIntersect::Create(dialogLineIntersect, currentScene, doc, data); } else { - VModelingLineIntersect *point = VModelingLineIntersect::Create(dialogLineIntersect, doc, data); + VModelingLineIntersect *point = VModelingLineIntersect::Create(dialogLineIntersect, doc, + data); AddToolToDetail(point, point->getId(), Tool::LineIntersectTool, dialogLineIntersect->getIdDetail()); } @@ -354,8 +359,8 @@ void MainWindow::ClosedDialogLineIntersect(int result){ } void MainWindow::ToolSpline(bool checked){ - SetToolButton(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", dialogSpline, - &MainWindow::ClosedDialogSpline); + SetToolButton(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", + tr("Select first point curve"), dialogSpline, &MainWindow::ClosedDialogSpline); } void MainWindow::ClosedDialogSpline(int result){ @@ -371,8 +376,8 @@ void MainWindow::ClosedDialogSpline(int result){ } void MainWindow::ToolArc(bool checked){ - SetToolButton(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", dialogArc, - &MainWindow::ClosedDialogArc); + SetToolButton(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", + tr("Select point of center of arc"), dialogArc, &MainWindow::ClosedDialogArc); } void MainWindow::ClosedDialogArc(int result){ @@ -388,7 +393,8 @@ void MainWindow::ClosedDialogArc(int result){ } void MainWindow::ToolSplinePath(bool checked){ - SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", dialogSplinePath, + SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", + tr("Select point of curve path"), dialogSplinePath, &MainWindow::ClosedDialogSplinePath); } @@ -405,7 +411,8 @@ void MainWindow::ClosedDialogSplinePath(int result){ } void MainWindow::ToolPointOfContact(bool checked){ - SetToolButton(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", dialogPointOfContact, + SetToolButton(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", + tr("Select first point of line"), dialogPointOfContact, &MainWindow::ClosedDialogPointOfContact); } @@ -430,7 +437,7 @@ void MainWindow::ToolDetail(bool checked){ QPixmap pixmap("://cursor/new_detail_cursor.png"); QCursor cur(pixmap, 2, 3); view->setCursor(cur); - helpLabel->setText("Виберіть точки."); + helpLabel->setText(tr("Select points, arcs, curves and details clockwise.")); dialogDetail = QSharedPointer(new DialogDetail(data, mode)); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogDetail.data(), &DialogDetail::ChoosedObject); @@ -458,6 +465,10 @@ void MainWindow::AboutQt(){ QMessageBox::aboutQt(this, tr("About Qt")); } +void MainWindow::ShowToolTip(const QString &toolTip){ + helpLabel->setText(toolTip); +} + void MainWindow::tableClosed(){ show(); MinimumScrollBar(); @@ -603,6 +614,7 @@ void MainWindow::CanselTool(){ { case Tool::ArrowTool: ui->actionArrowTool->setChecked(false); + helpLabel->setText(""); break; case Tool::SinglePointTool: //Nothing to do here because we can't create this tool from main window. @@ -1119,4 +1131,5 @@ void MainWindow::OpenPattern(const QString &fileName){ QString title(info.fileName()); title.append("-Valentina"); setWindowTitle(title); + helpLabel->setText(""); } diff --git a/mainwindow.h b/mainwindow.h index eba55383f..3d55ab212 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -94,6 +94,7 @@ public slots: void ClosedDialogDetail(int result); void About(); void AboutQt(); + void ShowToolTip(const QString &toolTip); /** * @brief tableClosed Слот, що виконується при отриманні сигналу закриття вікна укладання *деталей моделі. @@ -149,8 +150,8 @@ private: void SetEnableTool(bool enable); template void SetToolButton(bool checked, Tool::Tools t, const QString &cursor, - QSharedPointer &dialog, - Func closeDialogSlot); + const QString &toolTip,QSharedPointer &dialog, + Func closeDialogSlot); void MinimumScrollBar(); template void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, From bb0fed674b423871d40d9a74a24f5c27a0534b2b Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 7 Oct 2013 19:45:42 +0300 Subject: [PATCH 13/70] Updated translation for the ukrainian language. --HG-- branch : develop --- mainwindow.cpp | 2 +- translations/valentina_ru.ts | 1180 ++++++++++++++++++++++++++------- translations/valentina_uk.ts | 1182 +++++++++++++++++++++++++++------- 3 files changed, 1896 insertions(+), 468 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index c2051691b..2f0fb98b4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -437,7 +437,7 @@ void MainWindow::ToolDetail(bool checked){ QPixmap pixmap("://cursor/new_detail_cursor.png"); QCursor cur(pixmap, 2, 3); view->setCursor(cur); - helpLabel->setText(tr("Select points, arcs, curves and details clockwise.")); + helpLabel->setText(tr("Select points, arcs, curves clockwise.")); dialogDetail = QSharedPointer(new DialogDetail(data, mode)); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogDetail.data(), &DialogDetail::ChoosedObject); diff --git a/translations/valentina_ru.ts b/translations/valentina_ru.ts index f828a3d13..e3489ae30 100644 --- a/translations/valentina_ru.ts +++ b/translations/valentina_ru.ts @@ -9,76 +9,121 @@ Точка вдоль линии - + Length Длина - - + + Formula calculation of length of line + + + + + Calculate formula + + + + + ... - + + Value of length + + + + _ - + Name new point Имя новой точки - + + Put variable into formula + + + + First point Первая точка - + + First point of line + + + + Second point Вторая точка - + + Second point of line + + + + Type line Тип линии - + + Show line from first point to our point + + + + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых + + + Variables. Click twice to select. + + + + + Select second point of line + + DialogArc @@ -88,78 +133,137 @@ Дуга - + Radius Радиус - - - - - - + + Formula calculation of radius of arc + + + + + + + Put variable into formula + + + + + + + + + ... - - - + + + + Calculate formula + + + + + Value of radius + + + + + + _ - + First angle degree Первый угол градусы - + + First angle of arc counterclockwise + + + + + Value of first angle + + + + Second angle degree Второй угол градусы - + + Second angle of arc counterclockwise + + + + + Value of second angle + + + + Center point Центральная точка - + + Select point of center of arc + + + + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - - + + Length of arcs Длина дуг - + Angle of lines Уголы линий + + + Variables + + + + + Value angle of line. + + DialogBisector @@ -169,81 +273,136 @@ Бисектриса - + Length Длина - - + + Formula calculation of length of bisector + + + + + Calculate formula + + + + + ... - + + Value of length + + + + _ - + Name new point Имя новой точки - + + Put variable into formula + + + + First point Первая точка - + + First point of angle + + + + Second point Вторая точка - + + Second point of angle + + + + Third point Треться точка - + + Third point of angle + + + + Type line Тип линии - + + Show line from second point to our point + + + + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых + + + Variables. Click twice to select. + + + + + Select second point of angle + + + + + Select third point of angle + + DialogDetail @@ -262,6 +421,16 @@ Closed Замкнутая + + + Get wrong scene object. Ignore. + + + + + Get wrong tools. Ignore. + + DialogEndLine @@ -271,84 +440,119 @@ Точка на конце линии - + Length Длина - - - - - - - - - - + + Formula calculation of length of line + + + + + Calculate formula + + + + + + + + + + + + + ... - + + Value of length + + + + _ - + Base point Базовая точка - + + First point of line + + + + Name new point Имя новой точки - + Angle degree Угол градусы - + + Angle of line + + + + Type line Тип линии - + + Show line from first point to our point + + + + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых + + + Variables. Click twice to select. + + DialogHistory @@ -359,9 +563,71 @@ + Tool Инструмент + + + %1 - Base point + + + + + + %1_%2 - Line from point %1 to point %2 + + + + + %3 - Point along line %1_%2 + + + + + %1 - Point of soulder + + + + + %3 - Normal to line %1_%2 + + + + + %4 - Bisector of angle %1_%2_%3 + + + + + %5 - Point of intersection lines %1_%2 and %3_%4 + + + + + Curve %1_%2 + + + + + Arc with center in point %1 + + + + + Curve point %1 + + + + + %4 - Point of contact arc with center in point %1 and line %2_%3 + + + + + Get wrong tool type. Ignore. + + DialogIncrements @@ -379,6 +645,8 @@ + + Denotation Обозначение @@ -391,6 +659,8 @@ + + Base value Базовое значение @@ -407,16 +677,24 @@ + + + + Description Опис + + In size В размерах + + In growth В ростах @@ -433,6 +711,7 @@ + Line Линия @@ -448,6 +727,7 @@ + Curve Кривая @@ -463,6 +743,7 @@ + Arc Дуга @@ -471,6 +752,24 @@ Length of arc Длина дуги + + + Denotation %1 + + + + + + Calculated value + + + + + + + Length + Длина + DialogLine @@ -489,6 +788,11 @@ Second point Вторая точка + + + Select second point + + DialogLineIntersect @@ -498,32 +802,47 @@ Точка пересичения линий - + Name new point Имя новой точки - + First line Первая линия - + First point Первая точка - + Second point Вторая точка - + Second line Вторая линия + + + Select second point of first line + + + + + Select first point of second line + + + + + Select second point of second line + + DialogNormal @@ -533,89 +852,124 @@ Перпендикуляр - + Length Длина - - - - - - - - - - + + Formula calculation of length of normal + + + + + Calculate formula + + + + + + + + + + + + + ... - + + Value of length + + + + _ - + Name new point Имя новой точки - + + Put variable into formula + + + + First point Первая точка - + Second point Вторая точка - + Additional angle degrees Дополнительные угол градусы - + Type line Тип линии - + + Show line from first point to our point + + + + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых + + + Variables. Click twice to select. + + + + + Select second point of line + + DialogPointOfContact @@ -625,152 +979,232 @@ Точка касания - + Radius Радиус - - + + Formula calculation of radius of arc + + + + + Calculate formula + + + + + ... - + + Value of radius + + + + _ - + Name new point Имя новой точки - + + Put variable into formula + + + + Center of arc Центр дуги - + + Slect point of center of arc + + + + Top of the line Начало линии - + End of the line Конец линии - + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - + Length of lines Длина линий - + Length of arcs Длина дуг - + Length of curves Длина кривых + + + Variables. Click twice to select. + + + + + Select second point of line + + + + + Select point of center of arc + + DialogShoulderPoint - + Point of shoulder Точка плеча - + Length Длина - - + + Formula calculation of length of line + + + + + Calculate formula + + + + + ... - + + Value of length + + + + _ - + Name new point Имя новой точки - + + Put variable into formula + + + + First point Первая точка - + Second point Вторая точка - + Type of line Тип линии - + + Show line from first point to our point + + + + Input data Входные данные - + Size and growth Размер и рост - + Standart table Стандартная таблица - + Increments Прибавки - - + + Length of lines Длина линий - + Length of curves Длина кривых + + + Variables. Click twice to select. + + + + + Select second point of line + + + + + Select point of shoulder + + DialogSinglePoint @@ -780,22 +1214,31 @@ Одиночная точка - Координати - Координаты + Координаты - + + Coordinates on the sheet + + + + + Coordinates + + + + Y coordinate Y координата - + X coordinate Х координата - + Point name Имя точки @@ -842,6 +1285,11 @@ Coefficient of curvature of the curve Коефициент кривизные кривой + + + Select last point of curve + + DialogSplinePath @@ -876,10 +1324,51 @@ Угол второй контрольной точки - + + List of points + + + + Coefficient of curvature of the curve Коефициент кривизные кривой + + + Select point of curve path + + + + + DialogTool + + + Wrong details id. + + + + + + + Line + Линия + + + + + No line + + + + + Error + + + + + Line length + + MainWindow @@ -889,266 +1378,485 @@ Valentina - + + Tools for creating points. + + + + Point Точка - - - - - - - - - - - - + + Tool point of normal. + + + + + + + + + + + + + + + ... - + + Tool point of shoulder. + + + + + Tool point on the end line. + + + + + Tool point along line. + + + + + Tool point of bisector. + + + + + Tool point of contact. + + + + + Tools for creating lines. + + + + Line Линия - + + Tool line. + + + + + Tool point of line intersection. + + + + + Tools for creating curves. + + + + Curve Кривая - + + Tool curve. + + + + + Tool path curve. + + + + + Tools for creating arcs. + + + + Arc Дуга - + + Tool arc. + + + + + Tools for creating details. + + + + Detail Деталь - + + Tool new detail. + + + + + File + + + + + Help + + + + + Drawing + + + + toolBar - + toolBar_2 - + toolBar_3 - + New Новое - + Create a new pattern Создать новое лекало - + Open Открыть - + Open file with pattern Открыть файл с лекалом - + Save Сохранить - + Save pattern Сохранить лекало - + + Save as Сохранить как - + Save not yet saved pattern Сохранить еще не сохраненное лекало - + Draw Рисование - + Draw mode Режим рисования - + Details Детали - + Deatils mode Режим деталей - - + + Tools pointer Инструмент указатель - + New drawing Новый чертеж - + Add new drawing Добавить новый чертеж - - + + Change the name of drawing Изменить имя чертежа - + Table of variables Таблица переменных - + Tables of variables Таблици переменных - + History История - + Layout Роскладка - + Create layout Создать раскладку - + + + About Qt + + + + + + About Valentina + + + + + Exit + + + + Drawing %1 Чертеж %1 - - + + Drawing: Чертеж: - + Enter a name for the drawing. Введите имя чертежа. - - + + Error. Drawing of same name already exists. Ошибка. Чертеж с таким именем уже существует. - + Error creating drawing with the name Ошибка создания чертежа с именем - + Enter a new name for the drawing. Введите новое имя для чертежа. - + + + Select point + + + + + Select first point + + + + + + + Select first point of line + + + + + Select first point of angle + + + + + Select first point of first line + + + + + Select first point curve + + + + + Select point of center of arc + + + + + Select point of curve path + + + + + Valentina v.0.1.0 + + + + + The pattern has been modified. + + + + + Do you want to save your changes? + + + + Growth: Рост: - + Size: Размер: - + Drawing: Чертеж: - + + Lekalo files (*.xml);;All files (*.*) + + + + + Lekalo files (*.xml) Файл лекала (*.xml) - + + Error saving file. Can't save file. + + + + Open file Открыть файл - + + Got empty file name. + + + + + Could not copy temp file to pattern file + + + + + Could not remove pattern file + + + + Can't open pattern file. File name empty Не могу открыть файл лекала. Пустое имя файла - - - - - + + + + + + + Error! Ошибка! - + + Create new drawing for start working. + + + + + Select points, arcs, curves clockwise. + + + + Error parsing file. Ошибка парсинга файла. - + Error can't convert value. Ошибка, не могу конвертовать значение. - + Error empty parameter. Ошибка, пустой параметр. - + Error wrong id. Ошибка, неправильный id. - + + Error don't unique id. + + + + Error parsing pattern file. Ошибка парсинга файла лекала. - + Error in line %1 column %2 Ошибка в линии %1 столбец %2 @@ -1244,12 +1952,12 @@ Стоп - + SVG Generator Example Drawing SVG Generator Example Drawing - + An SVG drawing created by the SVG Generator Example provided with Qt. An SVG drawing created by the SVG Generator Example provided with Qt. @@ -1302,114 +2010,118 @@ VDomDocument - + Got wrong parameter id. Need only id > 0. Получен неправельный параметр id. Допустимы только id > 0. - + Can't convert toLongLong parameter Не могу конвертировать toLongLong параметр - + Got empty parameter Получен пустой параметр - + Can't convert toDouble parameter Не могу конвертировать toDouble параметр - + + This id is not unique. + + + + Error creating or updating detail Ошибка создания или обновления детали - + Error creating or updating single point Ошибка создания или обновления базовой точки - + Error creating or updating point of end line Ошибка создания или обновления точки на конце линии - + Error creating or updating point along line Ошибка создания или обновления точки вдоль линии - + Error creating or updating point of shoulder Ошибка создания или обновления точки плеча - + Error creating or updating point of normal Ошибка создания или обновления точки нормали - + Error creating or updating point of bisector Ошибка создания или обновления точки бисектрисы - + Error creating or updating point of lineintersection Ошибка создания или обновления точки пересичения линий - + Error creating or updating point of contact Ошибка создания или обновления точки прикосновения - + Error creating or updating modeling point Ошибка создания или обновления точки - + Error creating or updating line Ошибка создания или обновления линии - + Error creating or updating simple curve Ошибка создания или обновления кривой - + Error creating or updating curve path Ошибка создания или обновления сложной кривой - + Error creating or updating modeling simple curve Ошибка создания или обновления модельной кривой - + Error creating or updating modeling curve path Ошибка создания или обновления сложной модельной кривой - + Error creating or updating simple arc Ошибка создания или обновления дуги - + Error creating or updating modeling arc Ошибка создания или обновления модельной дуги - Can't get parent for object id = %1 - Не могу получить родителя объекта id = %1 + Не могу получить родителя объекта id = %1 diff --git a/translations/valentina_uk.ts b/translations/valentina_uk.ts index ce7eedba7..9040a6444 100644 --- a/translations/valentina_uk.ts +++ b/translations/valentina_uk.ts @@ -9,76 +9,121 @@ Точка вздовж лінії - + Length Довжина - - + + Formula calculation of length of line + Формула розрахунку довжини лінії + + + + Calculate formula + Розрахувати формулу + + + + ... - + + Value of length + Значення довжини + + + _ - + Name new point Ім'я нової точки - + + Put variable into formula + Вставити змінну в формулу + + + First point Перша точка - + + First point of line + Перша точка лінії + + + Second point Друга точка - + + Second point of line + Друга точка лінії + + + Type line Тип лінії - + + Show line from first point to our point + Показати лінію від першої точки до нашої точки + + + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - + Length of arcs Довжина дуг - + Length of curves Довжина кривих + + + Variables. Click twice to select. + Змінні. Подвійний клік для вибору. + + + + Select second point of line + Виберіть другу точку лінії + DialogArc @@ -88,78 +133,137 @@ Дуга - + Radius Радіус - - - - - - + + Formula calculation of radius of arc + Формула калькуляції радіуса дуги + + + + + + Put variable into formula + Вставити змінну в формулу + + + + + + + + ... - - - + + + + Calculate formula + Розрахувати формулу + + + + Value of radius + Значення радіусу + + + + + _ - + First angle degree Перший кут градуси - + + First angle of arc counterclockwise + Перший кут дуги проти годинникової стрілки + + + + Value of first angle + Значення першого кута + + + Second angle degree Другий кут градуси - + + Second angle of arc counterclockwise + Другий кут дуги проти годинникової стрілки + + + + Value of second angle + Значення другого кута + + + Center point Точка центру - + + Select point of center of arc + Виберіть точку центра дуги + + + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - - + + Length of arcs Довжина дуг - + Angle of lines Кут ліній + + + Variables + Змінні + + + + Value angle of line. + Значення дуги лінії. + DialogBisector @@ -169,81 +273,136 @@ Бісектриса - + Length Довжина - - + + Formula calculation of length of bisector + Формула калькуляції довжини бісектриси + + + + Calculate formula + Розрахувати формулу + + + + ... - + + Value of length + Значення довжини + + + _ - + Name new point Ім'я нової точки - + + Put variable into formula + Вставити змінну в формулу + + + First point Перша точка - + + First point of angle + Перша точка кута + + + Second point Друга точка - + + Second point of angle + Друга точка кута + + + Third point Третя точка - + + Third point of angle + Третя точка кута + + + Type line Тип лінії - + + Show line from second point to our point + Показати лінію з другої точки кута до нашої точки + + + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - + Length of arcs Довжина дуг - + Length of curves Довжина кривих + + + Variables. Click twice to select. + Змінні. Подвійний клік для вибору. + + + + Select second point of angle + Виберіть другу точку кута + + + + Select third point of angle + Виберіть третю точку кута + DialogDetail @@ -262,6 +421,16 @@ Closed Замкнена + + + Get wrong scene object. Ignore. + Отримано непаравильний об'єкт сцени. Ігноровано. + + + + Get wrong tools. Ignore. + Отримано неправильний інструмент. Ігноровано. + DialogEndLine @@ -271,84 +440,119 @@ Точка на кінці відрізку - + Length Довжина - - - - - - - - - - + + Formula calculation of length of line + Формула розрахунку довжини лінії + + + + Calculate formula + Розрахувати формулу + + + + + + + + + + + + ... - + + Value of length + Значення довжини + + + _ - + Base point Базова точка - + + First point of line + Перша точка лінії + + + Name new point Ім'я нової точки - + Angle degree Кут градуси - + + Angle of line + Кут лінії + + + Type line Тип лінії - + + Show line from first point to our point + Показати лінію від першої точки до нашої точки + + + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжина ліній - + Length of arcs Довжина дуг - + Length of curves Довжина кривих + + + Variables. Click twice to select. + Змінні. Подвійний клік для вибору. + DialogHistory @@ -359,9 +563,71 @@ + Tool Інструмент + + + %1 - Base point + %1 - Базова точка + + + + + %1_%2 - Line from point %1 to point %2 + %1_%2 - Лінія від точки %1 до точки %2 + + + + %3 - Point along line %1_%2 + %3 - Точка вздовж лінії %1_%2 + + + + %1 - Point of soulder + %1 - Точка плеча + + + + %3 - Normal to line %1_%2 + %3 - Перпедикуляр до лінії %1_%2 + + + + %4 - Bisector of angle %1_%2_%3 + %4 - Бісектриса кута %1_%2_%3 + + + + %5 - Point of intersection lines %1_%2 and %3_%4 + %5 - Точка перетину лінії %1_%2 і %3_%4 + + + + Curve %1_%2 + Крива %1_%2 + + + + Arc with center in point %1 + Дуга з центром в точці %1 + + + + Curve point %1 + Точка кривої %1 + + + + %4 - Point of contact arc with center in point %1 and line %2_%3 + %4 - Точка дотику дуги з центром в точці %1 і лінії %2_%3 + + + + Get wrong tool type. Ignore. + Отримано неправильний тип інструменту. Ігноруємо. + DialogIncrements @@ -379,6 +645,8 @@ + + Denotation Позначення @@ -391,6 +659,8 @@ + + Base value Базове значення @@ -407,16 +677,24 @@ + + + + Description Опис + + In size В розмірах + + In growth В ростах @@ -433,6 +711,7 @@ + Line Лінія @@ -448,6 +727,7 @@ + Curve Крива @@ -463,6 +743,7 @@ + Arc Дуга @@ -471,6 +752,24 @@ Length of arc Довжина дуги + + + Denotation %1 + Позначення %1 + + + + + Calculated value + Розраховане значення + + + + + + Length + Довжина + DialogLine @@ -489,6 +788,11 @@ Second point Друга точка + + + Select second point + Виберіть другу точку + DialogLineIntersect @@ -498,32 +802,47 @@ Точка перетину ліній - + Name new point Ім'я нової точки - + First line Перша лінія - + First point Перша точка - + Second point Друга точка - + Second line Друга лінія + + + Select second point of first line + Виберіть другу точка першої лінії + + + + Select first point of second line + Виберіть першу точку другої лінії + + + + Select second point of second line + Виберіть другу точку другої лінії + DialogNormal @@ -533,89 +852,124 @@ Перпендикуляр - + Length Довжина - - - - - - - - - - + + Formula calculation of length of normal + Формула розрахунку довжини перпендикуляра + + + + Calculate formula + Розрахувати формулу + + + + + + + + + + + + ... - + + Value of length + Значення довжини + + + _ - + Name new point Ім'я нової точки - + + Put variable into formula + Вставити змінну в формулу + + + First point Перша точка - + Second point Друга точка - + Additional angle degrees Додатковий кут градуси - + Type line Тип лінії - + + Show line from first point to our point + Показати лінію від першої точки до нашої точки + + + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжини ліній - + Length of arcs Довжини дуг - + Length of curves Довжини кривих + + + Variables. Click twice to select. + Змінні. Подвійний клік для вибору. + + + + Select second point of line + Виберіть другу точку лінії + DialogPointOfContact @@ -625,152 +979,232 @@ Точка дотику - + Radius Радіус - - + + Formula calculation of radius of arc + Формула розрахунку радіуса дуги + + + + Calculate formula + Розрахувати формулу + + + + ... - + + Value of radius + Значення радіусу + + + _ - + Name new point Ім'я нової точки - + + Put variable into formula + Вставити змінну в формулу + + + Center of arc Центер дуги - + + Slect point of center of arc + Виберіть точку центру дуги + + + Top of the line Початок лінії - + End of the line Кінець лінії - + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - + Length of lines Довжини ліній - + Length of arcs Довжини дуг - + Length of curves Довжини кривих + + + Variables. Click twice to select. + Змінні. Подвійний клік для вибору. + + + + Select second point of line + Виберіть другу точку лінії + + + + Select point of center of arc + Виберіть точку центру дуги + DialogShoulderPoint - + Point of shoulder Точка плеча - + Length Довжина - - + + Formula calculation of length of line + Формула розрахунку довжини лінії + + + + Calculate formula + Розрахувати формулу + + + + ... - + + Value of length + Значення довжини + + + _ - + Name new point Ім'я нової точки - + + Put variable into formula + Вставити змінну в формулу + + + First point Перша точка - + Second point Друга точка - + Type of line Тип лінії - + + Show line from first point to our point + Показати лінію від першої точки до нашої точки + + + Input data Вхідні данні - + Size and growth Розмір і зріст - + Standart table Стандартна таблиця - + Increments Прибавки - - + + Length of lines Довжини лінії - + Length of curves Довжни кривих + + + Variables. Click twice to select. + Змінні. Подвійний клік для вибору. + + + + Select second point of line + Виберіть другу точку лінії + + + + Select point of shoulder + Виберіть точку плеча + DialogSinglePoint @@ -780,22 +1214,31 @@ Точка - Координати + Координати + + + + Coordinates on the sheet + Координати на листі + + + + Coordinates Координати - + Y coordinate Y координата - + X coordinate Х координата - + Point name Ім'я точки @@ -842,6 +1285,11 @@ Coefficient of curvature of the curve Коефіцієнт кривизни кривої + + + Select last point of curve + Виберість останню точку кривої + DialogSplinePath @@ -876,10 +1324,51 @@ Кут другої контрольної точки - + + List of points + Список точок + + + Coefficient of curvature of the curve Коефіцієнт кривизни кривої + + + Select point of curve path + Виберіть точку складної кривої + + + + DialogTool + + + Wrong details id. + Неправильний id деталі. + + + + + + Line + Лінія + + + + + No line + Без лінії + + + + Error + Помилка + + + + Line length + Довжина лінії + MainWindow @@ -889,266 +1378,489 @@ Valentina - + + Tools for creating points. + Інструмент створення точок. + + + Point Точка - - - - - - - - - - - - + + Tool point of normal. + Інструмент точка перпендикуляра. + + + + + + + + + + + + + + ... - + + Tool point of shoulder. + Інструмент точка плеча. + + + + Tool point on the end line. + Інструмент точка на кінці лінії. + + + + Tool point along line. + Інструмент точка вздовж лінії. + + + + Tool point of bisector. + Інструмент точка бісектриси кута. + + + + Tool point of contact. + Інструмент точка дотику. + + + + Tools for creating lines. + Інструменти для створення ліній. + + + Line Лінія - + + Tool line. + Інструмент лінія. + + + + Tool point of line intersection. + Інструмент точка перетину ліній. + + + + Tools for creating curves. + Інструменти для створення кривих. + + + Curve Крива - + + Tool curve. + Інструмент крива. + + + + Tool path curve. + Інструмент складна крива. + + + + Tools for creating arcs. + Інструменти для створення дуг. + + + Arc Дуга - + + Tool arc. + Інструмент дуга. + + + + Tools for creating details. + Інструменти для створення деталей. + + + Detail Деталь - + + Tool new detail. + Інструмент нова деталь. + + + + File + Файл + + + + Help + Допомога + + + + Drawing + Креслення + + + toolBar - + toolBar_2 - + toolBar_3 - + New Новий - + Create a new pattern Створити нове лекало - + Open Відкрити - + Open file with pattern Відкрити файл з лекалами - + Save Зберегти - + Save pattern Зберегти лекало - + + Save as Зберегти як - + Save not yet saved pattern Зберегти ще не збережене лекало - + Draw Малювання - + Draw mode Режим малювання - + Details Деталь - + Deatils mode Режим деталей - - + + Tools pointer Інструмент вказівник - + New drawing Нове креслення - + Add new drawing Додати нове креслення - - + + Change the name of drawing Змінити ім'я креслення - + Table of variables Таблиця змінних - + Tables of variables Таблиці змінних - + History Історія - + Layout Розкладки - + Create layout Створити розкладку - + + + About Qt + Про Qt + + + + + About Valentina + Про Valentina + + + + Exit + Вихід + + + Drawing %1 Креслення %1 - - + + Drawing: Креслення: - + Enter a name for the drawing. Введіть ім'я креслення. - - + + Error. Drawing of same name already exists. Помилка. Креслення з таким ім'ям вже існує. - + Error creating drawing with the name Помилка створення креслення з ім'ям - + Enter a new name for the drawing. Введіть нове ім'я креслення. - + + + Select point + Виберість точку + + + + Select first point + Виберість першу точку + + + + + + Select first point of line + Виберість першу точку лінії + + + + Select first point of angle + Виберіть першу точку кута + + + + Select first point of first line + Виберіть першу точку першої лінії + + + + Select first point curve + Виберіть першу точку кривої + + + + Select point of center of arc + Виберіть точку центру дуги + + + + Select point of curve path + Виберіть точку складної кривої + + + Select points, arcs, curves and details clockwise. + Виберіть точки, дуги, криві і д + + + + Valentina v.0.1.0 + Valentina v.0.1.0 + + + + The pattern has been modified. + Лекало було зміненно. + + + + Do you want to save your changes? + Ви хочете зберегти зміни? + + + Growth: Зріст: - + Size: Розмір: - + Drawing: Креслення: - + + Lekalo files (*.xml);;All files (*.*) + Файли лекала (*.xml);;Всі файли (*.*) + + + + Lekalo files (*.xml) Файл лекала (*.xml) - + + Error saving file. Can't save file. + Помилка збереження файлу. Не можу зберегти файл. + + + Open file Відкрити файл - + + Got empty file name. + Отримано пусте імя файлу. + + + + Could not copy temp file to pattern file + Не можу копіювати тимчасовий файл до файлу лекала + + + + Could not remove pattern file + Не можу видалити файл лекала + + + Can't open pattern file. File name empty Не можу відкрити файл лекала. Пусте ім'я файлу - - - - - + + + + + + + Error! Помилка! - + + Create new drawing for start working. + Створіть нове креслення для початку роботи. + + + + Select points, arcs, curves clockwise. + Виберіть точки, дуги, криві загодинниковою стрілкою. + + + Error parsing file. Помилка парсингу файла. - + Error can't convert value. Помилка, не можу конвертувати значення. - + Error empty parameter. Помилка, пустий параметр. - + Error wrong id. Помикла, неправильний id. - + + Error don't unique id. + Помилка, не унікальний id. + + + Error parsing pattern file. Помилка парсінгу файлу лекала. - + Error in line %1 column %2 Помилка в лінії %1 стовпчик %2 @@ -1244,12 +1956,12 @@ Зупинити - + SVG Generator Example Drawing - + An SVG drawing created by the SVG Generator Example provided with Qt. @@ -1302,114 +2014,118 @@ VDomDocument - + Got wrong parameter id. Need only id > 0. Отримано неправильний id. Допускаються тільки id > 0. - + Can't convert toLongLong parameter Не можу конвертувати toLongLong параметру - + Got empty parameter Отримано пустий параметр - + Can't convert toDouble parameter Не можу конвертувати toDouble параметру - + + This id is not unique. + Цей id не унікальний. + + + Error creating or updating detail Помилка створення чи оновлення деталі - + Error creating or updating single point Помилка створення чи оновлення простої точки - + Error creating or updating point of end line Помилка створення чи оновлення точки кінця відрізку - + Error creating or updating point along line Помилка створення чи оновлення точки вздовж лінії - + Error creating or updating point of shoulder Помилка створення чи оновлення точки плеча - + Error creating or updating point of normal Помилка створення чи оновлення точки нормалі - + Error creating or updating point of bisector Помилка створення чи оновлення точки бісектриси - + Error creating or updating point of lineintersection Помилка створення чи оновлення точки перетину ліній - + Error creating or updating point of contact Помилка створення чи оновлення точки дотику - + Error creating or updating modeling point Помилка створення чи оновлення модельної точки - + Error creating or updating line Помилка створення чи оновлення лінії - + Error creating or updating simple curve Помилка створення чи оновлення кривої - + Error creating or updating curve path Помилка створення чи оновлення шляху кривих - + Error creating or updating modeling simple curve Помилка створення чи оновлення модельної кривої - + Error creating or updating modeling curve path Помилка створення чи оновлення модельного шляху кривих - + Error creating or updating simple arc Помилка створення чи оновлення дуги - + Error creating or updating modeling arc Помилка створення чи оновлення модельної дуги - Can't get parent for object id = %1 - Не можу отримати батька для об'єкту id = %1 + Не можу отримати батька для об'єкту id = %1 From b791ac648d155547c81e9a55d7cb5b93c9d7afdd Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 9 Oct 2013 19:24:28 +0300 Subject: [PATCH 14/70] Fix bugs. Wrong creation detail and wrong creation line. --HG-- branch : develop --- dialogs/dialogdetail.cpp | 2 +- geometry/vsplinepath.cpp | 2 +- tools/drawTools/vtoolline.cpp | 14 +++++++++----- tools/drawTools/vtoolline.h | 2 +- tools/modelingTools/vmodelingline.cpp | 14 +++++++++----- tools/modelingTools/vmodelingline.h | 2 +- tools/nodeDetails/vnodespline.cpp | 3 ++- tools/vtooldetail.cpp | 17 +++++++++++++++-- xml/vdomdocument.cpp | 22 +++++++++++++++++++--- 9 files changed, 58 insertions(+), 20 deletions(-) diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index 8ccb6adf3..32492ffb3 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -73,8 +73,8 @@ void DialogDetail::DialogAccepted(){ details.append( qvariant_cast(item->data(Qt::UserRole))); } details.setName(ui.lineEditNameDetail->text()); - emit DialogClosed(QDialog::Accepted); emit ToolTip(""); + emit DialogClosed(QDialog::Accepted); } void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){ diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index a4dd5c176..f6b6f1342 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -87,7 +87,7 @@ QVector VSplinePath::GetPathPoints() const{ VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve); QVector splP = spl.GetPoints(); - for(qint32 j = 0; i < splP.size(); ++j){ + for(qint32 j = 0; j < splP.size(); ++j){ pathPoints.append(splP[j]); } } diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index fc5cc7577..6280a118d 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -51,19 +51,23 @@ void VToolLine::Create(QSharedPointer &dialog, VMainGraphicsScene *s Create(0, firstPoint, secondPoint, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, +void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ Q_CHECK_PTR(scene); Q_CHECK_PTR(doc); Q_CHECK_PTR(data); - data->AddLine(firstPoint, secondPoint); - if(parse != Document::FullParse){ - doc->UpdateToolData(id, data); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->getNextId(); + } else { + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } } + data->AddLine(firstPoint, secondPoint); VDrawTool::AddRecord(id, Tool::LineTool, doc); if(parse == Document::FullParse){ - qint64 id = data->getNextId(); VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); Q_CHECK_PTR(line); scene->addItem(line); diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index 799f09c8b..a7b31824e 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -34,7 +34,7 @@ public: virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); - static void Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, + static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index 06614bf09..911906f67 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -51,18 +51,22 @@ VModelingLine *VModelingLine::Create(QSharedPointer &dialog, VDomDoc return Create(0, firstPoint, secondPoint, doc, data, Document::FullParse, Tool::FromGui); } -VModelingLine *VModelingLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, +VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VModelingLine *line = 0; Q_CHECK_PTR(doc); Q_CHECK_PTR(data); - data->AddLine(firstPoint, secondPoint, Draw::Modeling); - if(parse != Document::FullParse){ - doc->UpdateToolData(id, data); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->getNextId(); + } else { + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } } + data->AddLine(firstPoint, secondPoint, Draw::Modeling); if(parse == Document::FullParse){ - qint64 id = data->getNextId(); line = new VModelingLine(doc, data, id, firstPoint, secondPoint, typeCreation); doc->AddTool(id, line); doc->IncrementReferens(firstPoint); diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index 9ffe7e440..881abda27 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -34,7 +34,7 @@ public: QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint, + static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index cf4960b6f..b48470f83 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -35,7 +35,8 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 } VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ + Draw::Draws typeobject, const Document::Documents &parse, + Tool::Sources typeCreation){ VNodeSpline *spl = 0; if(parse == Document::FullParse){ spl = new VNodeSpline(doc, data, id, idSpline, typeobject, typeCreation); diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 0f4041dc3..c69be08b0 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -189,6 +189,8 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen point = data->GetModelingPoint(detail[i].getId()); } id = data->AddModelingPoint(point); + VNodePoint::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), + Document::FullParse, Tool::FromGui); } break; case(Tool::NodeArc):{ @@ -199,6 +201,8 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen arc = data->GetModelingArc(detail[i].getId()); } id = data->AddModelingArc(arc); + VNodeArc::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), + Document::FullParse, Tool::FromGui); } break; case(Tool::NodeSpline):{ @@ -209,6 +213,8 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen spline = data->GetModelingSpline(detail[i].getId()); } id = data->AddModelingSpline(spline); + VNodeSpline::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), + Document::FullParse, Tool::FromGui); } break; case(Tool::NodeSplinePath):{ @@ -219,6 +225,8 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen splinePath = data->GetModelingSplinePath(detail[i].getId()); } id = data->AddModelingSplinePath(splinePath); + VNodeSplinePath::Create(doc, data, id, detail[i].getId(), detail[i].getMode(), + Document::FullParse, Tool::FromGui); } break; default: @@ -328,19 +336,24 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ // dialog->show(); // } if(selectedAction == actionRemove){ - //deincrement referens - RemoveReferens(); + //remove form xml file QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ QDomNode element = domElement.parentNode(); if(!element.isNull()){ + //deincrement referens + RemoveReferens(); element.removeChild(domElement); //update xml file emit FullUpdateTree(); //remove form scene emit RemoveTool(this); + } else { + qWarning()<<"parentNode isNull"< VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(), map(QHash()), nameActivDraw(QString()), data(data), @@ -417,7 +418,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics } void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse, Draw::Draws mode){ + const QDomNode& node, const Document::Documents &parse, + Draw::Draws mode){ Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); VMainGraphicsScene *scene = 0; @@ -545,7 +547,8 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme } void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type, Draw::Draws mode){ + const Document::Documents &parse, const QString& type, + Draw::Draws mode){ Q_CHECK_PTR(scene); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty"); @@ -901,7 +904,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme spl.setMode(typeObject); spl.setIdObject(idObject); data->UpdateModelingSpline(id, spl); - VNodeSpline::Create(this, data, id, idObject,mode, parse, Tool::FromFile); + VNodeSpline::Create(this, data, id, idObject, mode, parse, Tool::FromFile); return; } catch(const VExceptionBadId &e){ @@ -1000,10 +1003,23 @@ void VDomDocument::FullUpdateTree(){ data->ClearObject(); Parse(Document::LiteParse, scene, scene); } + catch (const std::bad_alloc &) { + delete scene; + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Error parsing file.")); + msgBox.setInformativeText("std::bad_alloc"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setIcon(QMessageBox::Warning); + msgBox.exec(); + return; + } catch(...){ delete scene; throw; } + delete scene; setCurrentData(); emit FullUpdateFromFile(); From 7b56218e092256592644305eb99373404b325a0b Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 9 Oct 2013 21:11:25 +0300 Subject: [PATCH 15/70] Fixed bug with dialog of arc. --HG-- branch : develop --- container/vcontainer.cpp | 2 +- dialogs/dialogarc.cpp | 16 ++++++++++------ dialogs/dialogarc.h | 4 ++-- dialogs/dialogarc.ui | 6 +++--- tools/drawTools/vdrawtool.h | 2 ++ tools/drawTools/vtoolarc.cpp | 2 +- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 65292950e..947b84551 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -64,7 +64,7 @@ void VContainer::setData(const VContainer &data){ standartTable = *data.DataStandartTable(); incrementTable = *data.DataIncrementTable(); lengthLines = *data.DataLengthLines(); - lineAngles = *data.DataLengthArcs(); + lineAngles = *data.DataLineAngles(); splines = *data.DataSplines(); modelingSplines = *data.DataModelingSplines(); lengthSplines = *data.DataLengthSplines(); diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 7b4548ef1..7e02eb74c 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -63,7 +63,7 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines); - connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineArcs); + connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles); connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius); connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1); @@ -173,19 +173,22 @@ void DialogArc::PutF2(){ PutValHere(ui->lineEditF2, ui->listWidget); } -void DialogArc::LineArcs(){ - ShowLineArcs(); +void DialogArc::LineAngles(){ + ShowLineAngles(); } void DialogArc::RadiusChanged(){ + labelEditFormula = ui->labelEditRadius; ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius); } void DialogArc::F1Changed(){ + labelEditFormula = ui->labelEditF1; ValFormulaChanged(flagF1, ui->lineEditF1, timerF1); } void DialogArc::F2Changed(){ + labelEditFormula = ui->labelEditF2; ValFormulaChanged(flagF2, ui->lineEditF2, timerF2); } @@ -209,12 +212,13 @@ void DialogArc::EvalF2(){ Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2); } -void DialogArc::ShowLineArcs(){ +void DialogArc::ShowLineAngles(){ disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); ui->listWidget->clear(); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); - const QHash *lineArcsTable = data->DataLineAngles(); - QHashIterator i(*lineArcsTable); + const QHash *lineAnglesTable = data->DataLineAngles(); + Q_CHECK_PTR(lineAnglesTable); + QHashIterator i(*lineAnglesTable); while (i.hasNext()) { i.next(); QListWidgetItem *item = new QListWidgetItem(i.key()); diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index 00f23e8e5..cb4291a5c 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -53,7 +53,7 @@ public slots: void PutRadius(); void PutF1(); void PutF2(); - void LineArcs(); + void LineAngles(); void RadiusChanged(); void F1Changed(); void F2Changed(); @@ -75,7 +75,7 @@ private: void EvalRadius(); void EvalF1(); void EvalF2(); - void ShowLineArcs(); + void ShowLineAngles(); }; #endif // DIALOGARC_H diff --git a/dialogs/dialogarc.ui b/dialogs/dialogarc.ui index 26d4e43bb..3f08b5a41 100644 --- a/dialogs/dialogarc.ui +++ b/dialogs/dialogarc.ui @@ -482,7 +482,7 @@ - true + false Length of arcs @@ -492,10 +492,10 @@ - true + false - Length of arcs + Length of curves diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 513ca12cd..e96f93816 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -47,6 +47,8 @@ protected: template void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true){ + Q_CHECK_PTR(tool); + Q_CHECK_PTR(event); if(!ignoreContextMenuEvent){ QMenu menu; QAction *actionOption = menu.addAction(tr("Options")); diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index 84d453f8e..46cc44a5b 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -44,9 +44,9 @@ void VToolArc::setDialog(){ if(!dialogArc.isNull()){ VArc arc = VAbstractTool::data.GetArc(id); dialogArc->SetCenter(arc.GetCenter()); - dialogArc->SetRadius(arc.GetFormulaRadius()); dialogArc->SetF1(arc.GetFormulaF1()); dialogArc->SetF2(arc.GetFormulaF2()); + dialogArc->SetRadius(arc.GetFormulaRadius()); } } From ca61b27599f0d328a3bfd4eec8d870791bef1ebe Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 9 Oct 2013 21:24:53 +0300 Subject: [PATCH 16/70] Fixed bug with bisector. --HG-- branch : develop --- tools/drawTools/vtoolbisector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 80ee7453d..98c84c867 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -42,8 +42,10 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon qreal angle = line1.angleTo(line2); if(angle>180){ angle = 360 - angle; + line1.setAngle(line1.angle()-angle/2); + } else { + line1.setAngle(line1.angle()+angle/2); } - line1.setAngle(line1.angle()-angle/2); line1.setLength(length); return line1.p2(); } From 80b5fe6d5e69b9c4a3de03f7df49d7d75578e66d Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 10 Oct 2013 13:00:04 +0300 Subject: [PATCH 17/70] Fixed bug with change name of drawing. --HG-- branch : develop --- mainwindow.cpp | 8 ++++++-- xml/vdomdocument.cpp | 15 ++++++++++++--- xml/vdomdocument.h | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 2f0fb98b4..84ebd4500 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -198,8 +198,12 @@ void MainWindow::OptionDraw(){ } delete dlg; index = comboBoxDraws->findText(doc->GetNameActivDraw()); - doc->SetNameDraw(nameDraw); - comboBoxDraws->setItemText(index, nameDraw); + if(doc->SetNameDraw(nameDraw)){ + comboBoxDraws->setItemText(index, nameDraw); + } else { + QMessageBox::warning(this, tr("Error saving change!!!"), tr("Can't save new name of drawing")); + } + } template diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index cc8d87e01..f99b846f7 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -169,11 +169,20 @@ void VDomDocument::ChangeActivDraw(const QString& name, Document::Documents pars } } -void VDomDocument::SetNameDraw(const QString& name){ +bool VDomDocument::SetNameDraw(const QString& name){ Q_ASSERT_X(!name.isEmpty(), "SetNameDraw", "name draw is empty"); QString oldName = nameActivDraw; - nameActivDraw = name; - emit ChangedNameDraw(oldName, nameActivDraw); + QDomElement element; + if(GetActivDrawElement(element)){ + nameActivDraw = name; + element.setAttribute("name", nameActivDraw); + emit haveChange(); + emit ChangedNameDraw(oldName, nameActivDraw); + return true; + } else { + qWarning()<<"Can't find activ draw"<* getTools(); QVector *getHistory(); From 7f3b2f76ee0a3feecaff64367ec120da8d28d075 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 10 Oct 2013 21:45:58 +0300 Subject: [PATCH 18/70] Fixed bugs in VArc and VSpline. Bug in DataPoints. --HG-- branch : develop --- geometry/varc.cpp | 24 ++++++++++++++---------- geometry/varc.h | 6 ++++-- geometry/vspline.cpp | 16 ++++++++-------- geometry/vspline.h | 4 ++-- geometry/vsplinepath.cpp | 22 +++++++++++----------- geometry/vsplinepath.h | 4 ++-- tools/drawTools/vtoolalongline.cpp | 6 ++++-- tools/drawTools/vtoolarc.cpp | 3 ++- tools/drawTools/vtoolbisector.cpp | 3 ++- tools/drawTools/vtoolendline.cpp | 3 ++- tools/drawTools/vtoolline.cpp | 3 ++- tools/drawTools/vtoollineintersect.cpp | 12 ++++++++---- tools/drawTools/vtoolnormal.cpp | 3 ++- tools/drawTools/vtoolpointofcontact.cpp | 6 ++++++ tools/drawTools/vtoolshoulderpoint.cpp | 6 ++++-- tools/drawTools/vtoolspline.cpp | 3 ++- tools/drawTools/vtoolsplinepath.cpp | 3 ++- widgets/vapplication.cpp | 10 ++++++++++ 18 files changed, 87 insertions(+), 50 deletions(-) diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 214a39a51..095ce5bfc 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -21,15 +21,16 @@ #include "varc.h" #include +#include "exception/vexception.h" VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()), - center(0), points(0), mode(Draw::Calculation), idObject(0){ + center(0), points(QHash()), mode(Draw::Calculation), idObject(0){ } VArc::VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject) : f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), - center(center), points(points), mode(mode), idObject(idObject){ + center(center), points(*points), mode(mode), idObject(idObject){ } VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()), @@ -85,11 +86,11 @@ qint64 VArc::GetCenter() const{ } QPointF VArc::GetCenterPoint() const{ - if(points->contains(center)){ - return points->value(center).toQPointF(); + if(points.contains(center)){ + return points.value(center).toQPointF(); } else { - qCritical()<<"Не можу знайти id = "< *VArc::GetDataPoints() const{ +const QHash VArc::GetDataPoints() const{ return points; } @@ -133,9 +134,11 @@ qreal VArc::AngleArc() const{ qint32 VArc::NumberSplOfArc() const{ qint32 angArc = static_cast (AngleArc ()); switch( angArc ){ - case 0: - throw "Кут дуги не може бути 0 градусів."; + case 0:{ + QString error = QString(tr("Angle of arc can't be 0 degree.")); + throw VException(error); break; + } case 90: return 1; case 180: @@ -161,7 +164,8 @@ QVector VArc::GetPoints() const{ QVector VArc::SplOfArc(qint32 number) const{ qint32 n = NumberSplOfArc (); if( number > n ){ - throw "Дуга не складається з такої кількості сплайнів."; + QString error = QString(tr("Arc have not this number of part.")); + throw VException(error); } qreal f1 = GetF1 (); qreal f2 = GetF2 (); diff --git a/geometry/varc.h b/geometry/varc.h index 349083a44..7b8a99fc5 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -23,11 +23,13 @@ #define VARC_H #include "vspline.h" +#include /** * @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою. */ class VArc{ + Q_DECLARE_TR_FUNCTIONS(VArc) public: /** * @brief VArc конструктор по замовчуванню. @@ -84,7 +86,7 @@ public: * @return точку кінця дуги. */ QPointF GetP2 () const; - const QHash *GetDataPoints() const; + const QHash GetDataPoints() const; /** * @brief GetPath будує шлях по даній дузі. * @return повертає шлях. @@ -119,7 +121,7 @@ private: * @brief center центральна точка дуги. */ qint64 center; - const QHash *points; + QHash points; Draw::Draws mode; qint64 idObject; }; diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index ee19f4a18..3e09422cf 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -23,7 +23,7 @@ #include VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), - kCurve(1), points(0), mode(Draw::Calculation), idObject(0){ + kCurve(1), points(QHash()), mode(Draw::Calculation), idObject(0){ } VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), @@ -34,14 +34,14 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 VSpline::VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), - p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points), + p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(*points), mode(mode), idObject(idObject){ ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } VSpline::VSpline (const QHash *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), - angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), mode(mode), idObject(idObject){ + angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), mode(mode), idObject(idObject){ ModifiSpl ( p1, p2, p3, p4, kCurve); } @@ -129,8 +129,8 @@ qint64 VSpline::GetP1 () const{ } VPointF VSpline::GetPointP1() const{ - if(points->contains(p1)){ - return points->value(p1); + if(points.contains(p1)){ + return points.value(p1); } else { qCritical()<<"Не можу знайти id = "<contains(p4)){ - return points->value(p4); + if(points.contains(p4)){ + return points.value(p4); } else { qCritical()<<"Не можу знайти id = "< *VSpline::GetDataPoints() const{ +const QHash VSpline::GetDataPoints() const{ return points; } diff --git a/geometry/vspline.h b/geometry/vspline.h index 79ee52fe4..d87260421 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -136,7 +136,7 @@ public: qreal GetKasm1() const; qreal GetKasm2() const; qreal GetKcurve() const; - const QHash *GetDataPoints() const; + const QHash GetDataPoints() const; /** * @brief CrossingSplLine перевіряє перетин сплайну з лінією. * @param line лінія з якою перевіряється перетин. @@ -224,7 +224,7 @@ private: qreal kAsm1; qreal kAsm2; qreal kCurve; - const QHash *points; + QHash points; Draw::Draws mode; qint64 idObject; /** diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index f6b6f1342..bd0a5a8fe 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -22,16 +22,16 @@ #include "vsplinepath.h" #include "exception/vexception.h" -VSplinePath::VSplinePath(): path(QVector()), kCurve(1), mode(Draw::Calculation), points(0), - idObject(0){ +VSplinePath::VSplinePath(): path(QVector()), kCurve(1), mode(Draw::Calculation), + points(QHash()), idObject(0){ } VSplinePath::VSplinePath(const QHash *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector()), - kCurve(kCurve), mode(mode), points(points), idObject(idObject){ + kCurve(kCurve), mode(mode), points(*points), idObject(idObject){ } VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()), - kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()), + kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()), idObject(splPath.getIdObject()){ } @@ -66,7 +66,7 @@ VSpline VSplinePath::GetSpline(qint32 index) const{ if(index < 1 || index > Count()){ throw VException(tr("This spline is not exist.")); } - VSpline spl(points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(), + VSpline spl(&points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(), path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve); return spl; } @@ -74,8 +74,8 @@ VSpline VSplinePath::GetSpline(qint32 index) const{ QPainterPath VSplinePath::GetPath() const{ QPainterPath painterPath; for(qint32 i = 1; i <= Count(); ++i){ - VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), - path[i].KAsm1(), this->kCurve); + VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), + path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve); painterPath.addPath(spl.GetPath()); } return painterPath; @@ -84,8 +84,8 @@ QPainterPath VSplinePath::GetPath() const{ QVector VSplinePath::GetPathPoints() const{ QVector pathPoints; for(qint32 i = 1; i <= Count(); ++i){ - VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), - path[i].KAsm1(), this->kCurve); + VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), + path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve); QVector splP = spl.GetPoints(); for(qint32 j = 0; j < splP.size(); ++j){ pathPoints.append(splP[j]); @@ -101,14 +101,14 @@ QVector VSplinePath::GetSplinePath() const{ qreal VSplinePath::GetLength() const{ qreal length = 0; for(qint32 i = 1; i <= Count(); ++i){ - VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), + VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), path[i].KAsm1(), kCurve); length += spl.GetLength(); } return length; } -const QHash *VSplinePath::GetDataPoints() const{ +QHash VSplinePath::GetDataPoints() const{ return points; } diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index 1036154dd..a00be2c9b 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -60,7 +60,7 @@ public: QVector GetPathPoints() const; QVector GetSplinePath() const; qreal GetLength() const; - const QHash *GetDataPoints() const; + QHash GetDataPoints() const; void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; /** @@ -85,7 +85,7 @@ protected: QVector path; qreal kCurve; Draw::Draws mode; - const QHash *points; + QHash points; qint64 idObject; }; diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index e0237cbdd..c7e9ee7e4 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -128,15 +128,17 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); + data->AddLine(firstPointId, id); + data->AddLine(id, secondPointId); } else { data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); + data->AddLine(firstPointId, id); + data->AddLine(id, secondPointId); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } VDrawTool::AddRecord(id, Tool::AlongLineTool, doc); - data->AddLine(firstPointId, id); - data->AddLine(id, secondPointId); if(parse == Document::FullParse){ VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, typeCreation); diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index 46cc44a5b..efb705153 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -87,13 +87,14 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddArc(arc); + data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); } else { data->UpdateArc(id, arc); + data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); VDrawTool::AddRecord(id, Tool::ArcTool, doc); if(parse == Document::FullParse){ VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 98c84c867..02e4e5cb2 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -93,13 +93,14 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(firstPointId, id); } else { data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(firstPointId, id); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLine(firstPointId, id); VDrawTool::AddRecord(id, Tool::BisectorTool, doc); if(parse == Document::FullParse){ VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index a118ba707..c65e2ec9a 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -74,13 +74,14 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); + data->AddLine(basePointId, id); } else { data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); + data->AddLine(basePointId, id); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLine(basePointId, id); VDrawTool::AddRecord(id, Tool::EndLineTool, doc); if(parse == Document::FullParse){ VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle, diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 6280a118d..7c84cf2db 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -60,12 +60,13 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->getNextId(); + data->AddLine(firstPoint, secondPoint); } else { + data->AddLine(firstPoint, secondPoint); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLine(firstPoint, secondPoint); VDrawTool::AddRecord(id, Tool::LineTool, doc); if(parse == Document::FullParse){ VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index e1a0abbd0..35067c399 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -72,16 +72,20 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(p1Line1Id, id); + data->AddLine(id, p2Line1Id); + data->AddLine(p1Line2Id, id); + data->AddLine(id, p2Line2Id); } else { data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(p1Line1Id, id); + data->AddLine(id, p2Line1Id); + data->AddLine(p1Line2Id, id); + data->AddLine(id, p2Line2Id); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLine(p1Line1Id, id); - data->AddLine(id, p2Line1Id); - data->AddLine(p1Line2Id, id); - data->AddLine(id, p2Line2Id); VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc); if(parse == Document::FullParse){ VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 2fd033e3c..b742c3fe7 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -74,13 +74,14 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(firstPointId, id); } else { data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(firstPointId, id); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLine(firstPointId, id); VDrawTool::AddRecord(id, Tool::NormalTool, doc); if(parse == Document::FullParse){ VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle, diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index a87391f74..9cc003477 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -96,8 +96,14 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(firstPointId, id); + data->AddLine(secondPointId, id); + data->AddLine(center, id); } else { data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(firstPointId, id); + data->AddLine(secondPointId, id); + data->AddLine(center, id); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index 3b41fe3ef..9e01ff4ec 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -99,14 +99,16 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(p1Line, id); + data->AddLine(p2Line, id); } else { data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); + data->AddLine(p1Line, id); + data->AddLine(p2Line, id); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLine(p1Line, id); - data->AddLine(p2Line, id); VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc); if(parse == Document::FullParse){ VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula, diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 85d80d197..77575cce6 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -94,13 +94,14 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddSpline(spline); + data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); } else { data->UpdateSpline(id, spline); + data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); VDrawTool::AddRecord(id, Tool::SplineTool, doc); if(parse == Document::FullParse){ VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation); diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index b862f6815..00de5a672 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -82,13 +82,14 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddSplinePath(path); + data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); } else { data->UpdateSplinePath(id, path); + data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } } - data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); VDrawTool::AddRecord(id, Tool::SplinePathTool, doc); if(parse == Document::FullParse){ VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); diff --git a/widgets/vapplication.cpp b/widgets/vapplication.cpp index b8f658bcc..c522e8636 100644 --- a/widgets/vapplication.cpp +++ b/widgets/vapplication.cpp @@ -95,6 +95,16 @@ bool VApplication::notify(QObject *receiver, QEvent *event){ msgBox.exec(); abort(); } + catch(const VException &e){ + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Something wrong!!")); + msgBox.setInformativeText(e.ErrorMessage()); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setIcon(QMessageBox::Critical); + msgBox.exec(); + } catch(std::exception& e) { qCritical() << "Exception thrown:" << e.what(); } From 8e715bf71f75441ca5ef905c24ace309d97eb6eb Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 13 Oct 2013 10:11:09 +0300 Subject: [PATCH 19/70] Fixed bug with context menu of single point. --HG-- branch : develop --- .hgignore | 3 + Valentina.pro | 4 +- geometry/varc.cpp | 1 - tools/drawTools/vdrawtool.h | 30 +++--- translations/valentina_ru.ts | 188 ++++++++++++++++++++++------------- translations/valentina_uk.ts | 188 ++++++++++++++++++++++------------- 6 files changed, 256 insertions(+), 158 deletions(-) diff --git a/.hgignore b/.hgignore index 6f58ef173..2e058acbc 100644 --- a/.hgignore +++ b/.hgignore @@ -22,3 +22,6 @@ latex/ # Ignore file used QtCreator for user profile. *.pro.user + +# Ignore file Qt translation. +*.qm diff --git a/Valentina.pro b/Valentina.pro index f94c2e337..a85cc4a65 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -247,7 +247,7 @@ CONFIG(debug, debug|release){ QMAKE_EXTRA_COMPILERS += lrelease lrelease.input = TRANSLATIONS lrelease.output = ${QMAKE_FILE_BASE}.qm - lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${DESTDIR}${QMAKE_FILE_BASE}.qm + lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm "bin/"${QMAKE_FILE_BASE}.qm lrelease.CONFIG += no_link target_predeps } @@ -263,5 +263,3 @@ message(Data files: $$[QT_INSTALL_DATA]) message(Translation files: $$[QT_INSTALL_TRANSLATIONS]) message(Settings: $$[QT_INSTALL_SETTINGS]) message(Examples: $$[QT_INSTALL_EXAMPLES]) - - diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 095ce5bfc..607cef99e 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -137,7 +137,6 @@ qint32 VArc::NumberSplOfArc() const{ case 0:{ QString error = QString(tr("Angle of arc can't be 0 degree.")); throw VException(error); - break; } case 90: return 1; diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index e96f93816..5235452f1 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -75,20 +75,22 @@ protected: dialog->show(); } - if(selectedAction == actionRemove){ - //deincrement referens - RemoveReferens(); - //remove form xml file - QDomElement domElement = doc->elementById(QString().setNum(id)); - if(domElement.isElement()){ - QDomElement element; - bool ok = doc->GetActivCalculationElement(element); - if(ok){ - element.removeChild(domElement); - //update xml file - emit FullUpdateTree(); - //remove form scene - emit RemoveTool(tool); + if(showRemove){ + if(selectedAction == actionRemove){ + //deincrement referens + RemoveReferens(); + //remove form xml file + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + QDomElement element; + bool ok = doc->GetActivCalculationElement(element); + if(ok){ + element.removeChild(domElement); + //update xml file + emit FullUpdateTree(); + //remove form scene + emit RemoveTool(tool); + } } } } diff --git a/translations/valentina_ru.ts b/translations/valentina_ru.ts index e3489ae30..a6b0c678c 100644 --- a/translations/valentina_ru.ts +++ b/translations/valentina_ru.ts @@ -245,10 +245,14 @@ - Length of arcs Длина дуг + + + Length of curves + Длина кривых + Angle of lines @@ -1565,7 +1569,7 @@ - + Save as Сохранить как @@ -1643,13 +1647,13 @@ - + About Qt - + About Valentina @@ -1691,127 +1695,137 @@ Введите новое имя для чертежа. - - + + Error saving change!!! + + + + + Can't save new name of drawing + + + + + Select point - + Select first point - - - + + + Select first point of line - + Select first point of angle - + Select first point of first line - + Select first point curve - + Select point of center of arc - + Select point of curve path - + Valentina v.0.1.0 - + The pattern has been modified. - + Do you want to save your changes? - + Growth: Рост: - + Size: Размер: - + Drawing: Чертеж: - + Lekalo files (*.xml);;All files (*.*) - - + + Lekalo files (*.xml) Файл лекала (*.xml) - + Error saving file. Can't save file. - + Open file Открыть файл - + Got empty file name. - + Could not copy temp file to pattern file - + Could not remove pattern file - + Can't open pattern file. File name empty Не могу открыть файл лекала. Пустое имя файла - - - - - - - + + + + + + + Error! Ошибка! @@ -1821,42 +1835,42 @@ - + Select points, arcs, curves clockwise. - + Error parsing file. Ошибка парсинга файла. - + Error can't convert value. Ошибка, не могу конвертовать значение. - + Error empty parameter. Ошибка, пустой параметр. - + Error wrong id. Ошибка, неправильный id. - + Error don't unique id. - + Error parsing pattern file. Ошибка парсинга файла лекала. - + Error in line %1 column %2 Ошибка в линии %1 столбец %2 @@ -1970,6 +1984,7 @@ + Error! Ошибка! @@ -1998,6 +2013,29 @@ Error wrong id. Program will be terminated. Ошибка неправельный id. Програма будет закрыта. + + + Something wrong!! + + + + + VArc + + + Can't find id = %1 in table. + + + + + Angle of arc can't be 0 degree. + + + + + Arc have not this number of part. + + VContainer @@ -2010,115 +2048,125 @@ VDomDocument - + Got wrong parameter id. Need only id > 0. Получен неправельный параметр id. Допустимы только id > 0. - + Can't convert toLongLong parameter Не могу конвертировать toLongLong параметр - + Got empty parameter Получен пустой параметр - + Can't convert toDouble parameter Не могу конвертировать toDouble параметр - + This id is not unique. - + Error creating or updating detail Ошибка создания или обновления детали - + Error creating or updating single point Ошибка создания или обновления базовой точки - + Error creating or updating point of end line Ошибка создания или обновления точки на конце линии - + Error creating or updating point along line Ошибка создания или обновления точки вдоль линии - + Error creating or updating point of shoulder Ошибка создания или обновления точки плеча - + Error creating or updating point of normal Ошибка создания или обновления точки нормали - + Error creating or updating point of bisector Ошибка создания или обновления точки бисектрисы - + Error creating or updating point of lineintersection Ошибка создания или обновления точки пересичения линий - + Error creating or updating point of contact Ошибка создания или обновления точки прикосновения - + Error creating or updating modeling point Ошибка создания или обновления точки - + Error creating or updating line Ошибка создания или обновления линии - + Error creating or updating simple curve Ошибка создания или обновления кривой - + Error creating or updating curve path Ошибка создания или обновления сложной кривой - + Error creating or updating modeling simple curve Ошибка создания или обновления модельной кривой - + Error creating or updating modeling curve path Ошибка создания или обновления сложной модельной кривой - + Error creating or updating simple arc Ошибка создания или обновления дуги - + Error creating or updating modeling arc Ошибка создания или обновления модельной дуги + + + Error! + Ошибка! + + + + Error parsing file. + Ошибка парсинга файла. + Can't get parent for object id = %1 Не могу получить родителя объекта id = %1 @@ -2127,12 +2175,12 @@ VDrawTool - + Options Параметры - + Delete Удалить @@ -2155,7 +2203,7 @@ VToolDetail - + Delete Удалить diff --git a/translations/valentina_uk.ts b/translations/valentina_uk.ts index 9040a6444..dbbfe8910 100644 --- a/translations/valentina_uk.ts +++ b/translations/valentina_uk.ts @@ -245,10 +245,14 @@ - Length of arcs Довжина дуг + + + Length of curves + + Angle of lines @@ -1565,7 +1569,7 @@ - + Save as Зберегти як @@ -1643,13 +1647,13 @@ - + About Qt Про Qt - + About Valentina Про Valentina @@ -1691,45 +1695,55 @@ Введіть нове ім'я креслення. - - + + Error saving change!!! + + + + + Can't save new name of drawing + + + + + Select point Виберість точку - + Select first point Виберість першу точку - - - + + + Select first point of line Виберість першу точку лінії - + Select first point of angle Виберіть першу точку кута - + Select first point of first line Виберіть першу точку першої лінії - + Select first point curve Виберіть першу точку кривої - + Select point of center of arc Виберіть точку центру дуги - + Select point of curve path Виберіть точку складної кривої @@ -1738,84 +1752,84 @@ Виберіть точки, дуги, криві і д - + Valentina v.0.1.0 Valentina v.0.1.0 - + The pattern has been modified. Лекало було зміненно. - + Do you want to save your changes? Ви хочете зберегти зміни? - + Growth: Зріст: - + Size: Розмір: - + Drawing: Креслення: - + Lekalo files (*.xml);;All files (*.*) Файли лекала (*.xml);;Всі файли (*.*) - - + + Lekalo files (*.xml) Файл лекала (*.xml) - + Error saving file. Can't save file. Помилка збереження файлу. Не можу зберегти файл. - + Open file Відкрити файл - + Got empty file name. Отримано пусте імя файлу. - + Could not copy temp file to pattern file Не можу копіювати тимчасовий файл до файлу лекала - + Could not remove pattern file Не можу видалити файл лекала - + Can't open pattern file. File name empty Не можу відкрити файл лекала. Пусте ім'я файлу - - - - - - - + + + + + + + Error! Помилка! @@ -1825,42 +1839,42 @@ Створіть нове креслення для початку роботи. - + Select points, arcs, curves clockwise. Виберіть точки, дуги, криві загодинниковою стрілкою. - + Error parsing file. Помилка парсингу файла. - + Error can't convert value. Помилка, не можу конвертувати значення. - + Error empty parameter. Помилка, пустий параметр. - + Error wrong id. Помикла, неправильний id. - + Error don't unique id. Помилка, не унікальний id. - + Error parsing pattern file. Помилка парсінгу файлу лекала. - + Error in line %1 column %2 Помилка в лінії %1 стовпчик %2 @@ -1974,6 +1988,7 @@ + Error! Помилка! @@ -2002,6 +2017,29 @@ Error wrong id. Program will be terminated. Помилка неправильний id. Програма буде закрита. + + + Something wrong!! + + + + + VArc + + + Can't find id = %1 in table. + + + + + Angle of arc can't be 0 degree. + + + + + Arc have not this number of part. + + VContainer @@ -2014,115 +2052,125 @@ VDomDocument - + Got wrong parameter id. Need only id > 0. Отримано неправильний id. Допускаються тільки id > 0. - + Can't convert toLongLong parameter Не можу конвертувати toLongLong параметру - + Got empty parameter Отримано пустий параметр - + Can't convert toDouble parameter Не можу конвертувати toDouble параметру - + This id is not unique. Цей id не унікальний. - + Error creating or updating detail Помилка створення чи оновлення деталі - + Error creating or updating single point Помилка створення чи оновлення простої точки - + Error creating or updating point of end line Помилка створення чи оновлення точки кінця відрізку - + Error creating or updating point along line Помилка створення чи оновлення точки вздовж лінії - + Error creating or updating point of shoulder Помилка створення чи оновлення точки плеча - + Error creating or updating point of normal Помилка створення чи оновлення точки нормалі - + Error creating or updating point of bisector Помилка створення чи оновлення точки бісектриси - + Error creating or updating point of lineintersection Помилка створення чи оновлення точки перетину ліній - + Error creating or updating point of contact Помилка створення чи оновлення точки дотику - + Error creating or updating modeling point Помилка створення чи оновлення модельної точки - + Error creating or updating line Помилка створення чи оновлення лінії - + Error creating or updating simple curve Помилка створення чи оновлення кривої - + Error creating or updating curve path Помилка створення чи оновлення шляху кривих - + Error creating or updating modeling simple curve Помилка створення чи оновлення модельної кривої - + Error creating or updating modeling curve path Помилка створення чи оновлення модельного шляху кривих - + Error creating or updating simple arc Помилка створення чи оновлення дуги - + Error creating or updating modeling arc Помилка створення чи оновлення модельної дуги + + + Error! + Помилка! + + + + Error parsing file. + Помилка парсингу файла. + Can't get parent for object id = %1 Не можу отримати батька для об'єкту id = %1 @@ -2131,12 +2179,12 @@ VDrawTool - + Options Параметри - + Delete Видалити @@ -2159,7 +2207,7 @@ VToolDetail - + Delete Видалити From d0ce7e5d105904aae5a397a63ebb624065af12b7 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 13 Oct 2013 13:32:49 +0300 Subject: [PATCH 20/70] Precompiled header for qt and ccache. --HG-- branch : develop --- Valentina.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Valentina.pro b/Valentina.pro index a85cc4a65..ee7b1ec2b 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -11,7 +11,8 @@ QT += core gui widgets xml svg TARGET = Valentina TEMPLATE = app CONFIG -= debug_and_release debug_and_release_target -CONFIG += c++11 +CONFIG += c++11 precompile_header +QMAKE_CXX = ccache g++ SOURCES += main.cpp\ mainwindow.cpp \ From 3407961b6572a4bb699c23d72a9a45399b0e0e8a Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 13 Oct 2013 14:04:26 +0300 Subject: [PATCH 21/70] Alphabetic sorting for variables. --HG-- branch : develop --- dialogs/dialogtool.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index ccb701f24..100343c3c 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -396,15 +396,23 @@ void DialogTool::ShowVariable(const QHash *var){ Q_CHECK_PTR(listWidget); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); - connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); + QHashIterator i(*var); + QMap map; while (i.hasNext()) { i.next(); - QListWidgetItem *item = new QListWidgetItem(i.key()); + map.insert(i.key(), i.value()); + } + + QMapIterator iMap(map); + while (iMap.hasNext()) { + iMap.next(); + QListWidgetItem *item = new QListWidgetItem(iMap.key()); item->setFont(QFont("Times", 12, QFont::Bold)); listWidget->addItem(item); } listWidget->setCurrentRow (0); + connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); } qint64 DialogTool::getIdDetail() const{ From b31002df673f46691cc897abb1dea89d308dd3c5 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 13 Oct 2013 18:31:42 +0300 Subject: [PATCH 22/70] Enabled variables lengths of lines and lengths of arcs. Fixed wrong calculation of length line and curve. --HG-- branch : develop --- container/vcontainer.cpp | 18 ++++++++++-- container/vcontainer.h | 4 ++- dialogs/dialogalongline.cpp | 4 +++ dialogs/dialogalongline.ui | 4 +-- dialogs/dialogarc.cpp | 6 +++- dialogs/dialogarc.ui | 4 +-- dialogs/dialogbisector.cpp | 4 +++ dialogs/dialogbisector.ui | 4 +-- dialogs/dialogendline.cpp | 4 +++ dialogs/dialogendline.ui | 4 +-- dialogs/dialognormal.cpp | 4 +++ dialogs/dialognormal.ui | 4 +-- dialogs/dialogpointofcontact.cpp | 4 +++ dialogs/dialogpointofcontact.ui | 4 +-- dialogs/dialogshoulderpoint.cpp | 4 +++ dialogs/dialogshoulderpoint.ui | 4 +-- dialogs/dialogtool.cpp | 47 ++++++++++++++++++++++++++++---- dialogs/dialogtool.h | 4 +++ geometry/vspline.cpp | 22 ++------------- 19 files changed, 109 insertions(+), 44 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 947b84551..b9b6e4ccc 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -108,7 +108,17 @@ qreal VContainer::GetLine(const QString &name) const{ return GetObject(lengthLines, name); } -qreal VContainer::GetLineArc(const QString &name) const{ +qreal VContainer::GetLengthArc(const QString &name) const{ + Q_ASSERT(!name.isEmpty()); + return GetObject(lengthArcs, name); +} + +qreal VContainer::GetLengthSpline(const QString &name) const{ + Q_ASSERT(!name.isEmpty()); + return GetObject(lengthSplines, name); +} + +qreal VContainer::GetLineAngle(const QString &name) const{ Q_ASSERT(!name.isEmpty()); return GetObject(lineAngles, name); } @@ -562,6 +572,10 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const{ *ok = true; return lineAngles.value(name); } + if(lengthSplines.contains(name)){ + *ok = true; + return lengthSplines.value(name); + } *ok = false; return 0; } @@ -778,7 +792,7 @@ void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secon first = GetModelingPoint(firstPointId); second = GetModelingPoint(secondPointId); } - AddLengthSpline(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length()); + AddLengthSpline(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length())); } void VContainer::CreateManTableIGroup (){ diff --git a/container/vcontainer.h b/container/vcontainer.h index c7582b89d..ee2df1ba2 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -55,7 +55,9 @@ public: VStandartTableCell GetStandartTableCell(const QString& name) const; VIncrementTableRow GetIncrementTableRow(const QString& name) const; qreal GetLine(const QString &name) const; - qreal GetLineArc(const QString &name) const; + qreal GetLengthArc(const QString &name) const; + qreal GetLengthSpline(const QString &name) const; + qreal GetLineAngle(const QString &name) const; VSpline GetSpline(qint64 id) const; VSpline GetModelingSpline(qint64 id) const; VArc GetArc(qint64 id) const; diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index 4d522963a..3765cde10 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -33,6 +33,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; @@ -56,6 +58,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogAlongLine::StandartTable); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogAlongLine::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogAlongLine::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogAlongLine::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged); diff --git a/dialogs/dialogalongline.ui b/dialogs/dialogalongline.ui index acfb90561..3030f22ba 100644 --- a/dialogs/dialogalongline.ui +++ b/dialogs/dialogalongline.ui @@ -302,7 +302,7 @@ - false + true Length of arcs @@ -312,7 +312,7 @@ - false + true Length of curves diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 7e02eb74c..739e4e76e 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -52,6 +52,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius); connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1); @@ -64,6 +66,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines); connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogArc::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogArc::LengthCurves); connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius); connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1); @@ -153,7 +157,7 @@ void DialogArc::ValChenged(int row){ } QListWidgetItem *item = ui->listWidget->item( row ); if(ui->radioButtonLineAngles->isChecked()){ - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text())) + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineAngle(item->text())) .arg(tr("Value angle of line.")); ui->labelDescription->setText(desc); return; diff --git a/dialogs/dialogarc.ui b/dialogs/dialogarc.ui index 3f08b5a41..65ab8d07b 100644 --- a/dialogs/dialogarc.ui +++ b/dialogs/dialogarc.ui @@ -482,7 +482,7 @@ - false + true Length of arcs @@ -492,7 +492,7 @@ - false + true Length of curves diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index 6f6e785ce..0296b71a3 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -33,6 +33,8 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; @@ -57,6 +59,8 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogBisector::StandartTable); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogBisector::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogBisector::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogBisector::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged); diff --git a/dialogs/dialogbisector.ui b/dialogs/dialogbisector.ui index a4253118a..c33b41537 100644 --- a/dialogs/dialogbisector.ui +++ b/dialogs/dialogbisector.ui @@ -344,7 +344,7 @@ - false + true Length of arcs @@ -354,7 +354,7 @@ - false + true Length of curves diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index fc0530c0a..1251ce77a 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -38,6 +38,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget * radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; @@ -76,6 +78,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget * connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogEndLine::StandartTable); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEndLine::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEndLine::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEndLine::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); diff --git a/dialogs/dialogendline.ui b/dialogs/dialogendline.ui index 2b4c079ee..ad99685ca 100644 --- a/dialogs/dialogendline.ui +++ b/dialogs/dialogendline.ui @@ -500,7 +500,7 @@ - false + true Length of arcs @@ -510,7 +510,7 @@ - false + true Length of curves diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index 11cb6805d..ef60bcb91 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -35,6 +35,8 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; @@ -74,6 +76,8 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogNormal::StandartTable); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogNormal::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogNormal::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogNormal::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); diff --git a/dialogs/dialognormal.ui b/dialogs/dialognormal.ui index 26d182650..2283dbe55 100644 --- a/dialogs/dialognormal.ui +++ b/dialogs/dialognormal.ui @@ -519,7 +519,7 @@ - false + true Length of arcs @@ -529,7 +529,7 @@ - false + true Length of curves diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index 67148bb50..21a03227f 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -32,6 +32,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m radioButtonStandartTable = ui.radioButtonStandartTable; radioButtonIncrements = ui.radioButtonIncrements; radioButtonLengthLine = ui.radioButtonLengthLine; + radioButtonLengthArc = ui.radioButtonLengthArc; + radioButtonLengthCurve = ui.radioButtonLengthSpline; lineEditFormula = ui.lineEditFormula; labelEditFormula = ui.labelEditFormula; labelEditNamePoint = ui.labelEditNamePoint; @@ -55,6 +57,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m connect(ui.radioButtonStandartTable, &QRadioButton::clicked, this, &DialogPointOfContact::StandartTable); connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); + connect(ui.radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs); + connect(ui.radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogPointOfContact::LengthCurves); connect(ui.toolButtonEqual, &QPushButton::clicked, this, &DialogPointOfContact::EvalFormula); connect(ui.lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged); connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); diff --git a/dialogs/dialogpointofcontact.ui b/dialogs/dialogpointofcontact.ui index 4e28260b2..e4f1fba75 100644 --- a/dialogs/dialogpointofcontact.ui +++ b/dialogs/dialogpointofcontact.ui @@ -359,7 +359,7 @@ - false + true Length of arcs @@ -369,7 +369,7 @@ - false + true Length of curves diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index 28201e968..f1a5fff82 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -34,6 +34,8 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod radioButtonStandartTable = ui->radioButtonStandartTable; radioButtonIncrements = ui->radioButtonIncrements; radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; @@ -58,6 +60,8 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandartTable); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthLines); + connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthArcs); + connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged); diff --git a/dialogs/dialogshoulderpoint.ui b/dialogs/dialogshoulderpoint.ui index f0b4d9e27..b1865211e 100644 --- a/dialogs/dialogshoulderpoint.ui +++ b/dialogs/dialogshoulderpoint.ui @@ -380,7 +380,7 @@ - false + true Length of lines @@ -390,7 +390,7 @@ - false + true Length of curves diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 100343c3c..a347196d3 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -30,7 +30,7 @@ DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), - radioButtonLengthLine(0), idDetail(0), mode(mode){ + radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), idDetail(0), mode(mode){ Q_CHECK_PTR(data); timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); @@ -309,6 +309,14 @@ void DialogTool::LengthLines(){ ShowVariable(data->DataLengthLines()); } +void DialogTool::LengthArcs(){ + ShowVariable(data->DataLengthArcs()); +} + +void DialogTool::LengthCurves(){ + ShowVariable(data->DataLengthSplines()); +} + void DialogTool::Increments(){ ShowVariable(data->DataIncrementTable()); } @@ -331,17 +339,19 @@ void DialogTool::ValChenged(int row){ Q_CHECK_PTR(radioButtonStandartTable); Q_CHECK_PTR(radioButtonIncrements); Q_CHECK_PTR(radioButtonLengthLine); + Q_CHECK_PTR(radioButtonLengthArc); + Q_CHECK_PTR(radioButtonLengthCurve); if(listWidget->count() == 0){ return; } QListWidgetItem *item = listWidget->item( row ); if(radioButtonSizeGrowth->isChecked()){ if(item->text()=="Р"){ - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg("Зріст"); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg(tr("Growth")); labelDescription->setText(desc); } if(item->text()=="Сг"){ - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg("Розмір"); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size")); labelDescription->setText(desc); } return; @@ -366,12 +376,28 @@ void DialogTool::ValChenged(int row){ labelDescription->setText(desc); return; } + if(radioButtonLengthArc->isChecked()){ + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthArc(item->text())) + .arg(tr("Arc length")); + labelDescription->setText(desc); + return; + } + if(radioButtonLengthCurve->isChecked()){ + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthSpline(item->text())) + .arg(tr("Curve length")); + labelDescription->setText(desc); + return; + } } void DialogTool::UpdateList(){ - if(radioButtonSizeGrowth == 0 || radioButtonStandartTable == 0 || radioButtonIncrements == 0){ - return; - } + Q_CHECK_PTR(radioButtonSizeGrowth); + Q_CHECK_PTR(radioButtonStandartTable); + Q_CHECK_PTR(radioButtonIncrements); + Q_CHECK_PTR(radioButtonLengthLine); + Q_CHECK_PTR(radioButtonLengthArc); + Q_CHECK_PTR(radioButtonLengthCurve); + if(radioButtonSizeGrowth->isChecked()){ ShowVariable(data->DataBase()); } @@ -381,6 +407,15 @@ void DialogTool::UpdateList(){ if(radioButtonIncrements->isChecked()){ ShowVariable(data->DataIncrementTable()); } + if(radioButtonLengthLine->isChecked()){ + ShowVariable(data->DataLengthLines()); + } + if(radioButtonLengthArc->isChecked()){ + ShowVariable(data->DataLengthArcs()); + } + if(radioButtonLengthCurve->isChecked()){ + ShowVariable(data->DataLengthSplines()); + } } bool DialogTool::CheckObject(const qint64 &id){ diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index 630582144..dbe0b4730 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -62,6 +62,8 @@ public slots: void SizeGrowth(); void StandartTable(); void LengthLines(); + void LengthArcs(); + void LengthCurves(); void Increments(); void PutHere(); void PutVal(QListWidgetItem * item); @@ -86,6 +88,8 @@ protected: QRadioButton *radioButtonStandartTable; QRadioButton *radioButtonIncrements; QRadioButton *radioButtonLengthLine; + QRadioButton *radioButtonLengthArc; + QRadioButton *radioButtonLengthCurve; qint64 idDetail; Draw::Draws mode; bool CheckObject(const qint64 &id); diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 3e09422cf..e3dc49c3c 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -320,32 +320,14 @@ QVector VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF } qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const{ - /*QVector px; - QVector py; - QVector& wpx = px; - QVector& wpy = py; - px.append ( p1.x () ); - py.append ( p1.y () ); - PointBezier_r ( p1.x (), p1.y (), p2.x (), p2.y (), - p3.x (), p3.y (), p4.x (), p4.y (), 0, wpx, wpy); - px.append ( p4.x () ); - py.append ( p4.y () ); - qint32 i = 0; - qreal length = 0.0; - * - * Наприклад маємо 10 точок. Від 0 до 9 і останню точку не опрацьовуємо. - * Тому від 0 до 8(<10-1). - * - for ( i = 0; i < px.count() - 1; ++i ){ - length += QLineF ( QPointF ( px[i], py[i] ), QPointF ( px[i+1], py[i+1] ) ).length (); - }*/ QPainterPath splinePath; QVector points = GetPoints (p1, p2, p3, p4); splinePath.moveTo(points[0]); for (qint32 i = 1; i < points.count(); ++i){ splinePath.lineTo(points[i]); } - return splinePath.length(); + qreal length = toMM(splinePath.length()); + return length; } void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, From 1e70aea0db0fa277218154f38962a9ba59c2dfc1 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 13 Oct 2013 21:51:59 +0300 Subject: [PATCH 23/70] Fixed wrong value of arc length. Fixed wrong spline length. --HG-- branch : develop --- container/vcontainer.cpp | 20 +++----------------- container/vcontainer.h | 2 -- geometry/vspline.cpp | 3 +-- tools/drawTools/vtoolarc.cpp | 6 +++--- tools/drawTools/vtoolspline.cpp | 4 ++-- tools/drawTools/vtoolsplinepath.cpp | 4 ++-- tools/modelingTools/vmodelingarc.cpp | 2 +- tools/modelingTools/vmodelingspline.cpp | 2 +- tools/modelingTools/vmodelingsplinepath.cpp | 2 +- xml/vdomdocument.cpp | 4 ++++ 10 files changed, 18 insertions(+), 31 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index b9b6e4ccc..9d89dd1b6 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -454,7 +454,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value){ } void VContainer::AddLengthArc(const qint64 ¢er, const qint64 &id){ - AddLengthArc(GetNameArc(center, id), GetArc(id).GetLength()); + AddLengthArc(GetNameArc(center, id), toMM(GetArc(id).GetLength())); } void VContainer::AddLengthArc(const QString &name, const qreal &value){ @@ -655,7 +655,7 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId first = GetModelingPoint(firstPointId); second = GetModelingPoint(secondPointId); } - AddLengthLine(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length()/PrintDPI*25.4); + AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length())); nameLine = GetNameLineAngle(firstPointId, secondPointId, mode); AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle()); } @@ -773,7 +773,7 @@ QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id, Draw::Dra } else { centerPoint = GetModelingPoint(center); } - return QString ("Arc(%1)%2").arg(centerPoint.name()).arg(id); + return QString ("Arc_%1_%2").arg(centerPoint.name()).arg(id); } void VContainer::AddLengthLine(const QString &name, const qreal &value){ @@ -781,20 +781,6 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value){ lengthLines[name] = value; } -void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){ - QString nameLine = GetNameSpline(firstPointId, secondPointId, mode); - VPointF first; - VPointF second; - if(mode == Draw::Calculation){ - first = GetPoint(firstPointId); - second = GetPoint(secondPointId); - } else { - first = GetModelingPoint(firstPointId); - second = GetModelingPoint(secondPointId); - } - AddLengthSpline(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length())); -} - void VContainer::CreateManTableIGroup (){ AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3)); AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3)); diff --git a/container/vcontainer.h b/container/vcontainer.h index ee2df1ba2..235a4243a 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -72,8 +72,6 @@ public: void AddStandartTableCell(const QString& name, const VStandartTableCell& cell); void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell); void AddLengthLine(const QString &name, const qreal &value); - void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, - Draw::Draws mode = Draw::Calculation); void AddLengthSpline(const QString &name, const qreal &value); void AddLengthArc(const qint64 ¢er, const qint64 &id); void AddLengthArc(const QString &name, const qreal &value); diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index e3dc49c3c..4e6ac988c 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -326,8 +326,7 @@ qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) c for (qint32 i = 1; i < points.count(); ++i){ splinePath.lineTo(points[i]); } - qreal length = toMM(splinePath.length()); - return length; + return splinePath.length(); } void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index efb705153..c85aba0da 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -68,7 +68,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad QString errorMsg; qreal result = cal.eval(radius, &errorMsg); if(errorMsg.isEmpty()){ - calcRadius = result*PrintDPI/25.4; + calcRadius = toPixel(result); } errorMsg.clear(); @@ -87,10 +87,10 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddArc(arc); - data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); + data->AddLengthArc(data->GetNameArc(center,id), toMM(arc.GetLength())); } else { data->UpdateArc(id, arc); - data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength()); + data->AddLengthArc(data->GetNameArc(center,id), toMM(arc.GetLength())); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 77575cce6..71535e5f1 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -94,10 +94,10 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddSpline(spline); - data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); + data->AddLengthSpline(data->GetNameSpline(p1, p4), toMM(spline.GetLength())); } else { data->UpdateSpline(id, spline); - data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength()); + data->AddLengthSpline(data->GetNameSpline(p1, p4), toMM(spline.GetLength())); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 00de5a672..399367688 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -82,10 +82,10 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddSplinePath(path); - data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); + data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength())); } else { data->UpdateSplinePath(id, path); - data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); + data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength())); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); } diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index a04ed9310..372cb7fef 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -94,7 +94,7 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const doc->UpdateToolData(id, data); } } - data->AddLengthArc(data->GetNameArc(center,id, Draw::Modeling), arc.GetLength()); + data->AddLengthArc(data->GetNameArc(center,id, Draw::Modeling), toMM(arc.GetLength())); if(parse == Document::FullParse){ toolArc = new VModelingArc(doc, data, id, typeCreation); doc->AddTool(id, toolArc); diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index ddefbc81d..17467591b 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -102,7 +102,7 @@ VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, con doc->UpdateToolData(id, data); } } - data->AddLengthSpline(data->GetNameSpline(p1, p4, Draw::Modeling), spline.GetLength()); + data->AddLengthSpline(data->GetNameSpline(p1, p4, Draw::Modeling), toMM(spline.GetLength())); if(parse == Document::FullParse){ spl = new VModelingSpline(doc, data, id, typeCreation); doc->AddTool(id, spl); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 2b024389a..6756e0d4c 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -89,7 +89,7 @@ VModelingSplinePath * VModelingSplinePath::Create(const qint64 _id, const VSplin doc->UpdateToolData(id, data); } } - data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength()); + data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength())); if(parse == Document::FullParse){ spl = new VModelingSplinePath(doc, data, id, typeCreation); doc->AddTool(id, spl); diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index f99b846f7..d31f9b486 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -444,15 +444,19 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce if(!domElement.isNull()){ if(domElement.tagName() == "point"){ ParsePointElement(scene, domElement, parse, domElement.attribute("type", ""), mode); + continue; } if(domElement.tagName() == "line"){ ParseLineElement(scene, domElement, parse, mode); + continue; } if(domElement.tagName() == "spline"){ ParseSplineElement(scene, domElement, parse, domElement.attribute("type", ""), mode); + continue; } if(domElement.tagName() == "arc"){ ParseArcElement(scene, domElement, parse, domElement.attribute("type", ""), mode); + continue; } } } From 244756cb0664f46861c4c9c2426d3d03be32fe08 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 11:40:01 +0300 Subject: [PATCH 24/70] Fixed Issue #3. --HG-- branch : develop --- widgets/vmaingraphicsview.cpp | 48 +++++++++++++++++++++++++---------- widgets/vmaingraphicsview.h | 20 +++++---------- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index 694a12984..ddb07efe5 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -23,30 +23,50 @@ #include #include #include +#include VMainGraphicsView::VMainGraphicsView(QWidget *parent) : - QGraphicsView(parent){ + QGraphicsView(parent), _numScheduledScalings(0){ QGraphicsView::setResizeAnchor(QGraphicsView::AnchorUnderMouse); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); } void VMainGraphicsView::wheelEvent(QWheelEvent *event){ + // If you press CTRL this code will execute + int numDegrees = event->delta() / 8; + int numSteps = numDegrees / 15; // see QWheelEvent documentation + _numScheduledScalings += numSteps; + if (_numScheduledScalings * numSteps < 0){ // if user moved the wheel in another direction, we reset + _numScheduledScalings = numSteps; // previously scheduled scalings + } + + QTimeLine *anim = new QTimeLine(350, this); + anim->setUpdateInterval(20); + + connect(anim, &QTimeLine::valueChanged, this, &VMainGraphicsView::scalingTime); + connect(anim, &QTimeLine::finished, this, &VMainGraphicsView::animFinished); + anim->start(); +} + +void VMainGraphicsView::scalingTime(qreal x){ + Q_UNUSED(x); + qreal factor = 1.0 + qreal(_numScheduledScalings) / 300.0; if (QApplication::keyboardModifiers() == Qt::ControlModifier){ - // Если нажата клавиша CTRL этот код выполнится - if ((event->delta())>0){ - ZoomIn(); - } else if ((event->delta())<0){ - ZoomOut(); - } + scale(factor, factor); } else { - verticalScrollBar()->setValue(verticalScrollBar()->value() - event->delta()); + if(_numScheduledScalings < 0){ + verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() + factor*3.5)); + } else { + verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() - factor*3.5)); + } } } -void VMainGraphicsView::ZoomIn(){ - scale(1.1,1.1); -} - -void VMainGraphicsView::ZoomOut(){ - scale(1/1.1,1/1.1); +void VMainGraphicsView::animFinished(){ + if (_numScheduledScalings > 0){ + _numScheduledScalings--; + } else { + _numScheduledScalings++; + } + sender()->~QObject(); } diff --git a/widgets/vmaingraphicsview.h b/widgets/vmaingraphicsview.h index 67cf3f679..099d9f845 100644 --- a/widgets/vmaingraphicsview.h +++ b/widgets/vmaingraphicsview.h @@ -24,30 +24,22 @@ #include -class VMainGraphicsView : public QGraphicsView -{ +class VMainGraphicsView : public QGraphicsView{ Q_OBJECT public: explicit VMainGraphicsView(QWidget *parent = 0); - signals: protected: /** * @brief wheelEvent обробник повороту колеса мишки. * @param event передається подія. */ - void wheelEvent ( QWheelEvent * event ); - + void wheelEvent ( QWheelEvent * event ); public slots: - /** - * @brief ZoomIn збільшує масштаб листа. - */ - void ZoomIn(); - /** - * @brief ZoomOut зменшує масштаб листа. - */ - void ZoomOut(); - + void scalingTime(qreal x); + void animFinished(); +private: + qint32 _numScheduledScalings; }; #endif // VMAINGRAPHICSVIEW_H From 4d6179d3e233a83f02d064d036d25a2d64f0ee11 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 12:31:56 +0300 Subject: [PATCH 25/70] DragMode for scene. --HG-- branch : develop --- widgets/vmaingraphicsview.cpp | 24 ++++++++++++++++++++---- widgets/vmaingraphicsview.h | 8 +++++--- widgets/vtablegraphicsview.cpp | 4 ++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index ddb07efe5..d07bcc501 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -27,12 +27,12 @@ VMainGraphicsView::VMainGraphicsView(QWidget *parent) : QGraphicsView(parent), _numScheduledScalings(0){ - QGraphicsView::setResizeAnchor(QGraphicsView::AnchorUnderMouse); - setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); + this->setResizeAnchor(QGraphicsView::AnchorUnderMouse); + this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); + this->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); } void VMainGraphicsView::wheelEvent(QWheelEvent *event){ - // If you press CTRL this code will execute int numDegrees = event->delta() / 8; int numSteps = numDegrees / 15; // see QWheelEvent documentation _numScheduledScalings += numSteps; @@ -51,7 +51,7 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event){ void VMainGraphicsView::scalingTime(qreal x){ Q_UNUSED(x); qreal factor = 1.0 + qreal(_numScheduledScalings) / 300.0; - if (QApplication::keyboardModifiers() == Qt::ControlModifier){ + if (QApplication::keyboardModifiers() == Qt::ControlModifier){// If you press CTRL this code will execute scale(factor, factor); } else { if(_numScheduledScalings < 0){ @@ -70,3 +70,19 @@ void VMainGraphicsView::animFinished(){ } sender()->~QObject(); } + +void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress){ + if(mousePress->button() & Qt::LeftButton){ + switch(QGuiApplication::keyboardModifiers()){ + case Qt::ControlModifier: + QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag); + QGraphicsView::mousePressEvent(mousePress); + break; + } + } +} + +void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event){ + QGraphicsView::mouseReleaseEvent ( event ); + QGraphicsView::setDragMode( QGraphicsView::RubberBandDrag ); +} diff --git a/widgets/vmaingraphicsview.h b/widgets/vmaingraphicsview.h index 099d9f845..39d1687ff 100644 --- a/widgets/vmaingraphicsview.h +++ b/widgets/vmaingraphicsview.h @@ -29,15 +29,17 @@ class VMainGraphicsView : public QGraphicsView{ public: explicit VMainGraphicsView(QWidget *parent = 0); signals: +public slots: + void scalingTime(qreal x); + void animFinished(); protected: /** * @brief wheelEvent обробник повороту колеса мишки. * @param event передається подія. */ void wheelEvent ( QWheelEvent * event ); -public slots: - void scalingTime(qreal x); - void animFinished(); + void mousePressEvent(QMouseEvent *mousePress); + void mouseReleaseEvent(QMouseEvent *event); private: qint32 _numScheduledScalings; }; diff --git a/widgets/vtablegraphicsview.cpp b/widgets/vtablegraphicsview.cpp index b2f9d57f1..ce5cd7548 100644 --- a/widgets/vtablegraphicsview.cpp +++ b/widgets/vtablegraphicsview.cpp @@ -35,10 +35,10 @@ VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent) void VTableGraphicsView::selectionChanged(){ QList listSelectedItems = scene()->selectedItems(); if( listSelectedItems.isEmpty() == true ){ - qDebug() << "деталь не знайдено"; + qDebug() << tr("detail don't find"); emit itemChect(true); } else { - qDebug() << "деталь знайдено"; + qDebug() << tr("detail find"); emit itemChect(false); } } From 3bda5f620801cdea829d8f8368d28f2cbee59a72 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 14:26:42 +0300 Subject: [PATCH 26/70] Connected signal cellChanged to slot cellChanged in table of increments. Before conversion toDouble replace "," to ".". --HG-- branch : develop --- dialogs/dialogincrements.cpp | 16 +++++++++--- dialogs/dialogincrements.h | 49 ++++++++++++++++++------------------ widgets/doubledelegate.cpp | 18 +++++-------- xml/vdomdocument.cpp | 2 +- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 7ea38338c..c877ef145 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -26,6 +26,7 @@ #include "widgets/doubledelegate.h" #include "container/vincrementtablerow.h" #include +#include "exception/vexception.h" DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) : DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc){ @@ -41,6 +42,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget FillIncrementTable(); FillLengthLines(); + connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove); @@ -365,8 +367,8 @@ void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qreal base, q } void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ - QTableWidgetItem *item; - QTableWidgetItem *itemName; + QTableWidgetItem *item = 0; + QTableWidgetItem *itemName = 0; qint64 id; QDomElement domElement; switch(column) { @@ -386,8 +388,14 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ id = qvariant_cast(itemName->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("base", item->text().toDouble()); - emit FullUpdateTree(); + bool ok = false; + qreal value = item->text().toDouble(&ok); + if(ok){ + domElement.setAttribute("base", value); + emit FullUpdateTree(); + } else { + throw VException(tr("Can't convert toDouble value.")); + } } break; case 3: diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index ed357e92a..7f305494c 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -29,38 +29,37 @@ namespace Ui { class DialogIncrements; } -class DialogIncrements : public DialogTool -{ +class DialogIncrements : public DialogTool{ Q_OBJECT public: - explicit DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0); - ~DialogIncrements(); + DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0); + ~DialogIncrements(); public slots: - void clickedToolButtonAdd(); - void clickedToolButtonRemove(); - void cellChanged ( qint32 row, qint32 column ); - void FullUpdateFromFile(); - virtual void DialogAccepted(); + void clickedToolButtonAdd(); + void clickedToolButtonRemove(); + void cellChanged ( qint32 row, qint32 column ); + void FullUpdateFromFile(); + virtual void DialogAccepted(); signals: - void FullUpdateTree(); - void haveLiteChange(); + void FullUpdateTree(); + void haveLiteChange(); private: Q_DISABLE_COPY(DialogIncrements) Ui::DialogIncrements *ui; - VContainer *data; // need because we must change data - VDomDocument *doc; - void InitialStandartTable(); - void InitialIncrementTable(); - void InitialLinesTable(); - void InitialSplinesTable(); - void InitialArcsTable(); - void FillStandartTable(); - void FillIncrementTable(); - void FillLengthLines(); - void FillLengthSplines(); - void FillLengthArcs(); - void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth, - QString description); + VContainer *data; // need because we must change data + VDomDocument *doc; + void InitialStandartTable(); + void InitialIncrementTable(); + void InitialLinesTable(); + void InitialSplinesTable(); + void InitialArcsTable(); + void FillStandartTable(); + void FillIncrementTable(); + void FillLengthLines(); + void FillLengthSplines(); + void FillLengthArcs(); + void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth, + QString description); }; #endif // DIALOGINCREMENTS_H diff --git a/widgets/doubledelegate.cpp b/widgets/doubledelegate.cpp index 3b0932624..0f81b6785 100644 --- a/widgets/doubledelegate.cpp +++ b/widgets/doubledelegate.cpp @@ -53,10 +53,8 @@ { } - QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, - const QStyleOptionViewItem &/* option */, - const QModelIndex &/* index */) const - { + QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, + const QModelIndex &/* index */) const{ QDoubleSpinBox *editor = new QDoubleSpinBox(parent); editor->setMinimum(-1000.0); editor->setMaximum(1000.0); @@ -64,18 +62,15 @@ return editor; } - void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, - const QModelIndex &index) const - { - int value = index.model()->data(index, Qt::EditRole).toInt(); + void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const{ + qreal value = index.model()->data(index, Qt::EditRole).toDouble(); QDoubleSpinBox *spinBox = static_cast(editor); spinBox->setValue(value); } void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const - { + const QModelIndex &index) const{ QDoubleSpinBox *spinBox = static_cast(editor); spinBox->interpretText(); qreal value = spinBox->value(); @@ -84,7 +79,6 @@ } void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, const QModelIndex &/* index */) const - { + const QStyleOptionViewItem &option, const QModelIndex &/* index */) const{ editor->setGeometry(option.rect); } diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index d31f9b486..2de1c97b2 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -374,7 +374,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); bool ok = false; QString parametr = GetParametrString(domElement, name); - qreal param = parametr.toDouble(&ok); + qreal param = parametr.replace(",", ".").toDouble(&ok); if(ok == false){ throw VExceptionConversionError(tr("Can't convert toDouble parameter"), name); } From 517e754efd8a98db15e8683d8a3e64fac0f73eee Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 14:42:14 +0300 Subject: [PATCH 27/70] List of lengths of arc and curves in table of variables. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 4 ++++ widgets/vmaingraphicsview.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index c877ef145..19f981d4b 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -34,6 +34,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget InitialStandartTable(); InitialIncrementTable(); InitialLinesTable(); + InitialSplinesTable(); + InitialArcsTable(); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); @@ -41,6 +43,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget FillStandartTable(); FillIncrementTable(); FillLengthLines(); + FillLengthSplines(); + FillLengthArcs(); connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index d07bcc501..ca232aa95 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -78,6 +78,9 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress){ QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag); QGraphicsView::mousePressEvent(mousePress); break; + default: + QGraphicsView::mousePressEvent(mousePress); + break; } } } From 23a7efbc6aacef5d2be522fbe711d928f048f807 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 14:49:01 +0300 Subject: [PATCH 28/70] The main window is maximized after start application. --HG-- branch : develop --- main.cpp | 1 + mainwindow.ui | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 6ed51ac57..5f8fea974 100644 --- a/main.cpp +++ b/main.cpp @@ -60,6 +60,7 @@ int main(int argc, char *argv[]){ app.installTranslator(&appTranslator); MainWindow w; + w.setWindowState(w.windowState() ^ Qt::WindowMaximized); app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png")); TableWindow table; QObject::connect(&w, &MainWindow::ModelChosen, &table, &TableWindow::ModelChosen); diff --git a/mainwindow.ui b/mainwindow.ui index 5a99c2733..b842a4655 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -303,7 +303,7 @@ 0 0 - 137 + 150 58 @@ -379,7 +379,7 @@ 0 0 - 137 + 150 58 From 1f89b0038a78847fac33deb37d6984c0629a417b Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 15:18:42 +0300 Subject: [PATCH 29/70] Changed max and min value for double spin box in table of variables. --HG-- branch : develop --- widgets/doubledelegate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets/doubledelegate.cpp b/widgets/doubledelegate.cpp index 0f81b6785..c1f5ba564 100644 --- a/widgets/doubledelegate.cpp +++ b/widgets/doubledelegate.cpp @@ -56,8 +56,8 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const{ QDoubleSpinBox *editor = new QDoubleSpinBox(parent); - editor->setMinimum(-1000.0); - editor->setMaximum(1000.0); + editor->setMinimum(-10000.0); + editor->setMaximum(10000.0); return editor; } From 33a98de0d167d9f8630e47612e18977a2b320eaa Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 15:22:19 +0300 Subject: [PATCH 30/70] Send signal haveLiteChange when add or remove row in table. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 19f981d4b..38266a883 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -315,6 +315,7 @@ void DialogIncrements::clickedToolButtonAdd(){ ui->toolButtonRemove->setEnabled(true); connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); + emit haveLiteChange(); } void DialogIncrements::clickedToolButtonRemove(){ @@ -336,6 +337,7 @@ void DialogIncrements::clickedToolButtonRemove(){ } connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); + emit haveLiteChange(); } void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, From 900261cb7f9553737f4c9f8e1e7b1af0c46ac6d4 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 15:57:04 +0300 Subject: [PATCH 31/70] For tool point along line default type of line is "no line". --HG-- branch : develop --- dialogs/dialogalongline.cpp | 1 + dialogs/dialogalongline.h | 2 +- dialogs/dialogtool.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index 3765cde10..aa66b467a 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -46,6 +46,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected); FillComboBoxTypeLine(ui->comboBoxLineType); + ui->comboBoxLineType->setCurrentIndex(1); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index 3f004fb52..200d4168a 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -48,7 +48,7 @@ public: void setSecondPointId(const qint64 &value, const qint64 &id); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogAlongLine) Ui::DialogAlongLine *ui; diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index a347196d3..37e459821 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -92,6 +92,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{ } void DialogTool::FillComboBoxTypeLine(QComboBox *box) const{ + Q_ASSERT(box != 0); QStringList list; list<addItems(list); From 4552f887db25fc94bbdb96595dafd3a73fd8cf0b Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 17:44:33 +0300 Subject: [PATCH 32/70] Replaced Q_CHECK_PRT on Q_ASSERT. --HG-- branch : develop --- dialogs/dialogarc.cpp | 4 +- dialogs/dialoglineintersect.cpp | 2 +- dialogs/dialogtool.cpp | 80 +++++++++++++-------------- mainwindow.cpp | 2 +- tablewindow.cpp | 8 +-- tools/drawTools/vdrawtool.h | 4 +- tools/drawTools/vtoolline.cpp | 8 +-- tools/modelingTools/vmodelingline.cpp | 4 +- tools/nodeDetails/vnodearc.cpp | 2 +- tools/nodeDetails/vnodepoint.cpp | 2 +- tools/nodeDetails/vnodesplinepath.cpp | 2 +- tools/vtooldetail.cpp | 32 +++++------ xml/vdomdocument.cpp | 34 ++++++------ 13 files changed, 90 insertions(+), 94 deletions(-) diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index 739e4e76e..bfefe9037 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -197,7 +197,7 @@ void DialogArc::F2Changed(){ } void DialogArc::CheckState(){ - Q_CHECK_PTR(bOk); + Q_ASSERT(bOk != 0); bOk->setEnabled(flagRadius && flagF1 && flagF2); } @@ -221,7 +221,7 @@ void DialogArc::ShowLineAngles(){ ui->listWidget->clear(); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); const QHash *lineAnglesTable = data->DataLineAngles(); - Q_CHECK_PTR(lineAnglesTable); + Q_ASSERT(lineAnglesTable != 0); QHashIterator i(*lineAnglesTable); while (i.hasNext()) { i.next(); diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 3388a331e..260f4cc7d 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -158,7 +158,7 @@ void DialogLineIntersect::P2Line2Changed(int index){ } void DialogLineIntersect::CheckState(){ - Q_CHECK_PTR(bOk); + Q_ASSERT(bOk != 0); bOk->setEnabled(flagName && flagPoint); } diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 37e459821..75beca0a6 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -31,7 +31,7 @@ DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), idDetail(0), mode(mode){ - Q_CHECK_PTR(data); + Q_ASSERT(data != 0); timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); } @@ -136,8 +136,8 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const{ } void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){ - Q_CHECK_PTR(lineEdit); - Q_CHECK_PTR(listWidget); + Q_ASSERT(lineEdit != 0); + Q_ASSERT(listWidget != 0); QListWidgetItem *item = listWidget->currentItem(); QString val = item->text(); lineEdit->setText(lineEdit->text().append(val)); @@ -145,9 +145,9 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){ } void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ - Q_CHECK_PTR(edit); - Q_CHECK_PTR(timer); - Q_CHECK_PTR(labelEditFormula); + Q_ASSERT(edit != 0); + Q_ASSERT(timer != 0); + Q_ASSERT(labelEditFormula != 0); if(edit->text().isEmpty()){ flag = false; CheckState(); @@ -160,10 +160,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ } void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label){ - Q_CHECK_PTR(edit); - Q_CHECK_PTR(timer); - Q_CHECK_PTR(label); - Q_CHECK_PTR(labelEditFormula); + Q_ASSERT(edit != 0); + Q_ASSERT(timer != 0); + Q_ASSERT(label != 0); + Q_ASSERT(labelEditFormula != 0); QPalette palette = labelEditFormula->palette(); if(edit->text().isEmpty()){ flag = false; @@ -189,14 +189,14 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const{ - Q_CHECK_PTR(box); + Q_ASSERT(box != 0); FillComboBoxPoints(box, id); pointId = value; ChangeCurrentData(box, value); } qint64 DialogTool::getCurrentPointId(QComboBox *box) const{ - Q_CHECK_PTR(box); + Q_ASSERT(box != 0); qint32 index = box->currentIndex(); Q_ASSERT(index != -1); if(index != -1){ @@ -207,7 +207,7 @@ qint64 DialogTool::getCurrentPointId(QComboBox *box) const{ } void DialogTool::CheckState(){ - Q_CHECK_PTR(bOk); + Q_ASSERT(bOk != 0); bOk->setEnabled(flagFormula && flagName); } @@ -218,7 +218,7 @@ void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){ } void DialogTool::NamePointChanged(){ - Q_CHECK_PTR(labelEditNamePoint); + Q_ASSERT(labelEditNamePoint != 0); QLineEdit* edit = qobject_cast(sender()); if (edit){ QString name = edit->text(); @@ -253,48 +253,48 @@ void DialogTool::FormulaChanged(){ } void DialogTool::ArrowUp(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(90); } void DialogTool::ArrowDown(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(270); } void DialogTool::ArrowLeft(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(180); } void DialogTool::ArrowRight(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(0); } void DialogTool::ArrowLeftUp(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(135); } void DialogTool::ArrowLeftDown(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(225); } void DialogTool::ArrowRightUp(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(45); } void DialogTool::ArrowRightDown(){ - Q_CHECK_PTR(spinBoxAngle); + Q_ASSERT(spinBoxAngle != 0); spinBoxAngle->setValue(315); } void DialogTool::EvalFormula(){ - Q_CHECK_PTR(lineEditFormula); - Q_CHECK_PTR(labelResultCalculation); + Q_ASSERT(lineEditFormula != 0); + Q_ASSERT(labelResultCalculation != 0); Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation); } @@ -327,21 +327,21 @@ void DialogTool::PutHere(){ } void DialogTool::PutVal(QListWidgetItem *item){ - Q_CHECK_PTR(lineEditFormula); + Q_ASSERT(lineEditFormula != 0); QString val = item->text(); lineEditFormula->setText(lineEditFormula->text().append(val)); lineEditFormula->setFocus(); } void DialogTool::ValChenged(int row){ - Q_CHECK_PTR(listWidget); - Q_CHECK_PTR(labelDescription); - Q_CHECK_PTR(radioButtonSizeGrowth); - Q_CHECK_PTR(radioButtonStandartTable); - Q_CHECK_PTR(radioButtonIncrements); - Q_CHECK_PTR(radioButtonLengthLine); - Q_CHECK_PTR(radioButtonLengthArc); - Q_CHECK_PTR(radioButtonLengthCurve); + Q_ASSERT(listWidget != 0); + Q_ASSERT(labelDescription != 0); + Q_ASSERT(radioButtonSizeGrowth != 0); + Q_ASSERT(radioButtonStandartTable != 0); + Q_ASSERT(radioButtonIncrements != 0); + Q_ASSERT(radioButtonLengthLine != 0); + Q_ASSERT(radioButtonLengthArc != 0); + Q_ASSERT(radioButtonLengthCurve != 0); if(listWidget->count() == 0){ return; } @@ -392,12 +392,12 @@ void DialogTool::ValChenged(int row){ } void DialogTool::UpdateList(){ - Q_CHECK_PTR(radioButtonSizeGrowth); - Q_CHECK_PTR(radioButtonStandartTable); - Q_CHECK_PTR(radioButtonIncrements); - Q_CHECK_PTR(radioButtonLengthLine); - Q_CHECK_PTR(radioButtonLengthArc); - Q_CHECK_PTR(radioButtonLengthCurve); + Q_ASSERT(radioButtonSizeGrowth != 0); + Q_ASSERT(radioButtonStandartTable != 0); + Q_ASSERT(radioButtonIncrements != 0); + Q_ASSERT(radioButtonLengthLine != 0); + Q_ASSERT(radioButtonLengthArc != 0); + Q_ASSERT(radioButtonLengthCurve != 0); if(radioButtonSizeGrowth->isChecked()){ ShowVariable(data->DataBase()); @@ -429,7 +429,7 @@ bool DialogTool::CheckObject(const qint64 &id){ template void DialogTool::ShowVariable(const QHash *var){ - Q_CHECK_PTR(listWidget); + Q_ASSERT(listWidget != 0); disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->clear(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 84ebd4500..1bd08ccd2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -234,7 +234,7 @@ void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool const qint64 &idDetail){ QHash* tools = doc->getTools(); VToolDetail *det = qobject_cast(tools->value(idDetail)); - Q_CHECK_PTR(det); + Q_ASSERT(det != 0); det->AddTool(tool, id, typeTool); } diff --git a/tablewindow.cpp b/tablewindow.cpp index 3189b9845..bf9c4d9a7 100644 --- a/tablewindow.cpp +++ b/tablewindow.cpp @@ -141,7 +141,7 @@ void TableWindow::StopTable(){ } void TableWindow::saveScene(){ - QString name = QFileDialog::getSaveFileName(0, "Зберегти розкладку", "", "Images (*.png);;Svg files (*.svg)"); + QString name = QFileDialog::getSaveFileName(0, tr("Save layout"), "", "Images (*.png);;Svg files (*.svg)"); if(name.isNull()){ return; } @@ -149,12 +149,11 @@ void TableWindow::saveScene(){ QBrush *brush = new QBrush(); brush->setColor( QColor( Qt::white ) ); currentScene->setBackgroundBrush( *brush ); - currentScene->clearSelection(); // Selections would also render to the file + currentScene->clearSelection(); // Selections would also render to the file shadowPaper->setBrush(QBrush(Qt::white)); shadowPaper->setPen(QPen(Qt::white, 0.1)); paper->setPen(QPen(Qt::white, 0.1)); paper->setBrush(QBrush(Qt::white)); - currentScene->setSceneRect(QRectF(10,10,590,590)); currentScene->setSceneRect(currentScene->itemsBoundingRect()); QFileInfo fi(name); @@ -163,9 +162,6 @@ void TableWindow::saveScene(){ } else if(fi.suffix() == "png"){ PngFile(name); } -// if(name.indexOf(".svg",name.size()-4)<0){ -// name.append(".svg"); -// } brush->setColor( QColor( Qt::gray ) ); brush->setStyle( Qt::SolidPattern ); diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 5235452f1..15415bed2 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -47,8 +47,8 @@ protected: template void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true){ - Q_CHECK_PTR(tool); - Q_CHECK_PTR(event); + Q_ASSERT(tool != 0); + Q_ASSERT(event != 0); if(!ignoreContextMenuEvent){ QMenu menu; QAction *actionOption = menu.addAction(tr("Options")); diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 7c84cf2db..760c273b6 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -54,9 +54,9 @@ void VToolLine::Create(QSharedPointer &dialog, VMainGraphicsScene *s void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ - Q_CHECK_PTR(scene); - Q_CHECK_PTR(doc); - Q_CHECK_PTR(data); + Q_ASSERT(scene != 0); + Q_ASSERT(doc != 0); + Q_ASSERT(data != 0); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->getNextId(); @@ -70,7 +70,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 VDrawTool::AddRecord(id, Tool::LineTool, doc); if(parse == Document::FullParse){ VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); - Q_CHECK_PTR(line); + Q_ASSERT(line != 0); scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index 911906f67..61e8fb159 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -55,8 +55,8 @@ VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VModelingLine *line = 0; - Q_CHECK_PTR(doc); - Q_CHECK_PTR(data); + Q_ASSERT(doc != 0); + Q_ASSERT(data != 0); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->getNextId(); diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index ea755e7f5..a7f6913a6 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -38,7 +38,7 @@ void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idA Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ if(parse == Document::FullParse){ VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); - Q_CHECK_PTR(arc); + Q_ASSERT(arc != 0); doc->AddTool(id, arc); doc->IncrementReferens(idArc); } else { diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index 21426313f..0d8355e8f 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -43,7 +43,7 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){ if(parse == Document::FullParse){ VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); - Q_CHECK_PTR(point); + Q_ASSERT(point != 0); doc->AddTool(id, point); doc->IncrementReferens(idPoint); } else { diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index 493f5a397..f476cb11a 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -40,7 +40,7 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin Tool::Sources typeCreation){ if(parse == Document::FullParse){ VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation); - Q_CHECK_PTR(splPath); + Q_ASSERT(splPath != 0); doc->AddTool(id, splPath); VSplinePath path = data->GetModelingSplinePath(id); const QVector *points = path.GetPoint(); diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index c69be08b0..8f113e39b 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -31,40 +31,40 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, sceneDetails(scene){ VDetail detail = data->GetDetail(id); QHash* tools = doc->getTools(); - Q_CHECK_PTR(tools); + Q_ASSERT(tools != 0); for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ case(Tool::NodePoint):{ VNodePoint *point = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(point); + Q_ASSERT(point != 0); connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); point->setParentItem(this); break; } case(Tool::NodeArc):{ VNodeArc *arc = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(arc); + Q_ASSERT(arc != 0); connect(arc, &VNodeArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); arc->setParentItem(this); break; } case(Tool::NodeSpline):{ VNodeSpline *spl = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(spl); + Q_ASSERT(spl != 0); connect(spl, &VNodeSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); spl->setParentItem(this); break; } case(Tool::NodeSplinePath):{ VNodeSplinePath *splPath = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(splPath); + Q_ASSERT(splPath != 0); connect(splPath, &VNodeSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); splPath->setParentItem(this); break; } case(Tool::AlongLineTool):{ VModelingAlongLine *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -72,7 +72,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::ArcTool):{ VModelingArc *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -80,7 +80,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::BisectorTool):{ VModelingBisector *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -88,7 +88,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::EndLineTool):{ VModelingEndLine *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingEndLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingEndLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -96,7 +96,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::LineIntersectTool):{ VModelingLineIntersect *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -104,7 +104,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::LineTool):{ VModelingLine *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -112,7 +112,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::NormalTool):{ VModelingNormal *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -120,7 +120,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::PointOfContact):{ VModelingPointOfContact *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -128,7 +128,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::ShoulderPointTool):{ VModelingShoulderPoint *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -136,7 +136,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::SplinePathTool):{ VModelingSplinePath *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); @@ -144,7 +144,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, } case(Tool::SplineTool):{ VModelingSpline *tool = qobject_cast(tools->value(detail[i].getId())); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); connect(tool, &VModelingSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(tool, &VModelingSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); tool->setParentItem(this); diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 2de1c97b2..87942ff27 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -262,8 +262,8 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail){ - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); + Q_ASSERT(sceneDraw != 0); + Q_ASSERT(sceneDetail != 0); if(parse == Document::FullParse){ TestUniqueId(); data->Clear(); @@ -429,8 +429,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode& node, const Document::Documents &parse, Draw::Draws mode){ - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); + Q_ASSERT(sceneDraw != 0); + Q_ASSERT(sceneDetail != 0); VMainGraphicsScene *scene = 0; if(mode == Draw::Calculation){ scene = sceneDraw; @@ -464,7 +464,7 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, const Document::Documents &parse){ - Q_CHECK_PTR(sceneDetail); + Q_ASSERT(sceneDetail != 0); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try{ VDetail detail; @@ -543,7 +543,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, const Document::Documents &parse){ - Q_CHECK_PTR(sceneDetail); + Q_ASSERT(sceneDetail != 0); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); QDomNode domNode = domElement.firstChild(); while(!domNode.isNull()){ @@ -562,7 +562,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, const Document::Documents &parse, const QString& type, Draw::Draws mode){ - Q_CHECK_PTR(scene); + Q_ASSERT(scene != 0); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty"); if(type == "single"){ @@ -581,7 +581,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen } if(parse == Document::FullParse){ VToolSinglePoint *spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); - Q_CHECK_PTR(spoint); + Q_ASSERT(spoint != 0); scene->addItem(spoint); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); tools[id] = spoint; @@ -809,7 +809,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, Draw::Draws mode){ - Q_CHECK_PTR(scene); + Q_ASSERT(scene != 0); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); try{ qint64 id = GetParametrId(domElement); @@ -833,7 +833,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type, Draw::Draws mode){ - Q_CHECK_PTR(scene); + Q_ASSERT(scene != 0); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); if(type == "simple"){ @@ -956,7 +956,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse, const QString &type, Draw::Draws mode){ - Q_CHECK_PTR(scene); + Q_ASSERT(scene != 0); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); if(type == "simple"){ @@ -1011,7 +1011,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement void VDomDocument::FullUpdateTree(){ VMainGraphicsScene *scene = new VMainGraphicsScene(); - Q_CHECK_PTR(scene); + Q_ASSERT(scene != 0); try{ data->ClearObject(); Parse(Document::LiteParse, scene, scene); @@ -1088,28 +1088,28 @@ void VDomDocument::setCurrentData(){ void VDomDocument::AddTool(const qint64 &id, VDataTool *tool){ Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); tools.insert(id, tool); } void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data){ Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(data); + Q_ASSERT(data != 0); VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); tool->VDataTool::setData(data); } void VDomDocument::IncrementReferens(qint64 id) const{ Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); tool->incrementReferens(); } void VDomDocument::DecrementReferens(qint64 id) const{ Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); + Q_ASSERT(tool != 0); tool->decrementReferens(); } From 90207bd92682219b89e477809b8e07b33c7d1e76 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 19:18:08 +0300 Subject: [PATCH 33/70] Insert value of variable after cursor in line edit. --HG-- branch : develop --- container/vcontainer.cpp | 2 ++ dialogs/dialogtool.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 9d89dd1b6..f5ef78bc7 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -217,6 +217,8 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ } } break; + case(Tool::SplineTool): + break;//Nothing to do, just ignore. default: qWarning()<<"Get wrong tool type. Ignore."<currentItem(); - QString val = item->text(); - lineEdit->setText(lineEdit->text().append(val)); + int pos = lineEdit->cursorPosition(); + lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); lineEdit->setFocus(); + lineEdit->setCursorPosition(pos + item->text().size()); } void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ @@ -328,9 +329,12 @@ void DialogTool::PutHere(){ void DialogTool::PutVal(QListWidgetItem *item){ Q_ASSERT(lineEditFormula != 0); - QString val = item->text(); - lineEditFormula->setText(lineEditFormula->text().append(val)); + Q_ASSERT(item != 0); + int pos = lineEditFormula->cursorPosition(); + lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(), + item->text())); lineEditFormula->setFocus(); + lineEditFormula->setCursorPosition(pos + item->text().size()); } void DialogTool::ValChenged(int row){ From c94e939149e7b2ac8bd2df7069220e2d47d5e013 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 15 Oct 2013 12:26:47 +0300 Subject: [PATCH 34/70] Show value of variable in 0 row of list of variables. --HG-- branch : develop --- dialogs/dialogtool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 4d2424539..c0f9012b8 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -451,8 +451,8 @@ void DialogTool::ShowVariable(const QHash *var){ item->setFont(QFont("Times", 12, QFont::Bold)); listWidget->addItem(item); } - listWidget->setCurrentRow (0); connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); + listWidget->setCurrentRow (0); } qint64 DialogTool::getIdDetail() const{ From 11b7c6a1f0a6a8c3a32815ef2f83e74100a9e8ac Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 15 Oct 2013 13:20:34 +0300 Subject: [PATCH 35/70] In table of increments select next cell in this row after end of editing previous. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 11 ++++++++++- dialogs/dialogincrements.h | 2 ++ dialogs/dialogincrements.ui | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 38266a883..421909f04 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -29,7 +29,8 @@ #include "exception/vexception.h" DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) : - DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc){ + DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), + row(0), column(0){ ui->setupUi(this); InitialStandartTable(); InitialIncrementTable(); @@ -58,6 +59,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogIncrements::DialogAccepted); + ui->tabWidget->setCurrentIndex(0); } void DialogIncrements::FillStandartTable(){ @@ -155,6 +157,7 @@ void DialogIncrements::FillIncrementTable(){ ui->tableWidgetIncrement->resizeColumnsToContents(); ui->tableWidgetIncrement->resizeRowsToContents(); ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); + ui->tableWidgetIncrement->setCurrentCell( row, column ); } void DialogIncrements::FillLengthLines(){ @@ -377,6 +380,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ QTableWidgetItem *itemName = 0; qint64 id; QDomElement domElement; + this->row = row; switch(column) { case 0: item = ui->tableWidgetIncrement->item(row, 0); @@ -385,6 +389,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ if(domElement.isElement()){ domElement.setAttribute("name", item->text()); data->ClearIncrementTable(); + this->column = 2; emit FullUpdateTree(); } break; @@ -398,6 +403,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ qreal value = item->text().toDouble(&ok); if(ok){ domElement.setAttribute("base", value); + this->column = 3; emit FullUpdateTree(); } else { throw VException(tr("Can't convert toDouble value.")); @@ -411,6 +417,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ domElement.setAttribute("ksize", item->text().toDouble()); + this->column = 4; emit FullUpdateTree(); } break; @@ -421,6 +428,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ domElement.setAttribute("kgrowth", item->text().toDouble()); + this->column = 5; emit FullUpdateTree(); } break; @@ -434,6 +442,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text()); incr.setDescription(item->text()); data->UpdateIncrementTableRow(itemName->text(), incr); + ui->tableWidgetIncrement->setCurrentCell( row, 0 ); emit haveLiteChange(); } break; diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index 7f305494c..e5ac8262a 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -48,6 +48,8 @@ private: Ui::DialogIncrements *ui; VContainer *data; // need because we must change data VDomDocument *doc; + qint32 row; + qint32 column; void InitialStandartTable(); void InitialIncrementTable(); void InitialLinesTable(); diff --git a/dialogs/dialogincrements.ui b/dialogs/dialogincrements.ui index a76b4ca69..1917246a3 100644 --- a/dialogs/dialogincrements.ui +++ b/dialogs/dialogincrements.ui @@ -27,7 +27,7 @@ QTabWidget::North - 4 + 0 From eb03e8165e6aabb9b5cb2adde38eb5f6f8339eff Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 15 Oct 2013 14:01:36 +0300 Subject: [PATCH 36/70] Sorting by name for length of lines, curves and arcs. New aligment for name of length of curves. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 421909f04..b12414859 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -162,8 +162,16 @@ void DialogIncrements::FillIncrementTable(){ void DialogIncrements::FillLengthLines(){ const QHash *linesTable = data->DataLengthLines(); + QHashIterator iHash(*linesTable); + QMap map; + //Sorting QHash by name + while (iHash.hasNext()) { + iHash.next(); + map.insert(iHash.key(), iHash.value()); + } + qint32 currentRow = -1; - QHashIterator i(*linesTable); + QMapIterator i(map); while (i.hasNext()) { i.next(); qreal length = i.value(); @@ -186,8 +194,16 @@ void DialogIncrements::FillLengthLines(){ void DialogIncrements::FillLengthSplines(){ const QHash *splinesTable = data->DataLengthSplines(); + QHashIterator iHash(*splinesTable); + QMap map; + //Sorting QHash by name + while (iHash.hasNext()) { + iHash.next(); + map.insert(iHash.key(), iHash.value()); + } + qint32 currentRow = -1; - QHashIterator i(*splinesTable); + QMapIterator i(map); while (i.hasNext()) { i.next(); qreal length = i.value(); @@ -195,7 +211,7 @@ void DialogIncrements::FillLengthSplines(){ ui->tableWidgetSplines->setRowCount ( splinesTable->size() ); QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); - item->setTextAlignment(Qt::AlignHCenter); + item->setTextAlignment(Qt::AlignLeft); item->setFont(QFont("Times", 12, QFont::Bold)); ui->tableWidgetSplines->setItem(currentRow, 0, item); @@ -210,8 +226,16 @@ void DialogIncrements::FillLengthSplines(){ void DialogIncrements::FillLengthArcs(){ const QHash *arcsTable = data->DataLengthArcs(); + QHashIterator iHash(*arcsTable); + QMap map; + //Sorting QHash by name + while (iHash.hasNext()) { + iHash.next(); + map.insert(iHash.key(), iHash.value()); + } + qint32 currentRow = -1; - QHashIterator i(*arcsTable); + QMapIterator i(map); while (i.hasNext()) { i.next(); qreal length = i.value(); From 2fffdecc866b1d72da5855879ce14bdede87dbe8 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 16 Oct 2013 12:17:34 +0300 Subject: [PATCH 37/70] Zooming points, line and label of points after zooming scene. --HG-- branch : develop --- mainwindow.cpp | 2 + options.h | 2 +- tools/drawTools/vdrawtool.cpp | 8 ++++ tools/drawTools/vdrawtool.h | 2 + tools/drawTools/vtoolalongline.cpp | 6 +++ tools/drawTools/vtoolalongline.h | 1 + tools/drawTools/vtoolarc.cpp | 22 +++++++--- tools/drawTools/vtoolarc.h | 41 +++++++++-------- tools/drawTools/vtoolbisector.cpp | 6 +++ tools/drawTools/vtoolbisector.h | 1 + tools/drawTools/vtoolendline.cpp | 3 +- tools/drawTools/vtoolline.cpp | 42 ++++++++++++------ tools/drawTools/vtoolline.h | 18 ++++---- tools/drawTools/vtoollineintersect.cpp | 18 +++++--- tools/drawTools/vtoollineintersect.h | 46 +++++++++----------- tools/drawTools/vtoollinepoint.cpp | 14 ++++-- tools/drawTools/vtoollinepoint.h | 1 + tools/drawTools/vtoolnormal.cpp | 20 ++++++--- tools/drawTools/vtoolnormal.h | 41 ++++++++--------- tools/drawTools/vtoolpoint.cpp | 35 ++++++++++----- tools/drawTools/vtoolpoint.h | 1 + tools/drawTools/vtoolpointofcontact.cpp | 12 +++-- tools/drawTools/vtoolpointofcontact.h | 44 ++++++++++--------- tools/drawTools/vtoolshoulderpoint.cpp | 10 ++++- tools/drawTools/vtoolshoulderpoint.h | 45 +++++++++---------- tools/drawTools/vtoolsinglepoint.cpp | 5 +++ tools/drawTools/vtoolsinglepoint.h | 1 + tools/drawTools/vtoolspline.cpp | 23 +++++++--- tools/drawTools/vtoolspline.h | 53 +++++++++++----------- tools/drawTools/vtoolsplinepath.cpp | 23 +++++++--- tools/drawTools/vtoolsplinepath.h | 58 ++++++++++++------------- widgets/vgraphicssimpletextitem.cpp | 10 ++++- widgets/vgraphicssimpletextitem.h | 6 ++- widgets/vmaingraphicsscene.cpp | 9 +++- widgets/vmaingraphicsscene.h | 3 ++ widgets/vmaingraphicsview.cpp | 1 + widgets/vmaingraphicsview.h | 1 + xml/vdomdocument.cpp | 1 + 38 files changed, 386 insertions(+), 249 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 1bd08ccd2..19ae78c59 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -62,6 +62,7 @@ MainWindow::MainWindow(QWidget *parent) : view = new VMainGraphicsView(); ui->LayoutView->addWidget(view); view->setScene(currentScene); + connect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor); QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); policy.setHorizontalStretch(12); view->setSizePolicy(policy); @@ -162,6 +163,7 @@ void MainWindow::ActionNewDraw(){ VToolSinglePoint *spoint = new VToolSinglePoint(doc, data, id, Tool::FromGui); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); + connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); QHash* tools = doc->getTools(); tools->insert(id, spoint); VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); diff --git a/options.h b/options.h index d2620f3dd..1d04de588 100644 --- a/options.h +++ b/options.h @@ -28,7 +28,7 @@ #define PaperSize 50000 #define toPixel(mm) ((mm / 25.4) * PrintDPI) #define toMM(pix) ((pix / PrintDPI) * 25.4) -#define widthMainLine toPixel(0.8) +#define widthMainLine toPixel(1.2) #define widthHairLine widthMainLine/3 namespace Scene{ diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index 89164341b..197d800b9 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -22,6 +22,8 @@ #include "vdrawtool.h" #include +qreal VDrawTool::factor = 1; + VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) : VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), nameActivDraw(doc->GetNameActivDraw()){ @@ -78,6 +80,12 @@ void VDrawTool::ChangedNameDraw(const QString oldName, const QString newName){ } } +void VDrawTool::SetFactor(qreal factor){ + if(factor <= 2 && factor >= 0.5){ + this->factor = factor; + } +} + void VDrawTool::AddToCalculation(const QDomElement &domElement){ QDomElement calcElement; bool ok = doc->GetActivCalculationElement(calcElement); diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 15415bed2..91a7a4527 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -38,11 +38,13 @@ public slots: virtual void ChangedActivDraw(const QString newName); void ChangedNameDraw(const QString oldName, const QString newName); virtual void FullUpdateFromGui(int result)=0; + virtual void SetFactor(qreal factor); signals: void RemoveTool(QGraphicsItem *tool); protected: bool ignoreContextMenuEvent; QString nameActivDraw; + static qreal factor; void AddToCalculation(const QDomElement &domElement); template void ContextMenu(QSharedPointer &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index c7e9ee7e4..8d54e14bc 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -63,6 +63,11 @@ void VToolAlongLine::FullUpdateFromGui(int result){ dialogAlongLine.clear(); } +void VToolAlongLine::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogAlongLine, this, event); } @@ -145,6 +150,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS scene->addItem(point); connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolAlongLine::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(firstPointId); doc->IncrementReferens(secondPointId); diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index aede99661..ce02b8b30 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -42,6 +42,7 @@ public: public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index c85aba0da..a5e845d25 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -30,7 +30,7 @@ VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources path.addPath(arc.GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); @@ -126,14 +126,16 @@ void VToolArc::FullUpdateFromGui(int result){ void VToolArc::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); + currentColor = Qt::black; VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine)); + this->setPen(QPen(Qt::gray, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setAcceptHoverEvents (false); + currentColor = Qt::gray; VDrawTool::ChangedActivDraw(newName); } } @@ -141,15 +143,20 @@ void VToolArc::ChangedActivDraw(const QString newName){ void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ if(id == this->id){ if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine)); + this->setPen(QPen(baseColor, widthHairLine/factor)); currentColor = baseColor; } else { - this->setPen(QPen(color, widthHairLine)); + this->setPen(QPen(color, widthHairLine/factor)); currentColor = color; } } } +void VToolArc::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogArc, this, event); } @@ -177,12 +184,12 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); + this->setPen(QPen(currentColor, widthMainLine/factor)); } void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); + this->setPen(QPen(currentColor, widthHairLine/factor)); } void VToolArc::RemoveReferens(){ @@ -191,6 +198,7 @@ void VToolArc::RemoveReferens(){ } void VToolArc::RefreshGeometry(){ + this->setPen(QPen(currentColor, widthHairLine/factor)); VArc arc = VAbstractTool::data.GetArc(id); QPainterPath path; path.addPath(arc.GetPath()); diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index f78f26bbc..bca594770 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -30,31 +30,30 @@ class VToolArc :public VDrawTool, public QGraphicsPathItem{ Q_OBJECT public: - VToolArc(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, - const QString &f1, const QString &f2, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, + const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - virtual void ChangedActivDraw(const QString newName); - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void ChangedActivDraw(const QString newName); + virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogArc; - void RefreshGeometry(); + void RefreshGeometry(); }; #endif // VTOOLARC_H diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 02e4e5cb2..7e243a9f9 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -109,6 +109,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 scene->addItem(point); connect(point, &VToolBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolBisector::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(firstPointId); doc->IncrementReferens(secondPointId); @@ -145,6 +146,11 @@ void VToolBisector::FullUpdateFromGui(int result){ dialogBisector.clear(); } +void VToolBisector::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogBisector, this, event); } diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index 1c88f670d..3a982bbc1 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -44,6 +44,7 @@ public: public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index c65e2ec9a..2e0d24abb 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -69,7 +69,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr QString errorMsg; qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ - line.setLength(result*PrintDPI/25.4); + line.setLength(toPixel(result)); line.setAngle(angle); qint64 id = _id; if(typeCreation == Tool::FromGui){ @@ -89,6 +89,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr scene->addItem(point); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(basePointId); } diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 760c273b6..7f4c07bd5 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -33,6 +33,7 @@ VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firs this->setFlag(QGraphicsItem::ItemStacksBehindParent, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); + this->setPen(QPen(Qt::black, widthHairLine/factor)); if(typeCreation == Tool::FromGui){ AddToFile(); @@ -74,6 +75,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor); doc->AddTool(id, line); doc->IncrementReferens(firstPoint); doc->IncrementReferens(secondPoint); @@ -81,14 +83,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 } void VToolLine::FullUpdateFromFile(){ - QDomElement domElement = doc->elementById(QString().setNum(id)); - if(domElement.isElement()){ - firstPoint = domElement.attribute("firstPoint", "").toLongLong(); - secondPoint = domElement.attribute("secondPoint", "").toLongLong(); - } - VPointF first = VAbstractTool::data.GetPoint(firstPoint); - VPointF second = VAbstractTool::data.GetPoint(secondPoint); - this->setLine(QLineF(first.toQPointF(), second.toQPointF())); + RefreshGeometry(); } void VToolLine::FullUpdateFromGui(int result){ @@ -106,23 +101,30 @@ void VToolLine::FullUpdateFromGui(int result){ void VToolLine::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ if(id == this->id){ if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine)); + this->setPen(QPen(baseColor, widthHairLine/factor)); currentColor = baseColor; } else { - this->setPen(QPen(color, widthHairLine)); + this->setPen(QPen(color, widthHairLine/factor)); currentColor = color; } } } +void VToolLine::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolLine::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setAcceptHoverEvents (true); + currentColor = Qt::black; VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine)); + this->setPen(QPen(Qt::gray, widthHairLine/factor)); this->setAcceptHoverEvents (false); + currentColor = Qt::gray; VDrawTool::ChangedActivDraw(newName); } } @@ -143,12 +145,12 @@ void VToolLine::AddToFile(){ void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); + this->setPen(QPen(currentColor, widthMainLine/factor)); } void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); + this->setPen(QPen(currentColor, widthHairLine/factor)); } void VToolLine::RemoveReferens(){ @@ -156,3 +158,15 @@ void VToolLine::RemoveReferens(){ doc->DecrementReferens(secondPoint); } +void VToolLine::RefreshGeometry(){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + firstPoint = domElement.attribute("firstPoint", "").toLongLong(); + secondPoint = domElement.attribute("secondPoint", "").toLongLong(); + } + VPointF first = VAbstractTool::data.GetPoint(firstPoint); + VPointF second = VAbstractTool::data.GetPoint(secondPoint); + this->setLine(QLineF(first.toQPointF(), second.toQPointF())); + this->setPen(QPen(currentColor, widthHairLine/factor)); +} + diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index a7b31824e..dab4b6d47 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -29,19 +29,20 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem{ Q_OBJECT public: - VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, + qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void ChangedActivDraw(const QString newName); virtual void FullUpdateFromGui(int result); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void SetFactor(qreal factor); protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void AddToFile(); @@ -52,6 +53,7 @@ private: qint64 firstPoint; qint64 secondPoint; QSharedPointer dialogLine; + void RefreshGeometry(); }; #endif // VTOOLLINE_H diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 35067c399..132013d5a 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -24,7 +24,8 @@ VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent): + const qint64 &p2Line2, Tool::Sources typeCreation, + QGraphicsItem *parent): VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2), dialogLineIntersect(QSharedPointer()){ if(typeCreation == Tool::FromGui){ @@ -57,8 +58,9 @@ void VToolLineIntersect::Create(QSharedPointer &dialog, VMa void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation){ VPointF p1Line1 = data->GetPoint(p1Line1Id); VPointF p2Line1 = data->GetPoint(p2Line1Id); VPointF p1Line2 = data->GetPoint(p1Line2Id); @@ -94,6 +96,7 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const scene->addItem(point); connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolLineIntersect::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(p1Line1Id); doc->IncrementReferens(p2Line1Id); @@ -129,6 +132,11 @@ void VToolLineIntersect::FullUpdateFromGui(int result){ dialogLineIntersect.clear(); } +void VToolLineIntersect::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); +} + void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogLineIntersect, this, event); } @@ -140,8 +148,8 @@ void VToolLineIntersect::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "lineIntersect"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "p1Line1", p1Line1); AddAttribute(domElement, "p2Line1", p2Line1); diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index 1c5b36cfd..90e4d07f6 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -28,34 +28,30 @@ class VToolLineIntersect:public VToolPoint{ Q_OBJECT public: - VToolLineIntersect(VDomDocument *doc, VContainer *data, - const qint64 &id, - const qint64 &p1Line1, - const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, - VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const qint64 &p1Line1Id, - const qint64 &p2Line1Id, const qint64 &p1Line2Id, - const qint64 &p2Line2Id, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, + const qint64 &p2Line2, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, + const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 p1Line1; - qint64 p2Line1; - qint64 p1Line2; - qint64 p2Line2; + qint64 p1Line1; + qint64 p2Line1; + qint64 p1Line2; + qint64 p2Line2; QSharedPointer dialogLineIntersect; }; diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index b7536c1ae..af55544d4 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -30,7 +30,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 QPointF point1 = data->GetPoint(basePointId).toQPointF(); QPointF point2 = data->GetPoint(id).toQPointF(); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); - mainLine->setPen(QPen(Qt::black, widthHairLine)); + mainLine->setPen(QPen(Qt::black, widthHairLine/factor)); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); if(typeLine == "none"){ mainLine->setVisible(false); @@ -41,15 +41,18 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 void VToolLinePoint::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - mainLine->setPen(QPen(Qt::black, widthHairLine)); + mainLine->setPen(QPen(Qt::black, widthHairLine/factor)); + currentColor = Qt::black; VToolPoint::ChangedActivDraw(newName); } else { - mainLine->setPen(QPen(Qt::gray, widthHairLine)); + mainLine->setPen(QPen(Qt::gray, widthHairLine/factor)); + currentColor = Qt::gray; VToolPoint::ChangedActivDraw(newName); } } void VToolLinePoint::RefreshGeometry(){ + mainLine->setPen(QPen(currentColor, widthHairLine/factor)); VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); QPointF point = VDrawTool::data.GetPoint(id).toQPointF(); QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF(); @@ -64,3 +67,8 @@ void VToolLinePoint::RefreshGeometry(){ void VToolLinePoint::RemoveReferens(){ doc->DecrementReferens(basePointId); } + +void VToolLinePoint::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} diff --git a/tools/drawTools/vtoollinepoint.h b/tools/drawTools/vtoollinepoint.h index a298bc5f1..3d82b33f5 100644 --- a/tools/drawTools/vtoollinepoint.h +++ b/tools/drawTools/vtoollinepoint.h @@ -32,6 +32,7 @@ public: const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); public slots: virtual void ChangedActivDraw(const QString newName); + virtual void SetFactor(qreal factor); protected: QString typeLine; QString formula; diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index b742c3fe7..0ae377eb0 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -21,8 +21,7 @@ #include "vtoolnormal.h" -VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, +VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent): VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), @@ -62,7 +61,8 @@ void VToolNormal::Create(QSharedPointer &dialog, VMainGraphicsScen void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation){ VPointF firstPoint = data->GetPoint(firstPointId); VPointF secondPoint = data->GetPoint(secondPointId); Calculator cal(data); @@ -70,7 +70,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ QPointF fPoint = VToolNormal::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - result*PrintDPI/25.4, angle); + toPixel(result), angle); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); @@ -89,6 +89,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 scene->addItem(point); connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolNormal::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(firstPointId); doc->IncrementReferens(secondPointId); @@ -112,7 +113,7 @@ void VToolNormal::FullUpdateFromFile(){ formula = domElement.attribute("length", ""); basePointId = domElement.attribute("firstPoint", "").toLongLong(); secondPointId = domElement.attribute("secondPoint", "").toLongLong(); - angle = domElement.attribute("angle", "").toInt(); + angle = domElement.attribute("angle", "").toDouble(); } RefreshGeometry(); } @@ -133,6 +134,11 @@ void VToolNormal::FullUpdateFromGui(int result){ dialogNormal.clear(); } +void VToolNormal::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogNormal, this, event); } @@ -144,8 +150,8 @@ void VToolNormal::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "normal"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 217328744..41bda6144 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -29,29 +29,30 @@ class VToolNormal : public VToolLinePoint { Q_OBJECT public: - VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString typeLine, const QString pointName, - const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); - static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const qreal &length, const qreal &angle = 0); + VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qreal &angle, const qint64 &firstPointId, + const qint64 &secondPointId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const QString typeLine, const QString pointName, + const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); + static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, + const qreal &angle = 0); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 secondPointId; + qint64 secondPointId; QSharedPointer dialogNormal; }; diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index afd581fd4..faf1daf03 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -28,12 +28,11 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), - QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){ + QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0){ namePoint = new VGraphicsSimpleTextItem(this); lineName = new QGraphicsLineItem(this); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); - this->setPen(QPen(Qt::black, widthHairLine)); this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); @@ -61,7 +60,7 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my){ void VToolPoint::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); namePoint->setFlag(QGraphicsItem::ItemIsMovable, true); @@ -69,10 +68,11 @@ void VToolPoint::ChangedActivDraw(const QString newName){ namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); namePoint->setBrush(QBrush(Qt::black)); namePoint->setAcceptHoverEvents(true); - lineName->setPen(QPen(Qt::black, widthHairLine)); + lineName->setPen(QPen(Qt::black, widthHairLine/factor)); + currentColor = Qt::black; VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine)); + this->setPen(QPen(Qt::gray, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setAcceptHoverEvents (false); namePoint->setFlag(QGraphicsItem::ItemIsMovable, false); @@ -80,7 +80,8 @@ void VToolPoint::ChangedActivDraw(const QString newName){ namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); namePoint->setBrush(QBrush(Qt::gray)); namePoint->setAcceptHoverEvents(false); - lineName->setPen(QPen(Qt::gray, widthHairLine)); + lineName->setPen(QPen(Qt::gray, widthHairLine/factor)); + currentColor = Qt::gray; VDrawTool::ChangedActivDraw(newName); } } @@ -88,15 +89,20 @@ void VToolPoint::ChangedActivDraw(const QString newName){ void VToolPoint::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ if(id == this->id){ if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine)); + this->setPen(QPen(baseColor, widthHairLine/factor)); currentColor = baseColor; } else { - this->setPen(QPen(color, widthHairLine)); + this->setPen(QPen(color, widthHairLine/factor)); currentColor = color; } } } +void VToolPoint::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); +} + void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ if(event->button() == Qt::LeftButton){ emit ChoosedTool(id, Scene::Point); @@ -106,21 +112,25 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); + this->setPen(QPen(currentColor, widthMainLine/factor)); } void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); + this->setPen(QPen(currentColor, widthHairLine/factor)); } void VToolPoint::RefreshPointGeometry(const VPointF &point){ - QRectF rec = QRectF(0, 0, radius*2, radius*2); + this->setPen(QPen(currentColor, widthHairLine/factor)); + QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor); rec.translate(-rec.center().x(), -rec.center().y()); this->setRect(rec); this->setPos(point.toQPointF()); disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); + QFont font = namePoint->font(); + font.setPointSize(static_cast(namePoint->FontSize()/factor)); + namePoint->setFont(font); namePoint->setText(point.name()); namePoint->setPos(QPointF(point.mx(), point.my())); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, @@ -131,9 +141,10 @@ void VToolPoint::RefreshPointGeometry(const VPointF &point){ void VToolPoint::RefreshLine(){ QRectF nameRec = namePoint->sceneBoundingRect(); QPointF p1, p2; - LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2); + LineIntersectCircle(QPointF(), radius/factor, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2); QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); lineName->setLine(QLineF(p1, pRec - scenePos())); + lineName->setPen(QPen(currentColor, widthHairLine/factor)); if(QLineF(p1, pRec - scenePos()).length() <= toPixel(4)){ lineName->setVisible(false); } else { diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index 4b740bd74..35b8f1abd 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -36,6 +36,7 @@ public slots: virtual void ChangedActivDraw(const QString newName); virtual void FullUpdateFromGui(int result) = 0; virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void SetFactor(qreal factor); protected: qreal radius; VGraphicsSimpleTextItem *namePoint; diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index 9cc003477..d4bf3d522 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -91,7 +91,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const QString errorMsg; qreal result = cal.eval(radius, &errorMsg); if(errorMsg.isEmpty()){ - QPointF fPoint = VToolPointOfContact::FindPoint(result*PrintDPI/25.4, centerP.toQPointF(), + QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP.toQPointF(), firstP.toQPointF(), secondP.toQPointF()); qint64 id = _id; if(typeCreation == Tool::FromGui){ @@ -115,6 +115,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const scene->addItem(point); connect(point, &VToolPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfContact::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(center); doc->IncrementReferens(firstPointId); @@ -149,6 +150,11 @@ void VToolPointOfContact::FullUpdateFromGui(int result){ dialogPointOfContact.clear(); } +void VToolPointOfContact::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); +} + void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogPointOfContact, this, event); } @@ -160,8 +166,8 @@ void VToolPointOfContact::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "pointOfContact"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "radius", radius); AddAttribute(domElement, "center", center); diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index 4ed8e0c97..049e6efbc 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -28,30 +28,32 @@ class VToolPointOfContact : public VToolPoint { public: - VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &radius, const qint64 ¢er, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, - const QPointF &secondPoint); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, - const qint64 &secondPointId, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &radius, const qint64 ¢er, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, + const QPointF &secondPoint); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const QString &radius, const qint64 ¢er, + const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - QString radius; - qint64 center; - qint64 firstPointId; - qint64 secondPointId; + QString radius; + qint64 center; + qint64 firstPointId; + qint64 secondPointId; QSharedPointer dialogPointOfContact; }; diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index 9e01ff4ec..4e3307a51 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -117,6 +117,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const scene->addItem(point); connect(point, &VToolShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolShoulderPoint::SetFactor); doc->AddTool(id, point); doc->IncrementReferens(p1Line); doc->IncrementReferens(p2Line); @@ -153,6 +154,11 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){ dialogShoulderPoint.clear(); } +void VToolShoulderPoint::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogShoulderPoint, this, event); } @@ -164,8 +170,8 @@ void VToolShoulderPoint::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "shoulder"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index 91f682ecb..ccf92fe3e 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -25,32 +25,33 @@ #include "vtoollinepoint.h" #include "dialogs/dialogshoulderpoint.h" -class VToolShoulderPoint : public VToolLinePoint -{ +class VToolShoulderPoint : public VToolLinePoint{ public: - VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, - const qreal &length); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, - const qint64 &pShoulder, const QString &typeLine, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, const qint64 &p1Line, + const qint64 &p2Line, const qint64 &pShoulder, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, + const qreal &length); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, + const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, + const QString &pointName, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 p2Line; - qint64 pShoulder; + qint64 p2Line; + qint64 pShoulder; QSharedPointer dialogShoulderPoint; }; diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index f244d0104..b77d4973d 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -124,3 +124,8 @@ void VToolSinglePoint::ChangedActivDraw(const QString newName){ VToolPoint::ChangedActivDraw(newName); } } + +void VToolSinglePoint::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); +} diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index f5b2dad67..2a610bc92 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -36,6 +36,7 @@ public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); virtual void ChangedActivDraw(const QString newName); + virtual void SetFactor(qreal factor); signals: void FullUpdateTree(); protected: diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 71535e5f1..25efb8ab6 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -34,7 +34,7 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, path.addPath(spl.GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); @@ -108,6 +108,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c scene->addItem(spl); connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(spl, &VToolSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSpline::SetFactor); doc->AddTool(id, spl); doc->IncrementReferens(p1); doc->IncrementReferens(p4); @@ -202,12 +203,12 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); + this->setPen(QPen(currentColor, widthMainLine/factor)); } void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); + this->setPen(QPen(currentColor, widthHairLine/factor)); } void VToolSpline::RemoveReferens(){ @@ -217,6 +218,7 @@ void VToolSpline::RemoveReferens(){ } void VToolSpline::RefreshGeometry(){ + this->setPen(QPen(currentColor, widthHairLine/factor)); VSpline spl = VAbstractTool::data.GetSpline(id); QPainterPath path; path.addPath(spl.GetPath()); @@ -244,15 +246,17 @@ void VToolSpline::RefreshGeometry(){ void VToolSpline::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); + currentColor = Qt::black; emit setEnabledPoint(true); VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine)); + this->setPen(QPen(Qt::gray, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setAcceptHoverEvents (false); + currentColor = Qt::gray; emit setEnabledPoint(false); VDrawTool::ChangedActivDraw(newName); } @@ -261,11 +265,16 @@ void VToolSpline::ChangedActivDraw(const QString newName){ void VToolSpline::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ if(id == this->id){ if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine)); + this->setPen(QPen(baseColor, widthHairLine/factor)); currentColor = baseColor; } else { - this->setPen(QPen(color, widthHairLine)); + this->setPen(QPen(color, widthHairLine/factor)); currentColor = color; } } } + +void VToolSpline::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index b421b35a0..daddf741e 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -28,42 +28,41 @@ #include "widgets/vcontrolpointspline.h" #include "geometry/vsplinepath.h" -class VToolSpline:public VDrawTool, public QGraphicsPathItem -{ +class VToolSpline:public VDrawTool, public QGraphicsPathItem{ Q_OBJECT public: - VToolSpline (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); + VToolSpline (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0 ); virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, - const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, + const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); signals: - void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &controlPoint, const QPointF &splinePoint ); - void setEnabledPoint ( bool enable ); + void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, + const QPointF &controlPoint, const QPointF &splinePoint ); + void setEnabledPoint ( bool enable ); public slots: - virtual void FullUpdateFromFile (); - virtual void FullUpdateFromGui ( int result ); - void ControlPointChangePosition ( const qint32 &indexSpline, - SplinePoint::Position position, - const QPointF pos); - virtual void ChangedActivDraw ( const QString newName ); - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void FullUpdateFromFile (); + virtual void FullUpdateFromGui ( int result ); + void ControlPointChangePosition ( const qint32 &indexSpline, SplinePoint::Position position, + const QPointF pos); + virtual void ChangedActivDraw ( const QString newName ); + virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile (); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile (); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSpline; QVector controlPoints; - void RefreshGeometry (); + void RefreshGeometry (); }; #endif // VTOOLSPLINE_H diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 399367688..ca9fb7b0d 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -32,7 +32,7 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, path.addPath(splPath.GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); @@ -96,6 +96,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra scene->addItem(spl); connect(spl, &VToolSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(spl, &VToolSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSplinePath::SetFactor); doc->AddTool(id, spl); } } @@ -187,15 +188,17 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){ void VToolSplinePath::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(Qt::black, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); + currentColor = Qt::black; emit setEnabledPoint(true); VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine)); + this->setPen(QPen(Qt::gray, widthHairLine/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setAcceptHoverEvents (false); + currentColor = Qt::gray; emit setEnabledPoint(false); VDrawTool::ChangedActivDraw(newName); } @@ -204,15 +207,20 @@ void VToolSplinePath::ChangedActivDraw(const QString newName){ void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ if(id == this->id){ if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine)); + this->setPen(QPen(baseColor, widthHairLine/factor)); currentColor = baseColor; } else { - this->setPen(QPen(color, widthHairLine)); + this->setPen(QPen(color, widthHairLine/factor)); currentColor = color; } } } +void VToolSplinePath::SetFactor(qreal factor){ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogSplinePath, this, event); } @@ -252,12 +260,12 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthMainLine)); + this->setPen(QPen(currentColor, widthMainLine/factor)); } void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ Q_UNUSED(event); - this->setPen(QPen(currentColor, widthHairLine)); + this->setPen(QPen(currentColor, widthHairLine/factor)); } void VToolSplinePath::RemoveReferens(){ @@ -268,6 +276,7 @@ void VToolSplinePath::RemoveReferens(){ } void VToolSplinePath::RefreshGeometry(){ + this->setPen(QPen(currentColor, widthHairLine/factor)); VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); QPainterPath path; path.addPath(splPath.GetPath()); diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index b880bdfd2..b614f8896 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -30,42 +30,40 @@ class VToolSplinePath:public VDrawTool, public QGraphicsPathItem{ Q_OBJECT public: - VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const VSplinePath &path, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); signals: - void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, - const QPointF &controlPoint, const QPointF &splinePoint); - void setEnabledPoint(bool enable); + void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, + const QPointF &controlPoint, const QPointF &splinePoint); + void setEnabledPoint(bool enable); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - void ControlPointChangePosition(const qint32 &indexSpline, - SplinePoint::Position position, - const QPointF pos); - virtual void ChangedActivDraw(const QString newName); - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, + const QPointF pos); + virtual void ChangedActivDraw(const QString newName); + virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSplinePath; QVector controlPoints; - void RefreshGeometry(); - void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); - void UpdatePathPoint(QDomNode& node, VSplinePath &path); - void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, - const qint32 &indexSpline); + void RefreshGeometry(); + void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); + void UpdatePathPoint(QDomNode& node, VSplinePath &path); + void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline); }; #endif // VTOOLSPLINEPATH_H diff --git a/widgets/vgraphicssimpletextitem.cpp b/widgets/vgraphicssimpletextitem.cpp index a37aba2fc..6522aa093 100644 --- a/widgets/vgraphicssimpletextitem.cpp +++ b/widgets/vgraphicssimpletextitem.cpp @@ -22,16 +22,22 @@ #include "vgraphicssimpletextitem.h" #include #include +#include -VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent){ +VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent), + fontSize(0){ this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); this->setAcceptHoverEvents(true); + QFont font = this->font(); + font.setPointSize(font.pointSize()+3); + fontSize = font.pointSize(); + this->setFont(font); } VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent ) - :QGraphicsSimpleTextItem(text, parent){ + :QGraphicsSimpleTextItem(text, parent), fontSize(0){ this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); diff --git a/widgets/vgraphicssimpletextitem.h b/widgets/vgraphicssimpletextitem.h index e3f31d0bf..6f9dc20ef 100644 --- a/widgets/vgraphicssimpletextitem.h +++ b/widgets/vgraphicssimpletextitem.h @@ -24,18 +24,20 @@ #include -class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem -{ +class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem{ Q_OBJECT public: VGraphicsSimpleTextItem(QGraphicsItem * parent = 0); VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = 0 ); + qint32 FontSize()const {return fontSize;} signals: void NameChangePosition(const QPointF pos); protected: QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); +private: + qint32 fontSize; }; #endif // VGRAPHICSSIMPLETEXTITEM_H diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp index 74fee4735..3f9e932b0 100644 --- a/widgets/vmaingraphicsscene.cpp +++ b/widgets/vmaingraphicsscene.cpp @@ -25,11 +25,11 @@ #include #include -VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene(), horScrollBar(0), verScrollBar(0){ +VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1){ } VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent): - QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0){ + QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0), scaleFactor(1){ } void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event){ @@ -50,6 +50,11 @@ void VMainGraphicsScene::RemoveTool(QGraphicsItem *tool){ this->removeItem(tool); } +void VMainGraphicsScene::SetFactor(qreal factor){ + scaleFactor=scaleFactor*factor; + emit NewFactor(scaleFactor); +} + qint32 VMainGraphicsScene::getVerScrollBar() const{ return verScrollBar; } diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h index 41ec68d89..5acf6d555 100644 --- a/widgets/vmaingraphicsscene.h +++ b/widgets/vmaingraphicsscene.h @@ -42,6 +42,7 @@ public: public slots: void ChoosedItem(qint64 id, Scene::Scenes type); void RemoveTool(QGraphicsItem *tool); + void SetFactor(qreal factor); protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mousePressEvent(QGraphicsSceneMouseEvent *event); @@ -49,9 +50,11 @@ signals: void mouseMove(QPointF scenePos); void mousePress(QPointF scenePos); void ChoosedObject(qint64 id, Scene::Scenes type); + void NewFactor(qreal factor); private: qint32 horScrollBar; qint32 verScrollBar; + qreal scaleFactor; }; #endif // VMAINGRAPHICSSCENE_H diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index ca232aa95..a8558bec3 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -60,6 +60,7 @@ void VMainGraphicsView::scalingTime(qreal x){ verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() - factor*3.5)); } } + emit NewFactor(factor); } void VMainGraphicsView::animFinished(){ diff --git a/widgets/vmaingraphicsview.h b/widgets/vmaingraphicsview.h index 39d1687ff..df53f39cb 100644 --- a/widgets/vmaingraphicsview.h +++ b/widgets/vmaingraphicsview.h @@ -29,6 +29,7 @@ class VMainGraphicsView : public QGraphicsView{ public: explicit VMainGraphicsView(QWidget *parent = 0); signals: + void NewFactor(qreal factor); public slots: void scalingTime(qreal x); void animFinished(); diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 87942ff27..8c7118c84 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -584,6 +584,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen Q_ASSERT(spoint != 0); scene->addItem(spoint); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); tools[id] = spoint; } return; From 54bf459e17c01ed15978bd44bfcc00f201e85578 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 18 Oct 2013 13:03:01 +0300 Subject: [PATCH 38/70] New tool Height. --HG-- branch : develop --- Valentina.pro | 13 +- cursor.qrc | 1 + cursor/height_cursor.png | Bin 0 -> 1284 bytes dialogs/dialogendline.h | 3 +- dialogs/dialogheight.cpp | 122 ++++++++++++ dialogs/dialogheight.h | 40 ++++ dialogs/dialogheight.ui | 211 +++++++++++++++++++++ dialogs/dialoghistory.cpp | 14 ++ dialogs/dialogs.h | 1 + dialogs/dialogtool.cpp | 2 + icon.qrc | 1 + icon/32x32/height.png | Bin 0 -> 857 bytes mainwindow.cpp | 192 ++++++++++--------- mainwindow.h | 3 + mainwindow.ui | 104 ++++++---- options.h | 3 +- tools/drawTools/drawtools.h | 1 + tools/drawTools/vdrawtool.cpp | 2 +- tools/drawTools/vdrawtool.h | 12 +- tools/drawTools/vtoolendline.cpp | 14 +- tools/drawTools/vtoolheight.cpp | 138 ++++++++++++++ tools/drawTools/vtoolheight.h | 34 ++++ tools/modelingTools/modelingtools.h | 1 + tools/modelingTools/vmodelingalongline.cpp | 4 +- tools/modelingTools/vmodelingendline.cpp | 27 ++- tools/modelingTools/vmodelingheight.cpp | 130 +++++++++++++ tools/modelingTools/vmodelingheight.h | 34 ++++ tools/modelingTools/vmodelingtool.cpp | 2 +- tools/modelingTools/vmodelingtool.h | 52 ++--- tools/vabstracttool.cpp | 13 +- tools/vabstracttool.h | 4 +- xml/vdomdocument.cpp | 25 +++ 32 files changed, 1013 insertions(+), 190 deletions(-) create mode 100644 cursor/height_cursor.png create mode 100644 dialogs/dialogheight.cpp create mode 100644 dialogs/dialogheight.h create mode 100644 dialogs/dialogheight.ui create mode 100644 icon/32x32/height.png create mode 100644 tools/drawTools/vtoolheight.cpp create mode 100644 tools/drawTools/vtoolheight.h create mode 100644 tools/modelingTools/vmodelingheight.cpp create mode 100644 tools/modelingTools/vmodelingheight.h diff --git a/Valentina.pro b/Valentina.pro index ee7b1ec2b..c05bf37e1 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -97,7 +97,10 @@ SOURCES += main.cpp\ exception/vexceptionemptyparameter.cpp \ exception/vexceptionobjecterror.cpp \ widgets/vapplication.cpp \ - exception/vexceptionuniqueid.cpp + exception/vexceptionuniqueid.cpp \ + tools/drawTools/vtoolheight.cpp \ + tools/modelingTools/vmodelingheight.cpp \ + dialogs/dialogheight.cpp HEADERS += mainwindow.h \ widgets/vmaingraphicsscene.h \ @@ -188,7 +191,10 @@ HEADERS += mainwindow.h \ exception/vexceptionemptyparameter.h \ exception/vexceptionobjecterror.h \ widgets/vapplication.h \ - exception/vexceptionuniqueid.h + exception/vexceptionuniqueid.h \ + tools/drawTools/vtoolheight.h \ + tools/modelingTools/vmodelingheight.h \ + dialogs/dialogheight.h FORMS += mainwindow.ui \ dialogs/dialogsinglepoint.ui \ @@ -206,7 +212,8 @@ FORMS += mainwindow.ui \ dialogs/dialoghistory.ui \ dialogs/dialogpointofcontact.ui \ dialogs/dialogdetail.ui \ - tablewindow.ui + tablewindow.ui \ + dialogs/dialogheight.ui RESOURCES += \ icon.qrc \ diff --git a/cursor.qrc b/cursor.qrc index ece04dd88..b38ff9e43 100644 --- a/cursor.qrc +++ b/cursor.qrc @@ -12,5 +12,6 @@ cursor/splinepath_cursor.png cursor/pointcontact_cursor.png cursor/new_detail_cursor.png + cursor/height_cursor.png diff --git a/cursor/height_cursor.png b/cursor/height_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..05da2a5ae3d8643df9711c5b5a3cba02ee67ebdf GIT binary patch literal 1284 zcmV+f1^fDmP)Vl&|00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-3ky6ARyeS!w&!e06}y` zSad^gZEa<4bO1wAML|?gQaT`KWG!lNWoICEF)lD5D0OpbZf77#N=G0{P(?=|b~Z98 zEFf`pVQgu1c_2L?IWP*aMOc#n00cxyL_t(Y$HkXjOdM4d$A5QbmQ|FsP?govv=Jq- zVQFL67$`N07(QIW$J55>6ES3Mp`{Wc5+g<*G$#618#M+K6YznG^pOxlOr;M*;u2|0 z0Yys_ENqDi?ZWOHA9iM)!mW3Vfgpte#fd2bui*Vl(qO1xgLl$MreXDsG+ zyq%(y!Y~X(gt4))Rr~qi;GoJF>`sZrVk|8!NiZ0cSS&^`7^I=0;m#;e<*_Zgt`m>P z0aSl~KLAx#Rq4*m1zrWN0bc;-wqQ>Mc`Oz~L=cf=F`Ai~0mv&aFF%;#wPxU5;B&yg zBdR%vU2v3A$ziX#-EJu;C`bj_G2lAzyM@B`vVEgC!?AHsG#Vv4JDbtb(ZZgdo+Be8 zBM(?h7lAS$47hicaH*hAWr$LW>FH@gq0sd5@-iNe=QZF%Ys(d24tUCdZ!})dLXcj$ zuItGnqm;rlO>%N_*8P6};>ya(bs(aYiW!EH6^%w8bi3VqMI=u|^!4?10DL}QbPaTX zLvTI>7b-vwL7z&+`TF|$WIqQ)(=?l6>oqksSAcs+K&dUf7SVbjYL_PpM8iGr=;M!%F{{wzG_sOUH zIycM7(;cb1nw`ZbPMiq0w6wf8IXU@dJRY9~RyQaV;9ejHcpjJn-T)%NI|`mX5A82N z*)fk9*5GVldPSqZO zkAdS!D!Q^bdFo7JQd?Ua1|&B(*KBQVy$YP_=;(OPs!(8<1N7egvY{Ro&@7Qr%*R0MYWY uGC6#>gzv{LvKC#FpDzEL4S0d8K>Qyp?4_X9M^!xl0000setupUi(this); + labelEditNamePoint = ui->labelEditNamePoint; + flagFormula = true; + bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + connect(bOk, &QPushButton::clicked, this, &DialogHeight::DialogAccepted); + flagName = false; + CheckState(); + QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); + connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected); + FillComboBoxPoints(ui->comboBoxBasePoint); + FillComboBoxPoints(ui->comboBoxP1Line); + FillComboBoxPoints(ui->comboBoxP2Line); + FillComboBoxTypeLine(ui->comboBoxLineType); + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged); +} + +DialogHeight::~DialogHeight(){ + delete ui; +} + +QString DialogHeight::getPointName() const{ + return pointName; +} + +void DialogHeight::setPointName(const QString &value){ + pointName = value; + ui->lineEditNamePoint->setText(pointName); +} + +QString DialogHeight::getTypeLine() const{ + return typeLine; +} + +void DialogHeight::setTypeLine(const QString &value){ + typeLine = value; + SetupTypeLine(ui->comboBoxLineType, value); +} + +qint64 DialogHeight::getBasePointId() const{ + return basePointId; +} + +void DialogHeight::setBasePointId(const qint64 &value, const qint64 &id){ + basePointId = value; + setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); +} + +qint64 DialogHeight::getP1LineId() const{ + return p1LineId; +} + +void DialogHeight::setP1LineId(const qint64 &value, const qint64 &id){ + p1LineId = value; + setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id); +} + +qint64 DialogHeight::getP2LineId() const{ + return p2LineId; +} + +void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id){ + p2LineId = value; + setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id); +} + +void DialogHeight::ChoosedObject(qint64 id, Scene::Scenes type){ + if(idDetail == 0 && mode == Draw::Modeling){ + if(type == Scene::Detail){ + idDetail = id; + return; + } + } + if(mode == Draw::Modeling){ + if(!CheckObject(id)){ + return; + } + } + if(type == Scene::Point){ + VPointF point; + if(mode == Draw::Calculation){ + point = data->GetPoint(id); + } else { + point = data->GetModelingPoint(id); + } + switch(number){ + case(0): + ChangeCurrentText(ui->comboBoxBasePoint, point.name()); + number++; + emit ToolTip(tr("Select first point of line")); + break; + case(1): + ChangeCurrentText(ui->comboBoxP1Line, point.name()); + number++; + emit ToolTip(tr("Select second point of line")); + break; + case(2): + ChangeCurrentText(ui->comboBoxP2Line, point.name()); + number = 0; + emit ToolTip(tr("")); + if(!isInitialized){ + this->show(); + } + break; + } + } +} + +void DialogHeight::DialogAccepted(){ + pointName = ui->lineEditNamePoint->text(); + typeLine = GetTypeLine(ui->comboBoxLineType); + basePointId = getCurrentPointId(ui->comboBoxBasePoint); + p1LineId = getCurrentPointId(ui->comboBoxP1Line); + p2LineId = getCurrentPointId(ui->comboBoxP2Line); + emit DialogClosed(QDialog::Accepted); +} + diff --git a/dialogs/dialogheight.h b/dialogs/dialogheight.h new file mode 100644 index 000000000..b4e4c05b6 --- /dev/null +++ b/dialogs/dialogheight.h @@ -0,0 +1,40 @@ +#ifndef DIALOGHEIGHT_H +#define DIALOGHEIGHT_H + +#include "dialogtool.h" + +namespace Ui { +class DialogHeight; +} + +class DialogHeight : public DialogTool{ + Q_OBJECT +public: + explicit DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogHeight(); + QString getPointName() const; + void setPointName(const QString &value); + QString getTypeLine() const; + void setTypeLine(const QString &value); + qint64 getBasePointId() const; + void setBasePointId(const qint64 &value, const qint64 &id); + qint64 getP1LineId() const; + void setP1LineId(const qint64 &value, const qint64 &id); + qint64 getP2LineId() const; + void setP2LineId(const qint64 &value, const qint64 &id); +public slots: + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); +private: + Q_DISABLE_COPY(DialogHeight) + Ui::DialogHeight *ui; + qint32 number; + QString pointName; + QString typeLine; + qint64 basePointId; + qint64 p1LineId; + qint64 p2LineId; +}; + +#endif // DIALOGHEIGHT_H diff --git a/dialogs/dialogheight.ui b/dialogs/dialogheight.ui new file mode 100644 index 000000000..bfb3dab67 --- /dev/null +++ b/dialogs/dialogheight.ui @@ -0,0 +1,211 @@ + + + DialogHeight + + + + 0 + 0 + 247 + 220 + + + + Dialog + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Name new point + + + + + + + + + + + + + + + 0 + 0 + + + + Base point + + + + + + + First point of line + + + + + + + + + + + + 0 + 0 + + + + First point of line + + + + + + + First point of line + + + + + + + + + + + + 0 + 0 + + + + Second point of line + + + + + + + First point of line + + + + + + + + + + + Type line + + + + + + + Show line from first point to our point + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogHeight + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogHeight + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogs/dialoghistory.cpp b/dialogs/dialoghistory.cpp index 8e59671a3..d1b19544a 100644 --- a/dialogs/dialoghistory.cpp +++ b/dialogs/dialoghistory.cpp @@ -250,6 +250,20 @@ QString DialogHistory::Record(const VToolRecord &tool){ data->GetPoint(secondPointId).name(), data->GetPoint(tool.getId()).name()); break; + case Tool::Height:{ + qint64 p1LineId = 0; + qint64 p2LineId = 0; + domElement = doc->elementById(QString().setNum(tool.getId())); + if(domElement.isElement()){ + basePointId = domElement.attribute("basePoint", "").toLongLong(); + p1LineId = domElement.attribute("p1Line", "").toLongLong(); + p2LineId = domElement.attribute("p2Line", "").toLongLong(); + } + record = QString(tr("Point of perpendical from point %1 to line %2_%3")).arg(data->GetPoint(basePointId).name(), + data->GetPoint(p1LineId).name(), + data->GetPoint(p2LineId).name()); + break; + } default: qWarning()<findText(value); if(index != -1){ box->setCurrentIndex(index); + } else { + qWarning()<icon/32x32/new_detail.png icon/32x32/layout.png icon/16x16/mirror.png + icon/32x32/height.png diff --git a/icon/32x32/height.png b/icon/32x32/height.png new file mode 100644 index 0000000000000000000000000000000000000000..c44de68bcd8f33dc30267dd792a281946ac2fbab GIT binary patch literal 857 zcmV-f1E&0mP)T1risCXK~R=8lVd#<`6XGc>v5fsdK{`p*Bn{^xv| zbxMJf2|R>5F;}pdRri~fqWYP@F)YVAhKZv8ygB8e-~g_o8|x|#-Q?MV4f-^xXN9gp{6tUaP6tUKg9zQ?^7H(~&ADRSX1++v6@Y&3v>g`u%B zT*Ih4a2rnIvJp#)L--XBH{j)=Wa!u@#qPhQaA*ZC3lgm5yO+@X_6P5;M5)DL*~M z)D0BfDhp3+uX18=8LV9S>gCb1^Z~qp*8`#gk{5`Hc6UptYArR^xUuxm z`6#nXm=C4%t1#nf?8k?L0Q6k2FWmVY9>k5<9;|j6@8Z6=zZ2O)nEUnyaKb(KBfQ?h zkD+8+fSJZ5vRA^Sg;=fd`&yiUqhZAEmDQHw@rZE}*Lf&kz~}fz70=F>5rZ<;&v^t_zX?N*`K6F~Nt zETmORHQt?)tOBwNU)Ahf#7y3#@~i^TYcu26TjRaWIN0d0(CNpa8;6(UD~@o-M=~VT jl6xzj#hcMN|9|-#E4;xN0aS7700000NkvXXu0mjf(#DqX literal 0 HcmV?d00001 diff --git a/mainwindow.cpp b/mainwindow.cpp index 19ae78c59..7befade91 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -44,10 +44,10 @@ MainWindow::MainWindow(QWidget *parent) : dialogAlongLine(QSharedPointer()), dialogShoulderPoint(QSharedPointer()), dialogNormal(QSharedPointer()), dialogBisector(QSharedPointer()), - dialogLineIntersect(QSharedPointer()), - dialogSpline(QSharedPointer()), + dialogLineIntersect(QSharedPointer()), dialogSpline(QSharedPointer()), dialogArc(QSharedPointer()), dialogSplinePath(QSharedPointer()), - dialogPointOfContact(QSharedPointer()), dialogDetail(QSharedPointer()), + dialogPointOfContact(QSharedPointer()), + dialogDetail(QSharedPointer()), dialogHeight(QSharedPointer()), dialogHistory(0), doc(0), data(0), comboBoxDraws(0), fileName(QString()), changeInFile(false), mode(Draw::Calculation){ ui->setupUi(this); @@ -91,6 +91,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->toolButtonSplinePath, &QToolButton::clicked, this, &MainWindow::ToolSplinePath); connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact); connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail); + connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight); data = new VContainer; @@ -463,6 +464,23 @@ void MainWindow::ClosedDialogDetail(int result){ ArrowTool(); } +void MainWindow::ToolHeight(bool checked){ + SetToolButton(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"), + dialogHeight, &MainWindow::ClosedDialogHeight); +} + +void MainWindow::ClosedDialogHeight(int result){ + if(result == QDialog::Accepted){ + if(mode == Draw::Calculation){ + VToolHeight::Create(dialogHeight, currentScene, doc, data); + } else { + VModelingHeight *point = VModelingHeight::Create(dialogHeight, doc, data); + AddToolToDetail(point, point->getId(), Tool::Height, dialogHeight->getIdDetail()); + } + } + ArrowTool(); +} + void MainWindow::About(){ QMessageBox::about(this, tr("About Valentina"), tr("Valentina v.0.1.0")); } @@ -616,88 +634,91 @@ void MainWindow::mouseMove(QPointF scenePos){ } void MainWindow::CanselTool(){ - switch( tool ) - { - case Tool::ArrowTool: - ui->actionArrowTool->setChecked(false); - helpLabel->setText(""); - break; - case Tool::SinglePointTool: - //Nothing to do here because we can't create this tool from main window. - break; - case Tool::EndLineTool: - dialogEndLine.clear(); - ui->toolButtonEndLine->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::LineTool: - dialogLine.clear(); - ui->toolButtonLine->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearFocus(); - break; - case Tool::AlongLineTool: - dialogAlongLine.clear(); - ui->toolButtonAlongLine->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::ShoulderPointTool: - dialogShoulderPoint.clear(); - ui->toolButtonShoulderPoint->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::NormalTool: - dialogNormal.clear(); - ui->toolButtonNormal->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::BisectorTool: - dialogBisector.clear(); - ui->toolButtonBisector->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::LineIntersectTool: - dialogLineIntersect.clear(); - ui->toolButtonLineIntersect->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::SplineTool: - dialogSpline.clear(); - ui->toolButtonSpline->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::ArcTool: - dialogArc.clear(); - ui->toolButtonArc->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::SplinePathTool: - dialogSplinePath.clear(); - ui->toolButtonSplinePath->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::PointOfContact: - dialogPointOfContact.clear(); - ui->toolButtonPointOfContact->setChecked(false); - currentScene->setFocus(Qt::OtherFocusReason); - currentScene->clearSelection(); - break; - case Tool::Detail: - dialogDetail.clear(); - ui->toolButtonNewDetail->setChecked(false); - break; - default: - qWarning()<<"Get wrong tool type. Ignore."; - break; + switch( tool ){ + case Tool::ArrowTool: + ui->actionArrowTool->setChecked(false); + helpLabel->setText(""); + break; + case Tool::SinglePointTool: + //Nothing to do here because we can't create this tool from main window. + break; + case Tool::EndLineTool: + dialogEndLine.clear(); + ui->toolButtonEndLine->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::LineTool: + dialogLine.clear(); + ui->toolButtonLine->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearFocus(); + break; + case Tool::AlongLineTool: + dialogAlongLine.clear(); + ui->toolButtonAlongLine->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::ShoulderPointTool: + dialogShoulderPoint.clear(); + ui->toolButtonShoulderPoint->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::NormalTool: + dialogNormal.clear(); + ui->toolButtonNormal->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::BisectorTool: + dialogBisector.clear(); + ui->toolButtonBisector->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::LineIntersectTool: + dialogLineIntersect.clear(); + ui->toolButtonLineIntersect->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::SplineTool: + dialogSpline.clear(); + ui->toolButtonSpline->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::ArcTool: + dialogArc.clear(); + ui->toolButtonArc->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::SplinePathTool: + dialogSplinePath.clear(); + ui->toolButtonSplinePath->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::PointOfContact: + dialogPointOfContact.clear(); + ui->toolButtonPointOfContact->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::Detail: + dialogDetail.clear(); + ui->toolButtonNewDetail->setChecked(false); + break; + case Tool::Height: + dialogHeight.clear(); + ui->toolButtonHeight->setChecked(false); + break; + default: + qWarning()<<"Get wrong tool type. Ignore."; + break; } } @@ -935,6 +956,7 @@ void MainWindow::SetEnableTool(bool enable){ ui->toolButtonSplinePath->setEnabled(enable); ui->toolButtonPointOfContact->setEnabled(enable); ui->toolButtonNewDetail->setEnabled(enable); + ui->toolButtonHeight->setEnabled(enable); } void MainWindow::MinimumScrollBar(){ diff --git a/mainwindow.h b/mainwindow.h index 3d55ab212..844052539 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -80,6 +80,7 @@ public slots: void ToolSplinePath(bool checked); void ToolPointOfContact(bool checked); void ToolDetail(bool checked); + void ToolHeight(bool checked); void ClosedDialogEndLine(int result); void ClosedDialogLine(int result); void ClosedDialogAlongLine(int result); @@ -92,6 +93,7 @@ public slots: void ClosedDialogSplinePath(int result); void ClosedDialogPointOfContact(int result); void ClosedDialogDetail(int result); + void ClosedDialogHeight(int result); void About(); void AboutQt(); void ShowToolTip(const QString &toolTip); @@ -135,6 +137,7 @@ private: QSharedPointer dialogSplinePath; QSharedPointer dialogPointOfContact; QSharedPointer dialogDetail; + QSharedPointer dialogHeight; DialogHistory *dialogHistory; VDomDocument *doc; VContainer *data; diff --git a/mainwindow.ui b/mainwindow.ui index b842a4655..0e9a0df8b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -48,7 +48,7 @@ 0 0 150 - 104 + 150 @@ -64,20 +64,20 @@ Point - - + + false - Tool point of normal. + Tool point on the end line. ... - :/icon/32x32/normal.png:/icon/32x32/normal.png + :/icon/32x32/segment.png:/icon/32x32/segment.png @@ -116,46 +116,20 @@ - - + + false - Tool point on the end line. + Tool point of contact. ... - :/icon/32x32/segment.png:/icon/32x32/segment.png - - - - 32 - 32 - - - - true - - - - - - - false - - - Tool point along line. - - - ... - - - - :/icon/32x32/along_line.png:/icon/32x32/along_line.png + :/icon/32x32/point_of_contact.png:/icon/32x32/point_of_contact.png @@ -194,20 +168,72 @@ - - + + false - Tool point of contact. + Tool point of normal. ... - :/icon/32x32/point_of_contact.png:/icon/32x32/point_of_contact.png + :/icon/32x32/normal.png:/icon/32x32/normal.png + + + + 32 + 32 + + + + true + + + + + + + false + + + Tool point along line. + + + ... + + + + :/icon/32x32/along_line.png:/icon/32x32/along_line.png + + + + 32 + 32 + + + + true + + + + + + + false + + + Tool point of height. + + + ... + + + + :/icon/32x32/height.png:/icon/32x32/height.png diff --git a/options.h b/options.h index 1d04de588..28b99f2d9 100644 --- a/options.h +++ b/options.h @@ -55,7 +55,8 @@ enum Tool {ArrowTool, NodePoint, NodeArc, NodeSpline, - NodeSplinePath + NodeSplinePath, + Height }; Q_DECLARE_FLAGS(Tools, Tool) diff --git a/tools/drawTools/drawtools.h b/tools/drawTools/drawtools.h index 0d2c5b613..58fcbaf08 100644 --- a/tools/drawTools/drawtools.h +++ b/tools/drawTools/drawtools.h @@ -34,5 +34,6 @@ #include "vtoolsinglepoint.h" #include "vtoolspline.h" #include "vtoolsplinepath.h" +#include "vtoolheight.h" #endif // DRAWTOOLS_H diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index 197d800b9..0e622413b 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -25,7 +25,7 @@ qreal VDrawTool::factor = 1; VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) : - VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), + VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), ignoreFullUpdate(false), nameActivDraw(doc->GetNameActivDraw()){ connect(this->doc, &VDomDocument::ChangedActivDraw, this, &VDrawTool::ChangedActivDraw); connect(this->doc, &VDomDocument::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw); diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 91a7a4527..4ef092514 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -43,6 +43,7 @@ signals: void RemoveTool(QGraphicsItem *tool); protected: bool ignoreContextMenuEvent; + bool ignoreFullUpdate; QString nameActivDraw; static qreal factor; void AddToCalculation(const QDomElement &domElement); @@ -67,11 +68,12 @@ protected: if(selectedAction == actionOption){ dialog = QSharedPointer(new Dialog(getData())); - connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), &VMainGraphicsScene::ChoosedObject, - dialog.data(), &Dialog::ChoosedObject); - connect(dialog.data(), &Dialog::DialogClosed, tool, - &Tool::FullUpdateFromGui); - connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); + connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), + &VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject); + connect(dialog.data(), &Dialog::DialogClosed, tool, &Tool::FullUpdateFromGui); + if(!ignoreFullUpdate){ + connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); + } tool->setDialog(); diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index 2e0d24abb..3bfd214a0 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -37,14 +37,12 @@ VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id void VToolEndLine::setDialog(){ Q_ASSERT(!dialogEndLine.isNull()); - if(!dialogEndLine.isNull()){ - VPointF p = VAbstractTool::data.GetPoint(id); - dialogEndLine->setTypeLine(typeLine); - dialogEndLine->setFormula(formula); - dialogEndLine->setAngle(angle); - dialogEndLine->setBasePointId(basePointId, id); - dialogEndLine->setPointName(p.name()); - } + VPointF p = VAbstractTool::data.GetPoint(id); + dialogEndLine->setTypeLine(typeLine); + dialogEndLine->setFormula(formula); + dialogEndLine->setAngle(angle); + dialogEndLine->setBasePointId(basePointId, id); + dialogEndLine->setPointName(p.name()); } void VToolEndLine::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, diff --git a/tools/drawTools/vtoolheight.cpp b/tools/drawTools/vtoolheight.cpp new file mode 100644 index 000000000..3779eebfe --- /dev/null +++ b/tools/drawTools/vtoolheight.cpp @@ -0,0 +1,138 @@ +#include "vtoolheight.h" + +VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + Tool::Sources typeCreation, QGraphicsItem * parent) + :VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), + dialogHeight(QSharedPointer()), p1LineId(p1LineId), p2LineId(p2LineId){ + ignoreFullUpdate = true; + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VToolHeight::setDialog(){ + Q_ASSERT(!dialogHeight.isNull()); + VPointF p = VAbstractTool::data.GetPoint(id); + dialogHeight->setTypeLine(typeLine); + dialogHeight->setBasePointId(basePointId, id); + dialogHeight->setP1LineId(p1LineId, id); + dialogHeight->setP2LineId(p2LineId, id); + dialogHeight->setPointName(p.name()); +} + +void VToolHeight::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data){ + disconnect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &DialogHeight::UpdateList); + QString pointName = dialog->getPointName(); + QString typeLine = dialog->getTypeLine(); + qint64 basePointId = dialog->getBasePointId(); + qint64 p1LineId = dialog->getP1LineId(); + qint64 p2LineId = dialog->getP2LineId(); + Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data, + Document::FullParse, Tool::FromGui); +} + +void VToolHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ + VPointF basePoint = data->GetPoint(basePointId); + VPointF p1Line = data->GetPoint(p1LineId); + VPointF p2Line = data->GetPoint(p2LineId); + + QPointF pHeight = FindPoint(QLineF(p1Line.toQPointF(), p2Line.toQPointF()), basePoint.toQPointF()); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->AddPoint(VPointF(pHeight.x(), pHeight.y(), pointName, mx, my)); + data->AddLine(basePointId, id); + data->AddLine(p1LineId, id); + data->AddLine(p2LineId, id); + } else { + data->UpdatePoint(id, VPointF(pHeight.x(), pHeight.y(), pointName, mx, my)); + data->AddLine(basePointId, id); + data->AddLine(p1LineId, id); + data->AddLine(p2LineId, id); + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } + } + VDrawTool::AddRecord(id, Tool::Height, doc); + if(parse == Document::FullParse){ + VToolHeight *point = new VToolHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId, + typeCreation); + scene->addItem(point); + connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor); + doc->AddTool(id, point); + doc->IncrementReferens(basePointId); + doc->IncrementReferens(p1LineId); + doc->IncrementReferens(p2LineId); + } +} + +QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point){ + qreal a = 0, b = 0, c = 0; + LineCoefficients(line, &a, &b, &c); + qreal x = point.x() + a; + qreal y = b + point.y(); + QLineF l (point, QPointF(x, y)); + QPointF p; + QLineF::IntersectType intersect = line.intersect(l, &p); + if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){ + return p; + } else { + return QPointF(); + } +} + +void VToolHeight::FullUpdateFromFile(){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + typeLine = domElement.attribute("typeLine", ""); + basePointId = domElement.attribute("basePoint", "").toLongLong(); + p1LineId = domElement.attribute("p1Line", "").toLongLong(); + p2LineId = domElement.attribute("p2Line", "").toLongLong(); + } + RefreshGeometry(); + +} + +void VToolHeight::FullUpdateFromGui(int result){ + if(result == QDialog::Accepted){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + domElement.setAttribute("name", dialogHeight->getPointName()); + domElement.setAttribute("typeLine", dialogHeight->getTypeLine()); + domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId())); + domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId())); + domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId())); + emit FullUpdateTree(); + } + } + dialogHeight.clear(); +} + +void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + ContextMenu(dialogHeight, this, event); +} + +void VToolHeight::AddToFile(){ + VPointF point = VAbstractTool::data.GetPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "height"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); + + AddAttribute(domElement, "typeLine", typeLine); + AddAttribute(domElement, "basePoint", basePointId); + AddAttribute(domElement, "p1Line", p1LineId); + AddAttribute(domElement, "p2Line", p2LineId); + + AddToCalculation(domElement); + +} diff --git a/tools/drawTools/vtoolheight.h b/tools/drawTools/vtoolheight.h new file mode 100644 index 000000000..c3ab6d02f --- /dev/null +++ b/tools/drawTools/vtoolheight.h @@ -0,0 +1,34 @@ +#ifndef VTOOLHEIGHT_H +#define VTOOLHEIGHT_H + +#include "vtoollinepoint.h" +#include "dialogs/dialogheight.h" +#include + +class VToolHeight: public VToolLinePoint{ + Q_OBJECT +public: + VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static QPointF FindPoint(const QLineF &line, const QPointF &point); +public slots: + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); +protected: + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + QSharedPointer dialogHeight; + qint64 p1LineId; + qint64 p2LineId; +}; + +#endif // VTOOLHEIGHT_H diff --git a/tools/modelingTools/modelingtools.h b/tools/modelingTools/modelingtools.h index 2a051f87a..a40cdf15a 100644 --- a/tools/modelingTools/modelingtools.h +++ b/tools/modelingTools/modelingtools.h @@ -34,5 +34,6 @@ #include "vmodelingsinglepoint.h" #include "vmodelingspline.h" #include "vmodelingsplinepath.h" +#include "vmodelingheight.h" #endif // MODELINGTOOLS_H diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index 76d448dad..096ad37aa 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -74,8 +74,8 @@ void VModelingAlongLine::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "alongLine"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index 17021859d..f13768c51 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -24,9 +24,10 @@ #include #include "widgets/vmaingraphicsscene.h" -VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, - Tool::Sources typeCreation, QGraphicsItem *parent): +VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, const qreal &angle, + const qint64 &basePointId, Tool::Sources typeCreation, + QGraphicsItem *parent): VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent), dialogEndLine(QSharedPointer()){ @@ -37,18 +38,16 @@ VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qi void VModelingEndLine::setDialog(){ Q_ASSERT(!dialogEndLine.isNull()); - if(!dialogEndLine.isNull()){ - VPointF p = VAbstractTool::data.GetModelingPoint(id); - dialogEndLine->setTypeLine(typeLine); - dialogEndLine->setFormula(formula); - dialogEndLine->setAngle(angle); - dialogEndLine->setBasePointId(basePointId, id); - dialogEndLine->setPointName(p.name()); - } + VPointF p = VAbstractTool::data.GetModelingPoint(id); + dialogEndLine->setTypeLine(typeLine); + dialogEndLine->setFormula(formula); + dialogEndLine->setAngle(angle); + dialogEndLine->setBasePointId(basePointId, id); + dialogEndLine->setPointName(p.name()); } VModelingEndLine *VModelingEndLine::Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data){ + VContainer *data){ QString pointName = dialog->getPointName(); QString typeLine = dialog->getTypeLine(); QString formula = dialog->getFormula(); @@ -70,7 +69,7 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin QString errorMsg; qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ - line.setLength(result*PrintDPI/25.4); + line.setLength(toPixel(result)); line.setAngle(angle); qint64 id = _id; if(typeCreation == Tool::FromGui){ @@ -97,7 +96,7 @@ void VModelingEndLine::FullUpdateFromFile(){ typeLine = domElement.attribute("typeLine", ""); formula = domElement.attribute("length", ""); basePointId = domElement.attribute("basePoint", "").toLongLong(); - angle = domElement.attribute("angle", "").toInt(); + angle = domElement.attribute("angle", "").toDouble(); } RefreshGeometry(); } diff --git a/tools/modelingTools/vmodelingheight.cpp b/tools/modelingTools/vmodelingheight.cpp new file mode 100644 index 000000000..d4d6ef1bc --- /dev/null +++ b/tools/modelingTools/vmodelingheight.cpp @@ -0,0 +1,130 @@ +#include "vmodelingheight.h" + +VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, + const qint64 &p2LineId, Tool::Sources typeCreation, + QGraphicsItem * parent) + :VModelingLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), + dialogHeight(QSharedPointer()), p1LineId(p1LineId), p2LineId(p2LineId){ + ignoreFullUpdate = true; + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VModelingHeight::setDialog(){ + Q_ASSERT(!dialogHeight.isNull()); + VPointF p = VAbstractTool::data.GetModelingPoint(id); + dialogHeight->setTypeLine(typeLine); + dialogHeight->setBasePointId(basePointId, id); + dialogHeight->setP1LineId(p1LineId, id); + dialogHeight->setP2LineId(p2LineId, id); + dialogHeight->setPointName(p.name()); +} + +VModelingHeight *VModelingHeight::Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data){ + disconnect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &DialogHeight::UpdateList); + QString pointName = dialog->getPointName(); + QString typeLine = dialog->getTypeLine(); + qint64 basePointId = dialog->getBasePointId(); + qint64 p1LineId = dialog->getP1LineId(); + qint64 p2LineId = dialog->getP2LineId(); + return Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, doc, data, + Document::FullParse, Tool::FromGui); +} + +VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const qint64 &basePointId, const qint64 &p1LineId, + const qint64 &p2LineId, const qreal &mx, const qreal &my, + VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation){ + VModelingHeight *point = 0; + VPointF basePoint = data->GetModelingPoint(basePointId); + VPointF p1Line = data->GetModelingPoint(p1LineId); + VPointF p2Line = data->GetModelingPoint(p2LineId); + + QPointF pHeight = FindPoint(QLineF(p1Line.toQPointF(), p2Line.toQPointF()), basePoint.toQPointF()); + QLineF line = QLineF(basePoint.toQPointF(), pHeight); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->AddModelingPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); + } else { + data->UpdateModelingPoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } + } + data->AddLine(basePointId, id, Draw::Modeling); + if(parse == Document::FullParse){ + point = new VModelingHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId, typeCreation); + doc->AddTool(id, point); + doc->IncrementReferens(basePointId); + doc->IncrementReferens(p1LineId); + doc->IncrementReferens(p2LineId); + } + return point; +} + +void VModelingHeight::FullUpdateFromFile(){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + typeLine = domElement.attribute("typeLine", ""); + basePointId = domElement.attribute("basePoint", "").toLongLong(); + p1LineId = domElement.attribute("p1Line", "").toLongLong(); + p2LineId = domElement.attribute("p2Line", "").toLongLong(); + } + RefreshGeometry(); +} + +void VModelingHeight::FullUpdateFromGui(int result){ + if(result == QDialog::Accepted){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + domElement.setAttribute("name", dialogHeight->getPointName()); + domElement.setAttribute("typeLine", dialogHeight->getTypeLine()); + domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId())); + domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId())); + domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId())); + emit FullUpdateTree(); + } + } + dialogHeight.clear(); +} + +void VModelingHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + ContextMenu(dialogHeight, this, event); +} + +void VModelingHeight::AddToFile(){ + VPointF point = VAbstractTool::data.GetModelingPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "endLine"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); + + AddAttribute(domElement, "typeLine", typeLine); + AddAttribute(domElement, "basePoint", basePointId); + AddAttribute(domElement, "p1Line", p1LineId); + AddAttribute(domElement, "p2Line", p2LineId); + + AddToModeling(domElement); +} + +QPointF VModelingHeight::FindPoint(const QLineF &line, const QPointF &point){ + qreal a = 0, b = 0, c = 0; + LineCoefficients(line, &a, &b, &c); + qreal x = point.x() - b; + qreal y = -a + point.y(); + QLineF l (point, QPointF(x, y)); + QPointF p; + QLineF::IntersectType intersect = line.intersect(l, &p); + if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){ + return p; + } else { + return QPointF(); + } +} diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h new file mode 100644 index 000000000..8d02dd8fd --- /dev/null +++ b/tools/modelingTools/vmodelingheight.h @@ -0,0 +1,34 @@ +#ifndef VMODELINGHEIGHT_H +#define VMODELINGHEIGHT_H + +#include "vmodelinglinepoint.h" +#include "dialogs/dialogheight.h" + +class VModelingHeight : public VModelingLinePoint{ + Q_OBJECT +public: + VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const qint64 &basePointId, + const qint64 &p1LineId, const qint64 &p2LineId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); +virtual void setDialog(); + static VModelingHeight* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); + static QPointF FindPoint(const QLineF &line, const QPointF &point); +public slots: + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); +protected: + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + QSharedPointer dialogHeight; + qint64 p1LineId; + qint64 p2LineId; +}; + +#endif // VMODELINGHEIGHT_H diff --git a/tools/modelingTools/vmodelingtool.cpp b/tools/modelingTools/vmodelingtool.cpp index c651880dd..2dc6b5ad4 100644 --- a/tools/modelingTools/vmodelingtool.cpp +++ b/tools/modelingTools/vmodelingtool.cpp @@ -23,7 +23,7 @@ #include VModelingTool::VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): -VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false){ +VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), ignoreFullUpdate(false) { _referens = 0; } diff --git a/tools/modelingTools/vmodelingtool.h b/tools/modelingTools/vmodelingtool.h index f5bb4bbc7..69a4814e6 100644 --- a/tools/modelingTools/vmodelingtool.h +++ b/tools/modelingTools/vmodelingtool.h @@ -39,6 +39,7 @@ signals: void RemoveTool(QGraphicsItem *tool); protected: bool ignoreContextMenuEvent; + bool ignoreFullUpdate; void AddToModeling(const QDomElement &domElement); virtual void decrementReferens(); template @@ -46,39 +47,44 @@ protected: bool showRemove = true){ if(!ignoreContextMenuEvent){ QMenu menu; - QAction *actionOption = menu.addAction("Властивості"); - QAction *actionRemove; + QAction *actionOption = menu.addAction(tr("Option")); + QAction *actionRemove = 0; if(showRemove){ - actionRemove = menu.addAction("Видалити"); + actionRemove = menu.addAction(tr("Delete")); } QAction *selectedAction = menu.exec(event->screenPos()); if(selectedAction == actionOption){ - dialog = QSharedPointer(new Dialog(getData())); + dialog = QSharedPointer(new Dialog(getData())); - connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), &VMainGraphicsScene::ChoosedObject, - dialog.data(), &Dialog::ChoosedObject); - connect(dialog.data(), &Dialog::DialogClosed, tool, - &Tool::FullUpdateFromGui); - connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); + connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), + &VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject); + connect(dialog.data(), &Dialog::DialogClosed, tool, &Tool::FullUpdateFromGui); + if(!ignoreFullUpdate){ + connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); + } tool->setDialog(); dialog->show(); } - if(selectedAction == actionRemove){ - //remove form xml file - QDomElement domElement = doc->elementById(QString().setNum(id)); - if(domElement.isElement()){ - QDomElement element; - bool ok = doc->GetActivCalculationElement(element); - if(ok){ - element.removeChild(domElement); - //update xml file - emit FullUpdateTree(); - //remove form scene - emit RemoveTool(tool); - } - } + if(showRemove){ + if(selectedAction == actionRemove){ + //deincrement referens + RemoveReferens(); + //remove form xml file + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + QDomElement element; + bool ok = doc->GetActivCalculationElement(element); + if(ok){ + element.removeChild(domElement); + //update xml file + emit FullUpdateTree(); + //remove form scene + emit RemoveTool(tool); + } + } + } } } } diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index 50838f4d7..e6b656efc 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -85,10 +85,8 @@ qint32 VAbstractTool::LineIntersectCircle(QPointF center, qreal radius, QLineF l QPointF &p2){ const qreal eps = 1e-8; //коефіцієнти для рівняння відрізку - qreal a = line.p2().y() - line.p1().y(); - qreal b = line.p1().x() - line.p2().x(); - // В даному випадку не використовується. - //qreal c = - a * line.p1().x() - b * line.p1().y(); + qreal a = 0, b = 0, c = 0; + LineCoefficients(line, &a, &b, &c); // проекция центра окружности на прямую QPointF p = ClosestPoint (line, center); // сколько всего решений? @@ -138,6 +136,13 @@ const VContainer *VAbstractTool::getData()const{ return &data; } +void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c){ + //коефіцієнти для рівняння відрізку + *a = line.p2().y() - line.p1().y(); + *b = line.p1().x() - line.p2().x(); + *c = - *a * line.p1().x() - *b * line.p1().y(); +} + qint64 VAbstractTool::getId() const{ return id; } diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 2391e053b..0982bc64c 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -35,8 +35,8 @@ public: QPointF &p2); static QPointF ClosestPoint(QLineF line, QPointF p); static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k); - qint64 getId() const; - + qint64 getId() const; + static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c); public slots: virtual void FullUpdateFromFile()=0; signals: diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 8c7118c84..52e42e7ff 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -806,6 +806,31 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen throw excep; } } + if(type == "height"){ + try{ + qint64 id = GetParametrId(domElement); + QString name = GetParametrString(domElement, "name"); + qreal mx = toPixel(GetParametrDouble(domElement, "mx")); + qreal my = toPixel(GetParametrDouble(domElement, "my")); + QString typeLine = GetParametrString(domElement, "typeLine"); + qint64 basePointId = GetParametrLongLong(domElement, "basePoint"); + qint64 p1LineId = GetParametrLongLong(domElement, "p1Line"); + qint64 p2LineId = GetParametrLongLong(domElement, "p2Line"); + if(mode == Draw::Calculation){ + VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, mx, my, scene, + this, data, parse, Tool::FromFile); + } else { + VModelingHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, mx, my, this, + data, parse, Tool::FromFile); + } + return; + } + catch(const VExceptionBadId &e){ + VExceptionObjectError excep(tr("Error creating or updating height"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + } } void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, From 25190e16a95568de58ea71cb1eb50c8957d3fa42 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 18 Oct 2013 13:43:51 +0300 Subject: [PATCH 39/70] Use static method FindPoint common for tools. --HG-- branch : develop --- tools/drawTools/vtoolalongline.h | 38 ++++++------- tools/drawTools/vtoolbisector.h | 42 +++++++-------- tools/drawTools/vtoolendline.h | 27 +++++----- tools/drawTools/vtoolline.h | 42 +++++++-------- tools/drawTools/vtoolnormal.h | 3 +- tools/drawTools/vtoolpointofcontact.h | 3 +- tools/drawTools/vtoolsinglepoint.h | 27 +++++----- tools/modelingTools/vmodelingbisector.cpp | 16 +----- tools/modelingTools/vmodelingbisector.h | 42 +++++++-------- tools/modelingTools/vmodelingheight.cpp | 19 ++----- tools/modelingTools/vmodelingheight.h | 3 +- tools/modelingTools/vmodelingnormal.cpp | 14 ++--- tools/modelingTools/vmodelingnormal.h | 39 +++++++------- .../modelingTools/vmodelingpointofcontact.cpp | 27 ++-------- tools/modelingTools/vmodelingpointofcontact.h | 47 ++++++++-------- .../modelingTools/vmodelingshoulderpoint.cpp | 26 ++------- tools/modelingTools/vmodelingshoulderpoint.h | 45 ++++++++-------- tools/modelingTools/vmodelingsplinepath.h | 54 +++++++++---------- tools/modelingTools/vmodelingtool.h | 5 ++ 19 files changed, 216 insertions(+), 303 deletions(-) diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index ce02b8b30..4f5ddd04b 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -25,30 +25,30 @@ #include "vtoollinepoint.h" #include "dialogs/dialogalongline.h" -class VToolAlongLine : public VToolLinePoint -{ +class VToolAlongLine : public VToolLinePoint{ Q_OBJECT public: - VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, + const qint64 &firstPointId, const qint64 &secondPointId, + const QString &typeLine, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - virtual void SetFactor(qreal factor); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 secondPointId; + qint64 secondPointId; QSharedPointer dialogAlongLine; }; diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index 3a982bbc1..fa0bc9061 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -27,31 +27,31 @@ class VToolBisector : public VToolLinePoint{ public: - VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, + VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const qint64 &thirdPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint, const qreal& length); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, - const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, + const QString &pointName, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - virtual void SetFactor(qreal factor); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 firstPointId; - qint64 thirdPointId; + qint64 firstPointId; + qint64 thirdPointId; QSharedPointer dialogBisector; }; diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h index 4cd89b31b..7b9a5e39b 100644 --- a/tools/drawTools/vtoolendline.h +++ b/tools/drawTools/vtoolendline.h @@ -28,23 +28,22 @@ class VToolEndLine : public VToolLinePoint{ Q_OBJECT public: - VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qreal &angle, - const qint64 &basePointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); + VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qreal &angle, const qint64 &basePointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, + const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); private: QSharedPointer dialogEndLine; }; diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index dab4b6d47..bc9976805 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -29,31 +29,31 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem{ Q_OBJECT public: - VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data); - static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, + qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void ChangedActivDraw(const QString newName); - virtual void FullUpdateFromGui(int result); - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); - virtual void SetFactor(qreal factor); + virtual void FullUpdateFromFile(); + virtual void ChangedActivDraw(const QString newName); + virtual void FullUpdateFromGui(int result); + virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: - qint64 firstPoint; - qint64 secondPoint; + qint64 firstPoint; + qint64 secondPoint; QSharedPointer dialogLine; - void RefreshGeometry(); + void RefreshGeometry(); }; #endif // VTOOLLINE_H diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 41bda6144..f7336cacf 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -25,8 +25,7 @@ #include "vtoollinepoint.h" #include "dialogs/dialognormal.h" -class VToolNormal : public VToolLinePoint -{ +class VToolNormal : public VToolLinePoint{ Q_OBJECT public: VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index 049e6efbc..de7390549 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -25,8 +25,7 @@ #include "vtoolpoint.h" #include "dialogs/dialogpointofcontact.h" -class VToolPointOfContact : public VToolPoint -{ +class VToolPointOfContact : public VToolPoint{ public: VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index 2a610bc92..ee9b7bcf3 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -25,25 +25,24 @@ #include "dialogs/dialogsinglepoint.h" #include "vtoolpoint.h" -class VToolSinglePoint : public VToolPoint -{ +class VToolSinglePoint : public VToolPoint{ Q_OBJECT public: - VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); - virtual void setDialog(); + VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0 ); + virtual void setDialog(); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - virtual void ChangedActivDraw(const QString newName); - virtual void SetFactor(qreal factor); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void ChangedActivDraw(const QString newName); + virtual void SetFactor(qreal factor); signals: - void FullUpdateTree(); + void FullUpdateTree(); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); - virtual void decrementReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); + virtual void decrementReferens(); private: QSharedPointer dialogSinglePoint; }; diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index 158b19ad0..b98391d06 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -21,6 +21,7 @@ #include "vmodelingbisector.h" #include +#include "../drawTools/vtoolbisector.h" VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, @@ -36,19 +37,6 @@ VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const } } -QPointF VModelingBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const QPointF &thirdPoint, const qreal &length){ - QLineF line1(secondPoint, firstPoint); - QLineF line2(secondPoint, thirdPoint); - qreal angle = line1.angleTo(line2); - if(angle>180){ - angle = 360 - angle; - } - line1.setAngle(line1.angle()-angle/2); - line1.setLength(length); - return line1.p2(); -} - void VModelingBisector::setDialog(){ Q_ASSERT(!dialogBisector.isNull()); if(!dialogBisector.isNull()){ @@ -89,7 +77,7 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo QString errorMsg; qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ - QPointF fPoint = VModelingBisector::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), + QPointF fPoint = VToolBisector::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), thirdPoint.toQPointF(), result*PrintDPI/25.4); qint64 id = _id; if(typeCreation == Tool::FromGui){ diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index 8795d90de..3c13a03e6 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -28,31 +28,29 @@ class VModelingBisector : public VModelingLinePoint{ Q_OBJECT public: - VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, - const qint64 &thirdPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const QPointF &thirdPoint, const qreal& length); - virtual void setDialog(); - static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, - const QString &typeLine, const QString &pointName, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, + const qint64 &firstPointId, const qint64 &secondPointId, + const qint64 &thirdPointId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const qint64 &thirdPointId, + const QString &typeLine, const QString &pointName, const qreal &mx, + const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 firstPointId; - qint64 thirdPointId; + qint64 firstPointId; + qint64 thirdPointId; QSharedPointer dialogBisector; }; diff --git a/tools/modelingTools/vmodelingheight.cpp b/tools/modelingTools/vmodelingheight.cpp index d4d6ef1bc..46e3d3565 100644 --- a/tools/modelingTools/vmodelingheight.cpp +++ b/tools/modelingTools/vmodelingheight.cpp @@ -1,4 +1,5 @@ #include "vmodelingheight.h" +#include "../drawTools/vtoolheight.h" VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, @@ -44,7 +45,8 @@ VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointN VPointF p1Line = data->GetModelingPoint(p1LineId); VPointF p2Line = data->GetModelingPoint(p2LineId); - QPointF pHeight = FindPoint(QLineF(p1Line.toQPointF(), p2Line.toQPointF()), basePoint.toQPointF()); + QPointF pHeight = VToolHeight::FindPoint(QLineF(p1Line.toQPointF(), p2Line.toQPointF()), + basePoint.toQPointF()); QLineF line = QLineF(basePoint.toQPointF(), pHeight); qint64 id = _id; if(typeCreation == Tool::FromGui){ @@ -113,18 +115,3 @@ void VModelingHeight::AddToFile(){ AddToModeling(domElement); } - -QPointF VModelingHeight::FindPoint(const QLineF &line, const QPointF &point){ - qreal a = 0, b = 0, c = 0; - LineCoefficients(line, &a, &b, &c); - qreal x = point.x() - b; - qreal y = -a + point.y(); - QLineF l (point, QPointF(x, y)); - QPointF p; - QLineF::IntersectType intersect = line.intersect(l, &p); - if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){ - return p; - } else { - return QPointF(); - } -} diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h index 8d02dd8fd..7d2362b5a 100644 --- a/tools/modelingTools/vmodelingheight.h +++ b/tools/modelingTools/vmodelingheight.h @@ -11,14 +11,13 @@ public: const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); -virtual void setDialog(); + virtual void setDialog(); static VModelingHeight* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); - static QPointF FindPoint(const QLineF &line, const QPointF &point); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index 55edddd10..448232f50 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -20,6 +20,7 @@ ****************************************************************************/ #include "vmodelingnormal.h" +#include "../drawTools/vtoolnormal.h" VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, @@ -72,8 +73,8 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul QString errorMsg; qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ - QPointF fPoint = VModelingNormal::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - result*PrintDPI/25.4, angle); + QPointF fPoint = VToolNormal::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), + toPixel(result), angle); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddModelingPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); @@ -95,15 +96,6 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul return point; } -QPointF VModelingNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, - const qreal &angle){ - QLineF line(firstPoint, secondPoint); - QLineF normal = line.normalVector(); - normal.setAngle(normal.angle()+angle); - normal.setLength(length); - return normal.p2(); -} - void VModelingNormal::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index 906aa797f..7d640421e 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -28,30 +28,27 @@ class VModelingNormal : public VModelingLinePoint{ Q_OBJECT public: - VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString typeLine, - const QString pointName, const qreal angle, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); - static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const qreal &length, const qreal &angle = 0); + VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, + const qreal &angle, const qint64 &firstPointId, + const qint64 &secondPointId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const QString typeLine, + const QString pointName, const qreal angle, const qreal &mx, + const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 secondPointId; + qint64 secondPointId; QSharedPointer dialogNormal; }; diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index 35d6e9c2e..049d90300 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -20,6 +20,7 @@ ****************************************************************************/ #include "vmodelingpointofcontact.h" +#include "../drawTools/vtoolpointofcontact.h" VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, @@ -45,28 +46,6 @@ void VModelingPointOfContact::setDialog(){ } } -QPointF VModelingPointOfContact::FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint, - const QPointF &secondPoint){ - QPointF pArc; - qreal s = 0.0, s_x, s_y, step = 0.01, distans; - while( s < 1){ - s_x = secondPoint.x()-(qAbs(secondPoint.x()-firstPoint.x()))*s; - s_y = secondPoint.y()-(qAbs(secondPoint.y()-firstPoint.y()))*s; - distans = QLineF(center.x(), center.y(), s_x, s_y).length(); - if(ceil(distans*10) == ceil(radius*10)){ - pArc.rx() = s_x; - pArc.ry() = s_y; - break; - } - if(distans &dialog, VDomDocument *doc, VContainer *data){ QString radius = dialog->getRadius(); @@ -94,8 +73,8 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const QString errorMsg; qreal result = cal.eval(radius, &errorMsg); if(errorMsg.isEmpty()){ - QPointF fPoint = VModelingPointOfContact::FindPoint(result*PrintDPI/25.4, centerP.toQPointF(), - firstP.toQPointF(), secondP.toQPointF()); + QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP.toQPointF(), + firstP.toQPointF(), secondP.toQPointF()); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddModelingPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index 02302bc45..d8d4af4a4 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -28,35 +28,32 @@ class VModelingPointOfContact : public VModelingPoint{ Q_OBJECT public: - VModelingPointOfContact(VDomDocument *doc, VContainer *data, - const qint64 &id, const QString &radius, - const qint64 ¢er, - const qint64 &firstPointId, - const qint64 &secondPointId, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static QPointF FindPoint(const qreal &radius, const QPointF ¢er, - const QPointF &firstPoint, const QPointF &secondPoint); - static VModelingPointOfContact* Create(QSharedPointer &dialog, + VModelingPointOfContact(VDomDocument *doc, VContainer *data, + const qint64 &id, const QString &radius, + const qint64 ¢er, const qint64 &firstPointId, + const qint64 &secondPointId, + Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingPointOfContact* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, - const QString &pointName, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er, + const qint64 &firstPointId, const qint64 &secondPointId, + const QString &pointName, const qreal &mx, const qreal &my, + VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - QString radius; - qint64 center; - qint64 firstPointId; - qint64 secondPointId; + QString radius; + qint64 center; + qint64 firstPointId; + qint64 secondPointId; QSharedPointer dialogPointOfContact; }; diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index d96b5ccdf..16292b4df 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -21,6 +21,7 @@ #include "vmodelingshoulderpoint.h" #include +#include "../drawTools/vtoolshoulderpoint.h" VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, @@ -48,27 +49,6 @@ void VModelingShoulderPoint::setDialog(){ } } -QPointF VModelingShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, - const qreal &length){ - QLineF line = QLineF(p1Line, p2Line); - qreal dist = line.length(); - if(dist>length){ - qDebug()<<"A3П2="<=length){ - return line.p2(); - } - } -} - VModelingShoulderPoint *VModelingShoulderPoint::Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data){ QString formula = dialog->getFormula(); @@ -97,8 +77,8 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q QString errorMsg; qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ - QPointF fPoint = VModelingShoulderPoint::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - shoulderPoint.toQPointF(), result*PrintDPI/25.4); + QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), + shoulderPoint.toQPointF(), toPixel(result)); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddModelingPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index 399c95868..e4bc9b928 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -28,33 +28,30 @@ class VModelingShoulderPoint : public VModelingLinePoint{ Q_OBJECT public: - VModelingShoulderPoint(VDomDocument *doc, VContainer *data, - const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, - const QPointF &pShoulder, const qreal &length); - static VModelingShoulderPoint* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); - static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, - const QString &typeLine, const QString &pointName, - const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + VModelingShoulderPoint(VDomDocument *doc, VContainer *data, + const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &p1Line, + const qint64 &p2Line, const qint64 &pShoulder, + Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingShoulderPoint* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line, + const qint64 &p2Line, const qint64 &pShoulder, + const QString &typeLine, const QString &pointName, const qreal &mx, + const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, const Tool::Sources &typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 p2Line; - qint64 pShoulder; + qint64 p2Line; + qint64 pShoulder; QSharedPointer dialogShoulderPoint; }; diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index de3ea52c8..c92a70204 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -30,40 +30,38 @@ class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: - VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingSplinePath* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); - static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingSplinePath* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); signals: - void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, - const QPointF &controlPoint, const QPointF &splinePoint); - void setEnabledPoint(bool enable); + void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, + const QPointF &controlPoint, const QPointF &splinePoint); + void setEnabledPoint(bool enable); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - void ControlPointChangePosition(const qint32 &indexSpline, - SplinePoint::Position position, - const QPointF pos); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + void ControlPointChangePosition(const qint32 &indexSpline, + SplinePoint::Position position, const QPointF pos); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSplinePath; QVector controlPoints; - void RefreshGeometry(); - void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); - void UpdatePathPoint(QDomNode& node, VSplinePath &path); - void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, - const qint32 &indexSpline); + void RefreshGeometry(); + void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); + void UpdatePathPoint(QDomNode& node, VSplinePath &path); + void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, + const qint32 &indexSpline); }; #endif // VMODELINGSPLINEPATH_H diff --git a/tools/modelingTools/vmodelingtool.h b/tools/modelingTools/vmodelingtool.h index 69a4814e6..d19819378 100644 --- a/tools/modelingTools/vmodelingtool.h +++ b/tools/modelingTools/vmodelingtool.h @@ -51,6 +51,11 @@ protected: QAction *actionRemove = 0; if(showRemove){ actionRemove = menu.addAction(tr("Delete")); + if(_referens > 1){ + actionRemove->setEnabled(false); + } else { + actionRemove->setEnabled(true); + } } QAction *selectedAction = menu.exec(event->screenPos()); if(selectedAction == actionOption){ From 0263b60e3cff79b9e44a0cd0b11ad7949f533c5a Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 18 Oct 2013 21:20:54 +0300 Subject: [PATCH 40/70] New tool triangle. --HG-- branch : develop --- Valentina.pro | 13 +- cursor.qrc | 1 + cursor/triangle_cursor.png | Bin 0 -> 1480 bytes dialogs/dialogheight.cpp | 1 - dialogs/dialogheight.ui | 3 + dialogs/dialoghistory.cpp | 15 ++ dialogs/dialogtriangle.cpp | 125 ++++++++++++++ dialogs/dialogtriangle.h | 42 +++++ dialogs/dialogtriangle.ui | 196 ++++++++++++++++++++++ icon.qrc | 1 + icon/32x32/triangle.png | Bin 0 -> 3907 bytes mainwindow.cpp | 29 ++++ mainwindow.h | 6 +- mainwindow.ui | 34 +++- options.h | 3 +- tools/drawTools/drawtools.h | 1 + tools/drawTools/vtoolalongline.cpp | 4 +- tools/drawTools/vtoolshoulderpoint.cpp | 28 ++-- tools/drawTools/vtooltriangle.cpp | 150 +++++++++++++++++ tools/drawTools/vtooltriangle.h | 39 +++++ tools/modelingTools/modelingtools.h | 1 + tools/modelingTools/vmodelingtriangle.cpp | 127 ++++++++++++++ tools/modelingTools/vmodelingtriangle.h | 39 +++++ tools/vtooldetail.cpp | 16 ++ xml/vdomdocument.cpp | 26 +++ 25 files changed, 873 insertions(+), 27 deletions(-) create mode 100644 cursor/triangle_cursor.png create mode 100644 dialogs/dialogtriangle.cpp create mode 100644 dialogs/dialogtriangle.h create mode 100644 dialogs/dialogtriangle.ui create mode 100644 icon/32x32/triangle.png create mode 100644 tools/drawTools/vtooltriangle.cpp create mode 100644 tools/drawTools/vtooltriangle.h create mode 100644 tools/modelingTools/vmodelingtriangle.cpp create mode 100644 tools/modelingTools/vmodelingtriangle.h diff --git a/Valentina.pro b/Valentina.pro index c05bf37e1..74ac8fbca 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -100,7 +100,10 @@ SOURCES += main.cpp\ exception/vexceptionuniqueid.cpp \ tools/drawTools/vtoolheight.cpp \ tools/modelingTools/vmodelingheight.cpp \ - dialogs/dialogheight.cpp + dialogs/dialogheight.cpp \ + tools/drawTools/vtooltriangle.cpp \ + tools/modelingTools/vmodelingtriangle.cpp \ + dialogs/dialogtriangle.cpp HEADERS += mainwindow.h \ widgets/vmaingraphicsscene.h \ @@ -194,7 +197,10 @@ HEADERS += mainwindow.h \ exception/vexceptionuniqueid.h \ tools/drawTools/vtoolheight.h \ tools/modelingTools/vmodelingheight.h \ - dialogs/dialogheight.h + dialogs/dialogheight.h \ + tools/drawTools/vtooltriangle.h \ + tools/modelingTools/vmodelingtriangle.h \ + dialogs/dialogtriangle.h FORMS += mainwindow.ui \ dialogs/dialogsinglepoint.ui \ @@ -213,7 +219,8 @@ FORMS += mainwindow.ui \ dialogs/dialogpointofcontact.ui \ dialogs/dialogdetail.ui \ tablewindow.ui \ - dialogs/dialogheight.ui + dialogs/dialogheight.ui \ + dialogs/dialogtriangle.ui RESOURCES += \ icon.qrc \ diff --git a/cursor.qrc b/cursor.qrc index b38ff9e43..a0827a0a2 100644 --- a/cursor.qrc +++ b/cursor.qrc @@ -13,5 +13,6 @@ cursor/pointcontact_cursor.png cursor/new_detail_cursor.png cursor/height_cursor.png + cursor/triangle_cursor.png diff --git a/cursor/triangle_cursor.png b/cursor/triangle_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..2fc657ce879efdd8520dad8db447d914bf2fa432 GIT binary patch literal 1480 zcmV;(1vmPMP)Vl&|00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-3k&A89I~x@jd_m06}y` zSad^gZEa<4bO1wAML|?gQaT`KWG!lNWoICEF)lD5D0OpbZf77#N=G0{P(?=|b~Z98 zEFf`pVQgu1c_2L?IWP*aMOc#n00jt1L_t(Y$HkUyXq9Cc$A993kp^*4|KFZ34mIVtI z_$MvqiFl`)QVPd$5D}W1nuZeRr%s(xlO}trX|3t*?v|>mD$!a~RaM1`6)XN5@N|q5 zX4^KN=K-kW$BzTBc=6%~2E6_?Ry0bL2y3moT~tb;wMIk`kz_Nvdi5$mVBx}rkKZr2 zcB!&Fj!wzoIcFk2P)dyo$L`&`$;`~`?(FOYn6Uhv$Enl<9G(_{3_sCP**?}%!!hZ(>bD)qNAgOP$<;V z+uKWSZtfOfPg=%Dd49N?Z}X>8;P-=gAZARdO*8}|f-wdWp}oDG8#it+G&B@V+-YuZ zPTs%zB~Q46e3j+!NI?-;Dh@7j@VjMux{x@IlXN0co@dUSdB3u<^3VGE`s?%O&j+C6 z2!(o(@3I_b6$K$W0>;BL28}+^!q5u z3&2PO28MY#ZwmDpK7!-GZQD*}bt1!aa&n}+yj+FD;ZYq=Yn|+TB7*C>0A6Wn>G0(* z$k$;$_l77boC~gjfiO#FuI5Z{1Fp}G$?l|MYFQS>7?e^hTC_-=Jb7}$<#hi11$AjJ zdowIvnOy<{{dg{HnYo(pA(m*y#Ns|G=EfK-%St+sNURelPTX^({<$->10A|R%gzUw_}{H){FBx?DkFpJ&km50mj`_VT<#fW&6`K(_7)fQ(0!*L5f4Ej#3UCx zrNcRn^DeNat*z~~ix)30O(QFS8(%sB+`f+&hWj{DG>wd$9Ow^osV~gDo#$S?skMjp zT%wT(BO@c+ywy!l&uzqD5=o~f5YM#j@5%v6db()N%_g^C8UTZRL%axdX_H|&Dk_QB z1+YO!45bA*{N&j9qMF+e1m5%>vqbYlwx8KEg5c^{({MfT3|>+#HTogP#>$ANctmr{ zx!=Lkyn{S(IS`o2>?u<~yD|5ag3Q=!_P8ORvJn$^)a8$RfsbQtSr~joHMo%|I^w1W iNqZFEXpa`xBlI_6Mqud%g5MVa0000setupUi(this); labelEditNamePoint = ui->labelEditNamePoint; - flagFormula = true; bOk = ui->buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogHeight::DialogAccepted); flagName = false; diff --git a/dialogs/dialogheight.ui b/dialogs/dialogheight.ui index bfb3dab67..9c4900050 100644 --- a/dialogs/dialogheight.ui +++ b/dialogs/dialogheight.ui @@ -13,6 +13,9 @@ Dialog + + + diff --git a/dialogs/dialoghistory.cpp b/dialogs/dialoghistory.cpp index d1b19544a..10df37d63 100644 --- a/dialogs/dialoghistory.cpp +++ b/dialogs/dialoghistory.cpp @@ -264,6 +264,21 @@ QString DialogHistory::Record(const VToolRecord &tool){ data->GetPoint(p2LineId).name()); break; } + case Tool::Triangle:{ + qint64 axisP1Id = 0; + qint64 axisP2Id = 0; + domElement = doc->elementById(QString().setNum(tool.getId())); + if(domElement.isElement()){ + axisP1Id = domElement.attribute("axisP1", "").toLongLong(); + axisP2Id = domElement.attribute("axisP2", "").toLongLong(); + firstPointId = domElement.attribute("firstPoint", "").toLongLong(); + secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + } + record = QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg( + data->GetPoint(axisP1Id).name(),data->GetPoint(axisP2Id).name(), + data->GetPoint(firstPointId).name(), data->GetPoint(secondPointId).name()); + break; + } default: qWarning()<setupUi(this); + labelEditNamePoint = ui->labelEditNamePoint; + bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + connect(bOk, &QPushButton::clicked, this, &DialogTriangle::DialogAccepted); + flagName = false; + CheckState(); + QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); + connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected); + FillComboBoxPoints(ui->comboBoxAxisP1); + FillComboBoxPoints(ui->comboBoxAxisP2); + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged); +} + +DialogTriangle::~DialogTriangle(){ + delete ui; +} + +void DialogTriangle::ChoosedObject(qint64 id, Scene::Scenes type){ + if(idDetail == 0 && mode == Draw::Modeling){ + if(type == Scene::Detail){ + idDetail = id; + return; + } + } + if(mode == Draw::Modeling){ + if(!CheckObject(id)){ + return; + } + } + if(type == Scene::Point){ + VPointF point; + if(mode == Draw::Calculation){ + point = data->GetPoint(id); + } else { + point = data->GetModelingPoint(id); + } + switch(number){ + case(0): + ChangeCurrentText(ui->comboBoxAxisP1, point.name()); + number++; + emit ToolTip(tr("Select second point of axis")); + break; + case(1): + ChangeCurrentText(ui->comboBoxAxisP2, point.name()); + number++; + emit ToolTip(tr("Select first point")); + break; + case(2): + ChangeCurrentText(ui->comboBoxFirstPoint, point.name()); + number++; + emit ToolTip(tr("Select second point")); + break; + case(3): + ChangeCurrentText(ui->comboBoxSecondPoint, point.name()); + number = 0; + emit ToolTip(tr("")); + if(!isInitialized){ + this->show(); + } + break; + } + } +} + +void DialogTriangle::DialogAccepted(){ + pointName = ui->lineEditNamePoint->text(); + firstPointId = getCurrentPointId(ui->comboBoxFirstPoint); + secondPointId = getCurrentPointId(ui->comboBoxSecondPoint); + axisP1Id = getCurrentPointId(ui->comboBoxAxisP1); + axisP2Id = getCurrentPointId(ui->comboBoxAxisP2); + emit DialogClosed(QDialog::Accepted); +} +QString DialogTriangle::getPointName() const{ + return pointName; +} + +void DialogTriangle::setPointName(const QString &value){ + pointName = value; + ui->lineEditNamePoint->setText(pointName); +} + +qint64 DialogTriangle::getSecondPointId() const{ + return secondPointId; +} + +void DialogTriangle::setSecondPointId(const qint64 &value, const qint64 &id){ + secondPointId = value; + setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); +} + +qint64 DialogTriangle::getFirstPointId() const{ + return firstPointId; +} + +void DialogTriangle::setFirstPointId(const qint64 &value, const qint64 &id){ + firstPointId = value; + setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); +} + +qint64 DialogTriangle::getAxisP2Id() const{ + return axisP2Id; +} + +void DialogTriangle::setAxisP2Id(const qint64 &value, const qint64 &id){ + axisP2Id = value; + setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id); +} + +qint64 DialogTriangle::getAxisP1Id() const{ + return axisP1Id; +} + +void DialogTriangle::setAxisP1Id(const qint64 &value, const qint64 &id){ + axisP1Id = value; + setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id); +} + diff --git a/dialogs/dialogtriangle.h b/dialogs/dialogtriangle.h new file mode 100644 index 000000000..74c9bcf3c --- /dev/null +++ b/dialogs/dialogtriangle.h @@ -0,0 +1,42 @@ +#ifndef DIALOGTRIANGLE_H +#define DIALOGTRIANGLE_H + +#include "dialogtool.h" + +namespace Ui { +class DialogTriangle; +} + +class DialogTriangle : public DialogTool +{ + Q_OBJECT + +public: + DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogTriangle(); + qint64 getAxisP1Id() const; + void setAxisP1Id(const qint64 &value, const qint64 &id); + qint64 getAxisP2Id() const; + void setAxisP2Id(const qint64 &value, const qint64 &id); + qint64 getFirstPointId() const; + void setFirstPointId(const qint64 &value, const qint64 &id); + qint64 getSecondPointId() const; + void setSecondPointId(const qint64 &value, const qint64 &id); + QString getPointName() const; + void setPointName(const QString &value); +public slots: + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); +private: + Q_DISABLE_COPY(DialogTriangle) + Ui::DialogTriangle *ui; + qint32 number; + QString pointName; + qint64 axisP1Id; + qint64 axisP2Id; + qint64 firstPointId; + qint64 secondPointId; +}; + +#endif // DIALOGTRIANGLE_H diff --git a/dialogs/dialogtriangle.ui b/dialogs/dialogtriangle.ui new file mode 100644 index 000000000..7e788b2f0 --- /dev/null +++ b/dialogs/dialogtriangle.ui @@ -0,0 +1,196 @@ + + + DialogTriangle + + + + 0 + 0 + 267 + 220 + + + + Dialog + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Name new point + + + + + + + + + + + + + + First point of axis + + + + + + + First point of line + + + + + + + + + + + Second point of axis + + + + + + + First point of line + + + + + + + + + + + First point + + + + + + + First point of line + + + + + + + + + + + Second point + + + + + + + First point of line + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogTriangle + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogTriangle + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/icon.qrc b/icon.qrc index e5bf6d0ed..520ff398d 100644 --- a/icon.qrc +++ b/icon.qrc @@ -35,5 +35,6 @@ icon/32x32/layout.png icon/16x16/mirror.png icon/32x32/height.png + icon/32x32/triangle.png diff --git a/icon/32x32/triangle.png b/icon/32x32/triangle.png new file mode 100644 index 0000000000000000000000000000000000000000..c409b3b41367a854e73a52140cd08a6780d7fefc GIT binary patch literal 3907 zcmV-J54`Y+P)StO&>uS)ve< z0AYj>5AR{$W90N^4L=L-RlQUJ&DC0@ZjPh;=*jPLSYvv5M~MFBAl0-BNIsH15C~g000{K(ZT*W zKal6<?_01!^k@7iDG<<3=fuAC~28EsPoqkpK{9 zG%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~laM4*8xut5h5!4#~(4xGUqyucR% zVFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH;SjXJF*pt9;1XPc>u?taU>Kgl z7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj>4+3jBE`sZqynizYLQ(?Bl0bB z6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3rpmWi5G!I>XmZEFX8nhlgfVQHi z(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPzlc-O$C3+J1#CT#lv5;6stS0Uu z9wDA3UMCI{Uz12A4#|?_P6{CkNG+sOq(0IRX`DyT~9-sA|ffUF>w zk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3apE5$3psG>Lsh-pbs)#zDT1jo7 zc2F-(3)vyY4>O^>2$gY-Gd%Qm(Z8eYv>2*=jns=cMJ`N z4THx>VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA514ONSSt1^d=-((5|uiYR+WC0 z=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6TaXrs|dqbIl~?uTdNHFy_3W~^@< zVyraYW!!5#VPa`A+oZ&##pJ#z&6I1JX1dX|({#+t$SmBf*sRIyjyctwYo1}g*}U8Q zjfJH}oW)9uHjBrW+LnCF1(r>g_pF#!K2~{F^;XxcN!DEJEbDF7S8PxlSDOr*I-AS3 zsI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJcaVfH2VZT8O{%p4LO);n}Nd~$Sk z%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD%mlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_%;TM>o2SC_kmoO6c3xRt`@J4d zvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B%zNWq+-#xw~e%5}Oeh2)X`#bu} z{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx1&sx}1}_Xg6+#RN4Ot&@lW)Km z@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHXZ>IT7>CCnWh~P(Th`1kV8JQRP zeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlxwsLl7tZHmhY-8-3xPZ8-xPf?w z_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT<=mpV7v|~C%bs^USv6UZd^m-e z5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qUN<5P0omQ3hINdvaL;7fjPeygd zGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!lNmb5F^Ft;eTPi8AClMUo~=55Lw zlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@C~gS@r~shUu{a>bfJ1`^^VQ7&C1OKHDNXF zTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJzrV5xZBjOk9!NTH<(q(S+MDf~ zceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2;PCq@=ncR8zO#GQ^T~S@VXG71P zKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U{ozQjTW{-S_si{9Jg#)~P3t?+ z@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7?H6|n?o8ZWdXIRo{Jz@#>IeD{ z>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik)gwkDjgOrl9~%uCz4Bzvli{bb zrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq@2jb=I>#f&AH2?aJ@Kaet zy{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*!15EuYV=^4!c00ehQL_t(o z!@ZYVOk7nIhQB>GU}h)-Ln&1#mjbP{*r<()z8K#cjryb^Awe5U;Gq`FgS9cyMop^~ zEN!%@RlHP7n`kt#Ufz5$O`{JY$X^lnDE-oZ+3)x>W=KP__x%hBB}L z>NKsxr)XJK0BB&gLSYf80RY||`k1Fz4S)m$5cI=_D$qh;wsLm(GagwL00NK_+y#)4 z0qaXZ^@9}rH2Ni5<>*Q?Amc-i4;3=)Ff$3$5qhV7qiFQ(3IjkI6B5XBLQ#pKiJ2QP z+6CdbpYk__meYalhyRnSye;{t~hVm`9GBMcQ)U>*K^1ye9fLHt=$A=?GHZir2h zf4P@|(t5c3>2d?m=NQoS`Fe0@e~t^fnX0R+Q*&~c7xUyw0Xf#QvjzZNoWphem7*9khScCG{i zdOQs}V&|jC@kuHI5rV1$!UTEwphiKT;kkhmyuSQZkjTG)@&<4@iA?&a420064%1O6 z-wY_AMtJ2?Cr!(ff`s}LBGe3rQUkMYP<$}`=T9nNf-{$9<7U*eDvkxST@s<<-H7`J42UIrm zKp@PJsu;1(Y$IL?@o>*!zTUPMdfL+I1KRvvkdAHL1N|K^=;1DZ7_Y7&5wNk+sF0|S zr+V9Xe_LxhDPV5*5;A^oOAo}BJy2ADIvJuO7$st}fD(h^QUgTbI?a9U?7wvi;$k!l z$h30k?$-3{x#mT<|0M#k7<+ZyU@#IgG+{G?-^-hQ?L3^bbXXCFT%Vk`ir6hk*BrPl# zAVH)|#A9TVqb@;Fz&j2x35v$LEGHAQOZ6S*{2Dv87W2Y8TZn#{hEM8TI11Os!I4YH zz58hq0Nn@SzL%lrE#AnmP;WMof78dr+?|m$0jADL6L=@U<;LUnQs;1T@m~yoYy=Mx RSnB`)002ovPDHLkV1hvcS0Vra literal 0 HcmV?d00001 diff --git a/mainwindow.cpp b/mainwindow.cpp index 7befade91..37e1be32c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -48,6 +48,7 @@ MainWindow::MainWindow(QWidget *parent) : dialogArc(QSharedPointer()), dialogSplinePath(QSharedPointer()), dialogPointOfContact(QSharedPointer()), dialogDetail(QSharedPointer()), dialogHeight(QSharedPointer()), + dialogTriangle(QSharedPointer()), dialogHistory(0), doc(0), data(0), comboBoxDraws(0), fileName(QString()), changeInFile(false), mode(Draw::Calculation){ ui->setupUi(this); @@ -92,6 +93,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact); connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail); connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight); + connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle); data = new VContainer; @@ -481,6 +483,23 @@ void MainWindow::ClosedDialogHeight(int result){ ArrowTool(); } +void MainWindow::ToolTriangle(bool checked){ + SetToolButton(checked, Tool::Triangle, ":/cursor/triangle_cursor.png", tr("Select first point of axis"), + dialogTriangle, &MainWindow::ClosedDialogTriangle); +} + +void MainWindow::ClosedDialogTriangle(int result){ + if(result == QDialog::Accepted){ + if(mode == Draw::Calculation){ + VToolTriangle::Create(dialogTriangle, currentScene, doc, data); + } else { + VModelingTriangle *point = VModelingTriangle::Create(dialogTriangle, doc, data); + AddToolToDetail(point, point->getId(), Tool::Triangle, dialogTriangle->getIdDetail()); + } + } + ArrowTool(); +} + void MainWindow::About(){ QMessageBox::about(this, tr("About Valentina"), tr("Valentina v.0.1.0")); } @@ -640,6 +659,7 @@ void MainWindow::CanselTool(){ helpLabel->setText(""); break; case Tool::SinglePointTool: + Q_UNREACHABLE(); //Nothing to do here because we can't create this tool from main window. break; case Tool::EndLineTool: @@ -715,6 +735,14 @@ void MainWindow::CanselTool(){ case Tool::Height: dialogHeight.clear(); ui->toolButtonHeight->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; + case Tool::Triangle: + dialogTriangle.clear(); + ui->toolButtonTriangle->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); break; default: qWarning()<<"Get wrong tool type. Ignore."; @@ -957,6 +985,7 @@ void MainWindow::SetEnableTool(bool enable){ ui->toolButtonPointOfContact->setEnabled(enable); ui->toolButtonNewDetail->setEnabled(enable); ui->toolButtonHeight->setEnabled(enable); + ui->toolButtonTriangle->setEnabled(enable); } void MainWindow::MinimumScrollBar(){ diff --git a/mainwindow.h b/mainwindow.h index 844052539..2b65763b8 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -41,8 +41,7 @@ namespace Ui { class MainWindow; } -class MainWindow : public QMainWindow -{ +class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); @@ -81,6 +80,7 @@ public slots: void ToolPointOfContact(bool checked); void ToolDetail(bool checked); void ToolHeight(bool checked); + void ToolTriangle(bool checked); void ClosedDialogEndLine(int result); void ClosedDialogLine(int result); void ClosedDialogAlongLine(int result); @@ -94,6 +94,7 @@ public slots: void ClosedDialogPointOfContact(int result); void ClosedDialogDetail(int result); void ClosedDialogHeight(int result); + void ClosedDialogTriangle(int result); void About(); void AboutQt(); void ShowToolTip(const QString &toolTip); @@ -138,6 +139,7 @@ private: QSharedPointer dialogPointOfContact; QSharedPointer dialogDetail; QSharedPointer dialogHeight; + QSharedPointer dialogTriangle; DialogHistory *dialogHistory; VDomDocument *doc; VContainer *data; diff --git a/mainwindow.ui b/mainwindow.ui index 0e9a0df8b..920dd684a 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -246,6 +246,32 @@ + + + + false + + + Tool triangle. + + + ... + + + + :/icon/32x32/triangle.png:/icon/32x32/triangle.png + + + + 32 + 32 + + + + true + + + @@ -253,7 +279,7 @@ 0 0 - 150 + 100 58 @@ -329,7 +355,7 @@ 0 0 - 150 + 100 58 @@ -405,7 +431,7 @@ 0 0 - 150 + 98 58 @@ -455,7 +481,7 @@ 0 0 - 150 + 98 58 diff --git a/options.h b/options.h index 28b99f2d9..71aaa9dfd 100644 --- a/options.h +++ b/options.h @@ -56,7 +56,8 @@ enum Tool {ArrowTool, NodeArc, NodeSpline, NodeSplinePath, - Height + Height, + Triangle }; Q_DECLARE_FLAGS(Tools, Tool) diff --git a/tools/drawTools/drawtools.h b/tools/drawTools/drawtools.h index 58fcbaf08..8051d3641 100644 --- a/tools/drawTools/drawtools.h +++ b/tools/drawTools/drawtools.h @@ -35,5 +35,6 @@ #include "vtoolspline.h" #include "vtoolsplinepath.h" #include "vtoolheight.h" +#include "vtooltriangle.h" #endif // DRAWTOOLS_H diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index 8d54e14bc..905a5ea98 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -79,8 +79,8 @@ void VToolAlongLine::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "alongLine"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index 4e3307a51..f1ee18525 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -51,22 +51,22 @@ void VToolShoulderPoint::setDialog(){ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, const qreal &length){ QLineF line = QLineF(p1Line, p2Line); - qreal dist = line.length(); - if(dist>length){ - qDebug()<<"A3П2="<length){ + qDebug()<<"A3П2="<=length){ return line.p2(); } - qreal step = 0.01; - while(1){ - line.setLength(line.length()+step); - QLineF line2 = QLineF(pShoulder, line.p2()); - if(line2.length()>=length){ - return line.p2(); - } - } + } } void VToolShoulderPoint::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp new file mode 100644 index 000000000..5b02c23c3 --- /dev/null +++ b/tools/drawTools/vtooltriangle.cpp @@ -0,0 +1,150 @@ +#include "vtooltriangle.h" + +VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent) + :VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), + secondPointId(secondPointId), dialogTriangle(QSharedPointer()) { + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VToolTriangle::setDialog(){ + Q_ASSERT(!dialogTriangle.isNull()); + VPointF p = VAbstractTool::data.GetPoint(id); + dialogTriangle->setAxisP1Id(axisP1Id, id); + dialogTriangle->setAxisP2Id(axisP2Id, id); + dialogTriangle->setFirstPointId(firstPointId, id); + dialogTriangle->setSecondPointId(secondPointId, id); + dialogTriangle->setPointName(p.name()); +} + +void VToolTriangle::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data){ + qint64 axisP1Id = dialog->getAxisP1Id(); + qint64 axisP2Id = dialog->getAxisP2Id(); + qint64 firstPointId = dialog->getFirstPointId(); + qint64 secondPointId = dialog->getSecondPointId(); + QString pointName = dialog->getPointName(); + Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data, + Document::FullParse, Tool::FromGui); + +} + +void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ + VPointF axisP1 = data->GetPoint(axisP1Id); + VPointF axisP2 = data->GetPoint(axisP2Id); + VPointF firstPoint = data->GetPoint(firstPointId); + VPointF secondPoint = data->GetPoint(secondPointId); + + QPointF point = FindPoint(axisP1.toQPointF(), axisP2.toQPointF(), firstPoint.toQPointF(), + secondPoint.toQPointF()); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my)); + } else { + data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my)); + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } + } + VDrawTool::AddRecord(id, Tool::Triangle, doc); + if(parse == Document::FullParse){ + VToolTriangle *point = new VToolTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, + secondPointId, typeCreation); + scene->addItem(point); + connect(point, &VToolTriangle::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolTriangle::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolTriangle::SetFactor); + doc->AddTool(id, point); + doc->IncrementReferens(axisP1Id); + doc->IncrementReferens(axisP2Id); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); + } +} + +QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, + const QPointF secondPoint){ + qreal c = QLineF(firstPoint, secondPoint).length(); + qreal a = QLineF(axisP2, firstPoint).length(); + qreal b = QLineF(axisP2, secondPoint).length(); + if(c*c == a*a + b*b){ + return axisP2; + } + + QLineF line = QLineF(axisP1, axisP2); + qreal step = 0.01; + while(1){ + line.setLength(line.length()+step); + a = QLineF(line.p2(), firstPoint).length(); + b = QLineF(line.p2(), secondPoint).length(); + if(static_cast(c*c) == static_cast(a*a + b*b)){ + return line.p2(); + } + if(c*c < a*a + b*b){ + return axisP2; + qWarning()<elementById(QString().setNum(id)); + if(domElement.isElement()){ + axisP1Id = domElement.attribute("axisP1", "").toLongLong(); + axisP2Id = domElement.attribute("axisP2", "").toLongLong(); + firstPointId = domElement.attribute("firstPoint", "").toLongLong(); + secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + } + VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); +} + +void VToolTriangle::FullUpdateFromGui(int result){ + if(result == QDialog::Accepted){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + domElement.setAttribute("name", dialogTriangle->getPointName()); + domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id())); + domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id())); + domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId())); + domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId())); + emit FullUpdateTree(); + } + + } + dialogTriangle.clear(); +} + +void VToolTriangle::RemoveReferens(){ + doc->DecrementReferens(axisP1Id); + doc->DecrementReferens(axisP2Id); + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(secondPointId); +} + +void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + ContextMenu(dialogTriangle, this, event); +} + +void VToolTriangle::AddToFile(){ + VPointF point = VAbstractTool::data.GetPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "triangle"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); + + AddAttribute(domElement, "axisP1", axisP1Id); + AddAttribute(domElement, "axisP2", axisP2Id); + AddAttribute(domElement, "firstPoint", firstPointId); + AddAttribute(domElement, "secondPoint", secondPointId); + + AddToCalculation(domElement); +} diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h new file mode 100644 index 000000000..173af52cb --- /dev/null +++ b/tools/drawTools/vtooltriangle.h @@ -0,0 +1,39 @@ +#ifndef VTOOLTRIANGLE_H +#define VTOOLTRIANGLE_H + +#include "vtoolpoint.h" +#include "dialogs/dialogtriangle.h" + +class VToolTriangle : public VToolPoint{ + Q_OBJECT +public: + VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const QString &pointName, + const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); + static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, + const QPointF secondPoint); +public slots: + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); +protected: + virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + Q_DISABLE_COPY(VToolTriangle) + qint64 axisP1Id; + qint64 axisP2Id; + qint64 firstPointId; + qint64 secondPointId; + QSharedPointer dialogTriangle; +}; + +#endif // VTOOLTRIANGLE_H diff --git a/tools/modelingTools/modelingtools.h b/tools/modelingTools/modelingtools.h index a40cdf15a..bd61fee59 100644 --- a/tools/modelingTools/modelingtools.h +++ b/tools/modelingTools/modelingtools.h @@ -35,5 +35,6 @@ #include "vmodelingspline.h" #include "vmodelingsplinepath.h" #include "vmodelingheight.h" +#include "vmodelingtriangle.h" #endif // MODELINGTOOLS_H diff --git a/tools/modelingTools/vmodelingtriangle.cpp b/tools/modelingTools/vmodelingtriangle.cpp new file mode 100644 index 000000000..e2f722a07 --- /dev/null +++ b/tools/modelingTools/vmodelingtriangle.cpp @@ -0,0 +1,127 @@ +#include "vmodelingtriangle.h" +#include "../drawTools/vtooltriangle.h" + +VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &axisP1Id, const qint64 &axisP2Id, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem *parent) + :VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), + firstPointId(firstPointId), secondPointId(secondPointId), + dialogTriangle(QSharedPointer()) { + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VModelingTriangle::setDialog(){ + Q_ASSERT(!dialogTriangle.isNull()); + VPointF p = VAbstractTool::data.GetPoint(id); + dialogTriangle->setAxisP1Id(axisP1Id, id); + dialogTriangle->setAxisP2Id(axisP2Id, id); + dialogTriangle->setFirstPointId(firstPointId, id); + dialogTriangle->setSecondPointId(secondPointId, id); + dialogTriangle->setPointName(p.name()); +} + +VModelingTriangle *VModelingTriangle::Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data){ + qint64 axisP1Id = dialog->getAxisP1Id(); + qint64 axisP2Id = dialog->getAxisP2Id(); + qint64 firstPointId = dialog->getFirstPointId(); + qint64 secondPointId = dialog->getSecondPointId(); + QString pointName = dialog->getPointName(); + return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, + Document::FullParse, Tool::FromGui); + +} + +VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, + const qint64 &axisP1Id, const qint64 &axisP2Id, + const qint64 &firstPointId, const qint64 &secondPointId, + const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation){ + VModelingTriangle *tool = 0; + VPointF axisP1 = data->GetPoint(axisP1Id); + VPointF axisP2 = data->GetPoint(axisP2Id); + VPointF firstPoint = data->GetPoint(firstPointId); + VPointF secondPoint = data->GetPoint(secondPointId); + + QPointF point = VToolTriangle::FindPoint(axisP1.toQPointF(), axisP2.toQPointF(), firstPoint.toQPointF(), + secondPoint.toQPointF()); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my)); + } else { + data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my)); + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } + } + if(parse == Document::FullParse){ + tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, + secondPointId, typeCreation); + doc->AddTool(id, tool); + doc->IncrementReferens(axisP1Id); + doc->IncrementReferens(axisP2Id); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); + } + return tool; +} + +void VModelingTriangle::FullUpdateFromFile(){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + axisP1Id = domElement.attribute("axisP1", "").toLongLong(); + axisP2Id = domElement.attribute("axisP2", "").toLongLong(); + firstPointId = domElement.attribute("firstPoint", "").toLongLong(); + secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + } + VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id)); +} + +void VModelingTriangle::FullUpdateFromGui(int result){ + if(result == QDialog::Accepted){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + domElement.setAttribute("name", dialogTriangle->getPointName()); + domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id())); + domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id())); + domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId())); + domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId())); + emit FullUpdateTree(); + } + + } + dialogTriangle.clear(); +} + +void VModelingTriangle::RemoveReferens(){ + doc->DecrementReferens(axisP1Id); + doc->DecrementReferens(axisP2Id); + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(secondPointId); +} + +void VModelingTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + ContextMenu(dialogTriangle, this, event); +} + +void VModelingTriangle::AddToFile(){ + VPointF point = VAbstractTool::data.GetPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "triangle"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); + + AddAttribute(domElement, "axisP1", axisP1Id); + AddAttribute(domElement, "axisP2", axisP2Id); + AddAttribute(domElement, "firstPoint", firstPointId); + AddAttribute(domElement, "secondPoint", secondPointId); + + AddToModeling(domElement); +} diff --git a/tools/modelingTools/vmodelingtriangle.h b/tools/modelingTools/vmodelingtriangle.h new file mode 100644 index 000000000..a43b73867 --- /dev/null +++ b/tools/modelingTools/vmodelingtriangle.h @@ -0,0 +1,39 @@ +#ifndef VMODELINGTRIANGLE_H +#define VMODELINGTRIANGLE_H + +#include "vmodelingpoint.h" +#include "../drawTools/vtooltriangle.h" +#include "dialogs/dialogtriangle.h" + +class VModelingTriangle : public VModelingPoint{ + Q_OBJECT +public: + VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &axisP1Id, const qint64 &axisP2Id, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingTriangle* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingTriangle* Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, const qreal &my, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); +public slots: + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); +protected: + virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + Q_DISABLE_COPY(VModelingTriangle) + qint64 axisP1Id; + qint64 axisP2Id; + qint64 firstPointId; + qint64 secondPointId; + QSharedPointer dialogTriangle; +}; + +#endif // VMODELINGTRIANGLE_H diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 8f113e39b..93c1c8f3d 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -150,6 +150,22 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } + case(Tool::Height):{ + VModelingHeight *tool = qobject_cast(tools->value(detail[i].getId())); + Q_ASSERT(tool != 0); + connect(tool, &VModelingHeight::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingHeight::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + tool->setParentItem(this); + break; + } + case(Tool::Triangle):{ + VModelingTriangle *tool = qobject_cast(tools->value(detail[i].getId())); + Q_ASSERT(tool != 0); + connect(tool, &VModelingTriangle::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingTriangle::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + tool->setParentItem(this); + break; + } default: qWarning()<<"Get wrong tool type. Ignore."; break; diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 52e42e7ff..e4d31e700 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -831,6 +831,32 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen throw excep; } } + if(type == "triangle"){ + try{ + qint64 id = GetParametrId(domElement); + QString name = GetParametrString(domElement, "name"); + qreal mx = toPixel(GetParametrDouble(domElement, "mx")); + qreal my = toPixel(GetParametrDouble(domElement, "my")); + qint64 axisP1Id = GetParametrLongLong(domElement, "axisP1"); + qint64 axisP2Id = GetParametrLongLong(domElement, "axisP2"); + qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); + qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); + + if(mode == Draw::Calculation){ + VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, + scene, this, data, parse, Tool::FromFile); + } else { + VModelingTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, + this, data, parse, Tool::FromFile); + } + return; + } + catch(const VExceptionBadId &e){ + VExceptionObjectError excep(tr("Error creating or updating triangle"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + } } void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, From c6ae85b5acaa8a024d00edc7c24372a974b5ebf1 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 21 Oct 2013 10:45:49 +0300 Subject: [PATCH 41/70] Update id of line. Find point of tool triangle. Ignore full update for dialog of tool single point. --HG-- branch : develop --- container/vcontainer.cpp | 15 +++++++-------- tools/drawTools/vtoolline.cpp | 1 + tools/drawTools/vtoolsinglepoint.cpp | 1 + tools/drawTools/vtooltriangle.cpp | 14 +++++++++++--- tools/modelingTools/vmodelingline.cpp | 1 + 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index f5ef78bc7..eaf543107 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -796,18 +796,17 @@ void VContainer::CreateManTableIGroup (){ AddStandartTableCell("Vzy", VStandartTableCell(1328, 0, 49)); AddStandartTableCell("Vlop", VStandartTableCell(1320, 0, 49)); AddStandartTableCell("Vps", VStandartTableCell(811, -1, 36)); - AddStandartTableCell("Osh", VStandartTableCell(404,8, 2)); - AddStandartTableCell("OgI", VStandartTableCell(1034, 36, 4)); - AddStandartTableCell("OgII", VStandartTableCell(1044, 38, 2)); - AddStandartTableCell("OgIII", VStandartTableCell(1000, 40, 0)); - AddStandartTableCell("Ot", VStandartTableCell(780, 40, 0)); - AddStandartTableCell("Ob", VStandartTableCell(984, 30, 10)); - AddStandartTableCell("ObI", VStandartTableCell(964, 24, 12)); + AddStandartTableCell("Ssh", VStandartTableCell(202,4, 1)); + AddStandartTableCell("SgI", VStandartTableCell(517, 18, 2)); + AddStandartTableCell("SgII", VStandartTableCell(522, 19, 1)); + AddStandartTableCell("SgIII", VStandartTableCell(500, 20, 0)); + AddStandartTableCell("St", VStandartTableCell(390, 20, 0)); + AddStandartTableCell("Sb", VStandartTableCell(492, 15, 5)); + AddStandartTableCell("SbI", VStandartTableCell(482, 12, 6)); AddStandartTableCell("Obed", VStandartTableCell(566, 18, 6)); AddStandartTableCell("Ok", VStandartTableCell(386, 8, 8)); AddStandartTableCell("Oi", VStandartTableCell(380, 8, 6)); AddStandartTableCell("Osch", VStandartTableCell(234, 4, 4)); - AddStandartTableCell("Os", VStandartTableCell(350, 2, 8)); AddStandartTableCell("Dsb", VStandartTableCell(1120, 0, 44)); AddStandartTableCell("Dsp", VStandartTableCell(1110, 0, 43)); AddStandartTableCell("Dn", VStandartTableCell(826, -3, 37)); diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 7f4c07bd5..e3fb9e9ac 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -63,6 +63,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 id = data->getNextId(); data->AddLine(firstPoint, secondPoint); } else { + data->UpdateId(id); data->AddLine(firstPoint, secondPoint); if(parse != Document::FullParse){ doc->UpdateToolData(id, data); diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index b77d4973d..d8c4d8327 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -29,6 +29,7 @@ VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), dialogSinglePoint(QSharedPointer()){ + ignoreFullUpdate = true; this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); if(typeCreation == Tool::FromGui){ diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp index 5b02c23c3..d19f498b7 100644 --- a/tools/drawTools/vtooltriangle.cpp +++ b/tools/drawTools/vtooltriangle.cpp @@ -74,7 +74,11 @@ QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, con qreal a = QLineF(axisP2, firstPoint).length(); qreal b = QLineF(axisP2, secondPoint).length(); if(c*c == a*a + b*b){ - return axisP2; + QLineF l1(axisP2, firstPoint); + QLineF l2(axisP2, secondPoint); + if(l1.angleTo(l2) == 90 || l2.angleTo(l1) == 90){ + return axisP2; + } } QLineF line = QLineF(axisP1, axisP2); @@ -84,10 +88,14 @@ QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, con a = QLineF(line.p2(), firstPoint).length(); b = QLineF(line.p2(), secondPoint).length(); if(static_cast(c*c) == static_cast(a*a + b*b)){ - return line.p2(); + QLineF l1(axisP2, firstPoint); + QLineF l2(axisP2, secondPoint); + if(l1.angleTo(l2) == 90 || l2.angleTo(l1) == 90){ + return line.p2(); + } } if(c*c < a*a + b*b){ - return axisP2; + return line.p2(); qWarning()<getNextId(); } else { if(parse != Document::FullParse){ + data->UpdateId(id); doc->UpdateToolData(id, data); } } From 70901ddb1b932479d77d38564c238a9ca85f887c Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 21 Oct 2013 12:15:50 +0300 Subject: [PATCH 42/70] Wrong scaling in verticalScrollBar. --HG-- branch : develop --- widgets/vmaingraphicsview.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index a8558bec3..7c3e78be1 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -53,14 +53,18 @@ void VMainGraphicsView::scalingTime(qreal x){ qreal factor = 1.0 + qreal(_numScheduledScalings) / 300.0; if (QApplication::keyboardModifiers() == Qt::ControlModifier){// If you press CTRL this code will execute scale(factor, factor); + emit NewFactor(factor); } else { if(_numScheduledScalings < 0){ verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() + factor*3.5)); + emit NewFactor(factor); } else { - verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() - factor*3.5)); + if(verticalScrollBar()->value() > 0){ + verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() - factor*3.5)); + emit NewFactor(factor); + } } - } - emit NewFactor(factor); + } } void VMainGraphicsView::animFinished(){ From 27b239fc84e9660ce17279aed7481e91f70b211f Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 21 Oct 2013 12:36:24 +0300 Subject: [PATCH 43/70] Align for field description of increment. --HG-- branch : develop --- dialogs/dialogincrements.cpp | 6 ++++-- dialogs/dialogincrements.ui | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index b12414859..0bceb8d27 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -148,7 +148,7 @@ void DialogIncrements::FillIncrementTable(){ ui->tableWidgetIncrement->setItem(currentRow, 4, item); item = new QTableWidgetItem(cell.getDescription()); - item->setTextAlignment(Qt::AlignHCenter); + item->setTextAlignment(Qt::AlignLeft); ui->tableWidgetIncrement->setItem(currentRow, 5, item); } if(ui->tableWidgetIncrement->rowCount()>0){ @@ -156,7 +156,6 @@ void DialogIncrements::FillIncrementTable(){ } ui->tableWidgetIncrement->resizeColumnsToContents(); ui->tableWidgetIncrement->resizeRowsToContents(); - ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetIncrement->setCurrentCell( row, column ); } @@ -466,6 +465,8 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ){ VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text()); incr.setDescription(item->text()); data->UpdateIncrementTableRow(itemName->text(), incr); + ui->tableWidgetIncrement->resizeColumnsToContents(); + ui->tableWidgetIncrement->resizeRowsToContents(); ui->tableWidgetIncrement->setCurrentCell( row, 0 ); emit haveLiteChange(); } @@ -491,6 +492,7 @@ void DialogIncrements::InitialIncrementTable(){ ui->tableWidgetIncrement->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("In size"))); ui->tableWidgetIncrement->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("In growth"))); ui->tableWidgetIncrement->setHorizontalHeaderItem(5, new QTableWidgetItem(tr("Description"))); + ui->tableWidgetIncrement->verticalHeader()->setDefaultSectionSize(20); } void DialogIncrements::InitialLinesTable(){ diff --git a/dialogs/dialogincrements.ui b/dialogs/dialogincrements.ui index 1917246a3..74203d5cc 100644 --- a/dialogs/dialogincrements.ui +++ b/dialogs/dialogincrements.ui @@ -27,7 +27,7 @@ QTabWidget::North - 0 + 1 @@ -149,9 +149,15 @@ false + + false + 45 + + false + Denotation From 933c7d8a75007c65b87ee3e62b127f85e0214f07 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 21 Oct 2013 13:18:12 +0300 Subject: [PATCH 44/70] Before saving file run test "unique id". --HG-- branch : develop --- mainwindow.cpp | 17 ++++++++++++++++- xml/vdomdocument.h | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 37e1be32c..f32f20d3c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -996,6 +996,21 @@ void MainWindow::MinimumScrollBar(){ } bool MainWindow::SafeSaveing(const QString &fileName) const{ + try{ + doc->TestUniqueId(); + } + catch(const VExceptionUniqueId &e){ + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Error don't unique id.")); + msgBox.setInformativeText(e.ErrorMessage()); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setDetailedText(e.DetailedInformation()); + msgBox.setIcon(QMessageBox::Critical); + msgBox.exec(); + return false; + } if(fileName.isEmpty()){ qWarning()<actionSave->setEnabled(false); diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 76449e24b..51fcd2f03 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -66,6 +66,7 @@ public: void UpdateToolData(const qint64 &id, VContainer *data); void IncrementReferens(qint64 id) const; void DecrementReferens(qint64 id) const; + void TestUniqueId() const; signals: void ChangedActivDraw(const QString newName); void ChangedNameDraw(const QString oldName, const QString newName); @@ -111,8 +112,7 @@ private: qint64 GetParametrId(const QDomElement& domElement) const; qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name) const; QString GetParametrString(const QDomElement& domElement, const QString &name) const; - qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const; - void TestUniqueId() const; + qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const; void CollectId(QDomElement node, QVector &vector)const; }; From c66439ba7a45a8616d9b2156d8e9d42825b8dab6 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 21 Oct 2013 17:09:05 +0300 Subject: [PATCH 45/70] Tool point of intersection. --HG-- branch : develop --- Valentina.pro | 13 +- cursor.qrc | 1 + cursor/pointofintersect_cursor.png | Bin 0 -> 1403 bytes dialogs/dialogpointofintersection.cpp | 98 ++++++++++ dialogs/dialogpointofintersection.h | 34 ++++ dialogs/dialogpointofintersection.ui | 169 ++++++++++++++++++ icon.qrc | 1 + icon/32x32/point_of_intersection.png | Bin 0 -> 652 bytes mainwindow.cpp | 31 +++- mainwindow.h | 33 ++-- mainwindow.ui | 31 +++- options.h | 3 +- tools/drawTools/drawtools.h | 1 + tools/drawTools/vtoolline.cpp | 1 + tools/drawTools/vtoollineintersect.cpp | 1 + tools/drawTools/vtoolpointofintersection.cpp | 106 +++++++++++ tools/drawTools/vtoolpointofintersection.h | 33 ++++ tools/drawTools/vtoolspline.cpp | 1 + tools/drawTools/vtoolsplinepath.cpp | 1 + tools/drawTools/vtooltriangle.cpp | 2 +- tools/modelingTools/modelingtools.h | 1 + tools/modelingTools/vmodelingline.cpp | 1 + .../modelingTools/vmodelinglineintersect.cpp | 1 + .../vmodelingpointofintersection.cpp | 105 +++++++++++ .../vmodelingpointofintersection.h | 35 ++++ tools/modelingTools/vmodelingspline.cpp | 2 +- tools/modelingTools/vmodelingsplinepath.cpp | 1 + tools/modelingTools/vmodelingtriangle.cpp | 1 - xml/vdomdocument.cpp | 24 +++ 29 files changed, 704 insertions(+), 27 deletions(-) create mode 100644 cursor/pointofintersect_cursor.png create mode 100644 dialogs/dialogpointofintersection.cpp create mode 100644 dialogs/dialogpointofintersection.h create mode 100644 dialogs/dialogpointofintersection.ui create mode 100644 icon/32x32/point_of_intersection.png create mode 100644 tools/drawTools/vtoolpointofintersection.cpp create mode 100644 tools/drawTools/vtoolpointofintersection.h create mode 100644 tools/modelingTools/vmodelingpointofintersection.cpp create mode 100644 tools/modelingTools/vmodelingpointofintersection.h diff --git a/Valentina.pro b/Valentina.pro index 74ac8fbca..f9b662a95 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -103,7 +103,10 @@ SOURCES += main.cpp\ dialogs/dialogheight.cpp \ tools/drawTools/vtooltriangle.cpp \ tools/modelingTools/vmodelingtriangle.cpp \ - dialogs/dialogtriangle.cpp + dialogs/dialogtriangle.cpp \ + dialogs/dialogpointofintersection.cpp \ + tools/drawTools/vtoolpointofintersection.cpp \ + tools/modelingTools/vmodelingpointofintersection.cpp HEADERS += mainwindow.h \ widgets/vmaingraphicsscene.h \ @@ -200,7 +203,10 @@ HEADERS += mainwindow.h \ dialogs/dialogheight.h \ tools/drawTools/vtooltriangle.h \ tools/modelingTools/vmodelingtriangle.h \ - dialogs/dialogtriangle.h + dialogs/dialogtriangle.h \ + dialogs/dialogpointofintersection.h \ + tools/drawTools/vtoolpointofintersection.h \ + tools/modelingTools/vmodelingpointofintersection.h FORMS += mainwindow.ui \ dialogs/dialogsinglepoint.ui \ @@ -220,7 +226,8 @@ FORMS += mainwindow.ui \ dialogs/dialogdetail.ui \ tablewindow.ui \ dialogs/dialogheight.ui \ - dialogs/dialogtriangle.ui + dialogs/dialogtriangle.ui \ + dialogs/dialogpointofintersection.ui RESOURCES += \ icon.qrc \ diff --git a/cursor.qrc b/cursor.qrc index a0827a0a2..785c3ddd8 100644 --- a/cursor.qrc +++ b/cursor.qrc @@ -14,5 +14,6 @@ cursor/new_detail_cursor.png cursor/height_cursor.png cursor/triangle_cursor.png + cursor/pointofintersect_cursor.png diff --git a/cursor/pointofintersect_cursor.png b/cursor/pointofintersect_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..c01923887156d8f8f4e996f48696e5ce8d64bb21 GIT binary patch literal 1403 zcmV->1%&#EP)Vl&|00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-3k>8EDoLDvlRdU06}y` zSad^gZEa<4bO1wAML|?gQaT`KWG!lNWoICEF)lD5D0OpbZf77#N=G0{P(?=|b~Z98 zEFf`pVQgu1c_2L?IWP*aMOc#n00g^9L_t(Y$HkU^Xq0sv$6w#)dG6NTZo1v5%^^C- zB+XN=1|?d9Va??>ow?W_LgCC zwbf=!z3H@_-raN0r$5|t-EMbl1J6G2h41ryzR&mleZN1y9{4|P_wL;jp6l!D)g!$? zOH0du&*ziM%1RNDMUND`qN3s=APW~Rl*IMk-rkJj8UTi205CE#A`J}<;&3=vx^!tn zNlD3pj5DvQs=5e>uIr+d5C_gkbw4k}Ud0T61YuO`VZnL+C zQcB9o%A~!$JvU=MPc+N201y#0O{1WofDIcq+|HQnNDnj-V+Xoal73F0)Z#@?%lim%$YNfrvY{VJ;2Mr1t4d_ z+v@7-l+2S^Cn}+7nrNCPix)4JqM{;cYioNi4fs1rXYQJo&(p<$h+tV3BEsd%ml+-& zCKL)q>^(g_J&B+6BpvbNw0sVTrfHMd8-_8#|4Jz-EiDb!)YSZb`0(Mu6nEYVoCUT| zO0{%8xBZ@+il%8!+7k!_ynwf`urSpzhk)mSeQCjUU5^(Tr4*KBk&}}nB_$AJ3}l-~SY zOdKCrmZ|Hym7A9*1`rRHyu3Wwv}x0|{rmTS7>!2Hnx;8&{rdHYVHnEob`yz2Fims5 z+wJamxm*N;!3iZ`JoUI4yvd2LIssJJ=~<-U(?MNcC_??QOLMlJ{IcWYTf=`n_-gg) z)fWL-vSf)lReb?Yj04;O<|w7mG%aNzQc59Nvm9Zk=hv{)BMHL{J3Y@fH0_B0I=>Ih zx^(H%oxZ-lWq!Z^rxf6C0oCL49N;4n`CLRs0pIwgdVp6%!~(vXAGy2siX(f0Ok|+9 z#iBbye~-Ry0CaVAb=pzy_xsZ^pPy8Y1@Hi4`= zY;;}6FpQMGoyw{!D_FDUMf}e^g*bCI9yA`ieZ`TzZ^)CEUs_r^5Adr0=wM1j6kyE^ zxSW%n->`GXc2!VVV4OP_aOg^R_?9hq&7Pf`+q|vi=h}_0@eiK^7{)V2t-1gJ002ov JPDHLkV1iS`nZ^JB literal 0 HcmV?d00001 diff --git a/dialogs/dialogpointofintersection.cpp b/dialogs/dialogpointofintersection.cpp new file mode 100644 index 000000000..04f239337 --- /dev/null +++ b/dialogs/dialogpointofintersection.cpp @@ -0,0 +1,98 @@ +#include "dialogpointofintersection.h" +#include "ui_dialogpointofintersection.h" + +DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Draw::Draws mode, QWidget *parent) : + DialogTool(data, mode, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()), + firstPointId(0), secondPointId(0){ + ui->setupUi(this); + labelEditNamePoint = ui->labelEditNamePoint; + bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + connect(bOk, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogAccepted); + flagName = false; + CheckState(); + QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); + connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected); + FillComboBoxPoints(ui->comboBoxFirstPoint); + FillComboBoxPoints(ui->comboBoxSecondPoint); + connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged); +} + +DialogPointOfIntersection::~DialogPointOfIntersection(){ + delete ui; +} + +qint64 DialogPointOfIntersection::getSecondPointId() const{ + return secondPointId; +} + +void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint64 &id){ + secondPointId = value; + setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); +} + +void DialogPointOfIntersection::ChoosedObject(qint64 id, Scene::Scenes type){ + if(idDetail == 0 && mode == Draw::Modeling){ + if(type == Scene::Detail){ + idDetail = id; + return; + } + } + if(mode == Draw::Modeling){ + if(!CheckObject(id)){ + return; + } + } + if(type == Scene::Point){ + VPointF point; + if(mode == Draw::Calculation){ + point = data->GetPoint(id); + } else { + point = data->GetModelingPoint(id); + } + if(number == 0){ + qint32 index = ui->comboBoxFirstPoint->findText(point.name()); + if ( index != -1 ) { // -1 for not found + ui->comboBoxFirstPoint->setCurrentIndex(index); + number++; + emit ToolTip(tr("Select point horizontally")); + return; + } + } + if(number == 1){ + qint32 index = ui->comboBoxSecondPoint->findText(point.name()); + if ( index != -1 ) { // -1 for not found + ui->comboBoxSecondPoint->setCurrentIndex(index); + number = 0; + emit ToolTip(""); + } + if(!isInitialized){ + this->show(); + } + } + } +} + +void DialogPointOfIntersection::DialogAccepted(){ + pointName = ui->lineEditNamePoint->text(); + firstPointId = getCurrentPointId(ui->comboBoxFirstPoint); + secondPointId = getCurrentPointId(ui->comboBoxSecondPoint); + emit DialogClosed(QDialog::Accepted); +} + +qint64 DialogPointOfIntersection::getFirstPointId() const{ + return firstPointId; +} + +void DialogPointOfIntersection::setFirstPointId(const qint64 &value, const qint64 &id){ + firstPointId = value; + setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); +} + +QString DialogPointOfIntersection::getPointName() const{ + return pointName; +} + +void DialogPointOfIntersection::setPointName(const QString &value){ + pointName = value; + ui->lineEditNamePoint->setText(pointName); +} diff --git a/dialogs/dialogpointofintersection.h b/dialogs/dialogpointofintersection.h new file mode 100644 index 000000000..7ffb57604 --- /dev/null +++ b/dialogs/dialogpointofintersection.h @@ -0,0 +1,34 @@ +#ifndef DIALOGPOINTOFINTERSECTION_H +#define DIALOGPOINTOFINTERSECTION_H + +#include "dialogtool.h" + +namespace Ui { +class DialogPointOfIntersection; +} + +class DialogPointOfIntersection : public DialogTool{ + Q_OBJECT +public: + DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogPointOfIntersection(); + QString getPointName() const; + void setPointName(const QString &value); + qint64 getFirstPointId() const; + void setFirstPointId(const qint64 &value, const qint64 &id); + qint64 getSecondPointId() const; + void setSecondPointId(const qint64 &value, const qint64 &id); +public slots: + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); +private: + Q_DISABLE_COPY(DialogPointOfIntersection) + Ui::DialogPointOfIntersection *ui; + qint32 number; + QString pointName; + qint64 firstPointId; + qint64 secondPointId; +}; + +#endif // DIALOGPOINTOFINTERSECTION_H diff --git a/dialogs/dialogpointofintersection.ui b/dialogs/dialogpointofintersection.ui new file mode 100644 index 000000000..303aa8cc0 --- /dev/null +++ b/dialogs/dialogpointofintersection.ui @@ -0,0 +1,169 @@ + + + DialogPointOfIntersection + + + + 0 + 0 + 293 + 180 + + + + Dialog + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Name new point + + + + + + + + + + + + + + + 0 + 0 + + + + Point vertically + + + + + + + First point of angle + + + + + + + + + + + + 0 + 0 + + + + Point horizontally + + + + + + + Second point of angle + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogPointOfIntersection + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogPointOfIntersection + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/icon.qrc b/icon.qrc index 520ff398d..66b939f04 100644 --- a/icon.qrc +++ b/icon.qrc @@ -36,5 +36,6 @@ icon/16x16/mirror.png icon/32x32/height.png icon/32x32/triangle.png + icon/32x32/point_of_intersection.png diff --git a/icon/32x32/point_of_intersection.png b/icon/32x32/point_of_intersection.png new file mode 100644 index 0000000000000000000000000000000000000000..7ab757dde6bdb361a22cc30c9a65d9b91dde14c5 GIT binary patch literal 652 zcmV;70(1R|P)8CN@tp;{gBw0vSm} zK~z}7?UuW16j2n$fAczKcTU_WSZGWk#Ks^(P*AYhK)_1SMpT4=LJ(Z6{4?xRN;(B0 zf{h3kDhs|4EmEl1C15lWBe>q#Y{urUj_XW(?cQy2;4(9J&fN3ebHDS=flYH`6ToAj z0(dS1d%#)X6_5hYfMYHJ9JYb8V+9y*JNP{Ya4u)A0-SIKAaDKDB@d3|9Kk!_s7oGP z2HpUlftSE^Kgw_vm;`qBO9yrU*Bx-K&_;j-Ao>%Q_QKXI0e`W;5r7o<0zB#j;wl5{ zKp6=8#epGU*#v~f2oje5W(-~wqMjfaH!e15d!=3>eK4?0I)T) zbI%5A0Zj|$y)CnK+wXk>=6$>cV9!R{Q1Pg@!JNuDf+xVPe{G)<(b{h~a3>uYirfAn za0O`C;4gr&E|lZ_g5WDgbfTz_-_|W1FrtAGok>I&mn3ekiheYrPmO4`=ZctJJRRH_ mPx|5f#UQFVQNm688~X+@g3_69>p|xL0000()), dialogDetail(QSharedPointer()), dialogHeight(QSharedPointer()), dialogTriangle(QSharedPointer()), + dialogPointOfIntersection(QSharedPointer()), dialogHistory(0), doc(0), data(0), comboBoxDraws(0), fileName(QString()), changeInFile(false), mode(Draw::Calculation){ ui->setupUi(this); @@ -94,6 +95,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail); connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight); connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle); + connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection); data = new VContainer; @@ -485,7 +487,7 @@ void MainWindow::ClosedDialogHeight(int result){ void MainWindow::ToolTriangle(bool checked){ SetToolButton(checked, Tool::Triangle, ":/cursor/triangle_cursor.png", tr("Select first point of axis"), - dialogTriangle, &MainWindow::ClosedDialogTriangle); + dialogTriangle, &MainWindow::ClosedDialogTriangle); } void MainWindow::ClosedDialogTriangle(int result){ @@ -500,6 +502,26 @@ void MainWindow::ClosedDialogTriangle(int result){ ArrowTool(); } +void MainWindow::ToolPointOfIntersection(bool checked){ + SetToolButton(checked, Tool::PointOfIntersection, ":/cursor/pointofintersect_cursor.png", + tr("Select point vertically"), + dialogPointOfIntersection, &MainWindow::ClosedDialogPointOfIntersection); +} + +void MainWindow::ClosedDialogPointOfIntersection(int result){ + if(result == QDialog::Accepted){ + if(mode == Draw::Calculation){ + VToolPointOfIntersection::Create(dialogPointOfIntersection, currentScene, doc, data); + } else { + VModelingPointOfIntersection *point = VModelingPointOfIntersection::Create(dialogPointOfIntersection, + doc, data); + AddToolToDetail(point, point->getId(), Tool::PointOfIntersection, + dialogPointOfIntersection->getIdDetail()); + } + } + ArrowTool(); +} + void MainWindow::About(){ QMessageBox::about(this, tr("About Valentina"), tr("Valentina v.0.1.0")); } @@ -744,6 +766,12 @@ void MainWindow::CanselTool(){ currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; + case Tool::PointOfIntersection: + dialogPointOfIntersection.clear(); + ui->toolButtonPointOfIntersection->setChecked(false); + currentScene->setFocus(Qt::OtherFocusReason); + currentScene->clearSelection(); + break; default: qWarning()<<"Get wrong tool type. Ignore."; break; @@ -986,6 +1014,7 @@ void MainWindow::SetEnableTool(bool enable){ ui->toolButtonNewDetail->setEnabled(enable); ui->toolButtonHeight->setEnabled(enable); ui->toolButtonTriangle->setEnabled(enable); + ui->toolButtonPointOfIntersection->setEnabled(enable); } void MainWindow::MinimumScrollBar(){ diff --git a/mainwindow.h b/mainwindow.h index 2b65763b8..fca2537a4 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -81,6 +81,7 @@ public slots: void ToolDetail(bool checked); void ToolHeight(bool checked); void ToolTriangle(bool checked); + void ToolPointOfIntersection(bool checked); void ClosedDialogEndLine(int result); void ClosedDialogLine(int result); void ClosedDialogAlongLine(int result); @@ -95,6 +96,7 @@ public slots: void ClosedDialogDetail(int result); void ClosedDialogHeight(int result); void ClosedDialogTriangle(int result); + void ClosedDialogPointOfIntersection(int result); void About(); void AboutQt(); void ShowToolTip(const QString &toolTip); @@ -126,27 +128,28 @@ private: VMainGraphicsView *view; bool isInitialized; DialogIncrements *dialogTable; - QSharedPointer dialogEndLine; - QSharedPointer dialogLine; - QSharedPointer dialogAlongLine; - QSharedPointer dialogShoulderPoint; - QSharedPointer dialogNormal; - QSharedPointer dialogBisector; - QSharedPointer dialogLineIntersect; - QSharedPointer dialogSpline; - QSharedPointer dialogArc; - QSharedPointer dialogSplinePath; - QSharedPointer dialogPointOfContact; - QSharedPointer dialogDetail; - QSharedPointer dialogHeight; - QSharedPointer dialogTriangle; + QSharedPointer dialogEndLine; + QSharedPointer dialogLine; + QSharedPointer dialogAlongLine; + QSharedPointer dialogShoulderPoint; + QSharedPointer dialogNormal; + QSharedPointer dialogBisector; + QSharedPointer dialogLineIntersect; + QSharedPointer dialogSpline; + QSharedPointer dialogArc; + QSharedPointer dialogSplinePath; + QSharedPointer dialogPointOfContact; + QSharedPointer dialogDetail; + QSharedPointer dialogHeight; + QSharedPointer dialogTriangle; + QSharedPointer dialogPointOfIntersection; DialogHistory *dialogHistory; VDomDocument *doc; VContainer *data; QComboBox *comboBoxDraws; QString fileName; bool changeInFile; - Draw::Draws mode; + Draw::Draws mode; void ToolBarOption(); void ToolBarDraws(); void CanselTool(); diff --git a/mainwindow.ui b/mainwindow.ui index 920dd684a..2ea6899fd 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -272,6 +272,29 @@ + + + + false + + + ... + + + + :/icon/32x32/point_of_intersection.png:/icon/32x32/point_of_intersection.png + + + + 32 + 32 + + + + true + + + @@ -279,7 +302,7 @@ 0 0 - 100 + 150 58 @@ -355,7 +378,7 @@ 0 0 - 100 + 150 58 @@ -431,7 +454,7 @@ 0 0 - 98 + 150 58 @@ -481,7 +504,7 @@ 0 0 - 98 + 150 58 diff --git a/options.h b/options.h index 71aaa9dfd..5e1a70fab 100644 --- a/options.h +++ b/options.h @@ -57,7 +57,8 @@ enum Tool {ArrowTool, NodeSpline, NodeSplinePath, Height, - Triangle + Triangle, + PointOfIntersection }; Q_DECLARE_FLAGS(Tools, Tool) diff --git a/tools/drawTools/drawtools.h b/tools/drawTools/drawtools.h index 8051d3641..0b07ebc2b 100644 --- a/tools/drawTools/drawtools.h +++ b/tools/drawTools/drawtools.h @@ -36,5 +36,6 @@ #include "vtoolsplinepath.h" #include "vtoolheight.h" #include "vtooltriangle.h" +#include "vtoolpointofintersection.h" #endif // DRAWTOOLS_H diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index e3fb9e9ac..ced59ed03 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -26,6 +26,7 @@ VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firs Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), dialogLine(QSharedPointer()){ + ignoreFullUpdate = true; //Лінія VPointF first = data->GetPoint(firstPoint); VPointF second = data->GetPoint(secondPoint); diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 132013d5a..797ce2c26 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -28,6 +28,7 @@ VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, cons QGraphicsItem *parent): VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2), dialogLineIntersect(QSharedPointer()){ + ignoreFullUpdate = true; if(typeCreation == Tool::FromGui){ AddToFile(); } diff --git a/tools/drawTools/vtoolpointofintersection.cpp b/tools/drawTools/vtoolpointofintersection.cpp new file mode 100644 index 000000000..10ef3c214 --- /dev/null +++ b/tools/drawTools/vtoolpointofintersection.cpp @@ -0,0 +1,106 @@ +#include "vtoolpointofintersection.h" + +VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem *parent) + :VToolPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId), + dialogPointOfIntersection(QSharedPointer()) { + ignoreFullUpdate = true; + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VToolPointOfIntersection::setDialog(){ + Q_ASSERT(!dialogPointOfIntersection.isNull()); + VPointF p = VAbstractTool::data.GetPoint(id); + dialogPointOfIntersection->setFirstPointId(firstPointId, id); + dialogPointOfIntersection->setSecondPointId(secondPointId, id); + dialogPointOfIntersection->setPointName(p.name()); +} + +void VToolPointOfIntersection::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data){ + qint64 firstPointId = dialog->getFirstPointId(); + qint64 secondPointId = dialog->getSecondPointId(); + QString pointName = dialog->getPointName(); + Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); +} + +void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation){ + VPointF firstPoint = data->GetPoint(firstPointId); + VPointF secondPoint = data->GetPoint(secondPointId); + + QPointF point(firstPoint.x(), secondPoint.y()); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my)); + } else { + data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my)); + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } + } + VDrawTool::AddRecord(id, Tool::Triangle, doc); + if(parse == Document::FullParse){ + VToolPointOfIntersection *point = new VToolPointOfIntersection(doc, data, id, firstPointId, + secondPointId, typeCreation); + scene->addItem(point); + connect(point, &VToolPointOfIntersection::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(point, &VToolPointOfIntersection::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfIntersection::SetFactor); + doc->AddTool(id, point); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); + } +} + +void VToolPointOfIntersection::FullUpdateFromFile(){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + firstPointId = domElement.attribute("firstPoint", "").toLongLong(); + secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + } + VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); +} + +void VToolPointOfIntersection::FullUpdateFromGui(int result){ + if(result == QDialog::Accepted){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + domElement.setAttribute("name", dialogPointOfIntersection->getPointName()); + domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId())); + domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId())); + emit FullUpdateTree(); + } + } + dialogPointOfIntersection.clear(); +} + +void VToolPointOfIntersection::RemoveReferens(){ + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(secondPointId); +} + +void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + ContextMenu(dialogPointOfIntersection, this, event); +} + +void VToolPointOfIntersection::AddToFile(){ + VPointF point = VAbstractTool::data.GetPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "pointOfIntersection"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); + + AddAttribute(domElement, "firstPoint", firstPointId); + AddAttribute(domElement, "secondPoint", secondPointId); + + AddToCalculation(domElement); +} diff --git a/tools/drawTools/vtoolpointofintersection.h b/tools/drawTools/vtoolpointofintersection.h new file mode 100644 index 000000000..206ad322f --- /dev/null +++ b/tools/drawTools/vtoolpointofintersection.h @@ -0,0 +1,33 @@ +#ifndef VTOOLPOINTOFINTERSECTION_H +#define VTOOLPOINTOFINTERSECTION_H + +#include "vtoolpoint.h" +#include "dialogs/dialogpointofintersection.h" + +class VToolPointOfIntersection : public VToolPoint{ + Q_OBJECT +public: + VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data); + static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); +public slots: + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); +protected: + virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + Q_DISABLE_COPY(VToolPointOfIntersection) + qint64 firstPointId; + qint64 secondPointId; + QSharedPointer dialogPointOfIntersection; +}; + +#endif // VTOOLPOINTOFINTERSECTION_H diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 25efb8ab6..00d3478fb 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -28,6 +28,7 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent), dialogSpline(QSharedPointer()), controlPoints(QVector()){ + ignoreFullUpdate = true; VSpline spl = data->GetSpline(id); QPainterPath path; diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index ca9fb7b0d..f13333e62 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -27,6 +27,7 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer()), controlPoints(QVector()){ + ignoreFullUpdate = true; VSplinePath splPath = data->GetSplinePath(id); QPainterPath path; path.addPath(splPath.GetPath()); diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp index d19f498b7..79fd2c3d2 100644 --- a/tools/drawTools/vtooltriangle.cpp +++ b/tools/drawTools/vtooltriangle.cpp @@ -5,6 +5,7 @@ VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 & const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), secondPointId(secondPointId), dialogTriangle(QSharedPointer()) { + ignoreFullUpdate = true; if(typeCreation == Tool::FromGui){ AddToFile(); } @@ -29,7 +30,6 @@ void VToolTriangle::Create(QSharedPointer &dialog, VMainGraphics QString pointName = dialog->getPointName(); Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); - } void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, diff --git a/tools/modelingTools/modelingtools.h b/tools/modelingTools/modelingtools.h index bd61fee59..2fbf1dfad 100644 --- a/tools/modelingTools/modelingtools.h +++ b/tools/modelingTools/modelingtools.h @@ -36,5 +36,6 @@ #include "vmodelingsplinepath.h" #include "vmodelingheight.h" #include "vmodelingtriangle.h" +#include "vmodelingpointofintersection.h" #endif // MODELINGTOOLS_H diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index b9c03f4ca..ea09c70a7 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -26,6 +26,7 @@ VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qin qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), dialogLine(QSharedPointer()){ + ignoreFullUpdate = true; //Лінія VPointF first = data->GetModelingPoint(firstPoint); VPointF second = data->GetModelingPoint(secondPoint); diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index 51a45e7d0..0ae7c31a3 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -26,6 +26,7 @@ VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *da const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2), dialogLineIntersect(QSharedPointer()){ + ignoreFullUpdate = true; if(typeCreation == Tool::FromGui){ AddToFile(); } diff --git a/tools/modelingTools/vmodelingpointofintersection.cpp b/tools/modelingTools/vmodelingpointofintersection.cpp new file mode 100644 index 000000000..70d4db79d --- /dev/null +++ b/tools/modelingTools/vmodelingpointofintersection.cpp @@ -0,0 +1,105 @@ +#include "vmodelingpointofintersection.h" + +VModelingPointOfIntersection::VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem *parent) + :VModelingPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId), + dialogPointOfIntersection(QSharedPointer()) { + ignoreFullUpdate = true; + if(typeCreation == Tool::FromGui){ + AddToFile(); + } +} + +void VModelingPointOfIntersection::setDialog(){ + Q_ASSERT(!dialogPointOfIntersection.isNull()); + VPointF p = VAbstractTool::data.GetPoint(id); + dialogPointOfIntersection->setFirstPointId(firstPointId, id); + dialogPointOfIntersection->setSecondPointId(secondPointId, id); + dialogPointOfIntersection->setPointName(p.name()); +} + +VModelingPointOfIntersection *VModelingPointOfIntersection::Create(QSharedPointer &dialog, + VDomDocument *doc, VContainer *data){ + qint64 firstPointId = dialog->getFirstPointId(); + qint64 secondPointId = dialog->getSecondPointId(); + QString pointName = dialog->getPointName(); + return Create(0, pointName, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse, Tool::FromGui); +} + +VModelingPointOfIntersection *VModelingPointOfIntersection::Create(const qint64 _id, const QString &pointName, + const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, + const qreal &my, VDomDocument *doc, + VContainer *data, + const Document::Documents &parse, + Tool::Sources typeCreation){ + VModelingPointOfIntersection *tool = 0; + VPointF firstPoint = data->GetPoint(firstPointId); + VPointF secondPoint = data->GetPoint(secondPointId); + + QPointF point(firstPoint.x(), secondPoint.y()); + qint64 id = _id; + if(typeCreation == Tool::FromGui){ + id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my)); + } else { + data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my)); + if(parse != Document::FullParse){ + doc->UpdateToolData(id, data); + } + } + if(parse == Document::FullParse){ + tool = new VModelingPointOfIntersection(doc, data, id, firstPointId, secondPointId, typeCreation); + doc->AddTool(id, tool); + doc->IncrementReferens(firstPointId); + doc->IncrementReferens(secondPointId); + } + return tool; +} + +void VModelingPointOfIntersection::FullUpdateFromFile(){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + firstPointId = domElement.attribute("firstPoint", "").toLongLong(); + secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + } + VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id)); +} + +void VModelingPointOfIntersection::FullUpdateFromGui(int result){ + if(result == QDialog::Accepted){ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if(domElement.isElement()){ + domElement.setAttribute("name", dialogPointOfIntersection->getPointName()); + domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId())); + domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId())); + emit FullUpdateTree(); + } + } + dialogPointOfIntersection.clear(); +} + +void VModelingPointOfIntersection::RemoveReferens(){ + doc->DecrementReferens(firstPointId); + doc->DecrementReferens(secondPointId); +} + +void VModelingPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ + ContextMenu(dialogPointOfIntersection, this, event); +} + +void VModelingPointOfIntersection::AddToFile(){ + VPointF point = VAbstractTool::data.GetPoint(id); + QDomElement domElement = doc->createElement("point"); + + AddAttribute(domElement, "id", id); + AddAttribute(domElement, "type", "pointOfIntersection"); + AddAttribute(domElement, "name", point.name()); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); + + AddAttribute(domElement, "firstPoint", firstPointId); + AddAttribute(domElement, "secondPoint", secondPointId); + + AddToModeling(domElement); +} diff --git a/tools/modelingTools/vmodelingpointofintersection.h b/tools/modelingTools/vmodelingpointofintersection.h new file mode 100644 index 000000000..1c4c94397 --- /dev/null +++ b/tools/modelingTools/vmodelingpointofintersection.h @@ -0,0 +1,35 @@ +#ifndef VMODELINGPOINTOFINTERSECTION_H +#define VMODELINGPOINTOFINTERSECTION_H + +#include "vmodelingpoint.h" +#include "dialogs/dialogpointofintersection.h" + +class VModelingPointOfIntersection : public VModelingPoint{ + Q_OBJECT +public: + VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingPointOfIntersection* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingPointOfIntersection* Create(const qint64 _id, const QString &pointName, + const qint64 &firstPointId, const qint64 &secondPointId, + const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); +public slots: + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); +protected: + virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); +private: + Q_DISABLE_COPY(VModelingPointOfIntersection) + qint64 firstPointId; + qint64 secondPointId; + QSharedPointer dialogPointOfIntersection; +}; + +#endif // VMODELINGPOINTOFINTERSECTION_H diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index 17467591b..ccc1a8bb6 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -29,7 +29,7 @@ VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSpline(QSharedPointer()), controlPoints(QVector()){ - + ignoreFullUpdate = true; VSpline spl = data->GetModelingSpline(id); QPainterPath path; path.addPath(spl.GetPath()); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 6756e0d4c..75d4f6c98 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -27,6 +27,7 @@ VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qi QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer()), controlPoints(QVector()){ + ignoreFullUpdate = true; VSplinePath splPath = data->GetModelingSplinePath(id); QPainterPath path; path.addPath(splPath.GetPath()); diff --git a/tools/modelingTools/vmodelingtriangle.cpp b/tools/modelingTools/vmodelingtriangle.cpp index e2f722a07..feeb7c1c5 100644 --- a/tools/modelingTools/vmodelingtriangle.cpp +++ b/tools/modelingTools/vmodelingtriangle.cpp @@ -32,7 +32,6 @@ VModelingTriangle *VModelingTriangle::Create(QSharedPointer &dia QString pointName = dialog->getPointName(); return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse, Tool::FromGui); - } VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index e4d31e700..7d3cfc2fd 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -857,6 +857,30 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen throw excep; } } + if(type == "pointOfIntersection"){ + try{ + qint64 id = GetParametrId(domElement); + QString name = GetParametrString(domElement, "name"); + qreal mx = toPixel(GetParametrDouble(domElement, "mx")); + qreal my = toPixel(GetParametrDouble(domElement, "my")); + qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); + qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); + + if(mode == Draw::Calculation){ + VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, + parse, Tool::FromFile); + } else { + VModelingPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, this, data, + parse, Tool::FromFile); + } + return; + } + catch(const VExceptionBadId &e){ + VExceptionObjectError excep(tr("Error creating or updating point of intersection"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + } } void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, From b5afc2192d6e3abb83a3a5854f24b41deea679b2 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 22 Oct 2013 15:11:29 +0300 Subject: [PATCH 46/70] Wrong fill rule for detail. --HG-- branch : develop --- container/vcontainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index eaf543107..a4d8b8c0f 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -232,6 +232,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ } path.lineTo(points[0]); path.addPath(ekv); + path.setFillRule(Qt::WindingFill); return path; } From 4a89486f8d43ab3718b58f10059ef9a2e6df8949 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 22 Oct 2013 16:09:49 +0300 Subject: [PATCH 47/70] Add point of intersection to detail. --HG-- branch : develop --- tools/vtooldetail.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 93c1c8f3d..56126fcef 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -166,6 +166,14 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, tool->setParentItem(this); break; } + case(Tool::PointOfIntersection):{ + VModelingPointOfIntersection *tool = qobject_cast(tools->value(detail[i].getId())); + Q_ASSERT(tool != 0); + connect(tool, &VModelingPointOfIntersection::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &VModelingPointOfIntersection::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + tool->setParentItem(this); + break; + } default: qWarning()<<"Get wrong tool type. Ignore."; break; From 76ca37642c82e62e86ada234358d54baa56880a6 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 22 Oct 2013 16:39:51 +0300 Subject: [PATCH 48/70] Wrong path in spline. --HG-- branch : develop --- geometry/vspline.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 4e6ac988c..674980add 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -601,9 +601,13 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2){ QPainterPath VSpline::GetPath() const{ QPainterPath splinePath; QVector points = GetPoints (); - splinePath.moveTo(points[0]); - for (qint32 i = 1; i < points.count(); ++i){ - splinePath.lineTo(points[i]); + if(points.count() >= 2){ + for (qint32 i = 0; i < points.count()-1; ++i){ + splinePath.moveTo(points[i]); + splinePath.lineTo(points[i+1]); + } + } else { + qWarning()<<"points.count() < 2"< Date: Wed, 23 Oct 2013 12:12:39 +0300 Subject: [PATCH 49/70] Delete file lekalo.xml. --HG-- branch : develop --- mainwindow.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 40a25f252..e1d04f1f0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1099,14 +1099,6 @@ MainWindow::~MainWindow(){ CanselTool(); delete ui; - QFile file("lekalo.xml"); - if(file.open(QIODevice::WriteOnly | QIODevice::Truncate)){ - const int Indent = 4; - QTextStream out(&file); - doc->save(out, Indent); - file.close(); - } - delete data; if(!doc->isNull()){ delete doc; From aac3dca7644a2cccdf3f2f098f74d5d6a7364ed2 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 23 Oct 2013 13:40:51 +0300 Subject: [PATCH 50/70] New message box about program. --HG-- branch : develop --- Valentina.pro | 3 ++- mainwindow.cpp | 7 ++++++- version.h | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 version.h diff --git a/Valentina.pro b/Valentina.pro index f9b662a95..b523128a3 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -206,7 +206,8 @@ HEADERS += mainwindow.h \ dialogs/dialogtriangle.h \ dialogs/dialogpointofintersection.h \ tools/drawTools/vtoolpointofintersection.h \ - tools/modelingTools/vmodelingpointofintersection.h + tools/modelingTools/vmodelingpointofintersection.h \ + version.h FORMS += mainwindow.ui \ dialogs/dialogsinglepoint.ui \ diff --git a/mainwindow.cpp b/mainwindow.cpp index e1d04f1f0..72b05ef32 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -36,6 +36,7 @@ #include "exception/vexceptionemptyparameter.h" #include "exception/vexceptionwrongparameterid.h" #include "exception/vexceptionuniqueid.h" +#include "version.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), tool(Tool::ArrowTool), currentScene(0), sceneDraw(0), @@ -523,7 +524,11 @@ void MainWindow::ClosedDialogPointOfIntersection(int result){ } void MainWindow::About(){ - QMessageBox::about(this, tr("About Valentina"), tr("Valentina v.0.1.0")); + QString fullName = QString("Valentina %1").arg(APP_VERSION); + QString qtBase(tr("Based on Qt %2 (32 bit)").arg(QT_VERSION_STR)); + QString buildOn(tr("Built on %3 at %4").arg(__DATE__).arg(__TIME__)); + QString about = QString(tr("

%1

%2

%3

%4")).arg(fullName).arg(qtBase).arg(buildOn).arg(WARRANTY); + QMessageBox::about(this, tr("About Valentina"), about); } void MainWindow::AboutQt(){ diff --git a/version.h b/version.h new file mode 100644 index 000000000..4c5d92805 --- /dev/null +++ b/version.h @@ -0,0 +1,14 @@ +#ifndef VERSION_H +#define VERSION_H + +#include + +extern const int MAJOR_VERSION = 0; +extern const int MINOR_VERSION = 1; +extern const int DEBUG_VERSION = 0; + +extern const QString APP_VERSION(QStringLiteral("%1.%2.%3").arg(MAJOR_VERSION) + .arg(MINOR_VERSION) + .arg(DEBUG_VERSION)); +extern const QString WARRANTY(QT_TR_NOOP("The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.")); +#endif // VERSION_H From 473c90c72ce75a4994c3d0711fa7175b8a38c7de Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 25 Oct 2013 14:10:45 +0300 Subject: [PATCH 51/70] Supplement for seams. --HG-- branch : develop --- container/vcontainer.cpp | 54 ++++++++++- container/vcontainer.h | 1 + dialogs/dialogdetail.cpp | 77 +++++++++++++-- dialogs/dialogdetail.h | 23 +++-- dialogs/dialogdetail.ui | 198 ++++++++++++++++++++++++++++++++++----- geometry/vdetail.cpp | 55 ++++++++++- geometry/vdetail.h | 39 +++++--- geometry/vnodedetail.cpp | 37 +++++++- geometry/vnodedetail.h | 30 +++--- tools/vtooldetail.cpp | 71 +++++++++----- xml/vdomdocument.cpp | 13 ++- 11 files changed, 500 insertions(+), 98 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index a4d8b8c0f..d53da37d5 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -177,11 +177,18 @@ void VContainer::UpdateId(qint64 newId){ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ VDetail detail = GetDetail(idDetail); QVector points; + QVector pointsEkv; for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ case(Tool::NodePoint):{ VPointF point = GetModelingPoint(detail[i].getId()); points.append(point.toQPointF()); + if(detail.getSupplement() == true){ + QPointF pEkv = point.toQPointF(); + pEkv.setX(pEkv.x()+detail[i].getMx()); + pEkv.setY(pEkv.y()+detail[i].getMy()); + pointsEkv.append(pEkv); + } } break; case(Tool::NodeArc):{ @@ -190,8 +197,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints())); if(len1 <= lenReverse){ points << arc.GetPoints(); + if(detail.getSupplement() == true){ + pointsEkv << biasPoints(arc.GetPoints(), detail[i].getMx(), detail[i].getMy()); + } } else { points << GetReversePoint(arc.GetPoints()); + if(detail.getSupplement() == true){ + pointsEkv << biasPoints(GetReversePoint(arc.GetPoints()), detail[i].getMx(), + detail[i].getMy()); + } } } break; @@ -201,8 +215,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints())); if(len1 <= lenReverse){ points << spline.GetPoints(); + if(detail.getSupplement() == true){ + pointsEkv << biasPoints(spline.GetPoints(), detail[i].getMx(), detail[i].getMy()); + } } else { points << GetReversePoint(spline.GetPoints()); + if(detail.getSupplement() == true){ + pointsEkv << biasPoints(GetReversePoint(spline.GetPoints()), detail[i].getMx(), + detail[i].getMy()); + } } } break; @@ -212,8 +233,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints())); if(len1 <= lenReverse){ points << splinePath.GetPathPoints(); + if(detail.getSupplement() == true){ + pointsEkv << biasPoints(splinePath.GetPathPoints(), detail[i].getMx(), detail[i].getMy()); + } } else { points << GetReversePoint(splinePath.GetPathPoints()); + if(detail.getSupplement() == true){ + pointsEkv << biasPoints(GetReversePoint(splinePath.GetPathPoints()), detail[i].getMx(), + detail[i].getMy()); + } } } break; @@ -224,18 +252,38 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ break; } } - QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10)); + QPainterPath path; path.moveTo(points[0]); for (qint32 i = 1; i < points.count(); ++i){ path.lineTo(points[i]); } path.lineTo(points[0]); - path.addPath(ekv); - path.setFillRule(Qt::WindingFill); + + if(detail.getSupplement() == true){ + QPainterPath ekv; + if(detail.getClosed() == true){ + ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth())); + } else { + ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth())); + } + path.addPath(ekv); + path.setFillRule(Qt::WindingFill); + } return path; } +QVector VContainer::biasPoints(const QVector &points, const qreal &mx, const qreal &my) const{ + QVector p; + for(qint32 i = 0; i < points.size(); ++i){ + QPointF point = points.at(i); + point.setX(point.x() + mx); + point.setY(point.x() + my); + p.append(point); + } + return p; +} + QPainterPath VContainer::Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width) const{ QPainterPath ekv; diff --git a/container/vcontainer.h b/container/vcontainer.h index 235a4243a..4dee1c149 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -140,6 +140,7 @@ public: const QHash *DataDetails() const; static void UpdateId(qint64 newId); QPainterPath ContourPath(qint64 idDetail) const; + QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my) const; QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width)const; static QLineF ParallelLine(const QLineF &line, qreal width ); diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index 32492ffb3..64fe68fd7 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -23,13 +23,24 @@ #include DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) : - DialogTool(data, mode, parent), ui(), details(VDetail()){ + DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true){ ui.setupUi(this); + labelEditNamePoint = ui.labelEditNameDetail; bOk = ui.buttonBox->button(QDialogButtonBox::Ok); connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted); - + flagName = false; + CheckState(); QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected); + + connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged); + connect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), + this, &DialogDetail::BiasXChanged); + connect(ui.doubleSpinBoxBiasY, static_cast(&QDoubleSpinBox::valueChanged), + this, &DialogDetail::BiasYChanged); + connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams); + connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed); + connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged); } void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){ @@ -72,12 +83,16 @@ void DialogDetail::DialogAccepted(){ QListWidgetItem *item = ui.listWidget->item(i); details.append( qvariant_cast(item->data(Qt::UserRole))); } + details.setWidth(ui.doubleSpinBoxSeams->value()); details.setName(ui.lineEditNameDetail->text()); + details.setSupplement(supplement); + details.setClosed(closed); emit ToolTip(""); emit DialogClosed(QDialog::Accepted); } -void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){ +void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx, + qreal my){ QString name; switch(typeTool){ case(Tool::NodePoint):{ @@ -127,9 +142,19 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No QListWidgetItem *item = new QListWidgetItem(name); item->setFont(QFont("Times", 12, QFont::Bold)); - VNodeDetail node(id, typeTool, mode, typeNode); + VNodeDetail node(id, typeTool, mode, typeNode, mx, my); item->setData(Qt::UserRole, QVariant::fromValue(node)); ui.listWidget->addItem(item); + disconnect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), + this, &DialogDetail::BiasXChanged); + disconnect(ui.doubleSpinBoxBiasY, static_cast(&QDoubleSpinBox::valueChanged), + this, &DialogDetail::BiasYChanged); + ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx())); + ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy())); + connect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), + this, &DialogDetail::BiasXChanged); + connect(ui.doubleSpinBoxBiasY, static_cast(&QDoubleSpinBox::valueChanged), + this, &DialogDetail::BiasYChanged); } VDetail DialogDetail::getDetails() const{ @@ -140,9 +165,49 @@ void DialogDetail::setDetails(const VDetail &value){ details = value; ui.listWidget->clear(); for(qint32 i = 0; i < details.CountNode(); ++i){ - NewItem(details[i].getId(), details[i].getTypeTool(),details[i].getMode(), details[i].getTypeNode()); + NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), details[i].getMx(), + details[i].getMy()); } - details.setName(ui.lineEditNameDetail->text()); + ui.lineEditNameDetail->setText(details.getName()); + ui.checkBoxSeams->setChecked(details.getSupplement()); + ui.checkBoxClosed->setChecked(details.getClosed()); + ui.doubleSpinBoxSeams->setValue(details.getWidth()); + ui.listWidget->setCurrentRow(0); ui.listWidget->setFocus(Qt::OtherFocusReason); } +void DialogDetail::BiasXChanged(qreal d){ + qint32 row = ui.listWidget->currentRow(); + QListWidgetItem *item = ui.listWidget->item( row ); + VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); + node.setMx(toPixel(d)); + item->setData(Qt::UserRole, QVariant::fromValue(node)); +} + +void DialogDetail::BiasYChanged(qreal d){ + qint32 row = ui.listWidget->currentRow(); + QListWidgetItem *item = ui.listWidget->item( row ); + VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); + node.setMy(toPixel(d)); + item->setData(Qt::UserRole, QVariant::fromValue(node)); +} + +void DialogDetail::ClickedSeams(bool checked){ + supplement = checked; + ui.checkBoxClosed->setEnabled(checked); + ui.doubleSpinBoxSeams->setEnabled(checked); +} + +void DialogDetail::ClickedClosed(bool checked){ + closed = checked; +} + +void DialogDetail::ObjectChanged(int row){ + if(ui.listWidget->count() == 0){ + return; + } + QListWidgetItem *item = ui.listWidget->item( row ); + VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); + ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx())); + ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy())); +} diff --git a/dialogs/dialogdetail.h b/dialogs/dialogdetail.h index 79cc1b55e..efddaf2dc 100644 --- a/dialogs/dialogdetail.h +++ b/dialogs/dialogdetail.h @@ -29,17 +29,24 @@ class DialogDetail : public DialogTool{ Q_OBJECT public: - explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); - VDetail getDetails() const; - void setDetails(const VDetail &value); - + DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); + VDetail getDetails() const; + void setDetails(const VDetail &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); + void BiasXChanged(qreal d); + void BiasYChanged(qreal d); + void ClickedSeams(bool checked); + void ClickedClosed(bool checked); + void ObjectChanged(int row); private: Ui::DialogDetail ui; - VDetail details; - void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode); + VDetail details; + bool supplement; + bool closed; + void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx = 0, + qreal my = 0); }; #endif // DIALOGDETAIL_H diff --git a/dialogs/dialogdetail.ui b/dialogs/dialogdetail.ui index 7f1370ed1..08aba5839 100644 --- a/dialogs/dialogdetail.ui +++ b/dialogs/dialogdetail.ui @@ -6,8 +6,8 @@ 0 0 - 340 - 298 + 544 + 327 @@ -20,47 +20,196 @@ - + - + - + - + + + 6 + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + - + + + Bias X + + + + + + + -10000.000000000000000 + + + 10000.000000000000000 + + + + + + + + + 0 0 - - - - Name detail + Bias Y - + + + -10000.000000000000000 + + + 10000.000000000000000 + + - - - - - Closed - - - true - - - - + + + Option + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + + + + Name of detail + + + + + + + + 0 + 0 + + + + + + + + + + Supplement for seams + + + true + + + + + + + + + + 0 + 0 + + + + + + + Width + + + + + + + -10000.000000000000000 + + + 10.000000000000000 + + + + + + + + + Closed + + + true + + + + + @@ -83,7 +232,6 @@
lineEditNameDetail - checkBoxClosed listWidget buttonBox diff --git a/geometry/vdetail.cpp b/geometry/vdetail.cpp index 509fa073d..7e7fdf0c2 100644 --- a/geometry/vdetail.cpp +++ b/geometry/vdetail.cpp @@ -21,14 +21,30 @@ #include "vdetail.h" -VDetail::VDetail():nodes(QVector()),name(QString()), mx(0), my(0){ +VDetail::VDetail():nodes(QVector()),name(QString()), mx(0), my(0), supplement(true), closed(true), + width(10){ } VDetail::VDetail(const QString &name, const QVector &nodes):nodes(QVector()), - name(name), mx(0), my(0){ + name(name), mx(0), my(0), supplement(true), closed(true), width(10){ this->nodes = nodes; } +VDetail::VDetail(const VDetail &detail):nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()), + my(detail.getMy()), supplement(detail.getSupplement()), closed(detail.getClosed()), width(detail.getWidth()){ +} + +VDetail &VDetail::operator =(const VDetail &detail){ + nodes = detail.getNodes(); + name = detail.getName(); + mx = detail.getMx(); + my = detail.getMy(); + supplement = detail.getSupplement(); + closed = detail.getClosed(); + width = detail.getWidth(); + return *this; +} + void VDetail::append(const VNodeDetail &node){ nodes.append(node); } @@ -38,6 +54,9 @@ void VDetail::Clear(){ name.clear(); mx = 0; my = 0; + supplement = true; + closed = true; + width = 10; } qint32 VDetail::CountNode() const{ @@ -81,3 +100,35 @@ QString VDetail::getName() const{ void VDetail::setName(const QString &value){ name = value; } + +qreal VDetail::getWidth() const{ + return width; +} + +void VDetail::setWidth(const qreal &value){ + width = value; +} + +bool VDetail::getClosed() const{ + return closed; +} + +void VDetail::setClosed(bool value){ + closed = value; +} + +bool VDetail::getSupplement() const{ + return supplement; +} + +void VDetail::setSupplement(bool value){ + supplement = value; +} + +QVector VDetail::getNodes() const{ + return nodes; +} + +void VDetail::setNodes(const QVector &value){ + nodes = value; +} diff --git a/geometry/vdetail.h b/geometry/vdetail.h index 45cf841fb..5372e219a 100644 --- a/geometry/vdetail.h +++ b/geometry/vdetail.h @@ -39,24 +39,37 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants) class VDetail{ public: - VDetail(); - VDetail(const QString &name, const QVector &nodes); - void append(const VNodeDetail &node); - void Clear(); - qint32 CountNode() const; - bool Containes(const qint64 &id)const; + VDetail(); + VDetail(const QString &name, const QVector &nodes); + VDetail(const VDetail &detail); + VDetail &operator=(const VDetail &detail); + void append(const VNodeDetail &node); + void Clear(); + qint32 CountNode() const; + bool Containes(const qint64 &id)const; VNodeDetail & operator[](int indx); QString getName() const; - void setName(const QString &value); - qreal getMx() const; - void setMx(const qreal &value); - qreal getMy() const; - void setMy(const qreal &value); + void setName(const QString &value); + qreal getMx() const; + void setMx(const qreal &value); + qreal getMy() const; + void setMy(const qreal &value); + bool getSupplement() const; + void setSupplement(bool value); + bool getClosed() const; + void setClosed(bool value); + qreal getWidth() const; + void setWidth(const qreal &value); + QVector getNodes() const; + void setNodes(const QVector &value); private: QVector nodes; QString name; - qreal mx; - qreal my; + qreal mx; + qreal my; + bool supplement; + bool closed; + qreal width; }; #endif // VDETAIL_H diff --git a/geometry/vnodedetail.cpp b/geometry/vnodedetail.cpp index e1392e22e..b25c28d92 100644 --- a/geometry/vnodedetail.cpp +++ b/geometry/vnodedetail.cpp @@ -21,16 +21,27 @@ #include "vnodedetail.h" -VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Calculation), - typeNode(NodeDetail::Contour){ +VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Modeling), + typeNode(NodeDetail::Contour), mx(0), my(0){ } -VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode):id(id), - typeTool(typeTool), mode(mode), typeNode(typeNode){ +VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, + qreal mx, qreal my):id(id), typeTool(typeTool), mode(mode), typeNode(typeNode), + mx(mx), my(my){ } VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(node.getTypeTool()), - mode(node.getMode()), typeNode(node.getTypeNode()){ + mode(node.getMode()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){ +} + +VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node){ + id = node.getId(); + typeTool = node.getTypeTool(); + mode = node.getMode(); + typeNode = node.getTypeNode(); + mx = node.getMx(); + my = node.getMy(); + return *this; } Tool::Tools VNodeDetail::getTypeTool() const{ @@ -64,3 +75,19 @@ NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{ void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){ typeNode = value; } + +qreal VNodeDetail::getMy() const{ + return my; +} + +void VNodeDetail::setMy(const qreal &value){ + my = value; +} + +qreal VNodeDetail::getMx() const{ + return mx; +} + +void VNodeDetail::setMx(const qreal &value){ + mx = value; +} diff --git a/geometry/vnodedetail.h b/geometry/vnodedetail.h index 71763a677..04359f9da 100644 --- a/geometry/vnodedetail.h +++ b/geometry/vnodedetail.h @@ -31,26 +31,32 @@ namespace NodeDetail { } Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails) -class VNodeDetail -{ +class VNodeDetail{ public: - VNodeDetail(); - VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode); - VNodeDetail(const VNodeDetail &node); - qint64 getId() const; - void setId(const qint64 &value); + VNodeDetail(); + VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, + qreal mx = 0, qreal my = 0); + VNodeDetail(const VNodeDetail &node); + VNodeDetail &operator=(const VNodeDetail &node); + qint64 getId() const; + void setId(const qint64 &value); Tool::Tools getTypeTool() const; - void setTypeTool(const Tool::Tools &value); + void setTypeTool(const Tool::Tools &value); Draw::Draws getMode() const; - void setMode(const Draw::Draws &value); + void setMode(const Draw::Draws &value); NodeDetail::NodeDetails getTypeNode() const; - void setTypeNode(const NodeDetail::NodeDetails &value); - + void setTypeNode(const NodeDetail::NodeDetails &value); + qreal getMx() const; + void setMx(const qreal &value); + qreal getMy() const; + void setMy(const qreal &value); private: - qint64 id; + qint64 id; Tool::Tools typeTool; Draw::Draws mode; NodeDetail::NodeDetails typeNode; + qreal mx; + qreal my; }; Q_DECLARE_METATYPE(VNodeDetail) diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 56126fcef..559180c76 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -192,10 +192,8 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, void VToolDetail::setDialog(){ Q_ASSERT(!dialogDetail.isNull()); - if(!dialogDetail.isNull()){ - VDetail detail = VAbstractTool::data.GetDetail(id); - dialogDetail->setDetails(detail); - } + VDetail detail = VAbstractTool::data.GetDetail(id); + dialogDetail->setDetails(detail); } void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, @@ -257,7 +255,7 @@ void VToolDetail::Create(QSharedPointer &dialog, VMainGraphicsScen qWarning()<<"May be wrong tool type!!! Ignoring."<elementById(QString().setNum(id)); + if(domElement.isElement()){ + VDetail det = dialogDetail->getDetails(); + domElement.setAttribute("name", det.getName()); + domElement.setAttribute("supplement", QString().setNum(det.getSupplement())); + domElement.setAttribute("closed", QString().setNum(det.getClosed())); + domElement.setAttribute("width", QString().setNum(det.getWidth())); + if ( domElement.hasChildNodes() ){ + while ( domElement.childNodes().length() >= 1 ){ + domElement.removeChild( domElement.firstChild() ); + } + } + for(qint32 i = 0; i < det.CountNode(); ++i){ + AddNode(domElement, det[i]); + } + emit FullUpdateTree(); + } + } + dialogDetail.clear(); } void VToolDetail::AddToFile(){ @@ -299,8 +316,11 @@ void VToolDetail::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "name", detail.getName()); - AddAttribute(domElement, "mx", detail.getMx()); - AddAttribute(domElement, "my", detail.getMy()); + AddAttribute(domElement, "mx", toMM(detail.getMx())); + AddAttribute(domElement, "my", toMM(detail.getMy())); + AddAttribute(domElement, "supplement", detail.getSupplement()); + AddAttribute(domElement, "closed", detail.getClosed()); + AddAttribute(domElement, "width", detail.getWidth()); for(qint32 i = 0; i < detail.CountNode(); ++i){ AddNode(domElement, detail[i]); @@ -338,7 +358,7 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ QMenu menu; - //QAction *actionOption = menu.addAction(tr("Options")); + QAction *actionOption = menu.addAction(tr("Options")); QAction *actionRemove = menu.addAction(tr("Delete")); if(_referens > 1){ actionRemove->setEnabled(false); @@ -346,21 +366,15 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ actionRemove->setEnabled(true); } QAction *selectedAction = menu.exec(event->screenPos()); -// if(selectedAction == actionOption){ -// dialog = QSharedPointer(new Dialog(getData())); - -// connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), &VMainGraphicsScene::ChoosedObject, -// dialog.data(), &Dialog::ChoosedObject); -// connect(dialog.data(), &Dialog::DialogClosed, tool, -// &Tool::FullUpdateFromGui); -// connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); - -// tool->setDialog(); - -// dialog->show(); -// } + if(selectedAction == actionOption){ + dialogDetail = QSharedPointer(new DialogDetail(getData(), Draw::Modeling)); + connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject, + dialogDetail.data(), &DialogDetail::ChoosedObject); + connect(dialogDetail.data(), &DialogDetail::DialogClosed, this, &VToolDetail::FullUpdateFromGui); + setDialog(); + dialogDetail->show(); + } if(selectedAction == actionRemove){ - //remove form xml file QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ @@ -393,6 +407,8 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){ QDomElement nod = doc->createElement("node"); AddAttribute(nod, "idObject", node.getId()); + AddAttribute(nod, "mx", toMM(node.getMx())); + AddAttribute(nod, "my", toMM(node.getMy())); if(node.getTypeNode() == NodeDetail::Contour){ AddAttribute(nod, "nodeType", "Contour"); } else { @@ -444,6 +460,15 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){ case(Tool::SplineTool): AddAttribute(nod, "type", "SplineTool"); break; + case(Tool::Height): + AddAttribute(nod, "type", "Height"); + break; + case(Tool::Triangle): + AddAttribute(nod, "type", "Triangle"); + break; + case(Tool::PointOfIntersection): + AddAttribute(nod, "type", "PointOfIntersection"); + break; default: qWarning()<<"May be wrong tool type!!! Ignoring."< Date: Fri, 25 Oct 2013 14:16:07 +0300 Subject: [PATCH 52/70] New method RemoveAllChild. --HG-- branch : develop --- tools/vabstracttool.cpp | 8 ++++++++ tools/vabstracttool.h | 1 + tools/vtooldetail.cpp | 6 +----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index e6b656efc..61709d7b5 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -136,6 +136,14 @@ const VContainer *VAbstractTool::getData()const{ return &data; } +void VAbstractTool::RemoveAllChild(QDomElement &domElement){ + if ( domElement.hasChildNodes() ){ + while ( domElement.childNodes().length() >= 1 ){ + domElement.removeChild( domElement.firstChild() ); + } + } +} + void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c){ //коефіцієнти для рівняння відрізку *a = line.p2().y() - line.p1().y(); diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 0982bc64c..fc7d1e809 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -55,6 +55,7 @@ protected: void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); const VContainer *getData() const; virtual void RemoveReferens(){} + void RemoveAllChild(QDomElement &domElement); private: Q_DISABLE_COPY(VAbstractTool) }; diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 559180c76..81a9a3fbd 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -296,11 +296,7 @@ void VToolDetail::FullUpdateFromGui(int result){ domElement.setAttribute("supplement", QString().setNum(det.getSupplement())); domElement.setAttribute("closed", QString().setNum(det.getClosed())); domElement.setAttribute("width", QString().setNum(det.getWidth())); - if ( domElement.hasChildNodes() ){ - while ( domElement.childNodes().length() >= 1 ){ - domElement.removeChild( domElement.firstChild() ); - } - } + RemoveAllChild(domElement); for(qint32 i = 0; i < det.CountNode(); ++i){ AddNode(domElement, det[i]); } From b42bc9560a163ef826c20efdc532341498d1efbc Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 26 Oct 2013 20:55:06 +0300 Subject: [PATCH 53/70] Refactoring. --HG-- branch : develop --- container/vincrementtablerow.h | 40 ++++++------- container/vstandarttablecell.h | 19 +++---- dialogs/dialogalongline.cpp | 20 ------- dialogs/dialogalongline.h | 16 +++--- dialogs/dialogarc.cpp | 21 +------ dialogs/dialogarc.h | 27 ++++----- dialogs/dialogbisector.cpp | 24 -------- dialogs/dialogbisector.h | 19 +++---- dialogs/dialogdetail.cpp | 5 -- dialogs/dialogdetail.h | 3 +- dialogs/dialogendline.cpp | 27 +-------- dialogs/dialogendline.h | 12 ++-- dialogs/dialogheight.cpp | 20 ------- dialogs/dialogheight.h | 10 ++-- dialogs/dialoghistory.cpp | 1 - dialogs/dialoghistory.h | 34 ++++++----- dialogs/dialogincrements.cpp | 8 +-- dialogs/dialogline.cpp | 10 ---- dialogs/dialogline.h | 7 +-- dialogs/dialoglineintersect.cpp | 23 +------- dialogs/dialoglineintersect.h | 13 ++--- dialogs/dialognormal.cpp | 28 +-------- dialogs/dialognormal.h | 17 +++--- dialogs/dialogpointofcontact.cpp | 21 ------- dialogs/dialogpointofcontact.h | 49 +++++++--------- dialogs/dialogpointofintersection.cpp | 12 ---- dialogs/dialogpointofintersection.h | 30 +++++----- dialogs/dialogshoulderpoint.cpp | 27 +-------- dialogs/dialogshoulderpoint.h | 52 ++++++++--------- dialogs/dialogsinglepoint.cpp | 12 ---- dialogs/dialogsinglepoint.h | 21 ++++--- dialogs/dialogspline.cpp | 28 --------- dialogs/dialogspline.h | 57 +++++++++---------- dialogs/dialogsplinepath.cpp | 7 +-- dialogs/dialogsplinepath.h | 39 +++++++------ dialogs/dialogtool.cpp | 18 +----- dialogs/dialogtool.h | 18 ++---- dialogs/dialogtriangle.cpp | 19 ------- dialogs/dialogtriangle.h | 46 +++++++-------- tools/drawTools/vtoolbisector.cpp | 1 + tools/drawTools/vtoolendline.cpp | 1 + tools/drawTools/vtoolnormal.cpp | 1 + tools/drawTools/vtoolpointofcontact.cpp | 1 + tools/drawTools/vtoolshoulderpoint.cpp | 1 + tools/modelingTools/vmodelingbisector.cpp | 2 +- tools/modelingTools/vmodelingendline.cpp | 4 +- tools/modelingTools/vmodelingnormal.cpp | 1 + .../modelingTools/vmodelingpointofcontact.cpp | 1 + .../modelingTools/vmodelingshoulderpoint.cpp | 1 + 49 files changed, 260 insertions(+), 614 deletions(-) diff --git a/container/vincrementtablerow.h b/container/vincrementtablerow.h index 3896340fb..7846f0441 100644 --- a/container/vincrementtablerow.h +++ b/container/vincrementtablerow.h @@ -24,32 +24,26 @@ #include -class VIncrementTableRow -{ +class VIncrementTableRow{ public: - VIncrementTableRow(); - VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, - QString description = QString()); - qint64 getId() const; - void setId(const qint64 &value); - - qreal getBase() const; - void setBase(const qreal &value); - - qreal getKsize() const; - void setKsize(const qreal &value); - - qreal getKgrowth() const; - void setKgrowth(const qreal &value); - + VIncrementTableRow(); + VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, + QString description = QString()); + qint64 getId() const; + void setId(const qint64 &value); + qreal getBase() const; + void setBase(const qreal &value); + qreal getKsize() const; + void setKsize(const qreal &value); + qreal getKgrowth() const; + void setKgrowth(const qreal &value); QString getDescription() const; - void setDescription(const QString &value); - + void setDescription(const QString &value); private: - qint64 id; - qreal base; - qreal ksize; - qreal kgrowth; + qint64 id; + qreal base; + qreal ksize; + qreal kgrowth; QString description; }; diff --git a/container/vstandarttablecell.h b/container/vstandarttablecell.h index c165fbca4..536a63f8e 100644 --- a/container/vstandarttablecell.h +++ b/container/vstandarttablecell.h @@ -24,19 +24,18 @@ #include -class VStandartTableCell -{ +class VStandartTableCell{ public: - VStandartTableCell(); - VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString()); - qint32 GetBase() const; - qreal GetKsize() const; - qreal GetKgrowth() const; + VStandartTableCell(); + VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString()); + qint32 GetBase() const; + qreal GetKsize() const; + qreal GetKgrowth() const; QString GetDescription() const; private: - qint32 base; - qreal ksize; - qreal kgrowth; + qint32 base; + qreal ksize; + qreal kgrowth; QString description; }; diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index aa66b467a..c0724f951 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -121,44 +121,24 @@ void DialogAlongLine::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -qint64 DialogAlongLine::getSecondPointId() const{ - return secondPointId; -} - void DialogAlongLine::setSecondPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -qint64 DialogAlongLine::getFirstPointId() const{ - return firstPointId; -} - void DialogAlongLine::setFirstPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -QString DialogAlongLine::getFormula() const{ - return formula; -} - void DialogAlongLine::setFormula(const QString &value){ formula = value; ui->lineEditFormula->setText(formula); } -QString DialogAlongLine::getTypeLine() const{ - return typeLine; -} - void DialogAlongLine::setTypeLine(const QString &value){ typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } -QString DialogAlongLine::getPointName() const{ - return pointName; -} - void DialogAlongLine::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index 200d4168a..5020e17de 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -23,28 +23,26 @@ #define DIALOGALONGLINE_H #include "dialogtool.h" -#include "container/calculator.h" namespace Ui { class DialogAlongLine; } -class DialogAlongLine : public DialogTool -{ +class DialogAlongLine : public DialogTool{ Q_OBJECT public: - explicit DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, + DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogAlongLine(); - QString getPointName() const; + inline QString getPointName() const {return pointName;} void setPointName(const QString &value); - QString getTypeLine() const; + inline QString getTypeLine() const {return typeLine;} void setTypeLine(const QString &value); - QString getFormula() const; + inline QString getFormula() const {return formula;} void setFormula(const QString &value); - qint64 getFirstPointId() const; + inline qint64 getFirstPointId() const {return firstPointId;} void setFirstPointId(const qint64 &value, const qint64 &id); - qint64 getSecondPointId() const; + inline qint64 getSecondPointId() const {return secondPointId;} void setSecondPointId(const qint64 &value, const qint64 &id); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index bfefe9037..adb2ac91b 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -21,7 +21,6 @@ #include "dialogarc.h" #include "ui_dialogarc.h" -#include "../container/calculator.h" DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), @@ -78,8 +77,8 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed); } -qint64 DialogArc::GetCenter() const{ - return center; +DialogArc::~DialogArc(){ + delete ui; } void DialogArc::SetCenter(const qint64 &value){ @@ -87,37 +86,21 @@ void DialogArc::SetCenter(const qint64 &value){ ChangeCurrentData(ui->comboBoxBasePoint, center); } -QString DialogArc::GetF2() const{ - return f2; -} - void DialogArc::SetF2(const QString &value){ f2 = value; ui->lineEditF2->setText(f2); } -QString DialogArc::GetF1() const{ - return f1; -} - void DialogArc::SetF1(const QString &value){ f1 = value; ui->lineEditF1->setText(f1); } -QString DialogArc::GetRadius() const{ - return radius; -} - void DialogArc::SetRadius(const QString &value){ radius = value; ui->lineEditRadius->setText(radius); } -DialogArc::~DialogArc(){ -delete ui; -} - void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){ if(idDetail == 0 && mode == Draw::Modeling){ if(type == Scene::Detail){ diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index cb4291a5c..53467f108 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -28,24 +28,19 @@ namespace Ui { class DialogArc; } -class DialogArc : public DialogTool -{ +class DialogArc : public DialogTool{ Q_OBJECT public: - explicit DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); - ~DialogArc(); - qint64 GetCenter() const; - void SetCenter(const qint64 &value); - - QString GetRadius() const; - void SetRadius(const QString &value); - - QString GetF1() const; - void SetF1(const QString &value); - - QString GetF2() const; - void SetF2(const QString &value); - + DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); + ~DialogArc(); + inline qint64 GetCenter() const {return center;} + void SetCenter(const qint64 &value); + inline QString GetRadius() const {return radius;} + void SetRadius(const QString &value); + inline QString GetF1() const {return f1;} + void SetF1(const QString &value); + inline QString GetF2() const {return f2;} + void SetF2(const QString &value); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); virtual void DialogAccepted(); diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index 0296b71a3..5b22c2f4a 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -121,53 +121,29 @@ void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){ } } -QString DialogBisector::getPointName() const{ - return pointName; -} - void DialogBisector::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); } -QString DialogBisector::getTypeLine() const{ - return typeLine; -} - void DialogBisector::setTypeLine(const QString &value){ typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } -QString DialogBisector::getFormula() const{ - return formula; -} - void DialogBisector::setFormula(const QString &value){ formula = value; ui->lineEditFormula->setText(formula); } -qint64 DialogBisector::getFirstPointId() const{ - return firstPointId; -} - void DialogBisector::setFirstPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -qint64 DialogBisector::getSecondPointId() const{ - return secondPointId; -} - void DialogBisector::setSecondPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -qint64 DialogBisector::getThirdPointId() const{ - return thirdPointId; -} - void DialogBisector::setThirdPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id); } diff --git a/dialogs/dialogbisector.h b/dialogs/dialogbisector.h index aa7f529f2..e237cfbb8 100644 --- a/dialogs/dialogbisector.h +++ b/dialogs/dialogbisector.h @@ -23,32 +23,29 @@ #define DIALOGBISECTOR_H #include "dialogtool.h" -#include -#include "container/calculator.h" namespace Ui { class DialogBisector; } -class DialogBisector : public DialogTool -{ +class DialogBisector : public DialogTool{ Q_OBJECT public: explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); - ~DialogBisector(); - QString getPointName() const; + ~DialogBisector(); + QString getPointName() const {return pointName;} void setPointName(const QString &value); - QString getTypeLine() const; + inline QString getTypeLine() const {return typeLine;} void setTypeLine(const QString &value); - QString getFormula() const; + inline QString getFormula() const {return formula;} void setFormula(const QString &value); - qint64 getFirstPointId() const; + inline qint64 getFirstPointId() const {return firstPointId;} void setFirstPointId(const qint64 &value, const qint64 &id); - qint64 getSecondPointId() const; + inline qint64 getSecondPointId() const {return secondPointId;} void setSecondPointId(const qint64 &value, const qint64 &id); - qint64 getThirdPointId() const; + inline qint64 getThirdPointId() const {return thirdPointId;} void setThirdPointId(const qint64 &value, const qint64 &id); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index 64fe68fd7..caaa1bf78 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "dialogdetail.h" -#include DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true){ @@ -157,10 +156,6 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No this, &DialogDetail::BiasYChanged); } -VDetail DialogDetail::getDetails() const{ - return details; -} - void DialogDetail::setDetails(const VDetail &value){ details = value; ui.listWidget->clear(); diff --git a/dialogs/dialogdetail.h b/dialogs/dialogdetail.h index efddaf2dc..00ceb22b9 100644 --- a/dialogs/dialogdetail.h +++ b/dialogs/dialogdetail.h @@ -24,13 +24,12 @@ #include "ui_dialogdetail.h" #include "dialogtool.h" -#include "geometry/vdetail.h" class DialogDetail : public DialogTool{ Q_OBJECT public: DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0); - VDetail getDetails() const; + inline VDetail getDetails() const {return details;} void setDetails(const VDetail &value); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index 1251ce77a..d415e84c5 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -21,10 +21,6 @@ #include "dialogendline.h" #include "ui_dialogendline.h" -#include -#include -#include "container/vpointf.h" -#include "container/calculator.h" DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()), @@ -110,46 +106,26 @@ void DialogEndLine::ChoosedObject(qint64 id, Scene::Scenes type){ } } -QString DialogEndLine::getPointName() const{ - return pointName; -} - void DialogEndLine::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); } -QString DialogEndLine::getTypeLine() const{ - return typeLine; -} - void DialogEndLine::setTypeLine(const QString &value){ typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } -QString DialogEndLine::getFormula() const{ - return formula; -} - void DialogEndLine::setFormula(const QString &value){ formula = value; ui->lineEditFormula->setText(formula); } -qreal DialogEndLine::getAngle() const{ - return angle; -} - void DialogEndLine::setAngle(const qreal &value){ angle = value; ui->doubleSpinBoxAngle->setValue(angle); } -qint64 DialogEndLine::getBasePointId() const{ - return basePointId; -} - void DialogEndLine::setBasePointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); } @@ -163,7 +139,6 @@ void DialogEndLine::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -DialogEndLine::~DialogEndLine() -{ +DialogEndLine::~DialogEndLine(){ delete ui; } diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h index b07701169..a793ca85a 100644 --- a/dialogs/dialogendline.h +++ b/dialogs/dialogendline.h @@ -23,8 +23,6 @@ #define DIALOGENDLINE_H #include "dialogtool.h" -#include -#include "container/calculator.h" namespace Ui { class DialogEndLine; @@ -36,15 +34,15 @@ public: explicit DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogEndLine(); - QString getPointName() const; + inline QString getPointName() const {return pointName;} void setPointName(const QString &value); - QString getTypeLine() const; + inline QString getTypeLine() const {return typeLine;} void setTypeLine(const QString &value); - QString getFormula() const; + inline QString getFormula() const {return formula;} void setFormula(const QString &value); - qreal getAngle() const; + inline qreal getAngle() const {return angle;} void setAngle(const qreal &value); - qint64 getBasePointId() const; + inline qint64 getBasePointId() const {return basePointId;} void setBasePointId(const qint64 &value, const qint64 &id); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialogheight.cpp b/dialogs/dialogheight.cpp index fa71daa7c..7024d94c1 100644 --- a/dialogs/dialogheight.cpp +++ b/dialogs/dialogheight.cpp @@ -23,46 +23,26 @@ DialogHeight::~DialogHeight(){ delete ui; } -QString DialogHeight::getPointName() const{ - return pointName; -} - void DialogHeight::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); } -QString DialogHeight::getTypeLine() const{ - return typeLine; -} - void DialogHeight::setTypeLine(const QString &value){ typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } -qint64 DialogHeight::getBasePointId() const{ - return basePointId; -} - void DialogHeight::setBasePointId(const qint64 &value, const qint64 &id){ basePointId = value; setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); } -qint64 DialogHeight::getP1LineId() const{ - return p1LineId; -} - void DialogHeight::setP1LineId(const qint64 &value, const qint64 &id){ p1LineId = value; setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id); } -qint64 DialogHeight::getP2LineId() const{ - return p2LineId; -} - void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id){ p2LineId = value; setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id); diff --git a/dialogs/dialogheight.h b/dialogs/dialogheight.h index b4e4c05b6..d2eaa2022 100644 --- a/dialogs/dialogheight.h +++ b/dialogs/dialogheight.h @@ -13,15 +13,15 @@ public: explicit DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogHeight(); - QString getPointName() const; + inline QString getPointName() const {return pointName;} void setPointName(const QString &value); - QString getTypeLine() const; + inline QString getTypeLine() const {return typeLine;} void setTypeLine(const QString &value); - qint64 getBasePointId() const; + inline qint64 getBasePointId() const {return basePointId;} void setBasePointId(const qint64 &value, const qint64 &id); - qint64 getP1LineId() const; + inline qint64 getP1LineId() const {return p1LineId;} void setP1LineId(const qint64 &value, const qint64 &id); - qint64 getP2LineId() const; + inline qint64 getP2LineId() const{return p2LineId;} void setP2LineId(const qint64 &value, const qint64 &id); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialoghistory.cpp b/dialogs/dialoghistory.cpp index 10df37d63..e8f78704d 100644 --- a/dialogs/dialoghistory.cpp +++ b/dialogs/dialoghistory.cpp @@ -304,7 +304,6 @@ void DialogHistory::ShowPoint(){ } } - void DialogHistory::closeEvent(QCloseEvent *event){ QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); qint64 id = qvariant_cast(item->data(Qt::UserRole)); diff --git a/dialogs/dialoghistory.h b/dialogs/dialoghistory.h index a515a94a2..65dc1c1ce 100644 --- a/dialogs/dialoghistory.h +++ b/dialogs/dialoghistory.h @@ -29,32 +29,30 @@ namespace Ui { class DialogHistory; } -class DialogHistory : public DialogTool -{ +class DialogHistory : public DialogTool{ Q_OBJECT - public: - explicit DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0); - virtual ~DialogHistory(); + DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0); + virtual ~DialogHistory(); public slots: - virtual void DialogAccepted(); - void cellClicked(int row, int column); - void ChangedCursor(qint64 id); - void UpdateHistory(); + virtual void DialogAccepted(); + void cellClicked(int row, int column); + void ChangedCursor(qint64 id); + void UpdateHistory(); signals: - void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); + void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); protected: - virtual void closeEvent ( QCloseEvent * event ); + virtual void closeEvent ( QCloseEvent * event ); private: Q_DISABLE_COPY(DialogHistory) Ui::DialogHistory *ui; - VDomDocument *doc; - qint32 cursorRow; - qint32 cursorToolRecordRow; - void FillTable(); - QString Record(const VToolRecord &tool); - void InitialTable(); - void ShowPoint(); + VDomDocument *doc; + qint32 cursorRow; + qint32 cursorToolRecordRow; + void FillTable(); + QString Record(const VToolRecord &tool); + void InitialTable(); + void ShowPoint(); }; #endif // DIALOGHISTORY_H diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 0bceb8d27..b103273d4 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -21,12 +21,8 @@ #include "dialogincrements.h" #include "ui_dialogincrements.h" -#include -#include -#include "widgets/doubledelegate.h" -#include "container/vincrementtablerow.h" -#include -#include "exception/vexception.h" +#include +#include DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) : DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), diff --git a/dialogs/dialogline.cpp b/dialogs/dialogline.cpp index 784d6448a..ed6db782e 100644 --- a/dialogs/dialogline.cpp +++ b/dialogs/dialogline.cpp @@ -21,8 +21,6 @@ #include "dialogline.h" #include "ui_dialogline.h" -#include -#include DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){ @@ -40,10 +38,6 @@ DialogLine::~DialogLine(){ delete ui; } -qint64 DialogLine::getSecondPoint() const{ - return secondPoint; -} - void DialogLine::setSecondPoint(const qint64 &value){ secondPoint = value; VPointF point = data->GetPoint(value); @@ -53,10 +47,6 @@ void DialogLine::setSecondPoint(const qint64 &value){ } } -qint64 DialogLine::getFirstPoint() const{ - return firstPoint; -} - void DialogLine::setFirstPoint(const qint64 &value){ firstPoint = value; VPointF point = data->GetPoint(value); diff --git a/dialogs/dialogline.h b/dialogs/dialogline.h index dca627eaa..8a19cec33 100644 --- a/dialogs/dialogline.h +++ b/dialogs/dialogline.h @@ -28,16 +28,15 @@ namespace Ui { class DialogLine; } -class DialogLine : public DialogTool -{ +class DialogLine : public DialogTool{ Q_OBJECT public: explicit DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogLine(); - qint64 getFirstPoint() const; + inline qint64 getFirstPoint() const {return firstPoint;} void setFirstPoint(const qint64 &value); - qint64 getSecondPoint() const; + inline qint64 getSecondPoint() const {return secondPoint;} void setSecondPoint(const qint64 &value); public slots: void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 260f4cc7d..9e8d2b8ff 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -41,8 +41,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged); } -DialogLineIntersect::~DialogLineIntersect() -{ +DialogLineIntersect::~DialogLineIntersect(){ delete ui; } @@ -179,46 +178,26 @@ bool DialogLineIntersect::CheckIntersecion(){ } } -qint64 DialogLineIntersect::getP2Line2() const{ - return p2Line2; -} - void DialogLineIntersect::setP2Line2(const qint64 &value){ p2Line2 = value; ChangeCurrentData(ui->comboBoxP2Line2, value); } -qint64 DialogLineIntersect::getP1Line2() const{ - return p1Line2; -} - void DialogLineIntersect::setP1Line2(const qint64 &value){ p1Line2 = value; ChangeCurrentData(ui->comboBoxP1Line2, value); } -qint64 DialogLineIntersect::getP2Line1() const{ - return p2Line1; -} - void DialogLineIntersect::setP2Line1(const qint64 &value){ p2Line1 = value; ChangeCurrentData(ui->comboBoxP2Line1, value); } -qint64 DialogLineIntersect::getP1Line1() const{ - return p1Line1; -} - void DialogLineIntersect::setP1Line1(const qint64 &value){ p1Line1 = value; ChangeCurrentData(ui->comboBoxP1Line1, value); } -QString DialogLineIntersect::getPointName() const{ - return pointName; -} - void DialogLineIntersect::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); diff --git a/dialogs/dialoglineintersect.h b/dialogs/dialoglineintersect.h index 4f2f586b8..5d1ce01c5 100644 --- a/dialogs/dialoglineintersect.h +++ b/dialogs/dialoglineintersect.h @@ -28,22 +28,21 @@ namespace Ui { class DialogLineIntersect; } -class DialogLineIntersect : public DialogTool -{ +class DialogLineIntersect : public DialogTool{ Q_OBJECT public: explicit DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogLineIntersect(); - qint64 getP1Line1() const; + inline qint64 getP1Line1() const {return p1Line1;} void setP1Line1(const qint64 &value); - qint64 getP2Line1() const; + inline qint64 getP2Line1() const {return p2Line1;} void setP2Line1(const qint64 &value); - qint64 getP1Line2() const; + inline qint64 getP1Line2() const {return p1Line2;} void setP1Line2(const qint64 &value); - qint64 getP2Line2() const; + inline qint64 getP2Line2() const {return p2Line2;} void setP2Line2(const qint64 &value); - QString getPointName() const; + inline QString getPointName() const {return pointName;} void setPointName(const QString &value); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index ef60bcb91..c52340ba9 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -21,7 +21,6 @@ #include "dialognormal.h" #include "ui_dialognormal.h" -#include DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) : DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()), @@ -83,8 +82,7 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); } -DialogNormal::~DialogNormal() -{ +DialogNormal::~DialogNormal(){ delete ui; } @@ -140,53 +138,29 @@ void DialogNormal::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -qint64 DialogNormal::getSecondPointId() const{ - return secondPointId; -} - void DialogNormal::setSecondPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -qint64 DialogNormal::getFirstPointId() const{ - return firstPointId; -} - void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -qreal DialogNormal::getAngle() const{ - return angle; -} - void DialogNormal::setAngle(const qreal &value){ angle = value; ui->doubleSpinBoxAngle->setValue(angle); } -QString DialogNormal::getFormula() const{ - return formula; -} - void DialogNormal::setFormula(const QString &value){ formula = value; ui->lineEditFormula->setText(formula); } -QString DialogNormal::getTypeLine() const{ - return typeLine; -} - void DialogNormal::setTypeLine(const QString &value){ typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } -QString DialogNormal::getPointName() const{ - return pointName; -} - void DialogNormal::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); diff --git a/dialogs/dialognormal.h b/dialogs/dialognormal.h index 5586ae825..f96b5b39e 100644 --- a/dialogs/dialognormal.h +++ b/dialogs/dialognormal.h @@ -23,31 +23,28 @@ #define DIALOGNORMAL_H #include "dialogtool.h" -#include -#include "container/calculator.h" namespace Ui { class DialogNormal; } -class DialogNormal : public DialogTool -{ +class DialogNormal : public DialogTool{ Q_OBJECT public: explicit DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); ~DialogNormal(); - QString getPointName() const; + inline QString getPointName() const{return pointName;} void setPointName(const QString &value); - QString getTypeLine() const; + inline QString getTypeLine() const {return typeLine;} void setTypeLine(const QString &value); - QString getFormula() const; + inline QString getFormula() const {return formula;} void setFormula(const QString &value); - qreal getAngle() const; + inline qreal getAngle() const {return angle;} void setAngle(const qreal &value); - qint64 getFirstPointId() const; + inline qint64 getFirstPointId() const {return firstPointId;} void setFirstPointId(const qint64 &value, const qint64 &id); - qint64 getSecondPointId() const; + inline qint64 getSecondPointId() const {return secondPointId;} void setSecondPointId(const qint64 &value, const qint64 &id); public slots: virtual void ChoosedObject(qint64 id, Scene::Scenes type); diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index 21a03227f..d3ba3c5c4 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -115,7 +115,6 @@ void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){ } } - void DialogPointOfContact::DialogAccepted(){ pointName = ui.lineEditNamePoint->text(); radius = ui.lineEditFormula->text(); @@ -125,44 +124,24 @@ void DialogPointOfContact::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -qint64 DialogPointOfContact::getSecondPoint() const{ - return secondPoint; -} - void DialogPointOfContact::setSecondPoint(const qint64 &value, const qint64 &id){ setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id); } -qint64 DialogPointOfContact::getFirstPoint() const{ - return firstPoint; -} - void DialogPointOfContact::setFirstPoint(const qint64 &value, const qint64 &id){ setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id); } -qint64 DialogPointOfContact::getCenter() const{ - return center; -} - void DialogPointOfContact::setCenter(const qint64 &value, const qint64 &id){ setCurrentPointId(ui.comboBoxCenter, center, value, id); center = value; } -QString DialogPointOfContact::getRadius() const{ - return radius; -} - void DialogPointOfContact::setRadius(const QString &value){ radius = value; ui.lineEditFormula->setText(radius); } -QString DialogPointOfContact::getPointName() const{ - return pointName; -} - void DialogPointOfContact::setPointName(const QString &value){ pointName = value; ui.lineEditNamePoint->setText(pointName); diff --git a/dialogs/dialogpointofcontact.h b/dialogs/dialogpointofcontact.h index 7d85ddcb3..68ee50e80 100644 --- a/dialogs/dialogpointofcontact.h +++ b/dialogs/dialogpointofcontact.h @@ -24,42 +24,35 @@ #include "ui_dialogpointofcontact.h" #include "dialogtool.h" -#include "container/calculator.h" -class DialogPointOfContact : public DialogTool -{ +class DialogPointOfContact : public DialogTool{ Q_OBJECT public: - explicit DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); - QString getPointName() const; - void setPointName(const QString &value); - - QString getRadius() const; - void setRadius(const QString &value); - - qint64 getCenter() const; - void setCenter(const qint64 &value, const qint64 &id); - - qint64 getFirstPoint() const; - void setFirstPoint(const qint64 &value, const qint64 &id); - - qint64 getSecondPoint() const; - void setSecondPoint(const qint64 &value, const qint64 &id); - + DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + inline QString getPointName() const {return pointName;} + void setPointName(const QString &value); + inline QString getRadius() const {return radius;} + void setRadius(const QString &value); + inline qint64 getCenter() const {return center;} + void setCenter(const qint64 &value, const qint64 &id); + inline qint64 getFirstPoint() const {return firstPoint;} + void setFirstPoint(const qint64 &value, const qint64 &id); + inline qint64 getSecondPoint() const {return secondPoint;} + void setSecondPoint(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogPointOfContact) Ui::DialogPointOfContact ui; - qint32 number; - QString pointName; - QString radius; - qint64 center; - qint64 firstPoint; - qint64 secondPoint; + qint32 number; + QString pointName; + QString radius; + qint64 center; + qint64 firstPoint; + qint64 secondPoint; }; #endif // DIALOGPOINTOFCONTACT_H diff --git a/dialogs/dialogpointofintersection.cpp b/dialogs/dialogpointofintersection.cpp index 04f239337..1172284fe 100644 --- a/dialogs/dialogpointofintersection.cpp +++ b/dialogs/dialogpointofintersection.cpp @@ -21,10 +21,6 @@ DialogPointOfIntersection::~DialogPointOfIntersection(){ delete ui; } -qint64 DialogPointOfIntersection::getSecondPointId() const{ - return secondPointId; -} - void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint64 &id){ secondPointId = value; setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); @@ -79,19 +75,11 @@ void DialogPointOfIntersection::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -qint64 DialogPointOfIntersection::getFirstPointId() const{ - return firstPointId; -} - void DialogPointOfIntersection::setFirstPointId(const qint64 &value, const qint64 &id){ firstPointId = value; setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -QString DialogPointOfIntersection::getPointName() const{ - return pointName; -} - void DialogPointOfIntersection::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); diff --git a/dialogs/dialogpointofintersection.h b/dialogs/dialogpointofintersection.h index 7ffb57604..432105400 100644 --- a/dialogs/dialogpointofintersection.h +++ b/dialogs/dialogpointofintersection.h @@ -10,25 +10,25 @@ class DialogPointOfIntersection; class DialogPointOfIntersection : public DialogTool{ Q_OBJECT public: - DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); - ~DialogPointOfIntersection(); - QString getPointName() const; - void setPointName(const QString &value); - qint64 getFirstPointId() const; - void setFirstPointId(const qint64 &value, const qint64 &id); - qint64 getSecondPointId() const; - void setSecondPointId(const qint64 &value, const qint64 &id); + DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogPointOfIntersection(); + inline QString getPointName() const {return pointName;} + void setPointName(const QString &value); + inline qint64 getFirstPointId() const {return firstPointId;} + void setFirstPointId(const qint64 &value, const qint64 &id); + inline qint64 getSecondPointId() const {return secondPointId;} + void setSecondPointId(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogPointOfIntersection) Ui::DialogPointOfIntersection *ui; - qint32 number; - QString pointName; - qint64 firstPointId; - qint64 secondPointId; + qint32 number; + QString pointName; + qint64 firstPointId; + qint64 secondPointId; }; #endif // DIALOGPOINTOFINTERSECTION_H diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index f1a5fff82..0429522ae 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -67,8 +67,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged); } -DialogShoulderPoint::~DialogShoulderPoint() -{ +DialogShoulderPoint::~DialogShoulderPoint(){ delete ui; } @@ -133,52 +132,28 @@ void DialogShoulderPoint::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -qint64 DialogShoulderPoint::getPShoulder() const{ - return pShoulder; -} - void DialogShoulderPoint::setPShoulder(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id); } -qint64 DialogShoulderPoint::getP2Line() const{ - return p2Line; -} - void DialogShoulderPoint::setP2Line(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id); } -qint64 DialogShoulderPoint::getP1Line() const{ - return p1Line; -} - void DialogShoulderPoint::setP1Line(const qint64 &value, const qint64 &id){ setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id); } -QString DialogShoulderPoint::getFormula() const{ - return formula; -} - void DialogShoulderPoint::setFormula(const QString &value){ formula = value; ui->lineEditFormula->setText(formula); } -QString DialogShoulderPoint::getTypeLine() const{ - return typeLine; -} - void DialogShoulderPoint::setTypeLine(const QString &value){ typeLine = value; SetupTypeLine(ui->comboBoxLineType, value); } -QString DialogShoulderPoint::getPointName() const{ - return pointName; -} - void DialogShoulderPoint::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); diff --git a/dialogs/dialogshoulderpoint.h b/dialogs/dialogshoulderpoint.h index 49df44255..ed2cfb1cf 100644 --- a/dialogs/dialogshoulderpoint.h +++ b/dialogs/dialogshoulderpoint.h @@ -23,44 +23,42 @@ #define DIALOGSHOULDERPOINT_H #include "dialogtool.h" -#include "container/calculator.h" namespace Ui { class DialogShoulderPoint; } -class DialogShoulderPoint : public DialogTool -{ +class DialogShoulderPoint : public DialogTool{ Q_OBJECT public: - explicit DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); - ~DialogShoulderPoint(); - QString getPointName() const; - void setPointName(const QString &value); - QString getTypeLine() const; - void setTypeLine(const QString &value); - QString getFormula() const; - void setFormula(const QString &value); - qint64 getP1Line() const; - void setP1Line(const qint64 &value, const qint64 &id); - qint64 getP2Line() const; - void setP2Line(const qint64 &value, const qint64 &id); - qint64 getPShoulder() const; - void setPShoulder(const qint64 &value, const qint64 &id); + DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogShoulderPoint(); + inline QString getPointName() const {return pointName;} + void setPointName(const QString &value); + inline QString getTypeLine() const {return typeLine;} + void setTypeLine(const QString &value); + inline QString getFormula() const {return formula;} + void setFormula(const QString &value); + inline qint64 getP1Line() const {return p1Line;} + void setP1Line(const qint64 &value, const qint64 &id); + inline qint64 getP2Line() const {return p2Line;} + void setP2Line(const qint64 &value, const qint64 &id); + inline qint64 getPShoulder() const {return pShoulder;} + void setPShoulder(const qint64 &value, const qint64 &id); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogShoulderPoint) Ui::DialogShoulderPoint *ui; - qint32 number; - QString pointName; - QString typeLine; - QString formula; - qint64 p1Line; - qint64 p2Line; - qint64 pShoulder; + qint32 number; + QString pointName; + QString typeLine; + QString formula; + qint64 p1Line; + qint64 p2Line; + qint64 pShoulder; }; #endif // DIALOGSHOULDERPOINT_H diff --git a/dialogs/dialogsinglepoint.cpp b/dialogs/dialogsinglepoint.cpp index 276dd9542..47ee98d79 100644 --- a/dialogs/dialogsinglepoint.cpp +++ b/dialogs/dialogsinglepoint.cpp @@ -21,10 +21,6 @@ #include "dialogsinglepoint.h" #include "ui_dialogsinglepoint.h" -#include -#include -#include -#include "options.h" DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()), @@ -69,14 +65,6 @@ void DialogSinglePoint::setData(const QString name, const QPointF point){ ui->doubleSpinBoxY->setValue(point.y()/PrintDPI*25.4); } -QString DialogSinglePoint::getName()const{ - return name; -} - -QPointF DialogSinglePoint::getPoint()const{ - return point; -} - DialogSinglePoint::~DialogSinglePoint(){ delete ui; } diff --git a/dialogs/dialogsinglepoint.h b/dialogs/dialogsinglepoint.h index 02c064386..d60f8e2cd 100644 --- a/dialogs/dialogsinglepoint.h +++ b/dialogs/dialogsinglepoint.h @@ -28,23 +28,22 @@ namespace Ui { class DialogSinglePoint; } -class DialogSinglePoint : public DialogTool -{ +class DialogSinglePoint : public DialogTool{ Q_OBJECT public: - explicit DialogSinglePoint(const VContainer *data, QWidget *parent = 0); - void setData(const QString name, const QPointF point); - QString getName()const; - QPointF getPoint()const; - ~DialogSinglePoint(); + DialogSinglePoint(const VContainer *data, QWidget *parent = 0); + void setData(const QString name, const QPointF point); + inline QString getName()const {return name;} + inline QPointF getPoint()const {return point;} + ~DialogSinglePoint(); public slots: - void mousePress(QPointF scenePos); - virtual void DialogAccepted(); + void mousePress(QPointF scenePos); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogSinglePoint) Ui::DialogSinglePoint *ui; - QString name; - QPointF point; + QString name; + QPointF point; }; #endif // DIALOGSINGLEPOINT_H diff --git a/dialogs/dialogspline.cpp b/dialogs/dialogspline.cpp index c17c3d385..40bbe35db 100644 --- a/dialogs/dialogspline.cpp +++ b/dialogs/dialogspline.cpp @@ -109,64 +109,36 @@ void DialogSpline::DialogAccepted(){ emit DialogClosed(QDialog::Accepted); } -qreal DialogSpline::getKCurve() const{ - return kCurve; -} - void DialogSpline::setKCurve(const qreal &value){ kCurve = value; ui->doubleSpinBoxKcurve->setValue(value); } -qreal DialogSpline::getKAsm2() const{ - return kAsm2; -} - void DialogSpline::setKAsm2(const qreal &value){ kAsm2 = value; ui->doubleSpinBoxKasm2->setValue(value); } -qreal DialogSpline::getKAsm1() const{ - return kAsm1; -} - void DialogSpline::setKAsm1(const qreal &value){ kAsm1 = value; ui->doubleSpinBoxKasm1->setValue(value); } -qreal DialogSpline::getAngle2() const{ - return angle2; -} - void DialogSpline::setAngle2(const qreal &value){ angle2 = value; ui->spinBoxAngle2->setValue(static_cast(value)); } -qreal DialogSpline::getAngle1() const{ - return angle1; -} - void DialogSpline::setAngle1(const qreal &value){ angle1 = value; ui->spinBoxAngle1->setValue(static_cast(value)); } -qint64 DialogSpline::getP4() const{ - return p4; -} - void DialogSpline::setP4(const qint64 &value){ p4 = value; ChangeCurrentData(ui->comboBoxP4, value); } -qint64 DialogSpline::getP1() const{ - return p1; -} - void DialogSpline::setP1(const qint64 &value){ p1 = value; ChangeCurrentData(ui->comboBoxP1, value); diff --git a/dialogs/dialogspline.h b/dialogs/dialogspline.h index 180f3a455..3aaf78a42 100644 --- a/dialogs/dialogspline.h +++ b/dialogs/dialogspline.h @@ -28,41 +28,40 @@ namespace Ui { class DialogSpline; } -class DialogSpline : public DialogTool -{ +class DialogSpline : public DialogTool{ Q_OBJECT public: - explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); - ~DialogSpline(); - qint64 getP1() const; - void setP1(const qint64 &value); - qint64 getP4() const; - void setP4(const qint64 &value); - qreal getAngle1() const; - void setAngle1(const qreal &value); - qreal getAngle2() const; - void setAngle2(const qreal &value); - qreal getKAsm1() const; - void setKAsm1(const qreal &value); - qreal getKAsm2() const; - void setKAsm2(const qreal &value); - qreal getKCurve() const; - void setKCurve(const qreal &value); + explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogSpline(); + inline qint64 getP1() const {return p1;} + void setP1(const qint64 &value); + inline qint64 getP4() const {return p4;} + void setP4(const qint64 &value); + inline qreal getAngle1() const {return angle1;} + void setAngle1(const qreal &value); + inline qreal getAngle2() const {return angle2;} + void setAngle2(const qreal &value); + inline qreal getKAsm1() const {return kAsm1;} + void setKAsm1(const qreal &value); + inline qreal getKAsm2() const {return kAsm2;} + void setKAsm2(const qreal &value); + inline qreal getKCurve() const {return kCurve;} + void setKCurve(const qreal &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogSpline) Ui::DialogSpline *ui; - qint32 number; - qint64 p1; // перша точка - qint64 p4; // четверта точка - qreal angle1; // кут нахилу дотичної в першій точці - qreal angle2; // кут нахилу дотичної в другій точці - qreal kAsm1; - qreal kAsm2; - qreal kCurve; + qint32 number; + qint64 p1; // перша точка + qint64 p4; // четверта точка + qreal angle1; // кут нахилу дотичної в першій точці + qreal angle2; // кут нахилу дотичної в другій точці + qreal kAsm1; + qreal kAsm2; + qreal kCurve; }; #endif // DIALOGSPLINE_H diff --git a/dialogs/dialogsplinepath.cpp b/dialogs/dialogsplinepath.cpp index 0f085895d..848c0e7a9 100644 --- a/dialogs/dialogsplinepath.cpp +++ b/dialogs/dialogsplinepath.cpp @@ -48,15 +48,10 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWi this, &DialogSplinePath::KAsm2Changed); } -DialogSplinePath::~DialogSplinePath() -{ +DialogSplinePath::~DialogSplinePath(){ delete ui; } -VSplinePath DialogSplinePath::GetPath() const{ - return path; -} - void DialogSplinePath::SetPath(const VSplinePath &value){ this->path = value; ui->listWidget->clear(); diff --git a/dialogs/dialogsplinepath.h b/dialogs/dialogsplinepath.h index 41cfeb0c2..01ab75334 100644 --- a/dialogs/dialogsplinepath.h +++ b/dialogs/dialogsplinepath.h @@ -29,32 +29,31 @@ namespace Ui { class DialogSplinePath; } -class DialogSplinePath : public DialogTool -{ +class DialogSplinePath : public DialogTool{ Q_OBJECT public: - explicit DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); - ~DialogSplinePath(); - VSplinePath GetPath() const; - void SetPath(const VSplinePath &value); + DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogSplinePath(); + inline VSplinePath GetPath() const {return path;} + void SetPath(const VSplinePath &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); - void PointChenged(int row); - void currentPointChanged( int index ); - void Angle1Changed( int index ); - void Angle2Changed( int index ); - void KAsm1Changed(qreal d); - void KAsm2Changed(qreal d); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); + void PointChenged(int row); + void currentPointChanged( int index ); + void Angle1Changed( int index ); + void Angle2Changed( int index ); + void KAsm1Changed(qreal d); + void KAsm2Changed(qreal d); private: Q_DISABLE_COPY(DialogSplinePath) Ui::DialogSplinePath *ui; - VSplinePath path; - void NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2); - void DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); - void EnableFields(); - void SetAngle(qint32 angle); + VSplinePath path; + void NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2); + void DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); + void EnableFields(); + void SetAngle(qint32 angle); }; #endif // DIALOGSPLINEPATH_H diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index 571cc7d5b..de54c2465 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -20,11 +20,7 @@ ****************************************************************************/ #include "dialogtool.h" -#include -#include -#include "container/calculator.h" -#include "geometry/vdetail.h" -#include +#include DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0), @@ -36,9 +32,6 @@ DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); } -DialogTool::~DialogTool(){ -} - void DialogTool::closeEvent(QCloseEvent *event){ DialogClosed(QDialog::Rejected); event->accept(); @@ -214,7 +207,6 @@ void DialogTool::CheckState(){ bOk->setEnabled(flagFormula && flagName); } - void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){ Q_UNUSED(id); Q_UNUSED(type); @@ -456,11 +448,3 @@ void DialogTool::ShowVariable(const QHash *var){ connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); listWidget->setCurrentRow (0); } - -qint64 DialogTool::getIdDetail() const{ - return idDetail; -} - -void DialogTool::setIdDetail(const qint64 &value){ - idDetail = value; -} diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index dbe0b4730..9c418bd3b 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -23,24 +23,16 @@ #define DIALOGTOOL_H #include -#include -#include -#include -#include -#include -#include -#include -#include -#include "container/vcontainer.h" +#include class DialogTool : public QDialog{ Q_OBJECT public: DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0); - virtual ~DialogTool(); - qint64 getIdDetail() const; - void setIdDetail(const qint64 &value); + virtual ~DialogTool() {} + inline qint64 getIdDetail() const {return idDetail;} + inline void setIdDetail(const qint64 &value) {idDetail = value;} signals: void DialogClosed(int result); void ToolTip(const QString &toolTip); @@ -91,7 +83,7 @@ protected: QRadioButton *radioButtonLengthArc; QRadioButton *radioButtonLengthCurve; qint64 idDetail; - Draw::Draws mode; + Draw::Draws mode; bool CheckObject(const qint64 &id); virtual void closeEvent ( QCloseEvent * event ); virtual void showEvent( QShowEvent *event ); diff --git a/dialogs/dialogtriangle.cpp b/dialogs/dialogtriangle.cpp index fbb3dc3df..c86e3c008 100644 --- a/dialogs/dialogtriangle.cpp +++ b/dialogs/dialogtriangle.cpp @@ -78,46 +78,27 @@ void DialogTriangle::DialogAccepted(){ axisP2Id = getCurrentPointId(ui->comboBoxAxisP2); emit DialogClosed(QDialog::Accepted); } -QString DialogTriangle::getPointName() const{ - return pointName; -} void DialogTriangle::setPointName(const QString &value){ pointName = value; ui->lineEditNamePoint->setText(pointName); } -qint64 DialogTriangle::getSecondPointId() const{ - return secondPointId; -} - void DialogTriangle::setSecondPointId(const qint64 &value, const qint64 &id){ secondPointId = value; setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -qint64 DialogTriangle::getFirstPointId() const{ - return firstPointId; -} - void DialogTriangle::setFirstPointId(const qint64 &value, const qint64 &id){ firstPointId = value; setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -qint64 DialogTriangle::getAxisP2Id() const{ - return axisP2Id; -} - void DialogTriangle::setAxisP2Id(const qint64 &value, const qint64 &id){ axisP2Id = value; setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id); } -qint64 DialogTriangle::getAxisP1Id() const{ - return axisP1Id; -} - void DialogTriangle::setAxisP1Id(const qint64 &value, const qint64 &id){ axisP1Id = value; setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id); diff --git a/dialogs/dialogtriangle.h b/dialogs/dialogtriangle.h index 74c9bcf3c..2ec3df1a2 100644 --- a/dialogs/dialogtriangle.h +++ b/dialogs/dialogtriangle.h @@ -7,36 +7,34 @@ namespace Ui { class DialogTriangle; } -class DialogTriangle : public DialogTool -{ +class DialogTriangle : public DialogTool{ Q_OBJECT - public: - DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation, - QWidget *parent = 0); - ~DialogTriangle(); - qint64 getAxisP1Id() const; - void setAxisP1Id(const qint64 &value, const qint64 &id); - qint64 getAxisP2Id() const; - void setAxisP2Id(const qint64 &value, const qint64 &id); - qint64 getFirstPointId() const; - void setFirstPointId(const qint64 &value, const qint64 &id); - qint64 getSecondPointId() const; - void setSecondPointId(const qint64 &value, const qint64 &id); - QString getPointName() const; - void setPointName(const QString &value); + DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation, + QWidget *parent = 0); + ~DialogTriangle(); + inline qint64 getAxisP1Id() const {return axisP1Id;} + void setAxisP1Id(const qint64 &value, const qint64 &id); + inline qint64 getAxisP2Id() const {return axisP2Id;} + void setAxisP2Id(const qint64 &value, const qint64 &id); + inline qint64 getFirstPointId() const {return firstPointId;} + void setFirstPointId(const qint64 &value, const qint64 &id); + inline qint64 getSecondPointId() const {return secondPointId;} + void setSecondPointId(const qint64 &value, const qint64 &id); + inline QString getPointName() const {return pointName;} + void setPointName(const QString &value); public slots: - virtual void ChoosedObject(qint64 id, Scene::Scenes type); - virtual void DialogAccepted(); + virtual void ChoosedObject(qint64 id, Scene::Scenes type); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogTriangle) Ui::DialogTriangle *ui; - qint32 number; - QString pointName; - qint64 axisP1Id; - qint64 axisP2Id; - qint64 firstPointId; - qint64 secondPointId; + qint32 number; + QString pointName; + qint64 axisP1Id; + qint64 axisP2Id; + qint64 firstPointId; + qint64 secondPointId; }; #endif // DIALOGTRIANGLE_H diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 7e243a9f9..d88229457 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -20,6 +20,7 @@ ****************************************************************************/ #include "vtoolbisector.h" +#include VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index 3bfd214a0..fd0802008 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -23,6 +23,7 @@ #include #include #include "widgets/vmaingraphicsscene.h" +#include VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 0ae377eb0..2ff7c233d 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -20,6 +20,7 @@ ****************************************************************************/ #include "vtoolnormal.h" +#include VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index d4bf3d522..0f212993f 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -20,6 +20,7 @@ ****************************************************************************/ #include "vtoolpointofcontact.h" +#include VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index f1ee18525..bcb96974f 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -21,6 +21,7 @@ #include "vtoolshoulderpoint.h" #include +#include VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index b98391d06..f42616157 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -20,8 +20,8 @@ ****************************************************************************/ #include "vmodelingbisector.h" -#include #include "../drawTools/vtoolbisector.h" +#include VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index f13768c51..a45cc8ba2 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -20,9 +20,7 @@ ****************************************************************************/ #include "vmodelingendline.h" -#include -#include -#include "widgets/vmaingraphicsscene.h" +#include VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index 448232f50..c0e76e68c 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -21,6 +21,7 @@ #include "vmodelingnormal.h" #include "../drawTools/vtoolnormal.h" +#include VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index 049d90300..c0024457f 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -21,6 +21,7 @@ #include "vmodelingpointofcontact.h" #include "../drawTools/vtoolpointofcontact.h" +#include VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index 16292b4df..c2c934bf0 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -22,6 +22,7 @@ #include "vmodelingshoulderpoint.h" #include #include "../drawTools/vtoolshoulderpoint.h" +#include VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, From 2a88e74086c254baf66ac45fff9d4c57895c2aaa Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 26 Oct 2013 22:30:20 +0300 Subject: [PATCH 54/70] Refactoring. --HG-- branch : develop --- exception/vexception.cpp | 3 --- exception/vexception.h | 22 ++++++++---------- exception/vexceptionbadid.cpp | 11 --------- exception/vexceptionbadid.h | 20 ++++++++-------- exception/vexceptionconversionerror.cpp | 4 ---- exception/vexceptionconversionerror.h | 13 +++++------ exception/vexceptionemptyparameter.cpp | 5 ---- exception/vexceptionemptyparameter.h | 28 +++++++++++------------ exception/vexceptionobjecterror.cpp | 4 ---- exception/vexceptionobjecterror.h | 29 ++++++++++++------------ exception/vexceptionuniqueid.cpp | 1 - exception/vexceptionuniqueid.h | 21 ++++++++--------- exception/vexceptionwrongparameterid.cpp | 4 ---- exception/vexceptionwrongparameterid.h | 23 +++++++++---------- 14 files changed, 75 insertions(+), 113 deletions(-) diff --git a/exception/vexception.cpp b/exception/vexception.cpp index a22df35a3..ade9cb27d 100644 --- a/exception/vexception.cpp +++ b/exception/vexception.cpp @@ -25,9 +25,6 @@ VException::VException(const QString &what):QException(), what(what){ Q_ASSERT_X(!what.isEmpty(), Q_FUNC_INFO, "Error message is empty"); } -VException::VException(const VException &e):what(e.What()){ -} - QString VException::ErrorMessage() const{ QString error = QString("Exception: %1").arg(what); return error; diff --git a/exception/vexception.h b/exception/vexception.h index fc53c3d77..ad21054fb 100644 --- a/exception/vexception.h +++ b/exception/vexception.h @@ -24,21 +24,19 @@ #define VEXCEPTION_H #include -#include -class VException : public QException -{ +class VException : public QException{ public: - VException(const QString &what); - VException(const VException &e); - virtual ~VException() noexcept(true){} - void raise() const { throw *this; } - VException *clone() const { return new VException(*this); } - virtual QString ErrorMessage() const; - virtual QString DetailedInformation() const { return QString(); } - QString What() const {return what;} + VException(const QString &what); + VException(const VException &e):what(e.What()){} + virtual ~VException() noexcept(true){} + inline void raise() const { throw *this; } + inline VException *clone() const { return new VException(*this); } + virtual QString ErrorMessage() const; + virtual QString DetailedInformation() const { return QString(); } + inline QString What() const {return what;} protected: - QString what; + QString what; }; #endif // VEXCEPTION_H diff --git a/exception/vexceptionbadid.cpp b/exception/vexceptionbadid.cpp index 82f686f48..6e6d13691 100644 --- a/exception/vexceptionbadid.cpp +++ b/exception/vexceptionbadid.cpp @@ -21,17 +21,6 @@ #include "vexceptionbadid.h" -VExceptionBadId::VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id), - key(QString()){ -} - -VExceptionBadId::VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key) -{ -} - -VExceptionBadId::VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){ -} - QString VExceptionBadId::ErrorMessage() const{ QString error; if(key.isEmpty()){ diff --git a/exception/vexceptionbadid.h b/exception/vexceptionbadid.h index caa9fcd54..47a772c6b 100644 --- a/exception/vexceptionbadid.h +++ b/exception/vexceptionbadid.h @@ -24,19 +24,19 @@ #include "vexception.h" -class VExceptionBadId : public VException -{ +class VExceptionBadId : public VException{ public: - VExceptionBadId(const QString &what, const qint64 &id); - VExceptionBadId(const QString &what, const QString &key); - VExceptionBadId(const VExceptionBadId &e); - virtual ~VExceptionBadId() noexcept(true){} + VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id), + key(QString()){} + VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key){} + VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){} + virtual ~VExceptionBadId() noexcept(true){} virtual QString ErrorMessage() const; - qint64 BadId() const {return id; } - QString BadKey() const {return key; } + inline qint64 BadId() const {return id; } + inline QString BadKey() const {return key; } protected: - qint64 id; - QString key; + qint64 id; + QString key; }; #endif // VEXCEPTIONBADID_H diff --git a/exception/vexceptionconversionerror.cpp b/exception/vexceptionconversionerror.cpp index 7bfbf1366..6fca5172b 100644 --- a/exception/vexceptionconversionerror.cpp +++ b/exception/vexceptionconversionerror.cpp @@ -26,10 +26,6 @@ VExceptionConversionError::VExceptionConversionError(const QString &what, const Q_ASSERT_X(!str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty"); } -VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e): - VException(e), str(e.String()){ -} - QString VExceptionConversionError::ErrorMessage() const{ QString error = QString("ExceptionConversionError: %1 %2").arg(what, str); return error; diff --git a/exception/vexceptionconversionerror.h b/exception/vexceptionconversionerror.h index f0650a50d..3b011ed07 100644 --- a/exception/vexceptionconversionerror.h +++ b/exception/vexceptionconversionerror.h @@ -24,16 +24,15 @@ #include "vexception.h" -class VExceptionConversionError : public VException -{ +class VExceptionConversionError : public VException{ public: - VExceptionConversionError(const QString &what, const QString &str); - VExceptionConversionError(const VExceptionConversionError &e); - virtual ~VExceptionConversionError() noexcept(true) {} + VExceptionConversionError(const QString &what, const QString &str); + VExceptionConversionError(const VExceptionConversionError &e):VException(e), str(e.String()){} + virtual ~VExceptionConversionError() noexcept(true) {} virtual QString ErrorMessage() const; - QString String() const {return str;} + inline QString String() const {return str;} protected: - QString str; + QString str; }; #endif // VEXCEPTIONCONVERSIONERROR_H diff --git a/exception/vexceptionemptyparameter.cpp b/exception/vexceptionemptyparameter.cpp index fb7ee565f..b070a682f 100644 --- a/exception/vexceptionemptyparameter.cpp +++ b/exception/vexceptionemptyparameter.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vexceptionemptyparameter.h" -#include VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement): VException(what), @@ -33,10 +32,6 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS lineNumber = domElement.lineNumber(); } -VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e), - name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){ -} - QString VExceptionEmptyParameter::ErrorMessage() const{ QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name); return error; diff --git a/exception/vexceptionemptyparameter.h b/exception/vexceptionemptyparameter.h index 5e2ad973f..694ab0913 100644 --- a/exception/vexceptionemptyparameter.h +++ b/exception/vexceptionemptyparameter.h @@ -23,25 +23,25 @@ #define VEXCEPTIONEMPTYPARAMETER_H #include "vexception.h" -#include -class VExceptionEmptyParameter : public VException -{ +class VExceptionEmptyParameter : public VException{ public: - VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement); - VExceptionEmptyParameter(const VExceptionEmptyParameter &e); - virtual ~VExceptionEmptyParameter() noexcept(true) {} + VExceptionEmptyParameter(const QString &what, const QString &name, + const QDomElement &domElement); + VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e), name(e.Name()), + tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionEmptyParameter() noexcept(true) {} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString Name() const {return name;} - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} + inline QString Name() const {return name;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} protected: - QString name; - QString tagText; - QString tagName; - qint32 lineNumber; + QString name; + QString tagText; + QString tagName; + qint32 lineNumber; }; #endif // VEXCEPTIONEMPTYPARAMETER_H diff --git a/exception/vexceptionobjecterror.cpp b/exception/vexceptionobjecterror.cpp index d1a424eff..e3f4d833c 100644 --- a/exception/vexceptionobjecterror.cpp +++ b/exception/vexceptionobjecterror.cpp @@ -31,10 +31,6 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElem lineNumber = domElement.lineNumber(); } -VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e):VException(e), - tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){ -} - QString VExceptionObjectError::ErrorMessage() const{ QString error = QString("ExceptionObjectError: %1").arg(what); return error; diff --git a/exception/vexceptionobjecterror.h b/exception/vexceptionobjecterror.h index f0e36bb99..ab38f164e 100644 --- a/exception/vexceptionobjecterror.h +++ b/exception/vexceptionobjecterror.h @@ -23,26 +23,25 @@ #define VEXCEPTIONOBJECTERROR_H #include "vexception.h" -#include -class VExceptionObjectError : public VException -{ +class VExceptionObjectError : public VException{ public: - VExceptionObjectError(const QString &what, const QDomElement &domElement); - VExceptionObjectError(const VExceptionObjectError &e); - virtual ~VExceptionObjectError() noexcept(true) {} + VExceptionObjectError(const QString &what, const QDomElement &domElement); + VExceptionObjectError(const VExceptionObjectError &e):VException(e), tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){} + virtual ~VExceptionObjectError() noexcept(true) {} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} - void AddMoreInformation(const QString &info); - QString MoreInformation() const {return moreInfo;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} + void AddMoreInformation(const QString &info); + inline QString MoreInformation() const {return moreInfo;} protected: - QString tagText; - QString tagName; - qint32 lineNumber; - QString moreInfo; + QString tagText; + QString tagName; + qint32 lineNumber; + QString moreInfo; }; #endif // VEXCEPTIONOBJECTERROR_H diff --git a/exception/vexceptionuniqueid.cpp b/exception/vexceptionuniqueid.cpp index 51ddf4c82..c33fb592d 100644 --- a/exception/vexceptionuniqueid.cpp +++ b/exception/vexceptionuniqueid.cpp @@ -1,5 +1,4 @@ #include "vexceptionuniqueid.h" -#include VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){ diff --git a/exception/vexceptionuniqueid.h b/exception/vexceptionuniqueid.h index 1bf1760d4..d2e9cb5bd 100644 --- a/exception/vexceptionuniqueid.h +++ b/exception/vexceptionuniqueid.h @@ -2,23 +2,22 @@ #define VEXCEPTIONUNIQUEID_H #include "vexception.h" -#include class VExceptionUniqueId : public VException{ public: - VExceptionUniqueId(const QString &what, const QDomElement &domElement); - VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()), - tagName(e.TagName()), lineNumber(e.LineNumber()){} - virtual ~VExceptionUniqueId() noexcept(true){} + VExceptionUniqueId(const QString &what, const QDomElement &domElement); + VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionUniqueId() noexcept(true){} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} protected: - QString tagText; - QString tagName; - qint32 lineNumber; + QString tagText; + QString tagName; + qint32 lineNumber; }; #endif // VEXCEPTIONUNIQUEID_H diff --git a/exception/vexceptionwrongparameterid.cpp b/exception/vexceptionwrongparameterid.cpp index 0da7ea21b..59dd94450 100644 --- a/exception/vexceptionwrongparameterid.cpp +++ b/exception/vexceptionwrongparameterid.cpp @@ -31,10 +31,6 @@ VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, cons lineNumber = domElement.lineNumber(); } -VExceptionWrongParameterId::VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e), - tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){ -} - QString VExceptionWrongParameterId::ErrorMessage() const{ QString error = QString("ExceptionWrongParameterId: %1").arg(what); return error; diff --git a/exception/vexceptionwrongparameterid.h b/exception/vexceptionwrongparameterid.h index 1b8e611f6..1c4a9933c 100644 --- a/exception/vexceptionwrongparameterid.h +++ b/exception/vexceptionwrongparameterid.h @@ -23,23 +23,22 @@ #define VEXCEPTIONWRONGPARAMETERID_H #include "vexception.h" -#include -class VExceptionWrongParameterId : public VException -{ +class VExceptionWrongParameterId : public VException{ public: - VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); - VExceptionWrongParameterId(const VExceptionWrongParameterId &e); - virtual ~VExceptionWrongParameterId() noexcept(true){} + VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); + VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e),tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionWrongParameterId() noexcept(true){} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} protected: - QString tagText; - QString tagName; - qint32 lineNumber; + QString tagText; + QString tagName; + qint32 lineNumber; }; #endif // VEXCEPTIONWRONGPARAMETERID_H From f0a9bdf4d2471885dc20c03be0fc6ebb2c2255c2 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 26 Oct 2013 23:42:54 +0300 Subject: [PATCH 55/70] Refactoring. --HG-- branch : develop --- geometry/varc.cpp | 51 +--------------- geometry/varc.h | 42 +++++++------ geometry/vdetail.cpp | 63 -------------------- geometry/vdetail.h | 61 +++++++++---------- geometry/vnodedetail.cpp | 48 --------------- geometry/vnodedetail.h | 44 +++++++------- geometry/vspline.cpp | 61 +------------------ geometry/vspline.h | 121 ++++++++++++++++++-------------------- geometry/vsplinepath.cpp | 46 +-------------- geometry/vsplinepath.h | 59 ++++++++++--------- geometry/vsplinepoint.cpp | 33 ----------- geometry/vsplinepoint.h | 34 +++++------ 12 files changed, 180 insertions(+), 483 deletions(-) diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 607cef99e..99721616a 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -20,8 +20,7 @@ ****************************************************************************/ #include "varc.h" -#include -#include "exception/vexception.h" +#include VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()), center(0), points(QHash()), mode(Draw::Calculation), idObject(0){ @@ -53,38 +52,6 @@ VArc &VArc::operator =(const VArc &arc){ return *this; } -qreal VArc::GetF1() const{ - return f1; -} - -QString VArc::GetFormulaF1() const{ - return formulaF1; -} - -qreal VArc::GetF2() const{ - return f2; -} - -QString VArc::GetFormulaF2() const{ - return formulaF2; -} - -qreal VArc::GetLength () const{ - return M_PI * radius/180 * (f2-f1); -} - -qreal VArc::GetRadius() const{ - return radius; -} - -QString VArc::GetFormulaRadius() const{ - return formulaRadius; -} - -qint64 VArc::GetCenter() const{ - return center; -} - QPointF VArc::GetCenterPoint() const{ if(points.contains(center)){ return points.value(center).toQPointF(); @@ -197,19 +164,3 @@ QVector VArc::SplOfArc(qint32 number) const{ } return QVector(); } - -Draw::Draws VArc::getMode() const{ - return mode; -} - -void VArc::setMode(const Draw::Draws &value){ - mode = value; -} - -qint64 VArc::getIdObject() const{ - return idObject; -} - -void VArc::setIdObject(const qint64 &value){ - idObject = value; -} diff --git a/geometry/varc.h b/geometry/varc.h index 7b8a99fc5..ac436da4b 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -23,7 +23,6 @@ #define VARC_H #include "vspline.h" -#include /** * @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою. @@ -51,56 +50,55 @@ public: * @brief GetF1 повертає початковий кут дуги. * @return повертає кут в градусах. */ - QString GetFormulaF1 () const; - qreal GetF1 () const; + inline QString GetFormulaF1 () const {return formulaF1;} + inline qreal GetF1 () const {return f1;} /** * @brief GetF2 повертає кінцевий кут дуги. * @return повертає кут в градусах. */ - QString GetFormulaF2 () const;\ - qreal GetF2 () const; + inline QString GetFormulaF2 () const {return formulaF2;} + inline qreal GetF2 () const {return f2;} /** * @brief GetLength повертає довжину дуги. * @return повертає довжину дуги. */ - qreal GetLength () const; + inline qreal GetLength () const {return M_PI * radius/180 * (f2-f1);} /** * @brief GetRadius повертає радіус дуги. * @return повертає радіус дуги. */ - QString GetFormulaRadius () const; - qreal GetRadius () const; + inline QString GetFormulaRadius () const {return formulaRadius;} + inline qreal GetRadius () const {return radius;} /** * @brief GetCenter повертає точку центра дуги. * @return повертає точку центра дуги. */ - qint64 GetCenter () const; - QPointF GetCenterPoint() const; + inline qint64 GetCenter () const {return center;} + QPointF GetCenterPoint() const; /** * @brief GetP1 повертає першу точку з якої починається дуга. * @return точку початку дуги. */ - QPointF GetP1 () const; + QPointF GetP1 () const; /** * @brief GetP2 повертає другу точку в якій закінчується дуга. * @return точку кінця дуги. */ - QPointF GetP2 () const; + QPointF GetP2 () const; const QHash GetDataPoints() const; /** * @brief GetPath будує шлях по даній дузі. * @return повертає шлях. */ - QPainterPath GetPath() const; - qreal AngleArc()const; - qint32 NumberSplOfArc () const; - QVector GetPoints () const; - QVector SplOfArc( qint32 number ) const; - Draw::Draws getMode() const; - void setMode(const Draw::Draws &value); - qint64 getIdObject() const; - void setIdObject(const qint64 &value); - + QPainterPath GetPath() const; + qreal AngleArc() const; + qint32 NumberSplOfArc () const; + QVector GetPoints () const; + QVector SplOfArc( qint32 number ) const; + inline Draw::Draws getMode() const {return mode;} + inline void setMode(const Draw::Draws &value) {mode = value;} + inline qint64 getIdObject() const {return idObject;} + inline void setIdObject(const qint64 &value) {idObject = value;} private: /** * @brief f1 початковий кут в градусах diff --git a/geometry/vdetail.cpp b/geometry/vdetail.cpp index 7e7fdf0c2..9003d35e5 100644 --- a/geometry/vdetail.cpp +++ b/geometry/vdetail.cpp @@ -45,10 +45,6 @@ VDetail &VDetail::operator =(const VDetail &detail){ return *this; } -void VDetail::append(const VNodeDetail &node){ - nodes.append(node); -} - void VDetail::Clear(){ nodes.clear(); name.clear(); @@ -59,10 +55,6 @@ void VDetail::Clear(){ width = 10; } -qint32 VDetail::CountNode() const{ - return nodes.size(); -} - bool VDetail::Containes(const qint64 &id) const{ for(qint32 i = 0; i < nodes.size(); ++i){ VNodeDetail node = nodes[i]; @@ -77,58 +69,3 @@ VNodeDetail &VDetail::operator [](int indx){ return nodes[indx]; } -qreal VDetail::getMy() const{ - return my; -} - -void VDetail::setMy(const qreal &value){ - my = value; -} - -qreal VDetail::getMx() const{ - return mx; -} - -void VDetail::setMx(const qreal &value){ - mx = value; -} - -QString VDetail::getName() const{ - return name; -} - -void VDetail::setName(const QString &value){ - name = value; -} - -qreal VDetail::getWidth() const{ - return width; -} - -void VDetail::setWidth(const qreal &value){ - width = value; -} - -bool VDetail::getClosed() const{ - return closed; -} - -void VDetail::setClosed(bool value){ - closed = value; -} - -bool VDetail::getSupplement() const{ - return supplement; -} - -void VDetail::setSupplement(bool value){ - supplement = value; -} - -QVector VDetail::getNodes() const{ - return nodes; -} - -void VDetail::setNodes(const QVector &value){ - nodes = value; -} diff --git a/geometry/vdetail.h b/geometry/vdetail.h index 5372e219a..cb31ceee8 100644 --- a/geometry/vdetail.h +++ b/geometry/vdetail.h @@ -23,9 +23,6 @@ #define VDETAIL_H #include "vnodedetail.h" -#include -#include -#include namespace Detail { enum Contour { OpenContour, CloseContour }; @@ -39,37 +36,37 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants) class VDetail{ public: - VDetail(); - VDetail(const QString &name, const QVector &nodes); - VDetail(const VDetail &detail); - VDetail &operator=(const VDetail &detail); - void append(const VNodeDetail &node); - void Clear(); - qint32 CountNode() const; - bool Containes(const qint64 &id)const; - VNodeDetail & operator[](int indx); - QString getName() const; - void setName(const QString &value); - qreal getMx() const; - void setMx(const qreal &value); - qreal getMy() const; - void setMy(const qreal &value); - bool getSupplement() const; - void setSupplement(bool value); - bool getClosed() const; - void setClosed(bool value); - qreal getWidth() const; - void setWidth(const qreal &value); - QVector getNodes() const; - void setNodes(const QVector &value); + VDetail(); + VDetail(const QString &name, const QVector &nodes); + VDetail(const VDetail &detail); + VDetail &operator=(const VDetail &detail); + inline void append(const VNodeDetail &node) {nodes.append(node);} + void Clear(); + inline qint32 CountNode() const {return nodes.size();} + bool Containes(const qint64 &id)const; + VNodeDetail & operator[](int indx); + inline QString getName() const {return name;} + inline void setName(const QString &value) {name = value;} + inline qreal getMx() const {return mx;} + inline void setMx(const qreal &value) {mx = value;} + inline qreal getMy() const {return my;} + inline void setMy(const qreal &value) {my = value;} + inline bool getSupplement() const {return supplement;} + inline void setSupplement(bool value) {supplement = value;} + inline bool getClosed() const {return closed;} + inline void setClosed(bool value) {closed = value;} + inline qreal getWidth() const {return width;} + inline void setWidth(const qreal &value) {width = value;} + inline QVector getNodes() const {return nodes;} + inline void setNodes(const QVector &value) {nodes = value;} private: QVector nodes; - QString name; - qreal mx; - qreal my; - bool supplement; - bool closed; - qreal width; + QString name; + qreal mx; + qreal my; + bool supplement; + bool closed; + qreal width; }; #endif // VDETAIL_H diff --git a/geometry/vnodedetail.cpp b/geometry/vnodedetail.cpp index b25c28d92..50a5b5424 100644 --- a/geometry/vnodedetail.cpp +++ b/geometry/vnodedetail.cpp @@ -43,51 +43,3 @@ VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node){ my = node.getMy(); return *this; } - -Tool::Tools VNodeDetail::getTypeTool() const{ - return typeTool; -} - -void VNodeDetail::setTypeTool(const Tool::Tools &value){ - typeTool = value; -} - -qint64 VNodeDetail::getId() const{ - return id; -} - -void VNodeDetail::setId(const qint64 &value){ - id = value; -} - -Draw::Draws VNodeDetail::getMode() const{ - return mode; -} - -void VNodeDetail::setMode(const Draw::Draws &value){ - mode = value; -} - -NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{ - return typeNode; -} - -void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){ - typeNode = value; -} - -qreal VNodeDetail::getMy() const{ - return my; -} - -void VNodeDetail::setMy(const qreal &value){ - my = value; -} - -qreal VNodeDetail::getMx() const{ - return mx; -} - -void VNodeDetail::setMx(const qreal &value){ - mx = value; -} diff --git a/geometry/vnodedetail.h b/geometry/vnodedetail.h index 04359f9da..d28068ba2 100644 --- a/geometry/vnodedetail.h +++ b/geometry/vnodedetail.h @@ -33,30 +33,30 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails) class VNodeDetail{ public: - VNodeDetail(); - VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, - qreal mx = 0, qreal my = 0); - VNodeDetail(const VNodeDetail &node); - VNodeDetail &operator=(const VNodeDetail &node); - qint64 getId() const; - void setId(const qint64 &value); - Tool::Tools getTypeTool() const; - void setTypeTool(const Tool::Tools &value); - Draw::Draws getMode() const; - void setMode(const Draw::Draws &value); - NodeDetail::NodeDetails getTypeNode() const; - void setTypeNode(const NodeDetail::NodeDetails &value); - qreal getMx() const; - void setMx(const qreal &value); - qreal getMy() const; - void setMy(const qreal &value); + VNodeDetail(); + VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, + qreal mx = 0, qreal my = 0); + VNodeDetail(const VNodeDetail &node); + VNodeDetail &operator=(const VNodeDetail &node); + inline qint64 getId() const {return id;} + inline void setId(const qint64 &value) {id = value;} + inline Tool::Tools getTypeTool() const {return typeTool;} + inline void setTypeTool(const Tool::Tools &value) {typeTool = value;} + inline Draw::Draws getMode() const {return mode;} + inline void setMode(const Draw::Draws &value) {mode = value;} + inline NodeDetail::NodeDetails getTypeNode() const {return typeNode;} + inline void setTypeNode(const NodeDetail::NodeDetails &value) {typeNode = value;} + inline qreal getMx() const {return mx;} + inline void setMx(const qreal &value) {mx = value;} + inline qreal getMy() const {return my;} + inline void setMy(const qreal &value) {my = value;} private: - qint64 id; - Tool::Tools typeTool; - Draw::Draws mode; + qint64 id; + Tool::Tools typeTool; + Draw::Draws mode; NodeDetail::NodeDetails typeNode; - qreal mx; - qreal my; + qreal mx; + qreal my; }; Q_DECLARE_METATYPE(VNodeDetail) diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 674980add..f15abbde9 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vspline.h" -#include VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(QHash()), mode(Draw::Calculation), idObject(0){ @@ -33,8 +32,8 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 } VSpline::VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, - qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()), - p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(*points), + qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), + p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(*points), mode(mode), idObject(idObject){ ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve ); } @@ -124,10 +123,6 @@ void VSpline::ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCu // p4 = QPointF(p4.x()+mx, p4.y()+my); //} -qint64 VSpline::GetP1 () const{ - return p1; -} - VPointF VSpline::GetPointP1() const{ if(points.contains(p1)){ return points.value(p1); @@ -138,18 +133,6 @@ VPointF VSpline::GetPointP1() const{ return VPointF(); } -QPointF VSpline::GetP2 () const{ - return p2; -} - -QPointF VSpline::GetP3 () const{ - return p3; -} - -qint64 VSpline::GetP4() const{ - return p4; -} - VPointF VSpline::GetPointP4() const{ if(points.contains(p4)){ return points.value(p4); @@ -160,14 +143,6 @@ VPointF VSpline::GetPointP4() const{ return VPointF(); } -qreal VSpline::GetAngle1() const{ - return angle1; -} - -qreal VSpline::GetAngle2 () const{ - return angle2; -} - qreal VSpline::GetLength () const{ return LengthBezier ( GetPointP1().toQPointF(), this->p2, this->p3, GetPointP4().toQPointF()); } @@ -178,22 +153,6 @@ QString VSpline::GetName() const{ return QString("Spl_%1_%2").arg(first.name(), second.name()); } -qreal VSpline::GetKasm1() const{ - return kAsm1; -} - -qreal VSpline::GetKasm2() const{ - return kAsm2; -} - -qreal VSpline::GetKcurve() const{ - return kCurve; -} - -const QHash VSpline::GetDataPoints() const{ - return points; -} - QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const{ QVector px; QVector py; @@ -737,14 +696,6 @@ qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){ // this->ModifiSpl(P1, P2, P3, P4); //} -Draw::Draws VSpline::getMode() const{ - return mode; -} - -void VSpline::setMode(const Draw::Draws &value){ - mode = value; -} - QVector VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve){ QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y()); @@ -761,14 +712,6 @@ QVector VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qre return GetPoints(p1, p2, p3, p4); } -qint64 VSpline::getIdObject() const{ - return idObject; -} - -void VSpline::setIdObject(const qint64 &value){ - idObject = value; -} - VSpline &VSpline::operator =(const VSpline &spline){ this->p1 = spline.GetP1 (); this->p2 = spline.GetP2 (); diff --git a/geometry/vspline.h b/geometry/vspline.h index d87260421..b91d0b88a 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -22,24 +22,21 @@ #ifndef VSPLINE_H #define VSPLINE_H -#define M_2PI 6.28318530717958647692528676655900576 +#include -#include -#include -#include -#include "container/vpointf.h" +#define M_2PI 6.28318530717958647692528676655900576 /** * @brief VSpline клас, що реалізує сплайн. */ class VSpline{ public: - VSpline(); + VSpline(); /** * @brief VSpline конструктор. * @param spline сплайн з якого копіюємо. */ - VSpline (const VSpline &spline ); + VSpline (const VSpline &spline ); /** * @brief VSpline конструктор. * @param p1 початкова точка сплайна. @@ -50,9 +47,9 @@ public: * @param kAsm1 коефіцієнт довжини першої напрямної. * @param kAsm2 коефіцієнт довжини другої напрямної. */ - VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, - qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, - Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + VSpline (const QHash *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, + qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode = Draw::Calculation, + qint64 idObject = 0); /** * @brief VSpline конструктор. * @param p1 початкова точка сплайну. @@ -60,9 +57,8 @@ public: * @param p3 друга контролююча точка сплайну. * @param p4 кінцева точка сплайну. */ - VSpline (const QHash *points, qint64 p1, QPointF p2, QPointF p3, - qint64 p4, qreal kCurve, Draw::Draws mode = Draw::Calculation, - qint64 idObject = 0); + VSpline (const QHash *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4, + qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); /** * @brief ModifiSpl модифікує сплайн. * @param p1 початкова точка сплайну. @@ -73,7 +69,7 @@ public: * @param kAsm1 коефіцієнт довжини першої напрямної. * @param kAsm2 коефіцієнт довжини другої напрямної. */ - void ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, + void ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); /** * @brief ModifiSpl модифікує сплайн. @@ -82,61 +78,61 @@ public: * @param p3 друга контролююча точка сплайну. * @param p4 кінцева точка сплайну. */ - void ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve); + void ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve); /** * @brief RotationSpl поворот сплайна навколо точки на кут в градусах проти годиникової стрілки. * @param pRotate точка навколо якої повертаємо. * @param angle кут в градусах. */ -// void RotationSpl ( QPointF pRotate, qreal angle ); +// void RotationSpl ( QPointF pRotate, qreal angle ); /** * @brief BiasSpl зміщує сплайн. * @param mx зміщення по х координаті. * @param my зміщення по у координаті. */ -// void BiasSpl ( qreal mx, qreal my ); +// void BiasSpl ( qreal mx, qreal my ); /** * @brief GetP1 повертає першу точку сплайну. * @return перша точка сплайну. */ - qint64 GetP1 () const; - VPointF GetPointP1() const; + qint64 GetP1 () const {return p1;} + VPointF GetPointP1() const; /** * @brief GetP2 повертує першу контрольну точку сплайну. * @return перша контрольна точка сплайну. */ - QPointF GetP2 () const; + inline QPointF GetP2 () const {return p2;} /** * @brief GetP3 повертає другу контрольну точку сплайну. * @return друга контрольна точка сплайну. */ - QPointF GetP3 () const; + inline QPointF GetP3 () const {return p3;} /** * @brief GetP4 повертає останню точку сплайну. * @return остання точка сплайну. */ - qint64 GetP4 () const; - VPointF GetPointP4 () const; + inline qint64 GetP4 () const {return p4;} + VPointF GetPointP4 () const; /** * @brief GetAngle1 повертає кут першої напрямної. * @return кут в градусах. */ - qreal GetAngle1 () const; + inline qreal GetAngle1 () const {return angle1;} /** * @brief GetAngle2 повертає кут другої напрямної. * @return кут в градусах. */ - qreal GetAngle2() const; + inline qreal GetAngle2() const {return angle2;} /** * @brief GetLength повертає довжину сплайну. * @return довжина сплайну. */ - qreal GetLength () const; - QString GetName () const; - qreal GetKasm1() const; - qreal GetKasm2() const; - qreal GetKcurve() const; - const QHash GetDataPoints() const; + qreal GetLength () const; + QString GetName () const; + inline qreal GetKasm1() const {return kAsm1;} + inline qreal GetKasm2() const {return kAsm2;} + inline qreal GetKcurve() const {return kCurve;} + inline const QHash GetDataPoints() const {return points;} /** * @brief CrossingSplLine перевіряє перетин сплайну з лінією. * @param line лінія з якою перевіряється перетин. @@ -150,20 +146,20 @@ public: * @param curFir перший сплайн. * @param curSec другий сплайн. */ -// void CutSpline ( qreal length, VSpline* curFir, VSpline* curSec ) const; +// void CutSpline ( qreal length, VSpline* curFir, VSpline* curSec ) const; /** * @brief CutSpline розрізає сплайн. * @param point точка що ділить сплайн. * @param curFir перший сплайн. * @param curSec другий сплайн. */ -// void CutSpline (QPointF point, VSpline* curFir, VSpline* curSec ) const; +// void CutSpline (QPointF point, VSpline* curFir, VSpline* curSec ) const; /** * @brief PutAlongSpl розміщає точку на сплайні. * @param moveP точка яка розміщується на сплайні. * @param move довжина від початку сплайну. */ -// void PutAlongSpl ( QPointF &moveP, qreal move ) const; +// void PutAlongSpl ( QPointF &moveP, qreal move ) const; /** * @brief GetPoints повертає точки з яких складається сплайн. * @return список точок. @@ -173,19 +169,19 @@ public: * @brief GetPath повертає шлях сплайну. * @return шлях. */ - QPainterPath GetPath() const; + QPainterPath GetPath() const; /** * @brief Mirror вертикальне дзеркалення сплайну відносно точки. * @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну. */ -// void Mirror(const QPointF Pmirror); - Draw::Draws getMode() const; - void setMode(const Draw::Draws &value); - static QVector SplinePoints(QPointF p1, QPointF p4, qreal angle1, - qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); - qint64 getIdObject() const; - void setIdObject(const qint64 &value); - VSpline &operator=(const VSpline &spl); +// void Mirror(const QPointF Pmirror); + inline Draw::Draws getMode() const {return mode;} + inline void setMode(const Draw::Draws &value) {mode = value;} + static QVector SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, + qreal kCurve); + inline qint64 getIdObject() const {return idObject;} + inline void setIdObject(const qint64 &value) {idObject = value;} + VSpline &operator=(const VSpline &spl); protected: /** * @brief GetPoints повертає точки з яких складається сплайн. @@ -200,33 +196,33 @@ private: /** * @brief p1 початкова точка сплайну */ - qint64 p1; // перша точка + qint64 p1; // перша точка /** * @brief p2 перша контрольна точка сплайну. */ - QPointF p2; // друга точка + QPointF p2; // друга точка /** * @brief p3 друга контрольна точка сплайну. */ - QPointF p3; // третя точка + QPointF p3; // третя точка /** * @brief p4 кінцеві точка сплайну. */ - qint64 p4; // четверта точка + qint64 p4; // четверта точка /** * @brief angle1 кут в градусах першої напрямної. */ - qreal angle1; // кут нахилу дотичної в першій точці + qreal angle1; // кут нахилу дотичної в першій точці /** * @brief angle2 кут в градусах другої напрямної. */ - qreal angle2; // кут нахилу дотичної в другій точці - qreal kAsm1; - qreal kAsm2; - qreal kCurve; + qreal angle2; // кут нахилу дотичної в другій точці + qreal kAsm1; + qreal kAsm2; + qreal kCurve; QHash points; - Draw::Draws mode; - qint64 idObject; + Draw::Draws mode; + qint64 idObject; /** * @brief LengthBezier повертає дожину сплайну за його чотирьма точками. * @param p1 початкова точка сплайну. @@ -235,7 +231,7 @@ private: * @param p4 кінцева точка сплайну. * @return дожина сплайну. */ - qreal LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const; + qreal LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const; /** * @brief PointBezier_r знаходить точки сплайну по його чотирьом точках. * @param x1 х координата першої точки сплайну. @@ -250,9 +246,8 @@ private: * @param px список х координат точок сплайну. * @param py список у коодринат сплайну. */ - static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, - qreal x3, qreal y3, qreal x4, qreal y4, - qint16 level, QVector &px, QVector &py); + static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, + qint16 level, QVector &px, QVector &py); /** * @brief CalcSqDistance розраховує довжину між точками. * @param x1 х координата першої точки. @@ -261,7 +256,7 @@ private: * @param y2 у координата другої точки. * @return довжину. */ - static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2); + static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2); /** * @brief Cubic знаходить розв'язок кубічного рівняння. * @param x коефіцієнт. @@ -270,7 +265,7 @@ private: * @param c коефіцієнт. * @return повертає корені рівняння. */ - static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c); + static qint32 Cubic(qreal *x, qreal a, qreal b, qreal c); /** * @brief calc_t знаходить параметр t якому відповідає точка на сплайні. * @param curve_coord1 координата Х або У кривої. @@ -280,14 +275,14 @@ private: * @param point_coord координата Х або У точки на кривій. * @return */ -// static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, -// qreal curve_coord4, qreal point_coord)const; +// static qreal calc_t (qreal curve_coord1, qreal curve_coord2, qreal curve_coord3, qreal curve_coord4, +// qreal point_coord)const; /** * @brief param_t знаходить підходяще значення параметра t якому відповідає точка на сплайні * @param pBt точка для якої шукається значення параметра t. * @return підходяще значення t. */ -// qreal param_t (QPointF pBt)const; +// qreal param_t (QPointF pBt)const; }; #endif // VSPLINE_H diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index bd0a5a8fe..e58269751 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -20,7 +20,7 @@ ****************************************************************************/ #include "vsplinepath.h" -#include "exception/vexception.h" +#include VSplinePath::VSplinePath(): path(QVector()), kCurve(1), mode(Draw::Calculation), points(QHash()), idObject(0){ @@ -35,14 +35,6 @@ VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()), idObject(splPath.getIdObject()){ } -Draw::Draws VSplinePath::getMode() const{ - return mode; -} - -void VSplinePath::setMode(const Draw::Draws &value){ - mode = value; -} - void VSplinePath::append(VSplinePoint point){ path.append(point); } @@ -55,10 +47,6 @@ qint32 VSplinePath::Count() const{ } } -qint32 VSplinePath::CountPoint() const{ - return path.size(); -} - VSpline VSplinePath::GetSpline(qint32 index) const{ if(Count()<1){ throw VException(tr("Not enough points to create the spline.")); @@ -94,10 +82,6 @@ QVector VSplinePath::GetPathPoints() const{ return pathPoints; } -QVector VSplinePath::GetSplinePath() const{ - return path; -} - qreal VSplinePath::GetLength() const{ qreal length = 0; for(qint32 i = 1; i <= Count(); ++i){ @@ -108,10 +92,6 @@ qreal VSplinePath::GetLength() const{ return length; } -QHash VSplinePath::GetDataPoints() const{ - return points; -} - void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point){ if(indexSpline < 1 || indexSpline > Count()){ throw VException(tr("This spline is not exist.")); @@ -134,22 +114,6 @@ VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Positi } } -void VSplinePath::Clear(){ - path.clear(); -} - -qreal VSplinePath::getKCurve() const{ - return kCurve; -} - -void VSplinePath::setKCurve(const qreal &value){ - kCurve = value; -} - -const QVector *VSplinePath::GetPoint() const{ - return &path; -} - VSplinePath &VSplinePath::operator =(const VSplinePath &path){ this->path = path.GetSplinePath(); this->kCurve = path.getKCurve(); @@ -162,11 +126,3 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path){ VSplinePoint & VSplinePath::operator[](int indx){ return path[indx]; } - -qint64 VSplinePath::getIdObject() const{ - return idObject; -} - -void VSplinePath::setIdObject(const qint64 &value){ - idObject = value; -} diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index a00be2c9b..7a8ba8daa 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -23,8 +23,9 @@ #define VSPLINEPATH_H #include "vsplinepoint.h" +#include #include "vspline.h" -#include +#include namespace SplinePoint{ enum Position { FirstPoint, LastPoint }; @@ -41,52 +42,52 @@ public: /** * @brief VSplinePath конструктор по замовчуванню. */ - VSplinePath(); + VSplinePath(); /** * @brief VSplinePath конструктор по замовчуванню. */ - VSplinePath(const QHash *points, qreal kCurve = 1, - Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); - VSplinePath(const VSplinePath& splPath); + VSplinePath(const QHash *points, qreal kCurve = 1, + Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + VSplinePath(const VSplinePath& splPath); /** * @brief append додає точку сплайну до шляху. * @param point точка. */ - void append(VSplinePoint point); - qint32 Count() const; - qint32 CountPoint() const; - VSpline GetSpline(qint32 index) const; - QPainterPath GetPath() const; - QVector GetPathPoints() const; - QVector GetSplinePath() const; - qreal GetLength() const; - QHash GetDataPoints() const; - void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); - VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; + void append(VSplinePoint point); + qint32 Count() const; + inline qint32 CountPoint() const {return path.size();} + VSpline GetSpline(qint32 index) const; + QPainterPath GetPath() const; + QVector GetPathPoints() const; + inline QVector GetSplinePath() const {return path;} + qreal GetLength() const; + inline QHash GetDataPoints() const {return points;} + void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); + VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; /** * @brief Clear очищає шлях сплайнів. */ - void Clear(); - qreal getKCurve() const; - void setKCurve(const qreal &value); - const QVector *GetPoint() const; - VSplinePath& operator=(const VSplinePath &path); - VSplinePoint & operator[](int indx); - Draw::Draws getMode() const; - void setMode(const Draw::Draws &value); + inline void Clear() {path.clear();} + inline qreal getKCurve() const {return kCurve;} + inline void setKCurve(const qreal &value) {kCurve = value;} + inline const QVector *GetPoint() const {return &path;} + VSplinePath &operator=(const VSplinePath &path); + VSplinePoint &operator[](int indx); + inline Draw::Draws getMode() const {return mode;} + inline void setMode(const Draw::Draws &value) {mode = value;} - qint64 getIdObject() const; - void setIdObject(const qint64 &value); + inline qint64 getIdObject() const {return idObject;} + inline void setIdObject(const qint64 &value) {idObject = value;} protected: /** * @brief path вектор з точок сплайна. */ QVector path; - qreal kCurve; - Draw::Draws mode; + qreal kCurve; + Draw::Draws mode; QHash points; - qint64 idObject; + qint64 idObject; }; #endif // VSPLINEPATH_H diff --git a/geometry/vsplinepoint.cpp b/geometry/vsplinepoint.cpp index 6409eb5d5..ab071e509 100644 --- a/geometry/vsplinepoint.cpp +++ b/geometry/vsplinepoint.cpp @@ -32,41 +32,8 @@ VSplinePoint::VSplinePoint(const VSplinePoint &point):pSpline(point.P()), angle( kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){ } -VSplinePoint::~VSplinePoint(){ -} -qint64 VSplinePoint::P() const{ - return pSpline; -} -void VSplinePoint::SetP(const qint64 &value){ - pSpline = value; -} -qreal VSplinePoint::Angle1() const{ - return angle+180; -} -void VSplinePoint::SetAngle(const qreal &value){ - angle = value; -} -qreal VSplinePoint::Angle2() const{ - return angle; -} - -qreal VSplinePoint::KAsm1() const{ - return kAsm1; -} - -void VSplinePoint::SetKAsm1(const qreal &value){ - kAsm1 = value; -} - -qreal VSplinePoint::KAsm2() const{ - return kAsm2; -} - -void VSplinePoint::SetKAsm2(const qreal &value){ - kAsm2 = value; -} diff --git a/geometry/vsplinepoint.h b/geometry/vsplinepoint.h index 219e9fa96..ae9ffaeb5 100644 --- a/geometry/vsplinepoint.h +++ b/geometry/vsplinepoint.h @@ -32,62 +32,62 @@ public: /** * @brief VSplinePoint конструктор по замповчуванню. */ - VSplinePoint(); + VSplinePoint(); /** * @brief VSplinePoint конструктор. * @param pSpline точка сплайну. * @param angle кут дотичної сплайна. * @param factor коефіцієнт довжини дотичної. */ - VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle, qreal kAsm2); - VSplinePoint(const VSplinePoint &point); - ~VSplinePoint(); + VSplinePoint(qint64 pSpline, qreal kAsm1, qreal angle, qreal kAsm2); + VSplinePoint(const VSplinePoint &point); + ~VSplinePoint() {} /** * @brief P повертає точку. * @return точка. */ - qint64 P() const; - void SetP(const qint64 &value); + inline qint64 P() const {return pSpline;} + inline void SetP(const qint64 &value) {pSpline = value;} /** * @brief Angle1 повертає кут дотичної сплайна. * @return кут в градусах. */ - qreal Angle1() const; - void SetAngle(const qreal &value); + inline qreal Angle1() const {return angle+180;} + inline void SetAngle(const qreal &value) {angle = value;} /** * @brief Angle2 повертає кут дотичної сплайна. * @return кут в градусах. */ - qreal Angle2() const; + inline qreal Angle2() const {return angle;} /** * @brief KAsm1 повертає коефіцієнт довжини дотичної. * @return коефіцієнт. */ - qreal KAsm1() const; - void SetKAsm1(const qreal &value); + inline qreal KAsm1() const {return kAsm1;} + inline void SetKAsm1(const qreal &value) {kAsm1 = value;} /** * @brief KAsm2 повертає коефіцієнт довжини дотичної. * @return коефіцієнт. */ - qreal KAsm2() const; - void SetKAsm2(const qreal &value); + inline qreal KAsm2() const {return kAsm2;} + inline void SetKAsm2(const qreal &value) {kAsm2 = value;} protected: /** * @brief pSpline точка сплайну. */ - qint64 pSpline; + qint64 pSpline; /** * @brief angle кут дотичної сплайну. */ - qreal angle; + qreal angle; /** * @brief kAsm1 коефіцієнт довжини дотичної сплайну. */ - qreal kAsm1; + qreal kAsm1; /** * @brief kAsm2 коефіцієнт довжини дотичної сплайну. */ - qreal kAsm2; + qreal kAsm2; }; Q_DECLARE_METATYPE(VSplinePoint) From f2860076eefb74a090b68e095d16d03007e790c8 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 09:47:01 +0200 Subject: [PATCH 56/70] Refactoring. --HG-- branch : develop --- xml/vdomdocument.cpp | 47 ++++----------- xml/vdomdocument.h | 139 +++++++++++++++++++++---------------------- xml/vtoolrecord.cpp | 24 -------- xml/vtoolrecord.h | 31 ++++------ 4 files changed, 94 insertions(+), 147 deletions(-) diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 12d55c277..1e2d048dc 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -20,21 +20,19 @@ ****************************************************************************/ #include "vdomdocument.h" -#include -#include "tools/drawTools/drawtools.h" -#include "tools/nodeDetails/nodedetails.h" -#include "tools/modelingTools/modelingtools.h" -#include "tools/vtooldetail.h" -#include "options.h" -#include "container/calculator.h" -#include "geometry/vsplinepoint.h" -#include "exception/vexceptionwrongparameterid.h" -#include "exception/vexceptionconversionerror.h" -#include "exception/vexceptionemptyparameter.h" -#include "exception/vexceptionbadid.h" -#include "exception/vexceptionobjecterror.h" -#include "exception/vexceptionuniqueid.h" -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode) : QDomDocument(), map(QHash()), nameActivDraw(QString()), data(data), @@ -56,9 +54,6 @@ VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QC comboBoxDraws(comboBoxDraws), mode(mode){ } -VDomDocument::~VDomDocument(){ -} - QDomElement VDomDocument::elementById(const QString& id){ if (map.contains(id)) { QDomElement e = map[id]; @@ -190,10 +185,6 @@ void VDomDocument::SetActivDraw(const QString& name){ this->nameActivDraw = name; } -QString VDomDocument::GetNameActivDraw() const{ - return nameActivDraw; -} - bool VDomDocument::GetActivDrawElement(QDomElement &element){ if(!nameActivDraw.isEmpty()){ QDomNodeList elements = this->documentElement().elementsByTagName( "draw" ); @@ -307,14 +298,6 @@ void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDra } } -QHash *VDomDocument::getTools(){ - return &tools; -} - -QVector *VDomDocument::getHistory(){ - return &history; -} - void VDomDocument::ParseIncrementsElement(const QDomNode &node){ QDomNode domNode = node.firstChild(); while(!domNode.isNull()){ @@ -1134,10 +1117,6 @@ void VDomDocument::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable emit ShowTool(id, color, enable); } -qint64 VDomDocument::getCursor() const{ - return cursor; -} - void VDomDocument::setCursor(const qint64 &value){ cursor = value; emit ChangedCursor(cursor); diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 51fcd2f03..4f3ce2564 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -23,10 +23,9 @@ #define VDOMDOCUMENT_H #include -#include -#include -#include "widgets/vmaingraphicsscene.h" -#include "tools/vdatatool.h" +#include +#include +#include #include "vtoolrecord.h" namespace Document { @@ -40,80 +39,80 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents) class VDomDocument : public QObject, public QDomDocument{ Q_OBJECT public: - VDomDocument(VContainer *data,QComboBox *comboBoxDraws, Draw::Draws *mode); - VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, - Draw::Draws *mode); - VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, - Draw::Draws *mode); - ~VDomDocument(); - QDomElement elementById(const QString& id); - void CreateEmptyFile(); - void ChangeActivDraw(const QString& name, Document::Documents parse = Document::FullParse); - QString GetNameActivDraw() const; - bool GetActivDrawElement(QDomElement &element); - bool GetActivCalculationElement(QDomElement &element); - bool GetActivModelingElement(QDomElement &element); - bool GetActivDetailsElement(QDomElement &element); - bool appendDraw(const QString& name); - bool SetNameDraw(const QString& name); - void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); - QHash* getTools(); - QVector *getHistory(); - qint64 getCursor() const; - void setCursor(const qint64 &value); - void setCurrentData(); - void AddTool(const qint64 &id, VDataTool *tool); - void UpdateToolData(const qint64 &id, VContainer *data); - void IncrementReferens(qint64 id) const; - void DecrementReferens(qint64 id) const; - void TestUniqueId() const; + VDomDocument(VContainer *data,QComboBox *comboBoxDraws, Draw::Draws *mode); + VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, + Draw::Draws *mode); + VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, + Draw::Draws *mode); + ~VDomDocument(){} + QDomElement elementById(const QString& id); + void CreateEmptyFile(); + void ChangeActivDraw(const QString& name, Document::Documents parse = Document::FullParse); + inline QString GetNameActivDraw() const {return nameActivDraw;} + bool GetActivDrawElement(QDomElement &element); + bool GetActivCalculationElement(QDomElement &element); + bool GetActivModelingElement(QDomElement &element); + bool GetActivDetailsElement(QDomElement &element); + bool appendDraw(const QString& name); + bool SetNameDraw(const QString& name); + void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); + inline QHash* getTools() {return &tools;} + inline QVector *getHistory() {return &history;} + inline qint64 getCursor() const {return cursor;} + void setCursor(const qint64 &value); + void setCurrentData(); + void AddTool(const qint64 &id, VDataTool *tool); + void UpdateToolData(const qint64 &id, VContainer *data); + void IncrementReferens(qint64 id) const; + void DecrementReferens(qint64 id) const; + void TestUniqueId() const; signals: - void ChangedActivDraw(const QString newName); - void ChangedNameDraw(const QString oldName, const QString newName); - void FullUpdateFromFile(); - void haveChange(); - void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); - void ChangedCursor(qint64 id); + void ChangedActivDraw(const QString newName); + void ChangedNameDraw(const QString oldName, const QString newName); + void FullUpdateFromFile(); + void haveChange(); + void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + void ChangedCursor(qint64 id); public slots: - void FullUpdateTree(); - void haveLiteChange(); - void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); + void FullUpdateTree(); + void haveLiteChange(); + void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); private: Q_DISABLE_COPY(VDomDocument) QHash map; - QString nameActivDraw; - VContainer *data; + QString nameActivDraw; + VContainer *data; QHash tools; QVector history; - qint64 cursor; - QComboBox *comboBoxDraws; - Draw::Draws *mode; - bool find(QDomElement node, const QString& id); - bool CheckNameDraw(const QString& name) const; - void SetActivDraw(const QString& name); - bool GetActivNodeElement(const QString& name, QDomElement& element); - void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse); - void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse, Draw::Draws mode); - void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - const Document::Documents &parse); - void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - const Document::Documents &parse); - void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString &type, Draw::Draws mode); - void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, Draw::Draws mode); - void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement, + qint64 cursor; + QComboBox *comboBoxDraws; + Draw::Draws *mode; + bool find(QDomElement node, const QString& id); + bool CheckNameDraw(const QString& name) const; + void SetActivDraw(const QString& name); + bool GetActivNodeElement(const QString& name, QDomElement& element); + void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, + const QDomNode& node, const Document::Documents &parse); + void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, + const QDomNode& node, const Document::Documents &parse, Draw::Draws mode); + void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, + const Document::Documents &parse); + void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, + const Document::Documents &parse); + void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, const QString &type, Draw::Draws mode); + void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, Draw::Draws mode); + void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, const QString& type, Draw::Draws mode); + void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement, const Document::Documents &parse, const QString& type, Draw::Draws mode); - void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type, Draw::Draws mode); - void ParseIncrementsElement(const QDomNode& node); - qint64 GetParametrId(const QDomElement& domElement) const; - qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name) const; - QString GetParametrString(const QDomElement& domElement, const QString &name) const; - qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const; - void CollectId(QDomElement node, QVector &vector)const; + void ParseIncrementsElement(const QDomNode& node); + qint64 GetParametrId(const QDomElement& domElement) const; + qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name) const; + QString GetParametrString(const QDomElement& domElement, const QString &name) const; + qreal GetParametrDouble(const QDomElement& domElement, const QString &name) const; + void CollectId(QDomElement node, QVector &vector)const; }; #pragma GCC diagnostic pop diff --git a/xml/vtoolrecord.cpp b/xml/vtoolrecord.cpp index 5fe3279b4..64bd06127 100644 --- a/xml/vtoolrecord.cpp +++ b/xml/vtoolrecord.cpp @@ -27,27 +27,3 @@ VToolRecord::VToolRecord():id(0), typeTool(Tool::ArrowTool), nameDraw(QString()) VToolRecord::VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw):id(id), typeTool(typeTool), nameDraw(nameDraw){ } - -QString VToolRecord::getNameDraw() const{ - return nameDraw; -} - -void VToolRecord::setNameDraw(const QString &value){ - nameDraw = value; -} - -Tool::Tools VToolRecord::getTypeTool() const{ - return typeTool; -} - -void VToolRecord::setTypeTool(const Tool::Tools &value){ - typeTool = value; -} - -qint64 VToolRecord::getId() const{ - return id; -} - -void VToolRecord::setId(const qint64 &value){ - id = value; -} diff --git a/xml/vtoolrecord.h b/xml/vtoolrecord.h index 6292aab9f..add61c98a 100644 --- a/xml/vtoolrecord.h +++ b/xml/vtoolrecord.h @@ -22,27 +22,20 @@ #ifndef VTOOLRECORD_H #define VTOOLRECORD_H -#include -#include "options.h" - -class VToolRecord -{ +class VToolRecord{ public: - VToolRecord(); - VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw); - qint64 getId() const; - void setId(const qint64 &value); - - Tool::Tools getTypeTool() const; - void setTypeTool(const Tool::Tools &value); - - QString getNameDraw() const; - void setNameDraw(const QString &value); - + VToolRecord(); + VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw); + inline qint64 getId() const {return id;} + inline void setId(const qint64 &value) {id = value;} + inline Tool::Tools getTypeTool() const {return typeTool;} + inline void setTypeTool(const Tool::Tools &value) {typeTool = value;} + inline QString getNameDraw() const {return nameDraw;} + inline void setNameDraw(const QString &value) {nameDraw = value;} private: - qint64 id; - Tool::Tools typeTool; - QString nameDraw; + qint64 id; + Tool::Tools typeTool; + QString nameDraw; }; #endif // VTOOLRECORD_H From 3b908ae3285bbc7ec20ca4d1f8d8534f2d3ff507 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 10:10:39 +0200 Subject: [PATCH 57/70] Refactoring. --HG-- branch : develop --- widgets/doubledelegate.cpp | 63 +++++++++++++---------------- widgets/doubledelegate.h | 21 +++------- widgets/vapplication.cpp | 6 --- widgets/vapplication.h | 7 ++-- widgets/vcontrolpointspline.cpp | 4 -- widgets/vcontrolpointspline.h | 39 +++++++++--------- widgets/vgraphicssimpletextitem.cpp | 3 -- widgets/vitem.cpp | 14 ------- widgets/vitem.h | 20 ++++----- widgets/vmaingraphicsscene.cpp | 24 ----------- widgets/vmaingraphicsscene.h | 44 +++++++++----------- widgets/vmaingraphicsview.cpp | 4 -- widgets/vtablegraphicsview.cpp | 17 -------- widgets/vtablegraphicsview.h | 30 +++++++------- 14 files changed, 98 insertions(+), 198 deletions(-) diff --git a/widgets/doubledelegate.cpp b/widgets/doubledelegate.cpp index c1f5ba564..612f38b5a 100644 --- a/widgets/doubledelegate.cpp +++ b/widgets/doubledelegate.cpp @@ -45,40 +45,35 @@ using a spin box widget. */ -#include #include "doubledelegate.h" - DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(QObject *parent) - : QItemDelegate(parent) - { - } - - QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, - const QModelIndex &/* index */) const{ - QDoubleSpinBox *editor = new QDoubleSpinBox(parent); - editor->setMinimum(-10000.0); - editor->setMaximum(10000.0); - - return editor; - } - - void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const{ - qreal value = index.model()->data(index, Qt::EditRole).toDouble(); - - QDoubleSpinBox *spinBox = static_cast(editor); - spinBox->setValue(value); - } - - void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const{ - QDoubleSpinBox *spinBox = static_cast(editor); - spinBox->interpretText(); - qreal value = spinBox->value(); - - model->setData(index, value, Qt::EditRole); - } - - void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, const QModelIndex &/* index */) const{ - editor->setGeometry(option.rect); +QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index ) const{ + Q_UNUSED(option); + Q_UNUSED(index); + QDoubleSpinBox *editor = new QDoubleSpinBox(parent); + editor->setMinimum(-10000.0); + editor->setMaximum(10000.0); + return editor; +} + +void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const{ + qreal value = index.model()->data(index, Qt::EditRole).toDouble(); + + QDoubleSpinBox *spinBox = static_cast(editor); + spinBox->setValue(value); +} + +void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const{ + QDoubleSpinBox *spinBox = static_cast(editor); + spinBox->interpretText(); + qreal value = spinBox->value(); + + model->setData(index, value, Qt::EditRole); +} + +void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, + const QModelIndex &index) const{ + Q_UNUSED(index) + editor->setGeometry(option.rect); } diff --git a/widgets/doubledelegate.h b/widgets/doubledelegate.h index a86b54f63..a4c7a536e 100644 --- a/widgets/doubledelegate.h +++ b/widgets/doubledelegate.h @@ -42,26 +42,15 @@ #define DOUBLEDELEGATE_H #include -#include -#include -#include -#include class DoubleSpinBoxDelegate : public QItemDelegate{ Q_OBJECT - public: - DoubleSpinBoxDelegate(QObject *parent = 0); - - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - - void setEditorData(QWidget *editor, const QModelIndex &index) const; - void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const; - - void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + DoubleSpinBoxDelegate(QObject *parent = 0): QItemDelegate(parent){} + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; + void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; #endif diff --git a/widgets/vapplication.cpp b/widgets/vapplication.cpp index c522e8636..e78345d00 100644 --- a/widgets/vapplication.cpp +++ b/widgets/vapplication.cpp @@ -20,18 +20,12 @@ ****************************************************************************/ #include "vapplication.h" -#include -#include #include "exception/vexceptionobjecterror.h" #include "exception/vexceptionbadid.h" #include "exception/vexceptionconversionerror.h" #include "exception/vexceptionemptyparameter.h" #include "exception/vexceptionwrongparameterid.h" -VApplication::VApplication(int & argc, char ** argv) : - QApplication(argc, argv){ -} - // reimplemented from QApplication so we can throw exceptions in slots bool VApplication::notify(QObject *receiver, QEvent *event){ try { diff --git a/widgets/vapplication.h b/widgets/vapplication.h index 80d3f516c..3192cb658 100644 --- a/widgets/vapplication.h +++ b/widgets/vapplication.h @@ -3,12 +3,11 @@ #include -class VApplication : public QApplication -{ +class VApplication : public QApplication{ Q_OBJECT public: - VApplication(int &argc, char ** argv); - virtual ~VApplication() { } + VApplication(int &argc, char ** argv): QApplication(argc, argv){} + virtual ~VApplication() {} virtual bool notify(QObject * receiver, QEvent * event); }; diff --git a/widgets/vcontrolpointspline.cpp b/widgets/vcontrolpointspline.cpp index fceaac561..8daf75079 100644 --- a/widgets/vcontrolpointspline.cpp +++ b/widgets/vcontrolpointspline.cpp @@ -20,10 +20,6 @@ ****************************************************************************/ #include "vcontrolpointspline.h" -#include -#include -#include -#include VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint, diff --git a/widgets/vcontrolpointspline.h b/widgets/vcontrolpointspline.h index 231f8220a..977d246e0 100644 --- a/widgets/vcontrolpointspline.h +++ b/widgets/vcontrolpointspline.h @@ -23,38 +23,35 @@ #define VCONTROLPOINTSPLINE_H #include -#include #include #include "geometry/vsplinepath.h" -class VControlPointSpline : public QObject, public QGraphicsEllipseItem -{ +class VControlPointSpline : public QObject, public QGraphicsEllipseItem{ Q_OBJECT public: - VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &controlPoint, const QPointF &splinePoint, - QGraphicsItem * parent = 0); + VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, + const QPointF &controlPoint, const QPointF &splinePoint, + QGraphicsItem * parent = 0); signals: - void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, - const QPointF pos); + void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, + const QPointF pos); public slots: - void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, - const QPointF &controlPoint, const QPointF &splinePoint); - void setEnabledPoint(bool enable); + void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, + const QPointF &splinePoint); + void setEnabledPoint(bool enable); protected: - qreal radius; - QGraphicsLineItem *controlLine; - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); + qreal radius; + QGraphicsLineItem *controlLine; + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); private: Q_DISABLE_COPY(VControlPointSpline) - qint32 indexSpline; + qint32 indexSpline; SplinePoint::Position position; - qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, - QPointF &p2) const; - QPointF ClosestPoint(QLineF line, QPointF p) const; - QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k) const; + qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2) const; + QPointF ClosestPoint(QLineF line, QPointF p) const; + QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k) const; }; diff --git a/widgets/vgraphicssimpletextitem.cpp b/widgets/vgraphicssimpletextitem.cpp index 6522aa093..d0b9bb3f7 100644 --- a/widgets/vgraphicssimpletextitem.cpp +++ b/widgets/vgraphicssimpletextitem.cpp @@ -20,9 +20,6 @@ ****************************************************************************/ #include "vgraphicssimpletextitem.h" -#include -#include -#include VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent), fontSize(0){ diff --git a/widgets/vitem.cpp b/widgets/vitem.cpp index 917bd26ae..4f4b58f4a 100644 --- a/widgets/vitem.cpp +++ b/widgets/vitem.cpp @@ -20,16 +20,6 @@ ****************************************************************************/ #include "vitem.h" -#include -#include -#include "options.h" - -VItem::VItem():numInOutList(0){ -} - -VItem::VItem ( int numInList, QGraphicsItem * parent ):QGraphicsPathItem ( parent ), - numInOutList(numInList){ -} VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ): QGraphicsPathItem ( path, parent ), numInOutList(numInList){ @@ -77,7 +67,3 @@ QVariant VItem::itemChange( GraphicsItemChange change, const QVariant &value ){ void VItem::LengthChanged(){ checkItemChange(); } - -void VItem::SetIndexInList( qint32 index ){ - numInOutList = index; -} diff --git a/widgets/vitem.h b/widgets/vitem.h index 1b8e9e12b..7317bb315 100644 --- a/widgets/vitem.h +++ b/widgets/vitem.h @@ -35,14 +35,14 @@ public: * @brief VItem конструктор за замовчуванням *Конструктор генерує пусту деталь з номером в списку, що дорівнює 0. */ - VItem (); + VItem ():numInOutList(0){} /** * @brief VItem конструктор * @param numInList номер в списку деталей, що передається у вікно де *укладаються деталі. * @param parent батьківський об'єкт на сцені для даного. За замовчуванням немає. */ - VItem (int numInList, QGraphicsItem * parent = 0); + VItem (int numInList, QGraphicsItem * parent = 0):QGraphicsPathItem (parent), numInOutList(numInList){} /** * @brief VItem конструктор * @param path зображення що буде показуватися на сцені - об’єкт класу QPainterPath. @@ -50,22 +50,22 @@ public: *укладаються деталі. * @param parent батьківський об'єкт на сцені для даного. За замовчуванням немає. */ - VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = 0 ); + VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = 0 ); /** * @brief Rotate повертає об'єкт на кут в градусах * @param angle кут в градусах на який повертається деталь. */ - void Rotate ( qreal angle ); + void Rotate ( qreal angle ); public slots: /** * @brief LengthChanged слот який обробляє сигнал зміни довжини листа. */ - void LengthChanged(); + void LengthChanged(); /** * @brief SetIndexInList встановлює номер деталі в списку деталей. * @param index номер в списку. */ - void SetIndexInList( qint32 index ); + inline void SetIndexInList( qint32 index ) {numInOutList = index;} protected: /** * @brief itemChange модифікація стандартного методу itemChange. Виконується перехоплення зміни @@ -74,12 +74,12 @@ protected: * @param value * @return */ - QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); + QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); /** * @brief checkItemChange перевіряє вихід деталі за рамки листа і факт колізії. Посилає відповідні *сигнали. */ - void checkItemChange (); + void checkItemChange (); private: /** * @brief numInOutList для зберігання інформації про колізії від кожної деталі необхідно знати її @@ -92,13 +92,13 @@ signals: * @param numInOutList номер деталі яка вийшла за межі листа або тепер знаходиться в межах листа. * @param flag був вихід чи ні. */ - void itemOut ( int numInOutList, bool flag ); + void itemOut ( int numInOutList, bool flag ); /** * @brief itemColliding сигнал колізії деталі з іншими. Посилається як для додавання деталі до *списку тих що перетинаються, так і для виключення його з такого. * @param list список усіх деталей які приймають участь в колізії включаючи самого себе. * @param number 1 - перетин є, 0 - перетину немає. */ - void itemColliding ( QList list, int number ); + void itemColliding ( QList list, int number ); }; #endif // VITEM_H diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp index 3f9e932b0..d81f3c53e 100644 --- a/widgets/vmaingraphicsscene.cpp +++ b/widgets/vmaingraphicsscene.cpp @@ -20,10 +20,6 @@ ****************************************************************************/ #include "vmaingraphicsscene.h" -#include -#include -#include -#include VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1){ } @@ -46,27 +42,7 @@ void VMainGraphicsScene::ChoosedItem(qint64 id, Scene::Scenes type){ emit ChoosedObject(id, type); } -void VMainGraphicsScene::RemoveTool(QGraphicsItem *tool){ - this->removeItem(tool); -} - void VMainGraphicsScene::SetFactor(qreal factor){ scaleFactor=scaleFactor*factor; emit NewFactor(scaleFactor); } - -qint32 VMainGraphicsScene::getVerScrollBar() const{ - return verScrollBar; -} - -void VMainGraphicsScene::setVerScrollBar(const qint32 &value){ - verScrollBar = value; -} - -qint32 VMainGraphicsScene::getHorScrollBar() const{ - return horScrollBar; -} - -void VMainGraphicsScene::setHorScrollBar(const qint32 &value){ - horScrollBar = value; -} diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h index 5acf6d555..ecf28a06d 100644 --- a/widgets/vmaingraphicsscene.h +++ b/widgets/vmaingraphicsscene.h @@ -23,38 +23,32 @@ #define VMAINGRAPHICSSCENE_H #include -#include -#include -#include "options.h" -class VMainGraphicsScene : public QGraphicsScene -{ +class VMainGraphicsScene : public QGraphicsScene{ Q_OBJECT public: - VMainGraphicsScene(); - VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0); - qint32 getHorScrollBar() const; - void setHorScrollBar(const qint32 &value); - - qint32 getVerScrollBar() const; - void setVerScrollBar(const qint32 &value); - + VMainGraphicsScene(); + VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0); + inline qint32 getHorScrollBar() const {return horScrollBar;} + inline void setHorScrollBar(const qint32 &value) {horScrollBar = value;} + inline qint32 getVerScrollBar() const {return verScrollBar;} + inline void setVerScrollBar(const qint32 &value) {verScrollBar = value;} public slots: - void ChoosedItem(qint64 id, Scene::Scenes type); - void RemoveTool(QGraphicsItem *tool); - void SetFactor(qreal factor); + void ChoosedItem(qint64 id, Scene::Scenes type); + inline void RemoveTool(QGraphicsItem *tool) {this->removeItem(tool);} + void SetFactor(qreal factor); protected: - void mouseMoveEvent(QGraphicsSceneMouseEvent* event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent* event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); signals: - void mouseMove(QPointF scenePos); - void mousePress(QPointF scenePos); - void ChoosedObject(qint64 id, Scene::Scenes type); - void NewFactor(qreal factor); + void mouseMove(QPointF scenePos); + void mousePress(QPointF scenePos); + void ChoosedObject(qint64 id, Scene::Scenes type); + void NewFactor(qreal factor); private: - qint32 horScrollBar; - qint32 verScrollBar; - qreal scaleFactor; + qint32 horScrollBar; + qint32 verScrollBar; + qreal scaleFactor; }; #endif // VMAINGRAPHICSSCENE_H diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index 7c3e78be1..6de8dc1b6 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -20,10 +20,6 @@ ****************************************************************************/ #include "vmaingraphicsview.h" -#include -#include -#include -#include VMainGraphicsView::VMainGraphicsView(QWidget *parent) : QGraphicsView(parent), _numScheduledScalings(0){ diff --git a/widgets/vtablegraphicsview.cpp b/widgets/vtablegraphicsview.cpp index ce5cd7548..0fa974bda 100644 --- a/widgets/vtablegraphicsview.cpp +++ b/widgets/vtablegraphicsview.cpp @@ -20,11 +20,6 @@ ****************************************************************************/ #include "vtablegraphicsview.h" -#include -#include -#include -#include -#include VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent) : QGraphicsView(pScene, parent){ @@ -43,10 +38,6 @@ void VTableGraphicsView::selectionChanged(){ } } -void VTableGraphicsView::rotateItems(){ - rotateIt(); -} - void VTableGraphicsView::MirrorItem(){ QList list = scene()->selectedItems(); if(list.size()>0){ @@ -82,14 +73,6 @@ void VTableGraphicsView::MirrorItem(){ } } -void VTableGraphicsView::ZoomIn(){ - scale(1.1,1.1); -} - -void VTableGraphicsView::ZoomOut(){ - scale(1/1.1,1/1.1); -} - void VTableGraphicsView::wheelEvent(QWheelEvent *event){ if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier){ // Если нажата клавиша CTRL этот код выполнится diff --git a/widgets/vtablegraphicsview.h b/widgets/vtablegraphicsview.h index ef86ebeff..d1f2363a2 100644 --- a/widgets/vtablegraphicsview.h +++ b/widgets/vtablegraphicsview.h @@ -24,70 +24,68 @@ #include -class VTableGraphicsView : public QGraphicsView -{ +class VTableGraphicsView : public QGraphicsView{ Q_OBJECT public: enum typeMove_e { Left, Right, Up, Down }; - explicit VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0); - + VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0); signals: /** * @brief itemChect Сигнал, що посилається коли змінюється стан вибору деталі. * @param flag Зберігає стан вибору деталі: false - знайдено, true - не знайдено. */ - void itemChect( bool flag ); + void itemChect( bool flag ); public slots: /** * @brief selectionChanged Слот виконується при зміні стану вибору деталей. */ - void selectionChanged(); + void selectionChanged(); /** * @brief rotateItems слот, який виконується при натисненні кнопки повороту деталі. */ - void rotateItems(); + inline void rotateItems() {rotateIt();} /** * @brief MirrorItem дзеркалить об'єкт відносно вертикальної вісі семетрії об'єкта. */ - void MirrorItem(); + void MirrorItem(); /** * @brief ZoomIn збільшує масштаб листа. */ - void ZoomIn(); + inline void ZoomIn() {scale(1.1,1.1);} /** * @brief ZoomOut зменшує масштаб листа. */ - void ZoomOut(); + inline void ZoomOut() {scale(1/1.1,1/1.1);} protected: /** * @brief wheelEvent обробник повороту колеса мишки. * @param event передається подія. */ - void wheelEvent ( QWheelEvent * event ); + void wheelEvent ( QWheelEvent * event ); /** * @brief mousePressEvent обробник натиснення кнопки миші. * @param mousePress передається подія. */ - void mousePressEvent(QMouseEvent *mousePress); + void mousePressEvent(QMouseEvent *mousePress); /** * @brief mouseReleaseEvent обробник відпускання кнопки миші. * @param event передається подія */ - void mouseReleaseEvent ( QMouseEvent * event ); + void mouseReleaseEvent ( QMouseEvent * event ); /** * @brief keyPressEvent обробник натиснення клавіші. * @param event передається подія. */ - void keyPressEvent ( QKeyEvent * event ); + void keyPressEvent ( QKeyEvent * event ); /** * @brief rotateIt виконує поворот вибраних деталей на 180 градусів. */ - void rotateIt(); + void rotateIt(); /** * @brief MoveItem переміщує виділені об'єкти сцени. * @param move напрямок переміщення. */ - void MoveItem( VTableGraphicsView::typeMove_e move ); + void MoveItem( VTableGraphicsView::typeMove_e move ); }; From 61be0a0a9357b7cae95fbe6bc36161d5abfced8c Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 12:22:44 +0200 Subject: [PATCH 58/70] Refactoring. --HG-- branch : develop --- container/calculator.cpp | 1 - container/calculator.h | 44 +++--- container/vcontainer.cpp | 264 ++++++------------------------- container/vcontainer.h | 232 ++++++++++++++------------- container/vincrementtablerow.cpp | 38 ----- container/vincrementtablerow.h | 38 +++-- container/vpointf.h | 4 - container/vstandarttablecell.cpp | 16 -- container/vstandarttablecell.h | 22 ++- geometry/varc.h | 30 ++-- 10 files changed, 228 insertions(+), 461 deletions(-) diff --git a/container/calculator.cpp b/container/calculator.cpp index d161724bb..fb9642d57 100644 --- a/container/calculator.cpp +++ b/container/calculator.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "calculator.h" -#include #define DELIMITER 1 #define VARIABLE 2 diff --git a/container/calculator.h b/container/calculator.h index ad16c7f65..d8b3f518b 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -22,50 +22,48 @@ #ifndef CALCULATOR_H #define CALCULATOR_H -#include #include "vcontainer.h" /** * @brief The Calculator клас калькулятора формул лекал. Виконує розрахунок формул з підставлянням * значеннь зміних. */ -class Calculator -{ +class Calculator{ public: /** * @brief Calculator конструктор класу. Використовується при розрахунку лекала. * @param data покажчик на контейнер змінних */ - explicit Calculator(const VContainer *data); + explicit Calculator(const VContainer *data); /** * @brief eval виконує розрахунок формули. * @param prog рядко в якому зберігається формула. * @return значення формули. */ - qreal eval(QString prog, QString *errorMsg); + qreal eval(QString prog, QString *errorMsg); private: Q_DISABLE_COPY(Calculator) - QString *errorMsg; + QString *errorMsg; /** * @brief token теперішня лексема. */ - QString token; + QString token; /** * @brief tok внутрішне представлення лексеми. */ - qint32 tok; + qint32 tok; /** * @brief token_type тип лексеми. */ - qint32 token_type; + qint32 token_type; /** * @brief prog рядок в якому зберігається формула. */ - QString prog; /* Содержит анализируемое выражение */ + QString prog; /* Содержит анализируемое выражение */ /** * @brief index номер символу в рядку формули. */ - qint32 index; /* Индекс символа в строке*/ + qint32 index; /* Индекс символа в строке*/ /** * @brief data контейнер усіх змінних. */ @@ -73,16 +71,16 @@ private: /** * @brief debugFormula рядок розшифрованої формули. */ - QString debugFormula; + QString debugFormula; /** * @brief get_exp виконує розрахунок формули. * @return значення формули. */ - qreal get_exp(); + qreal get_exp(); /** * @brief get_token повертає наступну лексему. */ - void get_token();/* Получить лексему */ + void get_token();/* Получить лексему */ /** * @brief StrChr перевіряє чи символ належить рядку. * @param string рядок @@ -93,37 +91,37 @@ private: /** * @brief putback повертає зчитану лексему назад у потік. */ - void putback(); + void putback(); /** * @brief level2 метод додавання і віднімання двух термів. * @param result результат операції. */ - void level2(qreal *result); + void level2(qreal *result); /** * @brief level3 метод множення, ділення, знаходження процентів. * @param result результат операції. */ - void level3(qreal *result); + void level3(qreal *result); /** * @brief level4 метод знаходження степені двох чисел. * @param result результат операції. */ - void level4(qreal *result); + void level4(qreal *result); /** * @brief level5 метод знаходження унарного плюса чи мінуса. * @param result результат операції. */ - void level5(qreal *result); + void level5(qreal *result); /** * @brief level6 метод обробки виразу в круглих лапках. * @param result результат операції. */ - void level6(qreal *result); + void level6(qreal *result); /** * @brief primitive метод визначення значення зміної по її імені. * @param result результат операції. */ - void primitive(qreal *result); + void primitive(qreal *result); /** * @brief arith виконання специфікованої арифметики. Результат записується в перший елемент. * @param o знак операції. @@ -142,8 +140,8 @@ private: * @param s ім'я змінної. * @return значення зміної. */ - qreal find_var(QString s); - void serror(qint32 error); + qreal find_var(QString s); + void serror(qint32 error); /** * @brief look_up пошук відповідного внутрішнього формату для теперішньої лексеми в таблиці лексем. текущей лексемы в таблице лексем * @param s ім'я лексеми. diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index d53da37d5..a951bb167 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -20,8 +20,6 @@ ****************************************************************************/ #include "vcontainer.h" -#include -#include "options.h" #include qint64 VContainer::_id = 0; @@ -85,14 +83,6 @@ val VContainer::GetObject(const QHash &obj, key id){ } } -VPointF VContainer::GetPoint(qint64 id) const{ - return GetObject(points, id); -} - -VPointF VContainer::GetModelingPoint(qint64 id) const{ - return GetObject(modelingPoints, id); -} - VStandartTableCell VContainer::GetStandartTableCell(const QString &name) const{ Q_ASSERT(!name.isEmpty()); return GetObject(standartTable, name); @@ -123,44 +113,16 @@ qreal VContainer::GetLineAngle(const QString &name) const{ return GetObject(lineAngles, name); } -VSpline VContainer::GetSpline(qint64 id) const{ - return GetObject(splines, id); +qint64 VContainer::AddPoint(const VPointF &point){ + return AddObject(points, point); } -VSpline VContainer::GetModelingSpline(qint64 id) const{ - return GetObject(modelingSplines, id); +qint64 VContainer::AddModelingPoint(const VPointF &point){ +return AddObject(modelingPoints, point); } -VArc VContainer::GetArc(qint64 id) const{ - return GetObject(arcs, id); -} - -VArc VContainer::GetModelingArc(qint64 id) const{ - return GetObject(modelingArcs, id); -} - -VSplinePath VContainer::GetSplinePath(qint64 id) const{ - return GetObject(splinePaths, id); -} - -VSplinePath VContainer::GetModelingSplinePath(qint64 id) const{ - return GetObject(modelingSplinePaths, id); -} - -VDetail VContainer::GetDetail(qint64 id) const{ - return GetObject(details, id); -} - -void VContainer::AddStandartTableCell(const QString& name, const VStandartTableCell& cell){ - standartTable[name] = cell; -} - -void VContainer::AddIncrementTableRow(const QString& name, const VIncrementTableRow& cell){ - incrementTable[name] = cell; -} - -qint64 VContainer::getId(){ - return _id; +qint64 VContainer::AddDetail(const VDetail &detail){ + return AddObject(details, detail); } qint64 VContainer::getNextId(){ @@ -444,10 +406,6 @@ void VContainer::PrepareDetails(QVector &list) const{ } } -void VContainer::RemoveIncrementTableRow(const QString& name){ - incrementTable.remove(name); -} - template void VContainer::UpdateObject(QHash &obj, const qint64 &id, const val& point){ Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); @@ -455,50 +413,6 @@ void VContainer::UpdateObject(QHash &obj, const qint64 &id, const v UpdateId(id); } -void VContainer::UpdatePoint(qint64 id, const VPointF& point){ - UpdateObject(points, id, point); -} - -void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){ - UpdateObject(modelingPoints, id, point); -} - -void VContainer::UpdateDetail(qint64 id, const VDetail &detail){ - UpdateObject(details, id, detail); -} - -void VContainer::UpdateSpline(qint64 id, const VSpline &spl){ - UpdateObject(splines, id, spl); -} - -void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){ - UpdateObject(modelingSplines, id, spl); -} - -void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){ - UpdateObject(splinePaths, id, splPath); -} - -void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){ - UpdateObject(modelingSplinePaths, id, splPath); -} - -void VContainer::UpdateArc(qint64 id, const VArc &arc){ - UpdateObject(arcs, id, arc); -} - -void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){ - UpdateObject(modelingArcs, id, arc); -} - -void VContainer::UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell){ - standartTable[name] = cell; -} - -void VContainer::UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell){ - incrementTable[name] = cell; -} - void VContainer::AddLengthSpline(const QString &name, const qreal &value){ Q_ASSERT(!name.isEmpty()); lengthSplines[name] = value; @@ -557,46 +471,6 @@ void VContainer::ClearObject(){ splinePaths.clear(); } -void VContainer::ClearIncrementTable(){ - incrementTable.clear(); -} - -void VContainer::ClearLengthLines(){ - lengthLines.clear(); -} - -void VContainer::ClearLengthSplines(){ - lengthSplines.clear(); -} - -void VContainer::ClearLengthArcs(){ - lengthArcs.clear(); -} - -void VContainer::ClearLineAngles(){ - lineAngles.clear(); -} - -void VContainer::SetSize(qint32 size){ - base["Сг"] = size; -} - -void VContainer::SetGrowth(qint32 growth){ - base["Р"] = growth; -} - -qint32 VContainer::size() const{ - return base.value("Сг"); -} - -qint32 VContainer::growth() const{ - return base.value("Р"); -} - -bool VContainer::IncrementTableContains(const QString& name){ - return incrementTable.contains(name); -} - qreal VContainer::FindVar(const QString &name, bool *ok)const{ if(base.contains(name)){ *ok = true; @@ -631,70 +505,6 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const{ return 0; } -const QHash *VContainer::DataPoints() const{ - return &points; -} - -const QHash *VContainer::DataModelingPoints() const{ - return &modelingPoints; -} - -const QHash *VContainer::DataSplines() const{ - return &splines; -} - -const QHash *VContainer::DataModelingSplines() const{ - return &modelingSplines; -} - -const QHash *VContainer::DataArcs() const{ - return &arcs; -} - -const QHash *VContainer::DataModelingArcs() const{ - return &modelingArcs; -} - -const QHash *VContainer::DataBase() const{ - return &base; -} - -const QHash *VContainer::DataStandartTable() const{ - return &standartTable; -} - -const QHash *VContainer::DataIncrementTable() const{ - return &incrementTable; -} - -const QHash *VContainer::DataLengthLines() const{ - return &lengthLines; -} - -const QHash *VContainer::DataLengthSplines() const{ - return &lengthSplines; -} - -const QHash *VContainer::DataLengthArcs() const{ - return &lengthArcs; -} - -const QHash *VContainer::DataLineAngles() const{ - return &lineAngles; -} - -const QHash *VContainer::DataSplinePaths() const{ - return &splinePaths; -} - -const QHash *VContainer::DataModelingSplinePaths() const{ - return &modelingSplinePaths; -} - -const QHash *VContainer::DataDetails() const{ - return &details; -} - void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){ QString nameLine = GetNameLine(firstPointId, secondPointId, mode); VPointF first; @@ -711,25 +521,6 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle()); } -template -qint64 VContainer::AddObject(QHash &obj, const val& value){ - qint64 id = getNextId(); - obj[id] = value; - return id; -} - -qint64 VContainer::AddPoint(const VPointF& point){ - return AddObject(points, point); -} - -qint64 VContainer::AddModelingPoint(const VPointF &point){ - return AddObject(modelingPoints, point); -} - -qint64 VContainer::AddDetail(const VDetail &detail){ - return AddObject(details, detail); -} - qint64 VContainer::AddSpline(const VSpline &spl){ return AddObject(splines, spl); } @@ -754,6 +545,13 @@ qint64 VContainer::AddModelingArc(const VArc &arc){ return AddObject(modelingArcs, arc); } +template +qint64 VContainer::AddObject(QHash &obj, const val& value){ + qint64 id = getNextId(); + obj[id] = value; + return id; +} + QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode) const{ VPointF first; VPointF second; @@ -827,6 +625,42 @@ QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id, Draw::Dra return QString ("Arc_%1_%2").arg(centerPoint.name()).arg(id); } +void VContainer::UpdatePoint(qint64 id, const VPointF &point){ + UpdateObject(points, id, point); +} + +void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){ + UpdateObject(modelingPoints, id, point); +} + +void VContainer::UpdateDetail(qint64 id, const VDetail &detail){ + UpdateObject(details, id, detail); +} + +void VContainer::UpdateSpline(qint64 id, const VSpline &spl){ + UpdateObject(splines, id, spl); +} + +void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){ + UpdateObject(modelingSplines, id, spl); +} + +void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){ + UpdateObject(splinePaths, id, splPath); +} + +void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){ + UpdateObject(modelingSplinePaths, id, splPath); +} + +void VContainer::UpdateArc(qint64 id, const VArc &arc){ + UpdateObject(arcs, id, arc); +} + +void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){ + UpdateObject(modelingArcs, id, arc); +} + void VContainer::AddLengthLine(const QString &name, const qreal &value){ Q_ASSERT(!name.isEmpty()); lengthLines[name] = value; diff --git a/container/vcontainer.h b/container/vcontainer.h index 4dee1c149..dbd9c82b6 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -22,157 +22,155 @@ #ifndef VCONTAINER_H #define VCONTAINER_H -#include #include "vstandarttablecell.h" #include "vincrementtablerow.h" #include "geometry/varc.h" #include "geometry/vsplinepath.h" #include "geometry/vdetail.h" #include "widgets/vitem.h" -#include /** * @brief The VContainer class */ -class VContainer -{ +class VContainer{ Q_DECLARE_TR_FUNCTIONS(VContainer) public: /** * @brief VContainer */ - VContainer(); - VContainer &operator=(const VContainer &data); - VContainer(const VContainer &data); - void setData(const VContainer &data); + VContainer(); + VContainer &operator=(const VContainer &data); + VContainer(const VContainer &data); + void setData(const VContainer &data); /** * @brief GetPoint * @param id * @return */ - VPointF GetPoint(qint64 id) const; - VPointF GetModelingPoint(qint64 id) const; - VStandartTableCell GetStandartTableCell(const QString& name) const; - VIncrementTableRow GetIncrementTableRow(const QString& name) const; - qreal GetLine(const QString &name) const; - qreal GetLengthArc(const QString &name) const; - qreal GetLengthSpline(const QString &name) const; - qreal GetLineAngle(const QString &name) const; - VSpline GetSpline(qint64 id) const; - VSpline GetModelingSpline(qint64 id) const; - VArc GetArc(qint64 id) const; - VArc GetModelingArc(qint64 id) const; - VSplinePath GetSplinePath(qint64 id) const; - VSplinePath GetModelingSplinePath(qint64 id) const; - VDetail GetDetail(qint64 id) const; - static qint64 getId(); - qint64 AddPoint(const VPointF& point); - qint64 AddModelingPoint(const VPointF& point); - qint64 AddDetail(const VDetail& detail); - void AddStandartTableCell(const QString& name, const VStandartTableCell& cell); - void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell); - void AddLengthLine(const QString &name, const qreal &value); - void AddLengthSpline(const QString &name, const qreal &value); - void AddLengthArc(const qint64 ¢er, const qint64 &id); - void AddLengthArc(const QString &name, const qreal &value); - void AddLineAngle(const QString &name, const qreal &value); - void AddLine(const qint64 &firstPointId, const qint64 &secondPointId, - Draw::Draws mode = Draw::Calculation); - qint64 AddSpline(const VSpline& spl); - qint64 AddModelingSpline(const VSpline& spl); - qint64 AddSplinePath(const VSplinePath& splPath); - qint64 AddModelingSplinePath(const VSplinePath& splPath); - qint64 AddArc(const VArc& arc); - qint64 AddModelingArc(const VArc& arc); - QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Draws mode = Draw::Calculation) const; - QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Draws mode = Draw::Calculation) const; - QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint, - Draw::Draws mode = Draw::Calculation) const; - QString GetNameSplinePath(const VSplinePath &path, - Draw::Draws mode = Draw::Calculation) const; - QString GetNameArc(const qint64 ¢er, const qint64 &id, + inline VPointF GetPoint(qint64 id) const {return GetObject(points, id);} + inline VPointF GetModelingPoint(qint64 id) const {return GetObject(modelingPoints, id);} + VStandartTableCell GetStandartTableCell(const QString& name) const; + VIncrementTableRow GetIncrementTableRow(const QString& name) const; + qreal GetLine(const QString &name) const; + qreal GetLengthArc(const QString &name) const; + qreal GetLengthSpline(const QString &name) const; + qreal GetLineAngle(const QString &name) const; + inline VSpline GetSpline(qint64 id) const {return GetObject(splines, id);} + inline VSpline GetModelingSpline(qint64 id) const {return GetObject(modelingSplines, id);} + inline VArc GetArc(qint64 id) const {return GetObject(arcs, id);} + inline VArc GetModelingArc(qint64 id) const {return GetObject(modelingArcs, id);} + inline VSplinePath GetSplinePath(qint64 id) const {return GetObject(splinePaths, id);} + inline VSplinePath GetModelingSplinePath(qint64 id) const {return GetObject(modelingSplinePaths, id);} + inline VDetail GetDetail(qint64 id) const {return GetObject(details, id);} + static qint64 getId() {return _id;} + qint64 AddPoint(const VPointF& point); + qint64 AddModelingPoint(const VPointF& point); + qint64 AddDetail(const VDetail& detail); + inline void AddStandartTableCell(const QString& name, const VStandartTableCell& cell) + {standartTable[name] = cell;} + inline void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell) + {incrementTable[name] = cell;} + void AddLengthLine(const QString &name, const qreal &value); + void AddLengthSpline(const QString &name, const qreal &value); + void AddLengthArc(const qint64 ¢er, const qint64 &id); + void AddLengthArc(const QString &name, const qreal &value); + void AddLineAngle(const QString &name, const qreal &value); + void AddLine(const qint64 &firstPointId, const qint64 &secondPointId, + Draw::Draws mode = Draw::Calculation); + qint64 AddSpline(const VSpline& spl); + qint64 AddModelingSpline(const VSpline& spl); + qint64 AddSplinePath(const VSplinePath& splPath); + qint64 AddModelingSplinePath(const VSplinePath& splPath); + qint64 AddArc(const VArc& arc); + qint64 AddModelingArc(const VArc& arc); + QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode = Draw::Calculation) const; - void UpdatePoint(qint64 id, const VPointF& point); - void UpdateModelingPoint(qint64 id, const VPointF& point); - void UpdateDetail(qint64 id, const VDetail& detail); - void UpdateSpline(qint64 id, const VSpline& spl); - void UpdateModelingSpline(qint64 id, const VSpline& spl); - void UpdateSplinePath(qint64 id, const VSplinePath& splPath); - void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath); - void UpdateArc(qint64 id, const VArc& arc); - void UpdateModelingArc(qint64 id, const VArc& arc); - void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell); - void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell); - qreal GetValueStandartTableCell(const QString& name) const; - qreal GetValueIncrementTableRow(const QString& name) const; - void Clear(); - void ClearObject(); - void ClearIncrementTable(); - void ClearLengthLines(); - void ClearLengthSplines(); - void ClearLengthArcs(); - void ClearLineAngles(); - void SetSize(qint32 size); - void SetGrowth(qint32 growth); - qint32 size() const; - qint32 growth() const; - qreal FindVar(const QString& name, bool *ok)const; - bool IncrementTableContains(const QString& name); - static qint64 getNextId(); - void RemoveIncrementTableRow(const QString& name); - const QHash *DataPoints() const; - const QHash *DataModelingPoints() const; - const QHash *DataSplines() const; - const QHash *DataModelingSplines() const; - const QHash *DataArcs() const; - const QHash *DataModelingArcs() const; - const QHash *DataBase() const; - const QHash *DataStandartTable() const; - const QHash *DataIncrementTable() const; - const QHash *DataLengthLines() const; - const QHash *DataLengthSplines() const; - const QHash *DataLengthArcs() const; - const QHash *DataLineAngles() const; - const QHash *DataSplinePaths() const; - const QHash *DataModelingSplinePaths() const; - const QHash *DataDetails() const; - static void UpdateId(qint64 newId); - QPainterPath ContourPath(qint64 idDetail) const; - QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my) const; - QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, - const qreal &width)const; - static QLineF ParallelLine(const QLineF &line, qreal width ); - static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width); - QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const; - QVector CheckLoops(const QVector &points) const; - void PrepareDetails(QVector & list)const; + QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, + Draw::Draws mode = Draw::Calculation) const; + QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint, + Draw::Draws mode = Draw::Calculation) const; + QString GetNameSplinePath(const VSplinePath &path, + Draw::Draws mode = Draw::Calculation) const; + QString GetNameArc(const qint64 ¢er, const qint64 &id, Draw::Draws mode = Draw::Calculation) const; + void UpdatePoint(qint64 id, const VPointF& point); + void UpdateModelingPoint(qint64 id, const VPointF& point); + void UpdateDetail(qint64 id, const VDetail& detail); + void UpdateSpline(qint64 id, const VSpline& spl); + void UpdateModelingSpline(qint64 id, const VSpline& spl); + void UpdateSplinePath(qint64 id, const VSplinePath& splPath); + void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath); + void UpdateArc(qint64 id, const VArc& arc); + void UpdateModelingArc(qint64 id, const VArc& arc); + inline void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell) + {standartTable[name] = cell;} + inline void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell) + {incrementTable[name] = cell;} + qreal GetValueStandartTableCell(const QString& name) const; + qreal GetValueIncrementTableRow(const QString& name) const; + void Clear(); + void ClearObject(); + inline void ClearIncrementTable() {incrementTable.clear();} + inline void ClearLengthLines() {lengthLines.clear();} + inline void ClearLengthSplines() {lengthSplines.clear();} + inline void ClearLengthArcs() {lengthArcs.clear();} + inline void ClearLineAngles() {lineAngles.clear();} + inline void SetSize(qint32 size) {base["Сг"] = size;} + inline void SetGrowth(qint32 growth) {base["Р"] = growth;} + inline qint32 size() const {return base.value("Сг");} + inline qint32 growth() const {return base.value("Р");} + qreal FindVar(const QString& name, bool *ok)const; + inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);} + static qint64 getNextId(); + inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);} + inline const QHash *DataPoints() const {return &points;} + inline const QHash *DataModelingPoints() const {return &modelingPoints;} + inline const QHash *DataSplines() const {return &splines;} + inline const QHash *DataModelingSplines() const {return &modelingSplines;} + inline const QHash *DataArcs() const {return &arcs;} + inline const QHash *DataModelingArcs() const {return &modelingArcs;} + inline const QHash *DataBase() const {return &base;} + inline const QHash *DataStandartTable() const {return &standartTable;} + inline const QHash *DataIncrementTable() const {return &incrementTable;} + inline const QHash *DataLengthLines() const {return &lengthLines;} + inline const QHash *DataLengthSplines() const {return &lengthSplines;} + inline const QHash *DataLengthArcs() const {return &lengthArcs;} + inline const QHash *DataLineAngles() const {return &lineAngles;} + inline const QHash *DataSplinePaths() const {return &splinePaths;} + inline const QHash *DataModelingSplinePaths() const {return &modelingSplinePaths;} + inline const QHash *DataDetails() const {return &details;} + static void UpdateId(qint64 newId); + QPainterPath ContourPath(qint64 idDetail) const; + QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my) const; + QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width)const; + static QLineF ParallelLine(const QLineF &line, qreal width ); + static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width); + QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const; + QVector CheckLoops(const QVector &points) const; + void PrepareDetails(QVector & list) const; private: - static qint64 _id; + static qint64 _id; QHash base; QHash points; QHash modelingPoints; QHash standartTable; QHash incrementTable; - QHash lengthLines; - QHash lineAngles; + QHash lengthLines; + QHash lineAngles; QHash splines; QHash modelingSplines; - QHash lengthSplines; - QHash arcs; - QHash modelingArcs; - QHash lengthArcs; + QHash lengthSplines; + QHash arcs; + QHash modelingArcs; + QHash lengthArcs; QHash splinePaths; QHash modelingSplinePaths; QHash details; + void CreateManTableIGroup (); + QVector GetReversePoint(const QVector &points)const; + qreal GetLengthContour(const QVector &contour, const QVector &newPoints)const; template static val GetObject(const QHash &obj, key id); - template static void UpdateObject(QHash &obj, const qint64 &id, - const val& point); + template static void UpdateObject(QHash &obj, const qint64 &id, const val& point); template static qint64 AddObject(QHash &obj, const val& value); - void CreateManTableIGroup (); - QVector GetReversePoint(const QVector &points)const; - qreal GetLengthContour(const QVector &contour, const QVector &newPoints)const; }; #endif // VCONTAINER_H diff --git a/container/vincrementtablerow.cpp b/container/vincrementtablerow.cpp index 5240da150..f6ba763cc 100644 --- a/container/vincrementtablerow.cpp +++ b/container/vincrementtablerow.cpp @@ -29,42 +29,4 @@ VIncrementTableRow::VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth(kgrowth), description(description){ } -QString VIncrementTableRow::getDescription() const{ - return description; -} -void VIncrementTableRow::setDescription(const QString &value){ - description = value; -} - -qreal VIncrementTableRow::getKgrowth() const{ - return kgrowth; -} - -void VIncrementTableRow::setKgrowth(const qreal &value){ - kgrowth = value; -} - -qreal VIncrementTableRow::getKsize() const{ - return ksize; -} - -void VIncrementTableRow::setKsize(const qreal &value){ - ksize = value; -} - -qreal VIncrementTableRow::getBase() const{ - return base; -} - -void VIncrementTableRow::setBase(const qreal &value){ - base = value; -} - -qint64 VIncrementTableRow::getId() const{ - return id; -} - -void VIncrementTableRow::setId(const qint64 &value){ - id = value; -} diff --git a/container/vincrementtablerow.h b/container/vincrementtablerow.h index 7846f0441..592fe6140 100644 --- a/container/vincrementtablerow.h +++ b/container/vincrementtablerow.h @@ -22,29 +22,27 @@ #ifndef VINCREMENTTABLEROW_H #define VINCREMENTTABLEROW_H -#include - class VIncrementTableRow{ public: - VIncrementTableRow(); - VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, - QString description = QString()); - qint64 getId() const; - void setId(const qint64 &value); - qreal getBase() const; - void setBase(const qreal &value); - qreal getKsize() const; - void setKsize(const qreal &value); - qreal getKgrowth() const; - void setKgrowth(const qreal &value); - QString getDescription() const; - void setDescription(const QString &value); + VIncrementTableRow(); + VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, + QString description = QString()); + inline qint64 getId() const {return id;} + inline void setId(const qint64 &value) {id = value;} + inline qreal getBase() const {return base;} + inline void setBase(const qreal &value) {base = value;} + inline qreal getKsize() const {return ksize;} + inline void setKsize(const qreal &value) {ksize = value;} + inline qreal getKgrowth() const {return kgrowth;} + inline void setKgrowth(const qreal &value) {kgrowth = value;} + inline QString getDescription() const {return description;} + inline void setDescription(const QString &value) {description = value;} private: - qint64 id; - qreal base; - qreal ksize; - qreal kgrowth; - QString description; + qint64 id; + qreal base; + qreal ksize; + qreal kgrowth; + QString description; }; #endif // VINCREMENTTABLEROW_H diff --git a/container/vpointf.h b/container/vpointf.h index cfe7c8f1a..5282ed5fe 100644 --- a/container/vpointf.h +++ b/container/vpointf.h @@ -22,10 +22,6 @@ #ifndef VPOINTF_H #define VPOINTF_H -#include -#include -#include "options.h" - class VPointF{ public: inline VPointF () diff --git a/container/vstandarttablecell.cpp b/container/vstandarttablecell.cpp index 201aa4481..59ead8631 100644 --- a/container/vstandarttablecell.cpp +++ b/container/vstandarttablecell.cpp @@ -27,19 +27,3 @@ VStandartTableCell::VStandartTableCell():base(0), ksize(0), kgrowth(0), descript VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description):base(base), ksize(ksize), kgrowth(kgrowth), description(description){ } - -qint32 VStandartTableCell::GetBase() const{ - return base; -} - -qreal VStandartTableCell::GetKsize() const{ - return ksize; -} - -qreal VStandartTableCell::GetKgrowth() const{ - return kgrowth; -} - -QString VStandartTableCell::GetDescription() const{ - return description; -} diff --git a/container/vstandarttablecell.h b/container/vstandarttablecell.h index 536a63f8e..f94186b52 100644 --- a/container/vstandarttablecell.h +++ b/container/vstandarttablecell.h @@ -22,21 +22,19 @@ #ifndef VSTANDARTTABLECELL_H #define VSTANDARTTABLECELL_H -#include - class VStandartTableCell{ public: - VStandartTableCell(); - VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString()); - qint32 GetBase() const; - qreal GetKsize() const; - qreal GetKgrowth() const; - QString GetDescription() const; + VStandartTableCell(); + VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString()); + inline qint32 GetBase() const {return base;} + inline qreal GetKsize() const {return ksize;} + inline qreal GetKgrowth() const {return kgrowth;} + inline QString GetDescription() const {return description;} private: - qint32 base; - qreal ksize; - qreal kgrowth; - QString description; + qint32 base; + qreal ksize; + qreal kgrowth; + QString description; }; #endif // VSTANDARTTABLECELL_H diff --git a/geometry/varc.h b/geometry/varc.h index ac436da4b..964b68a52 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -33,7 +33,7 @@ public: /** * @brief VArc конструктор по замовчуванню. */ - VArc (); + VArc (); /** * @brief VArc конструктор. * @param center точка центру. @@ -41,11 +41,11 @@ public: * @param f1 початковий кут в градусах. * @param f2 кінцевий кут в градусах. */ - VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, - qreal f1, QString formulaF1, qreal f2 , QString formulaF2, - Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); - VArc(const VArc &arc); - VArc& operator= (const VArc &arc); + VArc (const QHash *points, qint64 center, qreal radius, QString formulaRadius, + qreal f1, QString formulaF1, qreal f2 , QString formulaF2, + Draw::Draws mode = Draw::Calculation, qint64 idObject = 0); + VArc(const VArc &arc); + VArc& operator= (const VArc &arc); /** * @brief GetF1 повертає початковий кут дуги. * @return повертає кут в градусах. @@ -103,25 +103,25 @@ private: /** * @brief f1 початковий кут в градусах */ - qreal f1; // початковий кут нахилу дуги (градуси) - QString formulaF1; + qreal f1; // початковий кут нахилу дуги (градуси) + QString formulaF1; /** * @brief f2 кінцевий кут в градусах */ - qreal f2; // кінцевий кут нахилу дуги (градуси) - QString formulaF2; + qreal f2; // кінцевий кут нахилу дуги (градуси) + QString formulaF2; /** * @brief radius радіус дуги. */ - qreal radius; - QString formulaRadius; + qreal radius; + QString formulaRadius; /** * @brief center центральна точка дуги. */ - qint64 center; + qint64 center; QHash points; - Draw::Draws mode; - qint64 idObject; + Draw::Draws mode; + qint64 idObject; }; #endif // VARC_H From 50cd9a7f201af0bca53eb08edeb4d76d3256ab37 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 13:56:05 +0200 Subject: [PATCH 59/70] Refactoring. --HG-- branch : develop --- mainwindow.cpp | 9 ---- mainwindow.h | 7 +-- tablewindow.cpp | 4 -- tablewindow.h | 1 - tools/drawTools/vdrawtool.cpp | 11 ---- tools/drawTools/vdrawtool.h | 7 ++- tools/drawTools/vtoolalongline.cpp | 2 - tools/drawTools/vtoolalongline.h | 27 +++++----- tools/drawTools/vtoolbisector.h | 17 +++---- tools/drawTools/vtoolendline.cpp | 2 - tools/drawTools/vtoolheight.h | 1 - tools/drawTools/vtoolline.cpp | 1 - tools/drawTools/vtoollineintersect.cpp | 1 - tools/drawTools/vtoollineintersect.h | 19 ++++--- tools/drawTools/vtoollinepoint.cpp | 4 -- tools/drawTools/vtoollinepoint.h | 8 +-- tools/drawTools/vtoolnormal.h | 3 +- tools/drawTools/vtoolpoint.cpp | 8 --- tools/drawTools/vtoolpoint.h | 5 +- tools/drawTools/vtoolpointofintersection.h | 11 ++-- tools/drawTools/vtoolshoulderpoint.cpp | 1 - tools/drawTools/vtoolshoulderpoint.h | 18 +++---- tools/drawTools/vtoolsinglepoint.cpp | 5 -- tools/drawTools/vtoolspline.h | 4 +- tools/drawTools/vtoolsplinepath.cpp | 1 - tools/drawTools/vtooltriangle.h | 41 ++++++++------- tools/modelingTools/vmodelingalongline.cpp | 2 - tools/modelingTools/vmodelingalongline.h | 34 ++++++------- tools/modelingTools/vmodelingarc.cpp | 1 - tools/modelingTools/vmodelingarc.h | 32 ++++++------ tools/modelingTools/vmodelingbisector.h | 10 ++-- tools/modelingTools/vmodelingendline.h | 30 +++++------ tools/modelingTools/vmodelingheight.h | 9 ++-- tools/modelingTools/vmodelingline.cpp | 1 - tools/modelingTools/vmodelingline.h | 33 ++++++------ tools/modelingTools/vmodelinglineintersect.h | 44 ++++++++-------- tools/modelingTools/vmodelinglinepoint.cpp | 4 -- tools/modelingTools/vmodelinglinepoint.h | 7 ++- tools/modelingTools/vmodelingnormal.cpp | 1 - tools/modelingTools/vmodelingnormal.h | 14 +++-- tools/modelingTools/vmodelingpoint.cpp | 7 --- tools/modelingTools/vmodelingpoint.h | 5 +- tools/modelingTools/vmodelingpointofcontact.h | 14 +++-- .../modelingTools/vmodelingshoulderpoint.cpp | 2 - tools/modelingTools/vmodelingshoulderpoint.h | 34 ++++++------- tools/modelingTools/vmodelingspline.cpp | 3 -- tools/modelingTools/vmodelingspline.h | 49 +++++++++--------- tools/modelingTools/vmodelingsplinepath.cpp | 1 - tools/modelingTools/vmodelingsplinepath.h | 47 ++++++++--------- tools/modelingTools/vmodelingtool.cpp | 10 ---- tools/modelingTools/vmodelingtool.h | 11 ++-- tools/modelingTools/vmodelingtriangle.h | 37 +++++++------- tools/nodeDetails/vabstractnode.h | 3 +- tools/nodeDetails/vnodearc.h | 3 +- tools/nodeDetails/vnodepoint.h | 33 ++++++------ tools/nodeDetails/vnodespline.h | 19 ++++--- tools/nodeDetails/vnodesplinepath.h | 10 ++-- tools/vabstracttool.cpp | 9 ---- tools/vabstracttool.h | 51 +++++++++---------- tools/vdatatool.cpp | 4 -- tools/vdatatool.h | 7 ++- tools/vtooldetail.cpp | 1 - 62 files changed, 325 insertions(+), 475 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 72b05ef32..30192b049 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -21,16 +21,7 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -#include -#include -#include -#include -#include -#include -#include -#include #include "geometry/vspline.h" -#include #include "exception/vexceptionobjecterror.h" #include "exception/vexceptionconversionerror.h" #include "exception/vexceptionemptyparameter.h" diff --git a/mainwindow.h b/mainwindow.h index fca2537a4..aac755e25 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -23,19 +23,14 @@ #define MAINWINDOW_H #include -#include -#include -#include -#include -#include #include "widgets/vmaingraphicsscene.h" #include "widgets/vmaingraphicsview.h" #include "widgets/vitem.h" #include "dialogs/dialogs.h" +#include "tools/vtooldetail.h" #include "tools/drawTools/drawtools.h" #include "tools/modelingTools/modelingtools.h" #include "xml/vdomdocument.h" -#include "tools/vtooldetail.h" namespace Ui { class MainWindow; diff --git a/tablewindow.cpp b/tablewindow.cpp index bf9c4d9a7..2e6960987 100644 --- a/tablewindow.cpp +++ b/tablewindow.cpp @@ -21,12 +21,8 @@ #include "tablewindow.h" #include "ui_tablewindow.h" -#include -#include #include "widgets/vtablegraphicsview.h" -#include #include "options.h" -#include TableWindow::TableWindow(QWidget *parent) : QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow), diff --git a/tablewindow.h b/tablewindow.h index a8604a8bf..5c257c379 100644 --- a/tablewindow.h +++ b/tablewindow.h @@ -23,7 +23,6 @@ #define TABLEWINDOW_H #include -#include #include "widgets/vitem.h" namespace Ui { diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index 0e622413b..7a4efffbf 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vdrawtool.h" -#include qreal VDrawTool::factor = 1; @@ -32,12 +31,6 @@ VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *pa connect(this->doc, &VDomDocument::ShowTool, this, &VDrawTool::ShowTool); } -VDrawTool::~VDrawTool(){ -} - -void VDrawTool::setDialog(){ -} - void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc){ qint64 cursor = doc->getCursor(); QVector *history = doc->getHistory(); @@ -56,10 +49,6 @@ void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *d } } -void VDrawTool::ignoreContextMenu(bool enable){ - ignoreContextMenuEvent = enable; -} - void VDrawTool::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ Q_UNUSED(id); Q_UNUSED(color); diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index 4ef092514..a0d037119 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -23,16 +23,15 @@ #define VDRAWTOOL_H #include "../vabstracttool.h" -#include class VDrawTool : public VAbstractTool{ Q_OBJECT public: VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); - virtual ~VDrawTool(); - virtual void setDialog(); + virtual ~VDrawTool() {} + virtual void setDialog() {} static void AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc); - void ignoreContextMenu(bool enable); + void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;} public slots: virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void ChangedActivDraw(const QString newName); diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index 905a5ea98..c155447d2 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -20,8 +20,6 @@ ****************************************************************************/ #include "vtoolalongline.h" -#include -#include #include "container/calculator.h" VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index 4f5ddd04b..ca220d8ad 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -29,26 +29,25 @@ class VToolAlongLine : public VToolLinePoint{ Q_OBJECT public: VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, - const QString &typeLine, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); + const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, + const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - virtual void SetFactor(qreal factor); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + virtual void SetFactor(qreal factor); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 secondPointId; + qint64 secondPointId; QSharedPointer dialogAlongLine; }; diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index fa0bc9061..f527ce612 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -27,20 +27,19 @@ class VToolBisector : public VToolLinePoint{ public: - VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, - const QPointF &thirdPoint, const qreal& length); + VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, + const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint, + const qreal& length); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, - const QString &pointName, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index fd0802008..a4111bd7b 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -20,8 +20,6 @@ ****************************************************************************/ #include "vtoolendline.h" -#include -#include #include "widgets/vmaingraphicsscene.h" #include diff --git a/tools/drawTools/vtoolheight.h b/tools/drawTools/vtoolheight.h index c3ab6d02f..43396e5f8 100644 --- a/tools/drawTools/vtoolheight.h +++ b/tools/drawTools/vtoolheight.h @@ -3,7 +3,6 @@ #include "vtoollinepoint.h" #include "dialogs/dialogheight.h" -#include class VToolHeight: public VToolLinePoint{ Q_OBJECT diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index ced59ed03..e8dfef50a 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolline.h" -#include VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 797ce2c26..7098b7d3f 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoollineintersect.h" -#include VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index 90e4d07f6..7f143f353 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -28,17 +28,16 @@ class VToolLineIntersect:public VToolPoint{ Q_OBJECT public: - VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); + VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, + const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, - const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, + const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index af55544d4..95303198b 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -64,10 +64,6 @@ void VToolLinePoint::RefreshGeometry(){ } } -void VToolLinePoint::RemoveReferens(){ - doc->DecrementReferens(basePointId); -} - void VToolLinePoint::SetFactor(qreal factor){ VDrawTool::SetFactor(factor); RefreshGeometry(); diff --git a/tools/drawTools/vtoollinepoint.h b/tools/drawTools/vtoollinepoint.h index 3d82b33f5..51f830bf9 100644 --- a/tools/drawTools/vtoollinepoint.h +++ b/tools/drawTools/vtoollinepoint.h @@ -27,9 +27,9 @@ class VToolLinePoint : public VToolPoint{ Q_OBJECT public: - VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); + VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &basePointId, const qreal &angle, + QGraphicsItem * parent = 0); public slots: virtual void ChangedActivDraw(const QString newName); virtual void SetFactor(qreal factor); @@ -40,7 +40,7 @@ protected: qint64 basePointId; QGraphicsLineItem *mainLine; virtual void RefreshGeometry(); - virtual void RemoveReferens(); + virtual void RemoveReferens() {doc->DecrementReferens(basePointId);} private: Q_DISABLE_COPY(VToolLinePoint) }; diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index f7336cacf..2a1e14bab 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -30,8 +30,7 @@ class VToolNormal : public VToolLinePoint{ public: VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); + const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index faf1daf03..41c4ffcff 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -20,11 +20,6 @@ ****************************************************************************/ #include "vtoolpoint.h" -#include -#include -#include -#include - VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), @@ -151,6 +146,3 @@ void VToolPoint::RefreshLine(){ lineName->setVisible(true); } } - -VToolPoint::~VToolPoint(){ -} diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index 35b8f1abd..7583e8e4a 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -28,9 +28,8 @@ class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{ Q_OBJECT public: - VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, - QGraphicsItem * parent = 0); - virtual ~VToolPoint(); + VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); + virtual ~VToolPoint(){} public slots: void NameChangePosition(const QPointF pos); virtual void ChangedActivDraw(const QString newName); diff --git a/tools/drawTools/vtoolpointofintersection.h b/tools/drawTools/vtoolpointofintersection.h index 206ad322f..7737d45a5 100644 --- a/tools/drawTools/vtoolpointofintersection.h +++ b/tools/drawTools/vtoolpointofintersection.h @@ -7,15 +7,16 @@ class VToolPointOfIntersection : public VToolPoint{ Q_OBJECT public: - VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index bcb96974f..ea04c8889 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -33,7 +33,6 @@ VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, cons if(typeCreation == Tool::FromGui){ AddToFile(); } - } void VToolShoulderPoint::setDialog(){ diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index ccf92fe3e..9b5942fdc 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -27,19 +27,17 @@ class VToolShoulderPoint : public VToolLinePoint{ public: - VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); + VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &p1Line, const qint64 &p2Line, + const qint64 &pShoulder, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, const qreal &length); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data); - static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, - const QString &pointName, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, + const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, + const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index d8c4d8327..92898ca84 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -20,11 +20,6 @@ ****************************************************************************/ #include "vtoolsinglepoint.h" -#include -#include -#include -#include -#include VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index daddf741e..f3db13297 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -41,8 +41,8 @@ public: VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); signals: - void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &controlPoint, const QPointF &splinePoint ); + void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, + const QPointF &splinePoint ); void setEnabledPoint ( bool enable ); public slots: virtual void FullUpdateFromFile (); diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index f13333e62..1bb2650b9 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vtoolsplinepath.h" -#include VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h index 173af52cb..c3dc11f7d 100644 --- a/tools/drawTools/vtooltriangle.h +++ b/tools/drawTools/vtooltriangle.h @@ -7,32 +7,31 @@ class VToolTriangle : public VToolPoint{ Q_OBJECT public: - VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, - VContainer *data); - static void Create(const qint64 _id, const QString &pointName, - const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); - static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, + VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc, + VContainer *data); + static void Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, const qint64 &axisP2Id, + const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, + VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); + static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, const QPointF secondPoint); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void RemoveReferens(); - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); private: Q_DISABLE_COPY(VToolTriangle) - qint64 axisP1Id; - qint64 axisP2Id; - qint64 firstPointId; - qint64 secondPointId; + qint64 axisP1Id; + qint64 axisP2Id; + qint64 firstPointId; + qint64 secondPointId; QSharedPointer dialogTriangle; }; diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index 096ad37aa..58f746530 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -20,8 +20,6 @@ ****************************************************************************/ #include "vmodelingalongline.h" -#include -#include #include "container/calculator.h" VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h index c5d88407d..582a1aebe 100644 --- a/tools/modelingTools/vmodelingalongline.h +++ b/tools/modelingTools/vmodelingalongline.h @@ -28,27 +28,25 @@ class VModelingAlongLine : public VModelingLinePoint{ Q_OBJECT public: - VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, - const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString &typeLine, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingAlongLine* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, + const QString &formula, const qint64 &firstPointId, + const qint64 &secondPointId, const QString &typeLine, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingAlongLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, + const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 secondPointId; + qint64 secondPointId; QSharedPointer dialogAlongLine; }; diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index 372cb7fef..2e4b54c08 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelingarc.h" -#include #include "container/calculator.h" VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index e452f59e1..af1c5394b 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -30,26 +30,26 @@ class VModelingArc :public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: - VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, - const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingArc* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, + const QString &f2, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogArc; - void RefreshGeometry(); + void RefreshGeometry(); }; #endif // VMODELINGARC_H diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index 3c13a03e6..ae10c2a36 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -34,13 +34,11 @@ public: const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); - static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); + static VModelingBisector* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, - const QString &typeLine, const QString &pointName, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, + const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index 6bd9d110b..27b771fc0 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -28,24 +28,22 @@ class VModelingEndLine : public VModelingLinePoint{ Q_OBJECT public: - VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qreal &angle, const qint64 &basePointId, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingEndLine* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, - const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &typeLine, const QString &formula, const qreal &angle, + const qint64 &basePointId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingEndLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qreal &angle, const qint64 &basePointId, + const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); private: QSharedPointer dialogEndLine; }; diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h index 7d2362b5a..d1e9bd58b 100644 --- a/tools/modelingTools/vmodelingheight.h +++ b/tools/modelingTools/vmodelingheight.h @@ -8,12 +8,11 @@ class VModelingHeight : public VModelingLinePoint{ Q_OBJECT public: VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const qint64 &basePointId, - const qint64 &p1LineId, const qint64 &p2LineId, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); + const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, + const qint64 &p2LineId, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); virtual void setDialog(); - static VModelingHeight* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); + static VModelingHeight* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index ea09c70a7..a0a881429 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelingline.h" -#include VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent): diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index 881abda27..48dc239a6 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -29,26 +29,25 @@ class VModelingLine: public VModelingTool, public QGraphicsLineItem{ Q_OBJECT public: - VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); - static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, + qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingLine* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: - qint64 firstPoint; - qint64 secondPoint; + qint64 firstPoint; + qint64 secondPoint; QSharedPointer dialogLine; }; diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h index e2af48470..8808613b3 100644 --- a/tools/modelingTools/vmodelinglineintersect.h +++ b/tools/modelingTools/vmodelinglineintersect.h @@ -28,33 +28,29 @@ class VModelingLineIntersect:public VModelingPoint{ Q_OBJECT public: - VModelingLineIntersect(VDomDocument *doc, VContainer *data, - const qint64 &id, const qint64 &p1Line1, - const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingLineIntersect* Create(QSharedPointer &dialog, - VDomDocument *doc,VContainer *data); - static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, - const qint64 &p2Line1Id, const qint64 &p1Line2Id, - const qint64 &p2Line2Id, const QString &pointName, - const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, + const qint64 &p1Line1, const qint64 &p2Line1, + const qint64 &p1Line2, const qint64 &p2Line2, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingLineIntersect* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); + static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, + const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, + const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 p1Line1; - qint64 p2Line1; - qint64 p1Line2; - qint64 p2Line2; + qint64 p1Line1; + qint64 p2Line1; + qint64 p1Line2; + qint64 p2Line2; QSharedPointer dialogLineIntersect; }; diff --git a/tools/modelingTools/vmodelinglinepoint.cpp b/tools/modelingTools/vmodelinglinepoint.cpp index c326a4079..36b3239a7 100644 --- a/tools/modelingTools/vmodelinglinepoint.cpp +++ b/tools/modelingTools/vmodelinglinepoint.cpp @@ -50,7 +50,3 @@ void VModelingLinePoint::RefreshGeometry(){ mainLine->setVisible(true); } } - -void VModelingLinePoint::RemoveReferens(){ - doc->DecrementReferens(basePointId); -} diff --git a/tools/modelingTools/vmodelinglinepoint.h b/tools/modelingTools/vmodelinglinepoint.h index 762ce1fc5..f3aede417 100644 --- a/tools/modelingTools/vmodelinglinepoint.h +++ b/tools/modelingTools/vmodelinglinepoint.h @@ -27,9 +27,8 @@ class VModelingLinePoint : public VModelingPoint{ Q_OBJECT public: - VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qint64 &basePointId, const qreal &angle, + VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); protected: QString typeLine; @@ -38,7 +37,7 @@ protected: qint64 basePointId; QGraphicsLineItem *mainLine; virtual void RefreshGeometry(); - virtual void RemoveReferens(); + virtual void RemoveReferens() {doc->DecrementReferens(basePointId);} private: Q_DISABLE_COPY(VModelingLinePoint) }; diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index c0e76e68c..495bf935d 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -33,7 +33,6 @@ VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint if(typeCreation == Tool::FromGui){ AddToFile(); } - } void VModelingNormal::setDialog(){ diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index 7d640421e..8adf0abbb 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -29,17 +29,15 @@ class VModelingNormal : public VModelingLinePoint{ Q_OBJECT public: VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, - const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); + const QString &typeLine, const QString &formula, const qreal &angle, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); static VModelingNormal* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString typeLine, - const QString pointName, const qreal angle, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, Tool::Sources typeCreation); + const qint64 &secondPointId, const QString typeLine, const QString pointName, + const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingpoint.cpp b/tools/modelingTools/vmodelingpoint.cpp index a6222e27b..5e78b7b65 100644 --- a/tools/modelingTools/vmodelingpoint.cpp +++ b/tools/modelingTools/vmodelingpoint.cpp @@ -20,10 +20,6 @@ ****************************************************************************/ #include "vmodelingpoint.h" -#include -#include -#include -#include #include "container/vpointf.h" VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, @@ -102,6 +98,3 @@ void VModelingPoint::RefreshLine(){ lineName->setVisible(true); } } - -VModelingPoint::~VModelingPoint(){ -} diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h index e3bef5073..1531cdb56 100644 --- a/tools/modelingTools/vmodelingpoint.h +++ b/tools/modelingTools/vmodelingpoint.h @@ -28,9 +28,8 @@ class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{ Q_OBJECT public: - VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, - QGraphicsItem * parent = 0); - virtual ~VModelingPoint(); + VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); + virtual ~VModelingPoint() {} public slots: void NameChangePosition(const QPointF pos); virtual void FullUpdateFromGui(int result) = 0; diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index d8d4af4a4..4aca22725 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -28,15 +28,13 @@ class VModelingPointOfContact : public VModelingPoint{ Q_OBJECT public: - VModelingPointOfContact(VDomDocument *doc, VContainer *data, - const qint64 &id, const QString &radius, - const qint64 ¢er, const qint64 &firstPointId, - const qint64 &secondPointId, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); + VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, + const QString &radius, const qint64 ¢er, + const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog(); - static VModelingPointOfContact* Create(QSharedPointer &dialog, - VDomDocument *doc, VContainer *data); + static VModelingPointOfContact* Create(QSharedPointer &dialog, VDomDocument *doc, + VContainer *data); static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index c2c934bf0..737b6222a 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelingshoulderpoint.h" -#include #include "../drawTools/vtoolshoulderpoint.h" #include @@ -34,7 +33,6 @@ VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *da if(typeCreation == Tool::FromGui){ AddToFile(); } - } void VModelingShoulderPoint::setDialog(){ diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index e4bc9b928..ec5e74727 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -28,30 +28,28 @@ class VModelingShoulderPoint : public VModelingLinePoint{ Q_OBJECT public: - VModelingShoulderPoint(VDomDocument *doc, VContainer *data, - const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, - Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - virtual void setDialog(); + VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + const QString &formula, const qint64 &p1Line, const qint64 &p2Line, + const qint64 &pShoulder, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); static VModelingShoulderPoint* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, - const QString &typeLine, const QString &pointName, const qreal &mx, - const qreal &my, VDomDocument *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, + const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, + VContainer *data, const Document::Documents &parse, + const Tool::Sources &typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void RemoveReferens(); private: - qint64 p2Line; - qint64 pShoulder; + qint64 p2Line; + qint64 pShoulder; QSharedPointer dialogShoulderPoint; }; diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index ccc1a8bb6..915c01d9b 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -20,11 +20,8 @@ ****************************************************************************/ #include "vmodelingspline.h" -#include -#include #include "geometry/vspline.h" - VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index bffdb148b..fb75685b3 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -31,37 +31,34 @@ class VModelingSpline:public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: - VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); - virtual void setDialog(); - static VModelingSpline* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); - static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, - const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, - const qreal &angle2, const qreal &kCurve, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0 ); + virtual void setDialog(); + static VModelingSpline* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); + static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, + const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, + Tool::Sources typeCreation); signals: - void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &controlPoint, const QPointF &splinePoint ); - void setEnabledPoint ( bool enable ); + void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position, + const QPointF &controlPoint, const QPointF &splinePoint ); + void setEnabledPoint ( bool enable ); public slots: - virtual void FullUpdateFromFile (); - virtual void FullUpdateFromGui ( int result ); - void ControlPointChangePosition ( const qint32 &indexSpline, - SplinePoint::Position position, - const QPointF pos); + virtual void FullUpdateFromFile (); + virtual void FullUpdateFromGui ( int result ); + void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position, + const QPointF pos); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile (); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile (); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: - QSharedPointer dialogSpline; + QSharedPointer dialogSpline; QVector controlPoints; - void RefreshGeometry (); + void RefreshGeometry (); }; #endif // VMODELINGSPLINE_H diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 75d4f6c98..141fa444d 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vmodelingsplinepath.h" -#include VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index c92a70204..823e6cfd5 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -30,38 +30,35 @@ class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem{ Q_OBJECT public: - VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingSplinePath* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); + VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingSplinePath* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); signals: - void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, - const QPointF &controlPoint, const QPointF &splinePoint); - void setEnabledPoint(bool enable); + void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, + const QPointF &splinePoint); + void setEnabledPoint(bool enable); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); - void ControlPointChangePosition(const qint32 &indexSpline, - SplinePoint::Position position, const QPointF pos); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); + void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, + const QPointF pos); protected: - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void RemoveReferens(); private: QSharedPointer dialogSplinePath; QVector controlPoints; - void RefreshGeometry(); - void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); - void UpdatePathPoint(QDomNode& node, VSplinePath &path); - void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, - const qint32 &indexSpline); + void RefreshGeometry(); + void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); + void UpdatePathPoint(QDomNode& node, VSplinePath &path); + void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline); }; #endif // VMODELINGSPLINEPATH_H diff --git a/tools/modelingTools/vmodelingtool.cpp b/tools/modelingTools/vmodelingtool.cpp index 2dc6b5ad4..58d420c5f 100644 --- a/tools/modelingTools/vmodelingtool.cpp +++ b/tools/modelingTools/vmodelingtool.cpp @@ -27,16 +27,6 @@ VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), ignoreFullU _referens = 0; } -VModelingTool::~VModelingTool(){ -} - -void VModelingTool::setDialog(){ -} - -void VModelingTool::ignoreContextMenu(bool enable){ - ignoreContextMenuEvent = enable; -} - void VModelingTool::AddToModeling(const QDomElement &domElement){ QDomElement modelingElement; bool ok = doc->GetActivModelingElement(modelingElement); diff --git a/tools/modelingTools/vmodelingtool.h b/tools/modelingTools/vmodelingtool.h index d19819378..359f7555a 100644 --- a/tools/modelingTools/vmodelingtool.h +++ b/tools/modelingTools/vmodelingtool.h @@ -25,14 +25,13 @@ #include "../vabstracttool.h" #include -class VModelingTool: public VAbstractTool -{ +class VModelingTool: public VAbstractTool{ Q_OBJECT public: - VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); - virtual ~VModelingTool(); - virtual void setDialog(); - void ignoreContextMenu(bool enable); + VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); + virtual ~VModelingTool(){} + virtual void setDialog(){} + inline void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;} public slots: virtual void FullUpdateFromGui(int result)=0; signals: diff --git a/tools/modelingTools/vmodelingtriangle.h b/tools/modelingTools/vmodelingtriangle.h index a43b73867..ab49870c5 100644 --- a/tools/modelingTools/vmodelingtriangle.h +++ b/tools/modelingTools/vmodelingtriangle.h @@ -8,31 +8,28 @@ class VModelingTriangle : public VModelingPoint{ Q_OBJECT public: - VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &axisP1Id, const qint64 &axisP2Id, - const qint64 &firstPointId, const qint64 &secondPointId, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - virtual void setDialog(); - static VModelingTriangle* Create(QSharedPointer &dialog, VDomDocument *doc, - VContainer *data); + VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + virtual void setDialog(); + static VModelingTriangle* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingTriangle* Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, - Tool::Sources typeCreation); + const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, + const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - virtual void FullUpdateFromGui(int result); + virtual void FullUpdateFromFile(); + virtual void FullUpdateFromGui(int result); protected: - virtual void RemoveReferens(); - virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); - virtual void AddToFile(); + virtual void RemoveReferens(); + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); + virtual void AddToFile(); private: Q_DISABLE_COPY(VModelingTriangle) - qint64 axisP1Id; - qint64 axisP2Id; - qint64 firstPointId; - qint64 secondPointId; + qint64 axisP1Id; + qint64 axisP2Id; + qint64 firstPointId; + qint64 secondPointId; QSharedPointer dialogTriangle; }; diff --git a/tools/nodeDetails/vabstractnode.h b/tools/nodeDetails/vabstractnode.h index 3cd1a63cc..adc93c20d 100644 --- a/tools/nodeDetails/vabstractnode.h +++ b/tools/nodeDetails/vabstractnode.h @@ -24,8 +24,7 @@ #include "../vabstracttool.h" -class VAbstractNode : public VAbstractTool -{ +class VAbstractNode : public VAbstractTool{ Q_OBJECT public: VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index 6776776ad..9c072e176 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -25,8 +25,7 @@ #include "vabstractnode.h" #include -class VNodeArc :public VAbstractNode, public QGraphicsPathItem -{ +class VNodeArc :public VAbstractNode, public QGraphicsPathItem{ Q_OBJECT public: VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index f7e963a97..3ef5ae177 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -25,30 +25,27 @@ #include "vabstractnode.h" #include "widgets/vgraphicssimpletextitem.h" -class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem -{ +class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem{ Q_OBJECT public: - VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, Tool::Sources typeCreation, - QGraphicsItem * parent = 0 ); - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, - Draw::Draws typeobject, const Document::Documents &parse, - Tool::Sources typeCreation); + VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, + Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile(); - void NameChangePosition(const QPointF pos); + virtual void FullUpdateFromFile(); + void NameChangePosition(const QPointF pos); protected: - qreal radius; + qreal radius; VGraphicsSimpleTextItem *namePoint; QGraphicsLineItem *lineName; - virtual void AddToFile(); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void UpdateNamePosition(qreal mx, qreal my); - virtual void RefreshPointGeometry(const VPointF &point); - void RefreshLine(); + virtual void AddToFile(); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + virtual void UpdateNamePosition(qreal mx, qreal my); + virtual void RefreshPointGeometry(const VPointF &point); + void RefreshLine(); private: Q_DISABLE_COPY(VNodePoint) }; diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h index 5e076f9ec..2399d26e4 100644 --- a/tools/nodeDetails/vnodespline.h +++ b/tools/nodeDetails/vnodespline.h @@ -25,23 +25,22 @@ #include "vabstractnode.h" #include -class VNodeSpline:public VAbstractNode, public QGraphicsPathItem -{ +class VNodeSpline:public VAbstractNode, public QGraphicsPathItem{ Q_OBJECT public: - VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, - Tool::Sources typeCreation, QGraphicsItem * parent = 0); - static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, + Tool::Sources typeCreation, QGraphicsItem * parent = 0); + static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: - virtual void FullUpdateFromFile (); + virtual void FullUpdateFromFile (); protected: - virtual void AddToFile (); - virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); + virtual void AddToFile (); + virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); private: - void RefreshGeometry (); + void RefreshGeometry (); }; #endif // VNODESPLINE_H diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index 21b09dd36..9541a805e 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -25,15 +25,13 @@ #include "vabstractnode.h" #include -class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem -{ +class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem{ Q_OBJECT public: VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, Tool::Sources typeCreation, - QGraphicsItem * parent = 0); - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, - Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0); + static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, + const Document::Documents &parse, Tool::Sources typeCreation); public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index 61709d7b5..49350a622 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vabstracttool.h" -#include VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){ @@ -132,10 +131,6 @@ QPointF VAbstractTool::addVector(QPointF p, QPointF p1, QPointF p2, qreal k){ return QPointF (p.x() + (p2.x() - p1.x()) * k, p.y() + (p2.y() - p1.y()) * k); } -const VContainer *VAbstractTool::getData()const{ - return &data; -} - void VAbstractTool::RemoveAllChild(QDomElement &domElement){ if ( domElement.hasChildNodes() ){ while ( domElement.childNodes().length() >= 1 ){ @@ -150,7 +145,3 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre *b = line.p1().x() - line.p2().x(); *c = - *a * line.p1().x() - *b * line.p1().y(); } - -qint64 VAbstractTool::getId() const{ - return id; -} diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index fc7d1e809..8b70a3258 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -22,40 +22,39 @@ #ifndef VABSTRACTTOOL_H #define VABSTRACTTOOL_H -#include "xml/vdomdocument.h" #include "vdatatool.h" +#include class VAbstractTool: public VDataTool{ Q_OBJECT public: - VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); - virtual ~VAbstractTool(); - static QPointF LineIntersectRect(QRectF rec, QLineF line); - static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, - QPointF &p2); - static QPointF ClosestPoint(QLineF line, QPointF p); - static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k); - qint64 getId() const; - static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c); + VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); + virtual ~VAbstractTool(); + static QPointF LineIntersectRect(QRectF rec, QLineF line); + static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2); + static QPointF ClosestPoint(QLineF line, QPointF p); + static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k); + inline qint64 getId() const {return id;} + static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c); public slots: - virtual void FullUpdateFromFile()=0; + virtual void FullUpdateFromFile()=0; signals: - void toolhaveChange(); - void ChoosedTool(qint64 id, Scene::Scenes type); - void FullUpdateTree(); + void toolhaveChange(); + void ChoosedTool(qint64 id, Scene::Scenes type); + void FullUpdateTree(); protected: - VDomDocument *doc; - const qint64 id; - const Qt::GlobalColor baseColor; - Qt::GlobalColor currentColor; - virtual void AddToFile()=0; - void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value); - void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value); - void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value); - void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); - const VContainer *getData() const; - virtual void RemoveReferens(){} - void RemoveAllChild(QDomElement &domElement); + VDomDocument *doc; + const qint64 id; + const Qt::GlobalColor baseColor; + Qt::GlobalColor currentColor; + virtual void AddToFile()=0; + void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value); + void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value); + void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value); + void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); + inline const VContainer *getData() const {return &data;} + virtual void RemoveReferens(){} + void RemoveAllChild(QDomElement &domElement); private: Q_DISABLE_COPY(VAbstractTool) }; diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index eb5d6cf20..4c6bab8cc 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -27,10 +27,6 @@ VDataTool &VDataTool::operator =(const VDataTool &tool){ return *this; } -void VDataTool::setData(const VContainer *value){ - data = *value; -} - void VDataTool::decrementReferens(){ if(_referens > 0){ --_referens; diff --git a/tools/vdatatool.h b/tools/vdatatool.h index eed3f4e60..2234f557f 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -22,18 +22,17 @@ #ifndef VDATATOOL_H #define VDATATOOL_H -#include "container/vcontainer.h" +#include //We need QObject class because we use qobject_cast. class VDataTool : public QObject{ Q_OBJECT public: - explicit VDataTool(VContainer *data, QObject *parent = 0) - : QObject(parent), data(*data), _referens(1){} + explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data), _referens(1){} virtual ~VDataTool(){} VDataTool &operator= (const VDataTool &tool); inline VContainer getData() const { return data; } - void setData(const VContainer *value); + inline void setData(const VContainer *value) {data = *value;} virtual inline qint64 referens() const {return _referens;} virtual inline void incrementReferens(){++_referens;} virtual void decrementReferens(); diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 81a9a3fbd..560659796 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -21,7 +21,6 @@ #include "vtooldetail.h" #include "nodeDetails/nodedetails.h" -#include #include "modelingTools/vmodelingtool.h" #include "modelingTools/modelingtools.h" From e5cf9a9ca43b8b869074d0d3765049448a335098 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 13:59:34 +0200 Subject: [PATCH 60/70] GNU General Public License. --HG-- branch : develop --- dialogs/dialogheight.h | 21 +++++++++++++++++++++ dialogs/dialogtriangle.h | 21 +++++++++++++++++++++ tools/drawTools/vtoolheight.h | 21 +++++++++++++++++++++ tools/drawTools/vtooltriangle.h | 21 +++++++++++++++++++++ tools/modelingTools/vmodelingheight.h | 21 +++++++++++++++++++++ tools/modelingTools/vmodelingtriangle.h | 21 +++++++++++++++++++++ 6 files changed, 126 insertions(+) diff --git a/dialogs/dialogheight.h b/dialogs/dialogheight.h index d2eaa2022..933b2d786 100644 --- a/dialogs/dialogheight.h +++ b/dialogs/dialogheight.h @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #ifndef DIALOGHEIGHT_H #define DIALOGHEIGHT_H diff --git a/dialogs/dialogtriangle.h b/dialogs/dialogtriangle.h index 2ec3df1a2..13b7c0c9d 100644 --- a/dialogs/dialogtriangle.h +++ b/dialogs/dialogtriangle.h @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #ifndef DIALOGTRIANGLE_H #define DIALOGTRIANGLE_H diff --git a/tools/drawTools/vtoolheight.h b/tools/drawTools/vtoolheight.h index 43396e5f8..197909888 100644 --- a/tools/drawTools/vtoolheight.h +++ b/tools/drawTools/vtoolheight.h @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #ifndef VTOOLHEIGHT_H #define VTOOLHEIGHT_H diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h index c3dc11f7d..1c69603ed 100644 --- a/tools/drawTools/vtooltriangle.h +++ b/tools/drawTools/vtooltriangle.h @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Tox is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #ifndef VTOOLTRIANGLE_H #define VTOOLTRIANGLE_H diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h index d1e9bd58b..42e6ec2c2 100644 --- a/tools/modelingTools/vmodelingheight.h +++ b/tools/modelingTools/vmodelingheight.h @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Tox is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #ifndef VMODELINGHEIGHT_H #define VMODELINGHEIGHT_H diff --git a/tools/modelingTools/vmodelingtriangle.h b/tools/modelingTools/vmodelingtriangle.h index ab49870c5..4ae18f5cc 100644 --- a/tools/modelingTools/vmodelingtriangle.h +++ b/tools/modelingTools/vmodelingtriangle.h @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Tox is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #ifndef VMODELINGTRIANGLE_H #define VMODELINGTRIANGLE_H From 36143a93ecb3a2f9a8ae03b1096025ad3704b9fc Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 14:36:29 +0200 Subject: [PATCH 61/70] Error in license. --HG-- branch : develop --- container/calculator.cpp | 2 +- container/calculator.h | 2 +- container/vcontainer.cpp | 2 +- container/vcontainer.h | 2 +- container/vincrementtablerow.cpp | 2 +- container/vincrementtablerow.h | 2 +- container/vpointf.cpp | 2 +- container/vpointf.h | 2 +- container/vstandarttablecell.cpp | 2 +- container/vstandarttablecell.h | 2 +- dialogs/dialogalongline.cpp | 2 +- dialogs/dialogalongline.h | 2 +- dialogs/dialogarc.cpp | 2 +- dialogs/dialogarc.h | 2 +- dialogs/dialogbisector.cpp | 2 +- dialogs/dialogbisector.h | 2 +- dialogs/dialogdetail.cpp | 2 +- dialogs/dialogdetail.h | 2 +- dialogs/dialogendline.cpp | 2 +- dialogs/dialogendline.h | 2 +- dialogs/dialoghistory.cpp | 2 +- dialogs/dialoghistory.h | 2 +- dialogs/dialogincrements.cpp | 2 +- dialogs/dialogincrements.h | 2 +- dialogs/dialogline.cpp | 2 +- dialogs/dialogline.h | 2 +- dialogs/dialoglineintersect.cpp | 2 +- dialogs/dialoglineintersect.h | 2 +- dialogs/dialognormal.cpp | 2 +- dialogs/dialognormal.h | 2 +- dialogs/dialogpointofcontact.cpp | 2 +- dialogs/dialogpointofcontact.h | 2 +- dialogs/dialogs.h | 2 +- dialogs/dialogshoulderpoint.cpp | 2 +- dialogs/dialogshoulderpoint.h | 2 +- dialogs/dialogsinglepoint.cpp | 2 +- dialogs/dialogsinglepoint.h | 2 +- dialogs/dialogspline.cpp | 2 +- dialogs/dialogspline.h | 2 +- dialogs/dialogsplinepath.cpp | 2 +- dialogs/dialogsplinepath.h | 2 +- dialogs/dialogtool.cpp | 2 +- dialogs/dialogtool.h | 2 +- exception/vexception.cpp | 2 +- exception/vexception.h | 2 +- exception/vexceptionbadid.cpp | 2 +- exception/vexceptionbadid.h | 2 +- exception/vexceptionconversionerror.cpp | 2 +- exception/vexceptionconversionerror.h | 2 +- exception/vexceptionemptyparameter.cpp | 2 +- exception/vexceptionemptyparameter.h | 2 +- exception/vexceptionobjecterror.cpp | 2 +- exception/vexceptionobjecterror.h | 2 +- exception/vexceptionwrongparameterid.cpp | 2 +- exception/vexceptionwrongparameterid.h | 2 +- geometry/varc.cpp | 2 +- geometry/varc.h | 2 +- geometry/vdetail.cpp | 2 +- geometry/vdetail.h | 2 +- geometry/vnodedetail.cpp | 2 +- geometry/vnodedetail.h | 2 +- geometry/vspline.cpp | 2 +- geometry/vspline.h | 2 +- geometry/vsplinepath.cpp | 2 +- geometry/vsplinepath.h | 2 +- geometry/vsplinepoint.cpp | 2 +- geometry/vsplinepoint.h | 2 +- main.cpp | 2 +- mainwindow.cpp | 2 +- mainwindow.h | 2 +- options.h | 2 +- stable.h | 2 +- tablewindow.cpp | 2 +- tablewindow.h | 2 +- tools/drawTools/drawtools.h | 2 +- tools/drawTools/vdrawtool.cpp | 2 +- tools/drawTools/vdrawtool.h | 2 +- tools/drawTools/vtoolalongline.cpp | 2 +- tools/drawTools/vtoolalongline.h | 2 +- tools/drawTools/vtoolarc.cpp | 2 +- tools/drawTools/vtoolarc.h | 2 +- tools/drawTools/vtoolbisector.cpp | 2 +- tools/drawTools/vtoolbisector.h | 2 +- tools/drawTools/vtoolendline.cpp | 2 +- tools/drawTools/vtoolendline.h | 2 +- tools/drawTools/vtoolline.cpp | 2 +- tools/drawTools/vtoolline.h | 2 +- tools/drawTools/vtoollineintersect.cpp | 2 +- tools/drawTools/vtoollineintersect.h | 2 +- tools/drawTools/vtoollinepoint.cpp | 2 +- tools/drawTools/vtoollinepoint.h | 2 +- tools/drawTools/vtoolnormal.cpp | 2 +- tools/drawTools/vtoolnormal.h | 2 +- tools/drawTools/vtoolpoint.cpp | 2 +- tools/drawTools/vtoolpoint.h | 2 +- tools/drawTools/vtoolpointofcontact.cpp | 2 +- tools/drawTools/vtoolpointofcontact.h | 2 +- tools/drawTools/vtoolshoulderpoint.cpp | 2 +- tools/drawTools/vtoolshoulderpoint.h | 2 +- tools/drawTools/vtoolsinglepoint.cpp | 2 +- tools/drawTools/vtoolsinglepoint.h | 2 +- tools/drawTools/vtoolspline.cpp | 2 +- tools/drawTools/vtoolspline.h | 2 +- tools/drawTools/vtoolsplinepath.cpp | 2 +- tools/drawTools/vtoolsplinepath.h | 2 +- tools/drawTools/vtooltriangle.h | 2 +- tools/modelingTools/modelingtools.h | 2 +- tools/modelingTools/vmodelingalongline.cpp | 2 +- tools/modelingTools/vmodelingalongline.h | 2 +- tools/modelingTools/vmodelingarc.cpp | 2 +- tools/modelingTools/vmodelingarc.h | 2 +- tools/modelingTools/vmodelingbisector.cpp | 2 +- tools/modelingTools/vmodelingbisector.h | 2 +- tools/modelingTools/vmodelingendline.cpp | 2 +- tools/modelingTools/vmodelingendline.h | 2 +- tools/modelingTools/vmodelingheight.h | 2 +- tools/modelingTools/vmodelingline.cpp | 2 +- tools/modelingTools/vmodelingline.h | 2 +- tools/modelingTools/vmodelinglineintersect.cpp | 2 +- tools/modelingTools/vmodelinglineintersect.h | 2 +- tools/modelingTools/vmodelinglinepoint.cpp | 2 +- tools/modelingTools/vmodelinglinepoint.h | 2 +- tools/modelingTools/vmodelingnormal.cpp | 2 +- tools/modelingTools/vmodelingnormal.h | 2 +- tools/modelingTools/vmodelingpoint.cpp | 2 +- tools/modelingTools/vmodelingpoint.h | 2 +- tools/modelingTools/vmodelingpointofcontact.cpp | 2 +- tools/modelingTools/vmodelingpointofcontact.h | 2 +- tools/modelingTools/vmodelingshoulderpoint.cpp | 2 +- tools/modelingTools/vmodelingshoulderpoint.h | 2 +- tools/modelingTools/vmodelingspline.cpp | 2 +- tools/modelingTools/vmodelingspline.h | 2 +- tools/modelingTools/vmodelingsplinepath.cpp | 2 +- tools/modelingTools/vmodelingsplinepath.h | 2 +- tools/modelingTools/vmodelingtool.cpp | 2 +- tools/modelingTools/vmodelingtool.h | 2 +- tools/modelingTools/vmodelingtriangle.h | 2 +- tools/nodeDetails/nodedetails.h | 2 +- tools/nodeDetails/vabstractnode.cpp | 2 +- tools/nodeDetails/vabstractnode.h | 2 +- tools/nodeDetails/vnodearc.cpp | 2 +- tools/nodeDetails/vnodearc.h | 2 +- tools/nodeDetails/vnodepoint.cpp | 2 +- tools/nodeDetails/vnodepoint.h | 2 +- tools/nodeDetails/vnodespline.cpp | 2 +- tools/nodeDetails/vnodespline.h | 2 +- tools/nodeDetails/vnodesplinepath.cpp | 2 +- tools/nodeDetails/vnodesplinepath.h | 2 +- tools/tools.h | 2 +- tools/vabstracttool.cpp | 2 +- tools/vabstracttool.h | 2 +- tools/vdatatool.cpp | 2 +- tools/vdatatool.h | 2 +- tools/vtooldetail.cpp | 2 +- tools/vtooldetail.h | 2 +- widgets/vapplication.cpp | 2 +- widgets/vcontrolpointspline.cpp | 2 +- widgets/vcontrolpointspline.h | 2 +- widgets/vgraphicssimpletextitem.cpp | 2 +- widgets/vgraphicssimpletextitem.h | 2 +- widgets/vitem.cpp | 2 +- widgets/vitem.h | 2 +- widgets/vmaingraphicsscene.cpp | 2 +- widgets/vmaingraphicsscene.h | 2 +- widgets/vmaingraphicsview.cpp | 2 +- widgets/vmaingraphicsview.h | 2 +- widgets/vtablegraphicsview.cpp | 2 +- widgets/vtablegraphicsview.h | 2 +- xml/vdomdocument.cpp | 2 +- xml/vdomdocument.h | 2 +- xml/vtoolrecord.cpp | 2 +- xml/vtoolrecord.h | 2 +- 172 files changed, 172 insertions(+), 172 deletions(-) diff --git a/container/calculator.cpp b/container/calculator.cpp index fb9642d57..36e7202e9 100644 --- a/container/calculator.cpp +++ b/container/calculator.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/calculator.h b/container/calculator.h index d8b3f518b..607dd648e 100644 --- a/container/calculator.h +++ b/container/calculator.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index a951bb167..7b94c7ab2 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vcontainer.h b/container/vcontainer.h index dbd9c82b6..94c02498e 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vincrementtablerow.cpp b/container/vincrementtablerow.cpp index f6ba763cc..e6e3670a4 100644 --- a/container/vincrementtablerow.cpp +++ b/container/vincrementtablerow.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vincrementtablerow.h b/container/vincrementtablerow.h index 592fe6140..f04abd8bf 100644 --- a/container/vincrementtablerow.h +++ b/container/vincrementtablerow.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vpointf.cpp b/container/vpointf.cpp index b9ae72544..14f5aa2d6 100644 --- a/container/vpointf.cpp +++ b/container/vpointf.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vpointf.h b/container/vpointf.h index 5282ed5fe..d51c13789 100644 --- a/container/vpointf.h +++ b/container/vpointf.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vstandarttablecell.cpp b/container/vstandarttablecell.cpp index 59ead8631..1eb2ff2f9 100644 --- a/container/vstandarttablecell.cpp +++ b/container/vstandarttablecell.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/container/vstandarttablecell.h b/container/vstandarttablecell.h index f94186b52..d74f683ad 100644 --- a/container/vstandarttablecell.h +++ b/container/vstandarttablecell.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogalongline.cpp b/dialogs/dialogalongline.cpp index c0724f951..969107db7 100644 --- a/dialogs/dialogalongline.cpp +++ b/dialogs/dialogalongline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogalongline.h b/dialogs/dialogalongline.h index 5020e17de..4b13fb25d 100644 --- a/dialogs/dialogalongline.h +++ b/dialogs/dialogalongline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogarc.cpp b/dialogs/dialogarc.cpp index adb2ac91b..dbd6eff99 100644 --- a/dialogs/dialogarc.cpp +++ b/dialogs/dialogarc.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogarc.h b/dialogs/dialogarc.h index 53467f108..302737d50 100644 --- a/dialogs/dialogarc.h +++ b/dialogs/dialogarc.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogbisector.cpp b/dialogs/dialogbisector.cpp index 5b22c2f4a..e975b8559 100644 --- a/dialogs/dialogbisector.cpp +++ b/dialogs/dialogbisector.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogbisector.h b/dialogs/dialogbisector.h index e237cfbb8..87b409421 100644 --- a/dialogs/dialogbisector.h +++ b/dialogs/dialogbisector.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogdetail.cpp b/dialogs/dialogdetail.cpp index caaa1bf78..fb66961c5 100644 --- a/dialogs/dialogdetail.cpp +++ b/dialogs/dialogdetail.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogdetail.h b/dialogs/dialogdetail.h index 00ceb22b9..43a518e90 100644 --- a/dialogs/dialogdetail.h +++ b/dialogs/dialogdetail.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogendline.cpp b/dialogs/dialogendline.cpp index d415e84c5..011784d5c 100644 --- a/dialogs/dialogendline.cpp +++ b/dialogs/dialogendline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogendline.h b/dialogs/dialogendline.h index a793ca85a..4996f8fb8 100644 --- a/dialogs/dialogendline.h +++ b/dialogs/dialogendline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialoghistory.cpp b/dialogs/dialoghistory.cpp index e8f78704d..80b71d293 100644 --- a/dialogs/dialoghistory.cpp +++ b/dialogs/dialoghistory.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialoghistory.h b/dialogs/dialoghistory.h index 65dc1c1ce..bd650452e 100644 --- a/dialogs/dialoghistory.h +++ b/dialogs/dialoghistory.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index b103273d4..86f2348c6 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogincrements.h b/dialogs/dialogincrements.h index e5ac8262a..a9f5d9e8a 100644 --- a/dialogs/dialogincrements.h +++ b/dialogs/dialogincrements.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogline.cpp b/dialogs/dialogline.cpp index ed6db782e..a94b65fd5 100644 --- a/dialogs/dialogline.cpp +++ b/dialogs/dialogline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogline.h b/dialogs/dialogline.h index 8a19cec33..99bc99d1a 100644 --- a/dialogs/dialogline.h +++ b/dialogs/dialogline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialoglineintersect.cpp b/dialogs/dialoglineintersect.cpp index 9e8d2b8ff..347c45815 100644 --- a/dialogs/dialoglineintersect.cpp +++ b/dialogs/dialoglineintersect.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialoglineintersect.h b/dialogs/dialoglineintersect.h index 5d1ce01c5..34cb19aeb 100644 --- a/dialogs/dialoglineintersect.h +++ b/dialogs/dialoglineintersect.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialognormal.cpp b/dialogs/dialognormal.cpp index c52340ba9..0b467145e 100644 --- a/dialogs/dialognormal.cpp +++ b/dialogs/dialognormal.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialognormal.h b/dialogs/dialognormal.h index f96b5b39e..e1f685e7f 100644 --- a/dialogs/dialognormal.h +++ b/dialogs/dialognormal.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogpointofcontact.cpp b/dialogs/dialogpointofcontact.cpp index d3ba3c5c4..d09b7b021 100644 --- a/dialogs/dialogpointofcontact.cpp +++ b/dialogs/dialogpointofcontact.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogpointofcontact.h b/dialogs/dialogpointofcontact.h index 68ee50e80..003c16001 100644 --- a/dialogs/dialogpointofcontact.h +++ b/dialogs/dialogpointofcontact.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogs.h b/dialogs/dialogs.h index 5d2e93329..82faf687b 100644 --- a/dialogs/dialogs.h +++ b/dialogs/dialogs.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogshoulderpoint.cpp b/dialogs/dialogshoulderpoint.cpp index 0429522ae..9c65ec76a 100644 --- a/dialogs/dialogshoulderpoint.cpp +++ b/dialogs/dialogshoulderpoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogshoulderpoint.h b/dialogs/dialogshoulderpoint.h index ed2cfb1cf..44b315738 100644 --- a/dialogs/dialogshoulderpoint.h +++ b/dialogs/dialogshoulderpoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogsinglepoint.cpp b/dialogs/dialogsinglepoint.cpp index 47ee98d79..c43c04e81 100644 --- a/dialogs/dialogsinglepoint.cpp +++ b/dialogs/dialogsinglepoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogsinglepoint.h b/dialogs/dialogsinglepoint.h index d60f8e2cd..3a4d1b860 100644 --- a/dialogs/dialogsinglepoint.h +++ b/dialogs/dialogsinglepoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogspline.cpp b/dialogs/dialogspline.cpp index 40bbe35db..08f8f331b 100644 --- a/dialogs/dialogspline.cpp +++ b/dialogs/dialogspline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogspline.h b/dialogs/dialogspline.h index 3aaf78a42..310a679dc 100644 --- a/dialogs/dialogspline.h +++ b/dialogs/dialogspline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogsplinepath.cpp b/dialogs/dialogsplinepath.cpp index 848c0e7a9..e3d45bdd0 100644 --- a/dialogs/dialogsplinepath.cpp +++ b/dialogs/dialogsplinepath.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogsplinepath.h b/dialogs/dialogsplinepath.h index 01ab75334..922351a31 100644 --- a/dialogs/dialogsplinepath.h +++ b/dialogs/dialogsplinepath.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogtool.cpp b/dialogs/dialogtool.cpp index de54c2465..c527cb383 100644 --- a/dialogs/dialogtool.cpp +++ b/dialogs/dialogtool.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/dialogs/dialogtool.h b/dialogs/dialogtool.h index 9c418bd3b..02b3d56f6 100644 --- a/dialogs/dialogtool.h +++ b/dialogs/dialogtool.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexception.cpp b/exception/vexception.cpp index ade9cb27d..a32b8ebde 100644 --- a/exception/vexception.cpp +++ b/exception/vexception.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexception.h b/exception/vexception.h index ad21054fb..28fa4c037 100644 --- a/exception/vexception.h +++ b/exception/vexception.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionbadid.cpp b/exception/vexceptionbadid.cpp index 6e6d13691..02bf10a76 100644 --- a/exception/vexceptionbadid.cpp +++ b/exception/vexceptionbadid.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionbadid.h b/exception/vexceptionbadid.h index 47a772c6b..89959d5d8 100644 --- a/exception/vexceptionbadid.h +++ b/exception/vexceptionbadid.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionconversionerror.cpp b/exception/vexceptionconversionerror.cpp index 6fca5172b..487d7ad3b 100644 --- a/exception/vexceptionconversionerror.cpp +++ b/exception/vexceptionconversionerror.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionconversionerror.h b/exception/vexceptionconversionerror.h index 3b011ed07..904093e63 100644 --- a/exception/vexceptionconversionerror.h +++ b/exception/vexceptionconversionerror.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionemptyparameter.cpp b/exception/vexceptionemptyparameter.cpp index b070a682f..31dc1550f 100644 --- a/exception/vexceptionemptyparameter.cpp +++ b/exception/vexceptionemptyparameter.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionemptyparameter.h b/exception/vexceptionemptyparameter.h index 694ab0913..f03be1cec 100644 --- a/exception/vexceptionemptyparameter.h +++ b/exception/vexceptionemptyparameter.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionobjecterror.cpp b/exception/vexceptionobjecterror.cpp index e3f4d833c..11d5be2b6 100644 --- a/exception/vexceptionobjecterror.cpp +++ b/exception/vexceptionobjecterror.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionobjecterror.h b/exception/vexceptionobjecterror.h index ab38f164e..db12bb943 100644 --- a/exception/vexceptionobjecterror.h +++ b/exception/vexceptionobjecterror.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionwrongparameterid.cpp b/exception/vexceptionwrongparameterid.cpp index 59dd94450..1ee8d090b 100644 --- a/exception/vexceptionwrongparameterid.cpp +++ b/exception/vexceptionwrongparameterid.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/exception/vexceptionwrongparameterid.h b/exception/vexceptionwrongparameterid.h index 1c4a9933c..6e81fcb43 100644 --- a/exception/vexceptionwrongparameterid.h +++ b/exception/vexceptionwrongparameterid.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/varc.cpp b/geometry/varc.cpp index 99721616a..cff5c6119 100644 --- a/geometry/varc.cpp +++ b/geometry/varc.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/varc.h b/geometry/varc.h index 964b68a52..1de78e3fd 100644 --- a/geometry/varc.h +++ b/geometry/varc.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vdetail.cpp b/geometry/vdetail.cpp index 9003d35e5..2b4433444 100644 --- a/geometry/vdetail.cpp +++ b/geometry/vdetail.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vdetail.h b/geometry/vdetail.h index cb31ceee8..f042f93a9 100644 --- a/geometry/vdetail.h +++ b/geometry/vdetail.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vnodedetail.cpp b/geometry/vnodedetail.cpp index 50a5b5424..33a5a1407 100644 --- a/geometry/vnodedetail.cpp +++ b/geometry/vnodedetail.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vnodedetail.h b/geometry/vnodedetail.h index d28068ba2..1b433aaa9 100644 --- a/geometry/vnodedetail.h +++ b/geometry/vnodedetail.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index f15abbde9..137a47483 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vspline.h b/geometry/vspline.h index b91d0b88a..55affce82 100644 --- a/geometry/vspline.h +++ b/geometry/vspline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vsplinepath.cpp b/geometry/vsplinepath.cpp index e58269751..bfd448753 100644 --- a/geometry/vsplinepath.cpp +++ b/geometry/vsplinepath.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vsplinepath.h b/geometry/vsplinepath.h index 7a8ba8daa..d8012b1ce 100644 --- a/geometry/vsplinepath.h +++ b/geometry/vsplinepath.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vsplinepoint.cpp b/geometry/vsplinepoint.cpp index ab071e509..93ad612ab 100644 --- a/geometry/vsplinepoint.cpp +++ b/geometry/vsplinepoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/geometry/vsplinepoint.h b/geometry/vsplinepoint.h index ae9ffaeb5..58fb845c8 100644 --- a/geometry/vsplinepoint.h +++ b/geometry/vsplinepoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/main.cpp b/main.cpp index 5f8fea974..0ff386dd9 100644 --- a/main.cpp +++ b/main.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/mainwindow.cpp b/mainwindow.cpp index 30192b049..8da0b92c5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/mainwindow.h b/mainwindow.h index aac755e25..7de1307cf 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/options.h b/options.h index 5e1a70fab..06dcc5a69 100644 --- a/options.h +++ b/options.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/stable.h b/stable.h index fba2585c6..32c6762e7 100644 --- a/stable.h +++ b/stable.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tablewindow.cpp b/tablewindow.cpp index 2e6960987..12ca8f48a 100644 --- a/tablewindow.cpp +++ b/tablewindow.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tablewindow.h b/tablewindow.h index 5c257c379..bda643db8 100644 --- a/tablewindow.h +++ b/tablewindow.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/drawtools.h b/tools/drawTools/drawtools.h index 0b07ebc2b..4889ad878 100644 --- a/tools/drawTools/drawtools.h +++ b/tools/drawTools/drawtools.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index 7a4efffbf..81938c85a 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index a0d037119..c9a05e2f6 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index c155447d2..f4fe35812 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index ca220d8ad..b9a1e16e9 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index a5e845d25..863289812 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index bca594770..fb99e11ed 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index d88229457..5f34e8843 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index f527ce612..90fd1a7f6 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index a4111bd7b..d73906144 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h index 7b9a5e39b..38e637544 100644 --- a/tools/drawTools/vtoolendline.h +++ b/tools/drawTools/vtoolendline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index e8dfef50a..207ff1e81 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index bc9976805..e7ccbfe9f 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 7098b7d3f..38e3cf305 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index 7f143f353..e42cca66c 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index 95303198b..cb30cd388 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoollinepoint.h b/tools/drawTools/vtoollinepoint.h index 51f830bf9..b349fac6c 100644 --- a/tools/drawTools/vtoollinepoint.h +++ b/tools/drawTools/vtoollinepoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 2ff7c233d..25915ee63 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 2a1e14bab..4ac03cff7 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index 41c4ffcff..17bf97489 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index 7583e8e4a..ddbc0159e 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index 0f212993f..a6213071b 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index de7390549..d7720cddc 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index ea04c8889..c344a36f6 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index 9b5942fdc..913fff10c 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index 92898ca84..98cd0bd4f 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index ee9b7bcf3..4571757af 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 00d3478fb..699c8143b 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index f3db13297..ead6779a0 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 1bb2650b9..6eda29244 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index b614f8896..3fbec5490 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h index 1c69603ed..9cf84d9ca 100644 --- a/tools/drawTools/vtooltriangle.h +++ b/tools/drawTools/vtooltriangle.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/modelingtools.h b/tools/modelingTools/modelingtools.h index 2fbf1dfad..b7c755edc 100644 --- a/tools/modelingTools/modelingtools.h +++ b/tools/modelingTools/modelingtools.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index 58f746530..8678c20b6 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h index 582a1aebe..5f47e88d9 100644 --- a/tools/modelingTools/vmodelingalongline.h +++ b/tools/modelingTools/vmodelingalongline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index 2e4b54c08..f2cc19d4d 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index af1c5394b..e7d0f1401 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index f42616157..830ef7447 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index ae10c2a36..f672e9c55 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index a45cc8ba2..475ec9b3c 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index 27b771fc0..fd81cd062 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h index 42e6ec2c2..f9fbdd7ab 100644 --- a/tools/modelingTools/vmodelingheight.h +++ b/tools/modelingTools/vmodelingheight.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index a0a881429..92e556189 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index 48dc239a6..98ec7041f 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index 0ae7c31a3..5464fc9b4 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h index 8808613b3..b090e5a2e 100644 --- a/tools/modelingTools/vmodelinglineintersect.h +++ b/tools/modelingTools/vmodelinglineintersect.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelinglinepoint.cpp b/tools/modelingTools/vmodelinglinepoint.cpp index 36b3239a7..361144935 100644 --- a/tools/modelingTools/vmodelinglinepoint.cpp +++ b/tools/modelingTools/vmodelinglinepoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelinglinepoint.h b/tools/modelingTools/vmodelinglinepoint.h index f3aede417..2fc252b99 100644 --- a/tools/modelingTools/vmodelinglinepoint.h +++ b/tools/modelingTools/vmodelinglinepoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index 495bf935d..5943e8e5c 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index 8adf0abbb..4e21102d5 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingpoint.cpp b/tools/modelingTools/vmodelingpoint.cpp index 5e78b7b65..cfa4ec3f9 100644 --- a/tools/modelingTools/vmodelingpoint.cpp +++ b/tools/modelingTools/vmodelingpoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h index 1531cdb56..6a68b5d80 100644 --- a/tools/modelingTools/vmodelingpoint.h +++ b/tools/modelingTools/vmodelingpoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index c0024457f..8758a4c52 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index 4aca22725..0f1516a67 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index 737b6222a..c18ab5003 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index ec5e74727..679d5e85c 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index 915c01d9b..b2df795d0 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index fb75685b3..49e9f3da8 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 141fa444d..0c95438fc 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index 823e6cfd5..4cb25f16d 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingtool.cpp b/tools/modelingTools/vmodelingtool.cpp index 58d420c5f..fd38f2088 100644 --- a/tools/modelingTools/vmodelingtool.cpp +++ b/tools/modelingTools/vmodelingtool.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingtool.h b/tools/modelingTools/vmodelingtool.h index 359f7555a..ff7b4da89 100644 --- a/tools/modelingTools/vmodelingtool.h +++ b/tools/modelingTools/vmodelingtool.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/modelingTools/vmodelingtriangle.h b/tools/modelingTools/vmodelingtriangle.h index 4ae18f5cc..a9f5176ec 100644 --- a/tools/modelingTools/vmodelingtriangle.h +++ b/tools/modelingTools/vmodelingtriangle.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/nodedetails.h b/tools/nodeDetails/nodedetails.h index a331e94b2..e9ed16c37 100644 --- a/tools/nodeDetails/nodedetails.h +++ b/tools/nodeDetails/nodedetails.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vabstractnode.cpp b/tools/nodeDetails/vabstractnode.cpp index ddd667825..1f4bab332 100644 --- a/tools/nodeDetails/vabstractnode.cpp +++ b/tools/nodeDetails/vabstractnode.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vabstractnode.h b/tools/nodeDetails/vabstractnode.h index adc93c20d..85d0a714c 100644 --- a/tools/nodeDetails/vabstractnode.h +++ b/tools/nodeDetails/vabstractnode.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodearc.cpp b/tools/nodeDetails/vnodearc.cpp index a7f6913a6..bc43e151b 100644 --- a/tools/nodeDetails/vnodearc.cpp +++ b/tools/nodeDetails/vnodearc.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index 9c072e176..e4a214928 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index 0d8355e8f..b5d568743 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index 3ef5ae177..783023fee 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index b48470f83..2614ab2f3 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h index 2399d26e4..47513764e 100644 --- a/tools/nodeDetails/vnodespline.h +++ b/tools/nodeDetails/vnodespline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index f476cb11a..8dd7f4e37 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index 9541a805e..40d85b582 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/tools.h b/tools/tools.h index 0c2a63142..998771f91 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index 49350a622..f932b0e06 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 8b70a3258..a57b5f254 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/vdatatool.cpp b/tools/vdatatool.cpp index 4c6bab8cc..60dba8c40 100644 --- a/tools/vdatatool.cpp +++ b/tools/vdatatool.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/vdatatool.h b/tools/vdatatool.h index 2234f557f..f0519762f 100644 --- a/tools/vdatatool.h +++ b/tools/vdatatool.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 560659796..1b85a6a3a 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/tools/vtooldetail.h b/tools/vtooldetail.h index a0441e48f..bca7778f5 100644 --- a/tools/vtooldetail.h +++ b/tools/vtooldetail.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vapplication.cpp b/widgets/vapplication.cpp index e78345d00..e53617b6f 100644 --- a/widgets/vapplication.cpp +++ b/widgets/vapplication.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vcontrolpointspline.cpp b/widgets/vcontrolpointspline.cpp index 8daf75079..cda4f792d 100644 --- a/widgets/vcontrolpointspline.cpp +++ b/widgets/vcontrolpointspline.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vcontrolpointspline.h b/widgets/vcontrolpointspline.h index 977d246e0..9ed7e1cbb 100644 --- a/widgets/vcontrolpointspline.h +++ b/widgets/vcontrolpointspline.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vgraphicssimpletextitem.cpp b/widgets/vgraphicssimpletextitem.cpp index d0b9bb3f7..52a74973e 100644 --- a/widgets/vgraphicssimpletextitem.cpp +++ b/widgets/vgraphicssimpletextitem.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vgraphicssimpletextitem.h b/widgets/vgraphicssimpletextitem.h index 6f9dc20ef..61bcd9471 100644 --- a/widgets/vgraphicssimpletextitem.h +++ b/widgets/vgraphicssimpletextitem.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vitem.cpp b/widgets/vitem.cpp index 4f4b58f4a..d9b508003 100644 --- a/widgets/vitem.cpp +++ b/widgets/vitem.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vitem.h b/widgets/vitem.h index 7317bb315..ccf47413f 100644 --- a/widgets/vitem.h +++ b/widgets/vitem.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp index d81f3c53e..dc3010ca0 100644 --- a/widgets/vmaingraphicsscene.cpp +++ b/widgets/vmaingraphicsscene.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h index ecf28a06d..63522396e 100644 --- a/widgets/vmaingraphicsscene.h +++ b/widgets/vmaingraphicsscene.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vmaingraphicsview.cpp b/widgets/vmaingraphicsview.cpp index 6de8dc1b6..acfca1764 100644 --- a/widgets/vmaingraphicsview.cpp +++ b/widgets/vmaingraphicsview.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vmaingraphicsview.h b/widgets/vmaingraphicsview.h index df53f39cb..d0035c7de 100644 --- a/widgets/vmaingraphicsview.h +++ b/widgets/vmaingraphicsview.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vtablegraphicsview.cpp b/widgets/vtablegraphicsview.cpp index 0fa974bda..609bb1ec3 100644 --- a/widgets/vtablegraphicsview.cpp +++ b/widgets/vtablegraphicsview.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/widgets/vtablegraphicsview.h b/widgets/vtablegraphicsview.h index d1f2363a2..8b52ac2a7 100644 --- a/widgets/vtablegraphicsview.h +++ b/widgets/vtablegraphicsview.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/xml/vdomdocument.cpp b/xml/vdomdocument.cpp index 1e2d048dc..7dc3e5807 100644 --- a/xml/vdomdocument.cpp +++ b/xml/vdomdocument.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/xml/vdomdocument.h b/xml/vdomdocument.h index 4f3ce2564..8f9f5709d 100644 --- a/xml/vdomdocument.h +++ b/xml/vdomdocument.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/xml/vtoolrecord.cpp b/xml/vtoolrecord.cpp index 64bd06127..881a484d9 100644 --- a/xml/vtoolrecord.cpp +++ b/xml/vtoolrecord.cpp @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. diff --git a/xml/vtoolrecord.h b/xml/vtoolrecord.h index add61c98a..ce598c1e0 100644 --- a/xml/vtoolrecord.h +++ b/xml/vtoolrecord.h @@ -9,7 +9,7 @@ ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** - ** Tox is distributed in the hope that it will be useful, + ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. From 8e07ed5fd4aa2b0e7f7821ec3361c51120bb2517 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 27 Oct 2013 15:50:00 +0200 Subject: [PATCH 62/70] Refactoring. --HG-- branch : develop --- tools/drawTools/vdrawtool.cpp | 2 +- version.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index 81938c85a..933dbdba2 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -88,7 +88,7 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement){ calcElement.insertAfter(domElement,refElement); doc->setCursor(0); } else { - qCritical()<<"Не можу знайти елемент після якого потрібно вставляти."<< Q_FUNC_INFO; + qCritical()< Date: Mon, 28 Oct 2013 17:45:27 +0200 Subject: [PATCH 63/70] Refactoring. --HG-- branch : develop --- geometry/vspline.cpp | 74 ++++++++++++++--------------- geometry/vspline.h | 18 +++---- mainwindow.cpp | 11 ++--- tools/drawTools/vdrawtool.h | 12 +++++ tools/drawTools/vtoolalongline.cpp | 1 - tools/drawTools/vtoolarc.cpp | 25 ++++------ tools/drawTools/vtoolline.cpp | 23 +++------ tools/drawTools/vtoollinepoint.cpp | 6 +-- tools/drawTools/vtoolpoint.cpp | 43 ++++++----------- tools/drawTools/vtoolspline.cpp | 28 ++++------- tools/drawTools/vtoolsplinepath.cpp | 28 ++++------- tools/drawTools/vtooltriangle.cpp | 2 +- tools/vtooldetail.cpp | 5 +- 13 files changed, 115 insertions(+), 161 deletions(-) diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 137a47483..1273a7f30 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -586,44 +586,44 @@ QPainterPath VSpline::GetPath() const{ 2 - 1 real root + complex roots imaginary part is zero (i.e. 2 real roots). */ -qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){ - qreal q,r,r2,q3; +//qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){ +// qreal q,r,r2,q3; - q = (a*a - 3.*b)/9.; - r = (a*(2.*a*a - 9.*b) + 27.*c)/54.; - r2 = r*r; - q3 = pow(q,3); - if(r2GetNameActivDraw(); QInputDialog *dlg = new QInputDialog(this); @@ -206,9 +206,8 @@ void MainWindow::OptionDraw(){ } template -void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &cursor, - const QString &toolTip, QSharedPointer &dialog, - Func closeDialogSlot){ +void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &cursor, const QString &toolTip, + QSharedPointer &dialog, Func closeDialogSlot){ if(checked){ CanselTool(); tool = t; @@ -223,14 +222,14 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList); } else { if(QToolButton *tButton = qobject_cast< QToolButton * >(this->sender())){ + Q_ASSERT(tButton != 0); tButton->setChecked(true); } } } template -void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, - const qint64 &idDetail){ +void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail){ QHash* tools = doc->getTools(); VToolDetail *det = qobject_cast(tools->value(idDetail)); Q_ASSERT(det != 0); diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index c9a05e2f6..da654fb42 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -99,6 +99,18 @@ protected: } } } + template + void ShowItem(Item *item, qint64 id, Qt::GlobalColor color, bool enable){ + Q_ASSERT(item != 0); + if(id == item->id){ + if(enable == false){ + currentColor = baseColor; + } else { + currentColor = color; + } + item->setPen(QPen(currentColor, widthHairLine/factor)); + } + } }; #endif // VDRAWTOOL_H diff --git a/tools/drawTools/vtoolalongline.cpp b/tools/drawTools/vtoolalongline.cpp index f4fe35812..8bfebd8a3 100644 --- a/tools/drawTools/vtoolalongline.cpp +++ b/tools/drawTools/vtoolalongline.cpp @@ -56,7 +56,6 @@ void VToolAlongLine::FullUpdateFromGui(int result){ domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId())); emit FullUpdateTree(); } - } dialogAlongLine.clear(); } diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index 863289812..f73d8f4bc 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -125,31 +125,22 @@ void VToolArc::FullUpdateFromGui(int result){ } void VToolArc::ChangedActivDraw(const QString newName){ + bool selectable = false; if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); + selectable = true; currentColor = Qt::black; - VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, false); - this->setAcceptHoverEvents (false); + selectable = false; currentColor = Qt::gray; - VDrawTool::ChangedActivDraw(newName); } + this->setPen(QPen(currentColor, widthHairLine/factor)); + this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); + this->setAcceptHoverEvents (selectable); + VDrawTool::ChangedActivDraw(newName); } void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ - if(id == this->id){ - if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine/factor)); - currentColor = baseColor; - } else { - this->setPen(QPen(color, widthHairLine/factor)); - currentColor = color; - } - } + ShowItem(this, id, color, enable); } void VToolArc::SetFactor(qreal factor){ diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 207ff1e81..62236ecca 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -100,15 +100,7 @@ void VToolLine::FullUpdateFromGui(int result){ } void VToolLine::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ - if(id == this->id){ - if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine/factor)); - currentColor = baseColor; - } else { - this->setPen(QPen(color, widthHairLine/factor)); - currentColor = color; - } - } + ShowItem(this, id, color, enable); } void VToolLine::SetFactor(qreal factor){ @@ -117,24 +109,23 @@ void VToolLine::SetFactor(qreal factor){ } void VToolLine::ChangedActivDraw(const QString newName){ + bool selectable = false; if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine/factor)); - this->setAcceptHoverEvents (true); + selectable = true; currentColor = Qt::black; - VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine/factor)); - this->setAcceptHoverEvents (false); + selectable = false; currentColor = Qt::gray; - VDrawTool::ChangedActivDraw(newName); } + this->setPen(QPen(currentColor, widthHairLine/factor)); + this->setAcceptHoverEvents (selectable); + VDrawTool::ChangedActivDraw(newName); } void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ ContextMenu(dialogLine, this, event); } - void VToolLine::AddToFile(){ QDomElement domElement = doc->createElement("line"); AddAttribute(domElement, "id", id); diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index cb30cd388..e7742599e 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -41,14 +41,12 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 void VToolLinePoint::ChangedActivDraw(const QString newName){ if(nameActivDraw == newName){ - mainLine->setPen(QPen(Qt::black, widthHairLine/factor)); currentColor = Qt::black; - VToolPoint::ChangedActivDraw(newName); } else { - mainLine->setPen(QPen(Qt::gray, widthHairLine/factor)); currentColor = Qt::gray; - VToolPoint::ChangedActivDraw(newName); } + mainLine->setPen(QPen(currentColor, widthHairLine/factor)); + VToolPoint::ChangedActivDraw(newName); } void VToolLinePoint::RefreshGeometry(){ diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index 17bf97489..eb53afb10 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -54,43 +54,28 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my){ } void VToolPoint::ChangedActivDraw(const QString newName){ + bool selectable = false; if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); - namePoint->setFlag(QGraphicsItem::ItemIsMovable, true); - namePoint->setFlag(QGraphicsItem::ItemIsSelectable, true); - namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); - namePoint->setBrush(QBrush(Qt::black)); - namePoint->setAcceptHoverEvents(true); - lineName->setPen(QPen(Qt::black, widthHairLine/factor)); + selectable = true; currentColor = Qt::black; - VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, false); - this->setAcceptHoverEvents (false); - namePoint->setFlag(QGraphicsItem::ItemIsMovable, false); - namePoint->setFlag(QGraphicsItem::ItemIsSelectable, false); - namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); - namePoint->setBrush(QBrush(Qt::gray)); - namePoint->setAcceptHoverEvents(false); - lineName->setPen(QPen(Qt::gray, widthHairLine/factor)); + selectable = false; currentColor = Qt::gray; - VDrawTool::ChangedActivDraw(newName); } + this->setPen(QPen(currentColor, widthHairLine/factor)); + this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); + this->setAcceptHoverEvents (selectable); + namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable); + namePoint->setFlag(QGraphicsItem::ItemIsSelectable, selectable); + namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable); + namePoint->setBrush(QBrush(currentColor)); + namePoint->setAcceptHoverEvents(selectable); + lineName->setPen(QPen(currentColor, widthHairLine/factor)); + VDrawTool::ChangedActivDraw(newName); } void VToolPoint::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ - if(id == this->id){ - if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine/factor)); - currentColor = baseColor; - } else { - this->setPen(QPen(color, widthHairLine/factor)); - currentColor = color; - } - } + ShowItem(this, id, color, enable); } void VToolPoint::SetFactor(qreal factor){ diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index 699c8143b..a38b40740 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -246,33 +246,23 @@ void VToolSpline::RefreshGeometry(){ void VToolSpline::ChangedActivDraw(const QString newName){ + bool selectable = false; if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); + selectable = true; currentColor = Qt::black; - emit setEnabledPoint(true); - VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, false); - this->setAcceptHoverEvents (false); + selectable = false; currentColor = Qt::gray; - emit setEnabledPoint(false); - VDrawTool::ChangedActivDraw(newName); } + this->setPen(QPen(currentColor, widthHairLine/factor)); + this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); + this->setAcceptHoverEvents (selectable); + emit setEnabledPoint(selectable); + VDrawTool::ChangedActivDraw(newName); } void VToolSpline::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ - if(id == this->id){ - if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine/factor)); - currentColor = baseColor; - } else { - this->setPen(QPen(color, widthHairLine/factor)); - currentColor = color; - } - } + ShowItem(this, id, color, enable); } void VToolSpline::SetFactor(qreal factor){ diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 6eda29244..301dc0520 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -187,33 +187,23 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){ } void VToolSplinePath::ChangedActivDraw(const QString newName){ + bool selectable = false; if(nameActivDraw == newName){ - this->setPen(QPen(Qt::black, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, true); - this->setAcceptHoverEvents(true); + selectable = true; currentColor = Qt::black; - emit setEnabledPoint(true); - VDrawTool::ChangedActivDraw(newName); } else { - this->setPen(QPen(Qt::gray, widthHairLine/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, false); - this->setAcceptHoverEvents (false); + selectable = false; currentColor = Qt::gray; - emit setEnabledPoint(false); - VDrawTool::ChangedActivDraw(newName); } + this->setPen(QPen(currentColor, widthHairLine/factor)); + this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); + this->setAcceptHoverEvents (selectable); + emit setEnabledPoint(selectable); + VDrawTool::ChangedActivDraw(newName); } void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ - if(id == this->id){ - if(enable == false){ - this->setPen(QPen(baseColor, widthHairLine/factor)); - currentColor = baseColor; - } else { - this->setPen(QPen(color, widthHairLine/factor)); - currentColor = color; - } - } + ShowItem(this, id, color, enable); } void VToolSplinePath::SetFactor(qreal factor){ diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp index 79fd2c3d2..260961412 100644 --- a/tools/drawTools/vtooltriangle.cpp +++ b/tools/drawTools/vtooltriangle.cpp @@ -95,8 +95,8 @@ QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, con } } if(c*c < a*a + b*b){ - return line.p2(); qWarning()<()), - sceneDetails(scene){ + VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), + QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){ VDetail detail = data->GetDetail(id); QHash* tools = doc->getTools(); Q_ASSERT(tools != 0); From f9f724fcabcf40a224ecdd9043f80ddadd0b1922 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 28 Oct 2013 19:27:31 +0200 Subject: [PATCH 64/70] Refactoring. --HG-- branch : develop --- dialogs/dialogsinglepoint.cpp | 19 +++++++++---------- mainwindow.cpp | 11 +++++------ tablewindow.cpp | 2 +- tools/drawTools/vtoolbisector.cpp | 11 +++++------ tools/drawTools/vtoolshoulderpoint.cpp | 4 ++-- tools/modelingTools/vmodelingarc.cpp | 10 +++------- tools/modelingTools/vmodelingbisector.cpp | 6 +++--- .../modelingTools/vmodelinglineintersect.cpp | 4 ++-- tools/modelingTools/vmodelingnormal.cpp | 4 ++-- .../modelingTools/vmodelingpointofcontact.cpp | 4 ++-- .../modelingTools/vmodelingshoulderpoint.cpp | 4 ++-- widgets/vcontrolpointspline.cpp | 2 +- 12 files changed, 37 insertions(+), 44 deletions(-) diff --git a/dialogs/dialogsinglepoint.cpp b/dialogs/dialogsinglepoint.cpp index c43c04e81..9bb6914d1 100644 --- a/dialogs/dialogsinglepoint.cpp +++ b/dialogs/dialogsinglepoint.cpp @@ -26,8 +26,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()), point(QPointF()){ ui->setupUi(this); - ui->doubleSpinBoxX->setRange(0,PaperSize/PrintDPI*25.4); - ui->doubleSpinBoxY->setRange(0,PaperSize/PrintDPI*25.4); + ui->doubleSpinBoxX->setRange(0,toMM(PaperSize)); + ui->doubleSpinBoxY->setRange(0,toMM(PaperSize)); bOk = ui->buttonBox->button(QDialogButtonBox::Ok); labelEditNamePoint = ui->labelEditName; flagName = false; @@ -40,18 +40,17 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) : void DialogSinglePoint::mousePress(QPointF scenePos){ if(isInitialized == false){ - ui->doubleSpinBoxX->setValue(scenePos.x()/PrintDPI*25.4); - ui->doubleSpinBoxY->setValue(scenePos.y()/PrintDPI*25.4); + ui->doubleSpinBoxX->setValue(toMM(scenePos.x())); + ui->doubleSpinBoxY->setValue(toMM(scenePos.y())); this->show(); } else { - ui->doubleSpinBoxX->setValue(scenePos.x()/PrintDPI*25.4); - ui->doubleSpinBoxY->setValue(scenePos.y()/PrintDPI*25.4); + ui->doubleSpinBoxX->setValue(toMM(scenePos.x())); + ui->doubleSpinBoxY->setValue(toMM(scenePos.y())); } } void DialogSinglePoint::DialogAccepted(){ - point = QPointF(ui->doubleSpinBoxX->value()*PrintDPI/25.4, - ui->doubleSpinBoxY->value()*PrintDPI/25.4); + point = QPointF(toPixel(ui->doubleSpinBoxX->value()), toPixel(ui->doubleSpinBoxY->value())); name = ui->lineEditName->text(); emit DialogClosed(QDialog::Accepted); } @@ -61,8 +60,8 @@ void DialogSinglePoint::setData(const QString name, const QPointF point){ this->point = point; isInitialized = true; ui->lineEditName->setText(name); - ui->doubleSpinBoxX->setValue(point.x()/PrintDPI*25.4); - ui->doubleSpinBoxY->setValue(point.y()/PrintDPI*25.4); + ui->doubleSpinBoxX->setValue(toMM(point.x())); + ui->doubleSpinBoxY->setValue(toMM(point.y())); } DialogSinglePoint::~DialogSinglePoint(){ diff --git a/mainwindow.cpp b/mainwindow.cpp index 622c1adbc..25a070910 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -151,12 +151,11 @@ void MainWindow::ActionNewDraw(){ comboBoxDraws->setCurrentIndex(index); currentDrawChanged( index ); } - connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::currentDrawChanged); + connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), this, + &MainWindow::currentDrawChanged); data->ClearObject(); //Create single point - qint64 id = data->AddPoint(VPointF((10+comboBoxDraws->count()*5)*PrintDPI/25.4, 10*PrintDPI/25.4, "А", 5, - 10)); + qint64 id = data->AddPoint(VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); VToolSinglePoint *spoint = new VToolSinglePoint(doc, data, id, Tool::FromGui); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); @@ -664,8 +663,8 @@ void MainWindow::currentDrawChanged( int index ){ void MainWindow::mouseMove(QPointF scenePos){ QString string = QString("%1, %2") - .arg(static_cast(scenePos.x()/PrintDPI*25.4)) - .arg(static_cast(scenePos.y()/PrintDPI*25.4)); + .arg(static_cast(toMM(scenePos.x()))) + .arg(static_cast(toMM(scenePos.y()))); mouseCoordinate->setText(string); } diff --git a/tablewindow.cpp b/tablewindow.cpp index 12ca8f48a..c23c5c1f1 100644 --- a/tablewindow.cpp +++ b/tablewindow.cpp @@ -35,7 +35,7 @@ TableWindow::TableWindow(QWidget *parent) : ui->statusBar->addWidget(numberDetal); ui->statusBar->addWidget(colission); outItems = collidingItems = false; - //sceneRect = QRectF(0, 0, 203*PrintDPI/25.4, 287*PrintDPI/25.4); + //sceneRect = QRectF(0, 0, toPixel(203), toPixel(287)); sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171)); currentScene = new QGraphicsScene(sceneRect); QBrush *brush = new QBrush(); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 5f34e8843..5be60dd00 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -90,7 +90,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ QPointF fPoint = VToolBisector::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - thirdPoint.toQPointF(), result*PrintDPI/25.4); + thirdPoint.toQPointF(), toPixel(result)); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); @@ -104,9 +104,8 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 } VDrawTool::AddRecord(id, Tool::BisectorTool, doc); if(parse == Document::FullParse){ - VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, - firstPointId, secondPointId, thirdPointId, - typeCreation); + VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, + thirdPointId, typeCreation); scene->addItem(point); connect(point, &VToolBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); @@ -163,8 +162,8 @@ void VToolBisector::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "bisector"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index c344a36f6..ec4749c51 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -53,7 +53,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li QLineF line = QLineF(p1Line, p2Line); qreal dist = line.length(); if(dist>length){ - qDebug()<<"A3П2="<AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index f2cc19d4d..575dbcf7e 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -25,14 +25,10 @@ VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer()){ - VArc arc = data->GetModelingArc(id); - QPainterPath path; - path.addPath(arc.GetPath()); - path.setFillRule( Qt::WindingFill ); - this->setPath(path); - this->setPen(QPen(Qt::black, widthHairLine)); + this->setPen(QPen(baseColor, widthHairLine)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); + RefreshGeometry(); if(typeCreation == Tool::FromGui){ AddToFile(); @@ -68,7 +64,7 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const QString errorMsg; qreal result = cal.eval(radius, &errorMsg); if(errorMsg.isEmpty()){ - calcRadius = result*PrintDPI/25.4; + calcRadius = toPixel(result); } errorMsg.clear(); diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index 830ef7447..9a2a2349b 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -78,7 +78,7 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo qreal result = cal.eval(formula, &errorMsg); if(errorMsg.isEmpty()){ QPointF fPoint = VToolBisector::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(), - thirdPoint.toQPointF(), result*PrintDPI/25.4); + thirdPoint.toQPointF(), toPixel(result)); qint64 id = _id; if(typeCreation == Tool::FromGui){ id = data->AddModelingPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); @@ -140,8 +140,8 @@ void VModelingBisector::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "bisector"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index 5464fc9b4..611749379 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -135,8 +135,8 @@ void VModelingLineIntersect::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "lineIntersect"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "p1Line1", p1Line1); AddAttribute(domElement, "p2Line1", p2Line1); diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index 5943e8e5c..72ebc2b65 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -135,8 +135,8 @@ void VModelingNormal::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "normal"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index 8758a4c52..9ea8c6935 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -134,8 +134,8 @@ void VModelingPointOfContact::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "pointOfContact"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "radius", radius); AddAttribute(domElement, "center", center); diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index c18ab5003..ebb6e38df 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -140,8 +140,8 @@ void VModelingShoulderPoint::AddToFile(){ AddAttribute(domElement, "id", id); AddAttribute(domElement, "type", "shoulder"); AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4); - AddAttribute(domElement, "my", point.my()/PrintDPI*25.4); + AddAttribute(domElement, "mx", toMM(point.mx())); + AddAttribute(domElement, "my", toMM(point.my())); AddAttribute(domElement, "typeLine", typeLine); AddAttribute(domElement, "length", formula); diff --git a/widgets/vcontrolpointspline.cpp b/widgets/vcontrolpointspline.cpp index cda4f792d..4e3e378b9 100644 --- a/widgets/vcontrolpointspline.cpp +++ b/widgets/vcontrolpointspline.cpp @@ -24,7 +24,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint, QGraphicsItem *parent):QGraphicsEllipseItem(parent), - radius(1.5*PrintDPI/25.4), controlLine(0), indexSpline(indexSpline), position(position){ + radius(toPixel(1.5)), controlLine(0), indexSpline(indexSpline), position(position){ //create circle QRectF rec = QRectF(0, 0, radius*2, radius*2); rec.translate(-rec.center().x(), -rec.center().y()); From 1539ba0c476cfb174f7fdd48228a1a49a6ad9ac1 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 29 Oct 2013 15:45:07 +0200 Subject: [PATCH 65/70] Static attribute of xml. --HG-- branch : develop --- tools/drawTools/vdrawtool.cpp | 2 +- tools/drawTools/vtoolalongline.cpp | 40 +++++---- tools/drawTools/vtoolalongline.h | 1 + tools/drawTools/vtoolarc.cpp | 25 +++--- tools/drawTools/vtoolarc.h | 2 + tools/drawTools/vtoolbisector.cpp | 46 +++++----- tools/drawTools/vtoolbisector.h | 1 + tools/drawTools/vtoolendline.cpp | 40 +++++---- tools/drawTools/vtoolendline.h | 1 + tools/drawTools/vtoolheight.cpp | 40 +++++---- tools/drawTools/vtoolheight.h | 1 + tools/drawTools/vtoolline.cpp | 18 ++-- tools/drawTools/vtoolline.h | 1 + tools/drawTools/vtoollineintersect.cpp | 40 +++++---- tools/drawTools/vtoollineintersect.h | 1 + tools/drawTools/vtoollinepoint.cpp | 4 +- tools/drawTools/vtoolnormal.cpp | 46 +++++----- tools/drawTools/vtoolnormal.h | 1 + tools/drawTools/vtoolpoint.cpp | 6 +- tools/drawTools/vtoolpoint.h | 1 + tools/drawTools/vtoolpointofcontact.cpp | 40 +++++---- tools/drawTools/vtoolpointofcontact.h | 1 + tools/drawTools/vtoolpointofintersection.cpp | 28 +++--- tools/drawTools/vtoolpointofintersection.h | 1 + tools/drawTools/vtoolshoulderpoint.cpp | 47 +++++----- tools/drawTools/vtoolshoulderpoint.h | 1 + tools/drawTools/vtoolsinglepoint.cpp | 28 +++--- tools/drawTools/vtoolsinglepoint.h | 1 + tools/drawTools/vtoolspline.cpp | 47 +++++----- tools/drawTools/vtoolspline.h | 2 + tools/drawTools/vtoolsplinepath.cpp | 33 +++---- tools/drawTools/vtoolsplinepath.h | 2 + tools/drawTools/vtooltriangle.cpp | 40 +++++---- tools/drawTools/vtooltriangle.h | 1 + tools/modelingTools/vmodelingalongline.cpp | 40 +++++---- tools/modelingTools/vmodelingalongline.h | 1 + tools/modelingTools/vmodelingarc.cpp | 25 +++--- tools/modelingTools/vmodelingarc.h | 2 + tools/modelingTools/vmodelingbisector.cpp | 46 +++++----- tools/modelingTools/vmodelingbisector.h | 1 + tools/modelingTools/vmodelingendline.cpp | 40 +++++---- tools/modelingTools/vmodelingendline.h | 1 + tools/modelingTools/vmodelingheight.cpp | 40 +++++---- tools/modelingTools/vmodelingheight.h | 1 + tools/modelingTools/vmodelingline.cpp | 18 ++-- tools/modelingTools/vmodelingline.h | 2 + .../modelingTools/vmodelinglineintersect.cpp | 40 +++++---- tools/modelingTools/vmodelinglineintersect.h | 1 + tools/modelingTools/vmodelinglinepoint.cpp | 4 +- tools/modelingTools/vmodelingnormal.cpp | 46 +++++----- tools/modelingTools/vmodelingnormal.h | 1 + tools/modelingTools/vmodelingpoint.cpp | 6 +- tools/modelingTools/vmodelingpoint.h | 1 + .../modelingTools/vmodelingpointofcontact.cpp | 40 +++++---- tools/modelingTools/vmodelingpointofcontact.h | 1 + .../vmodelingpointofintersection.cpp | 28 +++--- .../vmodelingpointofintersection.h | 1 + .../modelingTools/vmodelingshoulderpoint.cpp | 46 +++++----- tools/modelingTools/vmodelingshoulderpoint.h | 1 + tools/modelingTools/vmodelingspline.cpp | 52 +++++------ tools/modelingTools/vmodelingspline.h | 2 + tools/modelingTools/vmodelingsplinepath.cpp | 33 +++---- tools/modelingTools/vmodelingsplinepath.h | 2 + tools/modelingTools/vmodelingtriangle.cpp | 68 +++++++-------- tools/modelingTools/vmodelingtriangle.h | 1 + tools/nodeDetails/vabstractnode.cpp | 13 ++- tools/nodeDetails/vabstractnode.h | 4 + tools/nodeDetails/vnodearc.cpp | 15 ++-- tools/nodeDetails/vnodearc.h | 2 + tools/nodeDetails/vnodepoint.cpp | 23 ++--- tools/nodeDetails/vnodepoint.h | 2 + tools/nodeDetails/vnodespline.cpp | 15 ++-- tools/nodeDetails/vnodespline.h | 2 + tools/nodeDetails/vnodesplinepath.cpp | 15 ++-- tools/nodeDetails/vnodesplinepath.h | 2 + tools/vabstracttool.cpp | 66 ++++++++------ tools/vabstracttool.h | 55 ++++++++++-- tools/vtooldetail.cpp | 86 +++++++++++-------- tools/vtooldetail.h | 9 ++ 79 files changed, 845 insertions(+), 644 deletions(-) diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp index 933dbdba2..b6290d45a 100644 --- a/tools/drawTools/vdrawtool.cpp +++ b/tools/drawTools/vdrawtool.cpp @@ -92,7 +92,7 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement){ } } } else { - qCritical()<<"Can't find tag Calculation"<< Q_FUNC_INFO; + qCritical()<elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } RefreshGeometry(); } @@ -49,11 +51,11 @@ void VToolAlongLine::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogAlongLine->getPointName()); - domElement.setAttribute("typeLine", dialogAlongLine->getTypeLine()); - domElement.setAttribute("length", dialogAlongLine->getFormula()); - domElement.setAttribute("firstPoint", QString().setNum(dialogAlongLine->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId())); + domElement.setAttribute(AttrName, dialogAlongLine->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine()); + domElement.setAttribute(AttrLength, dialogAlongLine->getFormula()); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId())); emit FullUpdateTree(); } } @@ -71,18 +73,18 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolAlongLine::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "alongLine"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "firstPoint", basePointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrFirstPoint, basePointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h index b9a1e16e9..35734aab9 100644 --- a/tools/drawTools/vtoolalongline.h +++ b/tools/drawTools/vtoolalongline.h @@ -38,6 +38,7 @@ public: const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index f73d8f4bc..149560c3d 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -22,6 +22,9 @@ #include "vtoolarc.h" #include "container/calculator.h" +const QString VToolArc::TagName = QStringLiteral("arc"); +const QString VToolArc::ToolType = QStringLiteral("simple"); + VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer()){ @@ -114,10 +117,10 @@ void VToolArc::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter())); - domElement.setAttribute("radius", dialogArc->GetRadius()); - domElement.setAttribute("angle1", dialogArc->GetF1()); - domElement.setAttribute("angle2", dialogArc->GetF2()); + domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter())); + domElement.setAttribute(AttrRadius, dialogArc->GetRadius()); + domElement.setAttribute(AttrAngle1, dialogArc->GetF1()); + domElement.setAttribute(AttrAngle2, dialogArc->GetF2()); emit FullUpdateTree(); } } @@ -154,14 +157,14 @@ void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolArc::AddToFile(){ VArc arc = VAbstractTool::data.GetArc(id); - QDomElement domElement = doc->createElement("arc"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "simple"); - AddAttribute(domElement, "center", arc.GetCenter()); - AddAttribute(domElement, "radius", arc.GetFormulaRadius()); - AddAttribute(domElement, "angle1", arc.GetFormulaF1()); - AddAttribute(domElement, "angle2", arc.GetFormulaF2()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrCenter, arc.GetCenter()); + AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius()); + AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1()); + AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2()); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h index fb99e11ed..a743b96e1 100644 --- a/tools/drawTools/vtoolarc.h +++ b/tools/drawTools/vtoolarc.h @@ -38,6 +38,8 @@ public: static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp index 5be60dd00..9e21737ab 100644 --- a/tools/drawTools/vtoolbisector.cpp +++ b/tools/drawTools/vtoolbisector.cpp @@ -22,6 +22,8 @@ #include "vtoolbisector.h" #include +const QString VToolBisector::ToolType = QStringLiteral("bisector"); + VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, @@ -121,11 +123,11 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 void VToolBisector::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - basePointId = domElement.attribute("secondPoint", "").toLongLong(); - thirdPointId = domElement.attribute("thirdPoint", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong(); } RefreshGeometry(); } @@ -134,12 +136,12 @@ void VToolBisector::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogBisector->getPointName()); - domElement.setAttribute("typeLine", dialogBisector->getTypeLine()); - domElement.setAttribute("length", dialogBisector->getFormula()); - domElement.setAttribute("firstPoint", QString().setNum(dialogBisector->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogBisector->getSecondPointId())); - domElement.setAttribute("thirdPoint", QString().setNum(dialogBisector->getThirdPointId())); + domElement.setAttribute(AttrName, dialogBisector->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine()); + domElement.setAttribute(AttrLength, dialogBisector->getFormula()); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId())); + domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId())); emit FullUpdateTree(); } } @@ -157,19 +159,19 @@ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolBisector::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "bisector"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", basePointId); - AddAttribute(domElement, "thirdPoint", thirdPointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, basePointId); + AddAttribute(domElement, AttrThirdPoint, thirdPointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h index 90fd1a7f6..6e0603f01 100644 --- a/tools/drawTools/vtoolbisector.h +++ b/tools/drawTools/vtoolbisector.h @@ -40,6 +40,7 @@ public: const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp index d73906144..d2b58d931 100644 --- a/tools/drawTools/vtoolendline.cpp +++ b/tools/drawTools/vtoolendline.cpp @@ -23,6 +23,8 @@ #include "widgets/vmaingraphicsscene.h" #include +const QString VToolEndLine::ToolType = QStringLiteral("endLine"); + VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, Tool::Sources typeCreation, QGraphicsItem *parent): @@ -96,10 +98,10 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr void VToolEndLine::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("basePoint", "").toLongLong(); - angle = domElement.attribute("angle", "").toInt(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); + angle = domElement.attribute(AttrAngle, "").toInt(); } RefreshGeometry(); } @@ -112,11 +114,11 @@ void VToolEndLine::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogEndLine->getPointName()); - domElement.setAttribute("typeLine", dialogEndLine->getTypeLine()); - domElement.setAttribute("length", dialogEndLine->getFormula()); - domElement.setAttribute("angle", QString().setNum(dialogEndLine->getAngle())); - domElement.setAttribute("basePoint", QString().setNum(dialogEndLine->getBasePointId())); + domElement.setAttribute(AttrName, dialogEndLine->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine()); + domElement.setAttribute(AttrLength, dialogEndLine->getFormula()); + domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle())); + domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId())); emit FullUpdateTree(); } } @@ -125,18 +127,18 @@ void VToolEndLine::FullUpdateFromGui(int result){ void VToolEndLine::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "endLine"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "angle", angle); - AddAttribute(domElement, "basePoint", basePointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrAngle, angle); + AddAttribute(domElement, AttrBasePoint, basePointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h index 38e637544..75ce3cfeb 100644 --- a/tools/drawTools/vtoolendline.h +++ b/tools/drawTools/vtoolendline.h @@ -38,6 +38,7 @@ public: const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolheight.cpp b/tools/drawTools/vtoolheight.cpp index 3779eebfe..0ab9ff998 100644 --- a/tools/drawTools/vtoolheight.cpp +++ b/tools/drawTools/vtoolheight.cpp @@ -1,5 +1,7 @@ #include "vtoolheight.h" +const QString VToolHeight::ToolType = QStringLiteral("height"); + VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, Tool::Sources typeCreation, QGraphicsItem * parent) @@ -90,10 +92,10 @@ QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point){ void VToolHeight::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - basePointId = domElement.attribute("basePoint", "").toLongLong(); - p1LineId = domElement.attribute("p1Line", "").toLongLong(); - p2LineId = domElement.attribute("p2Line", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); + p1LineId = domElement.attribute(AttrP1Line, "").toLongLong(); + p2LineId = domElement.attribute(AttrP2Line, "").toLongLong(); } RefreshGeometry(); @@ -103,11 +105,11 @@ void VToolHeight::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogHeight->getPointName()); - domElement.setAttribute("typeLine", dialogHeight->getTypeLine()); - domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId())); - domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId())); - domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId())); + domElement.setAttribute(AttrName, dialogHeight->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine()); + domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId())); + domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId())); + domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId())); emit FullUpdateTree(); } } @@ -120,18 +122,18 @@ void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolHeight::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "height"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "basePoint", basePointId); - AddAttribute(domElement, "p1Line", p1LineId); - AddAttribute(domElement, "p2Line", p2LineId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrBasePoint, basePointId); + AddAttribute(domElement, AttrP1Line, p1LineId); + AddAttribute(domElement, AttrP2Line, p2LineId); AddToCalculation(domElement); diff --git a/tools/drawTools/vtoolheight.h b/tools/drawTools/vtoolheight.h index 197909888..06158aca4 100644 --- a/tools/drawTools/vtoolheight.h +++ b/tools/drawTools/vtoolheight.h @@ -39,6 +39,7 @@ public: const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); static QPointF FindPoint(const QLineF &line, const QPointF &point); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp index 62236ecca..98d24fb94 100644 --- a/tools/drawTools/vtoolline.cpp +++ b/tools/drawTools/vtoolline.cpp @@ -21,6 +21,8 @@ #include "vtoolline.h" +const QString VToolLine::TagName = QStringLiteral("line"); + VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint), @@ -91,8 +93,8 @@ void VToolLine::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("firstPoint", QString().setNum(dialogLine->getFirstPoint())); - domElement.setAttribute("secondPoint", QString().setNum(dialogLine->getSecondPoint())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint())); emit FullUpdateTree(); } } @@ -127,10 +129,10 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ } void VToolLine::AddToFile(){ - QDomElement domElement = doc->createElement("line"); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "firstPoint", firstPoint); - AddAttribute(domElement, "secondPoint", secondPoint); + QDomElement domElement = doc->createElement(TagName); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrFirstPoint, firstPoint); + AddAttribute(domElement, AttrSecondPoint, secondPoint); AddToCalculation(domElement); } @@ -153,8 +155,8 @@ void VToolLine::RemoveReferens(){ void VToolLine::RefreshGeometry(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - firstPoint = domElement.attribute("firstPoint", "").toLongLong(); - secondPoint = domElement.attribute("secondPoint", "").toLongLong(); + firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong(); } VPointF first = VAbstractTool::data.GetPoint(firstPoint); VPointF second = VAbstractTool::data.GetPoint(secondPoint); diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h index e7ccbfe9f..c88e6fb21 100644 --- a/tools/drawTools/vtoolline.h +++ b/tools/drawTools/vtoolline.h @@ -37,6 +37,7 @@ public: static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; public slots: virtual void FullUpdateFromFile(); virtual void ChangedActivDraw(const QString newName); diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp index 38e3cf305..b0eb6696a 100644 --- a/tools/drawTools/vtoollineintersect.cpp +++ b/tools/drawTools/vtoollineintersect.cpp @@ -21,6 +21,8 @@ #include "vtoollineintersect.h" +const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); + VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, Tool::Sources typeCreation, @@ -109,10 +111,10 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const void VToolLineIntersect::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - p1Line1 = domElement.attribute("p1Line1", "").toLongLong(); - p2Line1 = domElement.attribute("p2Line1", "").toLongLong(); - p1Line2 = domElement.attribute("p1Line2", "").toLongLong(); - p2Line2 = domElement.attribute("p2Line2", "").toLongLong(); + p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong(); + p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong(); + p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong(); + p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong(); } RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); } @@ -121,11 +123,11 @@ void VToolLineIntersect::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogLineIntersect->getPointName()); - domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1())); - domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1())); - domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2())); - domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2())); + domElement.setAttribute(AttrName, dialogLineIntersect->getPointName()); + domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1())); + domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1())); + domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2())); + domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2())); emit FullUpdateTree(); } } @@ -143,18 +145,18 @@ void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLineIntersect::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "lineIntersect"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "p1Line1", p1Line1); - AddAttribute(domElement, "p2Line1", p2Line1); - AddAttribute(domElement, "p1Line2", p1Line2); - AddAttribute(domElement, "p2Line2", p2Line2); + AddAttribute(domElement, AttrP1Line1, p1Line1); + AddAttribute(domElement, AttrP2Line1, p2Line1); + AddAttribute(domElement, AttrP1Line2, p1Line2); + AddAttribute(domElement, AttrP2Line2, p2Line2); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h index e42cca66c..2cea55c28 100644 --- a/tools/drawTools/vtoollineintersect.h +++ b/tools/drawTools/vtoollineintersect.h @@ -38,6 +38,7 @@ public: const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp index e7742599e..3c5c11785 100644 --- a/tools/drawTools/vtoollinepoint.cpp +++ b/tools/drawTools/vtoollinepoint.cpp @@ -32,7 +32,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); mainLine->setPen(QPen(Qt::black, widthHairLine/factor)); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); - if(typeLine == "none"){ + if(typeLine == TypeLineNone){ mainLine->setVisible(false); } else { mainLine->setVisible(true); @@ -55,7 +55,7 @@ void VToolLinePoint::RefreshGeometry(){ QPointF point = VDrawTool::data.GetPoint(id).toQPointF(); QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF(); mainLine->setLine(QLineF(basePoint - point, QPointF())); - if(typeLine == "none"){ + if(typeLine == TypeLineNone){ mainLine->setVisible(false); } else { mainLine->setVisible(true); diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp index 25915ee63..0dd4fd809 100644 --- a/tools/drawTools/vtoolnormal.cpp +++ b/tools/drawTools/vtoolnormal.cpp @@ -22,6 +22,8 @@ #include "vtoolnormal.h" #include +const QString VToolNormal::ToolType = QStringLiteral("normal"); + VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent): @@ -110,11 +112,11 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP void VToolNormal::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); - angle = domElement.attribute("angle", "").toDouble(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + angle = domElement.attribute(AttrAngle, "").toDouble(); } RefreshGeometry(); } @@ -123,12 +125,12 @@ void VToolNormal::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogNormal->getPointName()); - domElement.setAttribute("typeLine", dialogNormal->getTypeLine()); - domElement.setAttribute("length", dialogNormal->getFormula()); - domElement.setAttribute("angle", QString().setNum(dialogNormal->getAngle())); - domElement.setAttribute("firstPoint", QString().setNum(dialogNormal->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogNormal->getSecondPointId())); + domElement.setAttribute(AttrName, dialogNormal->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine()); + domElement.setAttribute(AttrLength, dialogNormal->getFormula()); + domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId())); emit FullUpdateTree(); } } @@ -146,19 +148,19 @@ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolNormal::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "normal"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "angle", angle); - AddAttribute(domElement, "firstPoint", basePointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrAngle, angle); + AddAttribute(domElement, AttrFirstPoint, basePointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h index 4ac03cff7..3370d2c90 100644 --- a/tools/drawTools/vtoolnormal.h +++ b/tools/drawTools/vtoolnormal.h @@ -41,6 +41,7 @@ public: Tool::Sources typeCreation); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length, const qreal &angle = 0); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp index eb53afb10..fc94cd91a 100644 --- a/tools/drawTools/vtoolpoint.cpp +++ b/tools/drawTools/vtoolpoint.cpp @@ -21,6 +21,8 @@ #include "vtoolpoint.h" +const QString VToolPoint::TagName = QStringLiteral("point"); + VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0){ @@ -47,8 +49,8 @@ void VToolPoint::NameChangePosition(const QPointF pos){ void VToolPoint::UpdateNamePosition(qreal mx, qreal my){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("mx", QString().setNum(toMM(mx))); - domElement.setAttribute("my", QString().setNum(toMM(my))); + domElement.setAttribute(AttrMx, QString().setNum(toMM(mx))); + domElement.setAttribute(AttrMy, QString().setNum(toMM(my))); emit toolhaveChange(); } } diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h index ddbc0159e..924f5c593 100644 --- a/tools/drawTools/vtoolpoint.h +++ b/tools/drawTools/vtoolpoint.h @@ -30,6 +30,7 @@ class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{ public: VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); virtual ~VToolPoint(){} + static const QString TagName; public slots: void NameChangePosition(const QPointF pos); virtual void ChangedActivDraw(const QString newName); diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index a6213071b..f068aecb2 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -22,6 +22,8 @@ #include "vtoolpointofcontact.h" #include +const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); + VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, @@ -128,10 +130,10 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const void VToolPointOfContact::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - radius = domElement.attribute("radius", ""); - center = domElement.attribute("center", "").toLongLong(); - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + radius = domElement.attribute(AttrRadius, ""); + center = domElement.attribute(AttrCenter, "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); } @@ -140,11 +142,11 @@ void VToolPointOfContact::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogPointOfContact->getPointName()); - domElement.setAttribute("radius", dialogPointOfContact->getRadius()); - domElement.setAttribute("center", QString().setNum(dialogPointOfContact->getCenter())); - domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfContact->getFirstPoint())); - domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfContact->getSecondPoint())); + domElement.setAttribute(AttrName, dialogPointOfContact->getPointName()); + domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius()); + domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint())); emit FullUpdateTree(); } } @@ -162,18 +164,18 @@ void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event void VToolPointOfContact::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "pointOfContact"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "radius", radius); - AddAttribute(domElement, "center", center); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrRadius, radius); + AddAttribute(domElement, AttrCenter, center); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h index d7720cddc..852329aa5 100644 --- a/tools/drawTools/vtoolpointofcontact.h +++ b/tools/drawTools/vtoolpointofcontact.h @@ -40,6 +40,7 @@ public: const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolpointofintersection.cpp b/tools/drawTools/vtoolpointofintersection.cpp index 10ef3c214..ceff574c3 100644 --- a/tools/drawTools/vtoolpointofintersection.cpp +++ b/tools/drawTools/vtoolpointofintersection.cpp @@ -1,5 +1,7 @@ #include "vtoolpointofintersection.h" +const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); + VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent) @@ -61,8 +63,8 @@ void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName void VToolPointOfIntersection::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); } @@ -71,9 +73,9 @@ void VToolPointOfIntersection::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogPointOfIntersection->getPointName()); - domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId())); + domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName()); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId())); emit FullUpdateTree(); } } @@ -91,16 +93,16 @@ void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent * void VToolPointOfIntersection::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "pointOfIntersection"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolpointofintersection.h b/tools/drawTools/vtoolpointofintersection.h index 7737d45a5..6aa69cd3c 100644 --- a/tools/drawTools/vtoolpointofintersection.h +++ b/tools/drawTools/vtoolpointofintersection.h @@ -17,6 +17,7 @@ public: const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index ec4749c51..77b2510e9 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -20,9 +20,10 @@ ****************************************************************************/ #include "vtoolshoulderpoint.h" -#include #include +const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); + VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, @@ -129,11 +130,11 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const void VToolShoulderPoint::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("p1Line", "").toLongLong(); - p2Line = domElement.attribute("p2Line", "").toLongLong(); - pShoulder = domElement.attribute("pShoulder", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrP1Line, "").toLongLong(); + p2Line = domElement.attribute(AttrP2Line, "").toLongLong(); + pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong(); } RefreshGeometry(); } @@ -142,12 +143,12 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogShoulderPoint->getPointName()); - domElement.setAttribute("typeLine", dialogShoulderPoint->getTypeLine()); - domElement.setAttribute("length", dialogShoulderPoint->getFormula()); - domElement.setAttribute("p1Line", QString().setNum(dialogShoulderPoint->getP1Line())); - domElement.setAttribute("p2Line", QString().setNum(dialogShoulderPoint->getP2Line())); - domElement.setAttribute("pShoulder", QString().setNum(dialogShoulderPoint->getPShoulder())); + domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine()); + domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula()); + domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line())); + domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line())); + domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder())); emit FullUpdateTree(); } } @@ -165,19 +166,19 @@ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolShoulderPoint::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "shoulder"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "p1Line", basePointId); - AddAttribute(domElement, "p2Line", p2Line); - AddAttribute(domElement, "pShoulder", pShoulder); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrP1Line, basePointId); + AddAttribute(domElement, AttrP2Line, p2Line); + AddAttribute(domElement, AttrPShoulder, pShoulder); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h index 913fff10c..c56277620 100644 --- a/tools/drawTools/vtoolshoulderpoint.h +++ b/tools/drawTools/vtoolshoulderpoint.h @@ -39,6 +39,7 @@ public: const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp index 98cd0bd4f..79f39759e 100644 --- a/tools/drawTools/vtoolsinglepoint.cpp +++ b/tools/drawTools/vtoolsinglepoint.cpp @@ -21,6 +21,8 @@ #include "vtoolsinglepoint.h" +const QString VToolSinglePoint::ToolType = QStringLiteral("single"); + VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), dialogSinglePoint(QSharedPointer()){ @@ -42,15 +44,15 @@ void VToolSinglePoint::setDialog(){ void VToolSinglePoint::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "single"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "x", toMM(point.x())); - AddAttribute(domElement, "y", toMM(point.y())); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrX, toMM(point.x())); + AddAttribute(domElement, AttrY, toMM(point.y())); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); AddToCalculation(domElement); } @@ -72,8 +74,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, QPointF newPos = value.toPointF(); QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("x", QString().setNum(toMM(newPos.x()))); - domElement.setAttribute("y", QString().setNum(toMM(newPos.y()))); + domElement.setAttribute(AttrX, QString().setNum(toMM(newPos.x()))); + domElement.setAttribute(AttrY, QString().setNum(toMM(newPos.y()))); //I don't now why but signal does not work. doc->FullUpdateTree(); } @@ -101,9 +103,9 @@ void VToolSinglePoint::FullUpdateFromGui(int result){ QString name = dialogSinglePoint->getName(); QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", name); - domElement.setAttribute("x", QString().setNum(toMM(p.x()))); - domElement.setAttribute("y", QString().setNum(toMM(p.y()))); + domElement.setAttribute(AttrName, name); + domElement.setAttribute(AttrX, QString().setNum(toMM(p.x()))); + domElement.setAttribute(AttrY, QString().setNum(toMM(p.y()))); //I don't now why but signal does not work. doc->FullUpdateTree(); } diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h index 4571757af..65b9365cc 100644 --- a/tools/drawTools/vtoolsinglepoint.h +++ b/tools/drawTools/vtoolsinglepoint.h @@ -31,6 +31,7 @@ public: VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); virtual void setDialog(); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index a38b40740..60ed17a35 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -20,9 +20,10 @@ ****************************************************************************/ #include "vtoolspline.h" -#include #include "geometry/vspline.h" +const QString VToolSpline::TagName = QStringLiteral("spline"); +const QString VToolSpline::ToolType = QStringLiteral("simple"); VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, @@ -141,13 +142,13 @@ void VToolSpline::FullUpdateFromGui(int result){ controlPoints[1]->pos(), dialogSpline->getP4(), dialogSpline->getKCurve()); QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("point1", QString().setNum(spl.GetP1())); - domElement.setAttribute("point4", QString().setNum(spl.GetP4())); - domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1())); - domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2())); - domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1())); - domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2())); - domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve())); + domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1())); + domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4())); + domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); + domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); + domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); + domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); + domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); emit FullUpdateTree(); } } @@ -165,11 +166,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo } QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1())); - domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2())); - domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1())); - domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2())); - domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve())); + domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); + domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); + domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); + domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); + domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); emit FullUpdateTree(); } } @@ -180,17 +181,17 @@ void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolSpline::AddToFile(){ VSpline spl = VAbstractTool::data.GetSpline(id); - QDomElement domElement = doc->createElement("spline"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "simple"); - AddAttribute(domElement, "point1", spl.GetP1()); - AddAttribute(domElement, "point4", spl.GetP4()); - AddAttribute(domElement, "angle1", spl.GetAngle1()); - AddAttribute(domElement, "angle2", spl.GetAngle2()); - AddAttribute(domElement, "kAsm1", spl.GetKasm1()); - AddAttribute(domElement, "kAsm2", spl.GetKasm2()); - AddAttribute(domElement, "kCurve", spl.GetKcurve()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrPoint1, spl.GetP1()); + AddAttribute(domElement, AttrPoint4, spl.GetP4()); + AddAttribute(domElement, AttrAngle1, spl.GetAngle1()); + AddAttribute(domElement, AttrAngle2, spl.GetAngle2()); + AddAttribute(domElement, AttrKAsm1, spl.GetKasm1()); + AddAttribute(domElement, AttrKAsm2, spl.GetKasm2()); + AddAttribute(domElement, AttrKCurve, spl.GetKcurve()); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h index ead6779a0..a298b7ae4 100644 --- a/tools/drawTools/vtoolspline.h +++ b/tools/drawTools/vtoolspline.h @@ -40,6 +40,8 @@ public: const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; signals: void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint ); diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 301dc0520..3e8cb0bee 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -21,6 +21,9 @@ #include "vtoolsplinepath.h" +const QString VToolSplinePath::TagName = QStringLiteral("spline"); +const QString VToolSplinePath::ToolType = QStringLiteral("path"); + VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), @@ -129,7 +132,7 @@ void VToolSplinePath::FullUpdateFromGui(int result){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve())); + domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); } @@ -152,7 +155,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, Spli CorectControlPoints(spl, splPath, indexSpline); QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve())); + domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); } @@ -178,10 +181,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){ QDomElement domElement = nodeList.at(i).toElement(); if(!domElement.isNull()){ VSplinePoint p = path[i]; - domElement.setAttribute("pSpline", QString().setNum(p.P())); - domElement.setAttribute("kAsm1", QString().setNum(p.KAsm1())); - domElement.setAttribute("kAsm2", QString().setNum(p.KAsm2())); - domElement.setAttribute("angle", QString().setNum(p.Angle2())); + domElement.setAttribute(AttrPSpline, QString().setNum(p.P())); + domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1())); + domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2())); + domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2())); } } } @@ -217,11 +220,11 @@ void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolSplinePath::AddToFile(){ VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); - QDomElement domElement = doc->createElement("spline"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "path"); - AddAttribute(domElement, "kCurve", splPath.getKCurve()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrKCurve, splPath.getKCurve()); for(qint32 i = 0; i < splPath.CountPoint(); ++i){ AddPathPoint(domElement, splPath[i]); @@ -231,12 +234,12 @@ void VToolSplinePath::AddToFile(){ } void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){ - QDomElement pathPoint = doc->createElement("pathPoint"); + QDomElement pathPoint = doc->createElement(AttrPathPoint); - AddAttribute(pathPoint, "pSpline", splPoint.P()); - AddAttribute(pathPoint, "kAsm1", splPoint.KAsm1()); - AddAttribute(pathPoint, "kAsm2", splPoint.KAsm2()); - AddAttribute(pathPoint, "angle", splPoint.Angle2()); + AddAttribute(pathPoint, AttrPSpline, splPoint.P()); + AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); + AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); + AddAttribute(pathPoint, AttrAngle, splPoint.Angle2()); domElement.appendChild(pathPoint); } diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h index 3fbec5490..3bc9974e5 100644 --- a/tools/drawTools/vtoolsplinepath.h +++ b/tools/drawTools/vtoolsplinepath.h @@ -38,6 +38,8 @@ public: static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp index 260961412..6c9c74b3b 100644 --- a/tools/drawTools/vtooltriangle.cpp +++ b/tools/drawTools/vtooltriangle.cpp @@ -1,5 +1,7 @@ #include "vtooltriangle.h" +const QString VToolTriangle::ToolType = QStringLiteral("triangle"); + VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent) @@ -104,10 +106,10 @@ QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, con void VToolTriangle::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - axisP1Id = domElement.attribute("axisP1", "").toLongLong(); - axisP2Id = domElement.attribute("axisP2", "").toLongLong(); - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong(); + axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id)); } @@ -116,11 +118,11 @@ void VToolTriangle::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogTriangle->getPointName()); - domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id())); - domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id())); - domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId())); + domElement.setAttribute(AttrName, dialogTriangle->getPointName()); + domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id())); + domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId())); emit FullUpdateTree(); } @@ -141,18 +143,18 @@ void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolTriangle::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "triangle"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "axisP1", axisP1Id); - AddAttribute(domElement, "axisP2", axisP2Id); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrAxisP1, axisP1Id); + AddAttribute(domElement, AttrAxisP2, axisP2Id); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h index 9cf84d9ca..63b07c06a 100644 --- a/tools/drawTools/vtooltriangle.h +++ b/tools/drawTools/vtooltriangle.h @@ -40,6 +40,7 @@ public: const Document::Documents &parse, Tool::Sources typeCreation); static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, const QPointF secondPoint); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp index 8678c20b6..30da7536d 100644 --- a/tools/modelingTools/vmodelingalongline.cpp +++ b/tools/modelingTools/vmodelingalongline.cpp @@ -22,6 +22,8 @@ #include "vmodelingalongline.h" #include "container/calculator.h" +const QString VModelingAlongLine::ToolType = QStringLiteral("alongLine"); + VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, @@ -37,10 +39,10 @@ VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint void VModelingAlongLine::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } RefreshGeometry(); } @@ -49,11 +51,11 @@ void VModelingAlongLine::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogAlongLine->getPointName()); - domElement.setAttribute("typeLine", dialogAlongLine->getTypeLine()); - domElement.setAttribute("length", dialogAlongLine->getFormula()); - domElement.setAttribute("firstPoint", QString().setNum(dialogAlongLine->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId())); + domElement.setAttribute(AttrName, dialogAlongLine->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine()); + domElement.setAttribute(AttrLength, dialogAlongLine->getFormula()); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId())); emit FullUpdateTree(); } @@ -67,18 +69,18 @@ void VModelingAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VModelingAlongLine::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "alongLine"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "firstPoint", basePointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrFirstPoint, basePointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h index 5f47e88d9..eceb805b3 100644 --- a/tools/modelingTools/vmodelingalongline.h +++ b/tools/modelingTools/vmodelingalongline.h @@ -38,6 +38,7 @@ public: const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index 575dbcf7e..6181db5c7 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -22,6 +22,9 @@ #include "vmodelingarc.h" #include "container/calculator.h" +const QString VModelingArc::TagName = QStringLiteral("arc"); +const QString VModelingArc::ToolType = QStringLiteral("simple"); + VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer()){ @@ -106,10 +109,10 @@ void VModelingArc::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter())); - domElement.setAttribute("radius", dialogArc->GetRadius()); - domElement.setAttribute("angle1", dialogArc->GetF1()); - domElement.setAttribute("angle2", dialogArc->GetF2()); + domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter())); + domElement.setAttribute(AttrRadius, dialogArc->GetRadius()); + domElement.setAttribute(AttrAngle1, dialogArc->GetF1()); + domElement.setAttribute(AttrAngle2, dialogArc->GetF2()); emit FullUpdateTree(); } } @@ -122,14 +125,14 @@ void VModelingArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VModelingArc::AddToFile(){ VArc arc = VAbstractTool::data.GetModelingArc(id); - QDomElement domElement = doc->createElement("arc"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "simple"); - AddAttribute(domElement, "center", arc.GetCenter()); - AddAttribute(domElement, "radius", arc.GetFormulaRadius()); - AddAttribute(domElement, "angle1", arc.GetFormulaF1()); - AddAttribute(domElement, "angle2", arc.GetFormulaF2()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrCenter, arc.GetCenter()); + AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius()); + AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1()); + AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2()); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h index e7d0f1401..18c20f897 100644 --- a/tools/modelingTools/vmodelingarc.h +++ b/tools/modelingTools/vmodelingarc.h @@ -37,6 +37,8 @@ public: static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp index 9a2a2349b..fa84f937b 100644 --- a/tools/modelingTools/vmodelingbisector.cpp +++ b/tools/modelingTools/vmodelingbisector.cpp @@ -23,6 +23,8 @@ #include "../drawTools/vtoolbisector.h" #include +const QString VModelingBisector::ToolType = QStringLiteral("bisector"); + VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, @@ -104,11 +106,11 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo void VModelingBisector::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - basePointId = domElement.attribute("secondPoint", "").toLongLong(); - thirdPointId = domElement.attribute("thirdPoint", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong(); } RefreshGeometry(); } @@ -117,12 +119,12 @@ void VModelingBisector::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogBisector->getPointName()); - domElement.setAttribute("typeLine", dialogBisector->getTypeLine()); - domElement.setAttribute("length", dialogBisector->getFormula()); - domElement.setAttribute("firstPoint", QString().setNum(dialogBisector->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogBisector->getSecondPointId())); - domElement.setAttribute("thirdPoint", QString().setNum(dialogBisector->getThirdPointId())); + domElement.setAttribute(AttrName, dialogBisector->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine()); + domElement.setAttribute(AttrLength, dialogBisector->getFormula()); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId())); + domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId())); emit FullUpdateTree(); } } @@ -135,19 +137,19 @@ void VModelingBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VModelingBisector::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "bisector"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", basePointId); - AddAttribute(domElement, "thirdPoint", thirdPointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, basePointId); + AddAttribute(domElement, AttrThirdPoint, thirdPointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h index f672e9c55..2a84ac1fc 100644 --- a/tools/modelingTools/vmodelingbisector.h +++ b/tools/modelingTools/vmodelingbisector.h @@ -39,6 +39,7 @@ public: const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp index 475ec9b3c..fa4b51f5f 100644 --- a/tools/modelingTools/vmodelingendline.cpp +++ b/tools/modelingTools/vmodelingendline.cpp @@ -22,6 +22,8 @@ #include "vmodelingendline.h" #include +const QString VModelingEndLine::ToolType = QStringLiteral("endLine"); + VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, Tool::Sources typeCreation, @@ -91,10 +93,10 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin void VModelingEndLine::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("basePoint", "").toLongLong(); - angle = domElement.attribute("angle", "").toDouble(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); + angle = domElement.attribute(AttrAngle, "").toDouble(); } RefreshGeometry(); } @@ -107,11 +109,11 @@ void VModelingEndLine::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogEndLine->getPointName()); - domElement.setAttribute("typeLine", dialogEndLine->getTypeLine()); - domElement.setAttribute("length", dialogEndLine->getFormula()); - domElement.setAttribute("angle", QString().setNum(dialogEndLine->getAngle())); - domElement.setAttribute("basePoint", QString().setNum(dialogEndLine->getBasePointId())); + domElement.setAttribute(AttrName, dialogEndLine->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine()); + domElement.setAttribute(AttrLength, dialogEndLine->getFormula()); + domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle())); + domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId())); emit FullUpdateTree(); } } @@ -120,18 +122,18 @@ void VModelingEndLine::FullUpdateFromGui(int result){ void VModelingEndLine::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "endLine"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "angle", angle); - AddAttribute(domElement, "basePoint", basePointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrAngle, angle); + AddAttribute(domElement, AttrBasePoint, basePointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h index fd81cd062..edf57b266 100644 --- a/tools/modelingTools/vmodelingendline.h +++ b/tools/modelingTools/vmodelingendline.h @@ -38,6 +38,7 @@ public: const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingheight.cpp b/tools/modelingTools/vmodelingheight.cpp index 46e3d3565..cbf87545f 100644 --- a/tools/modelingTools/vmodelingheight.cpp +++ b/tools/modelingTools/vmodelingheight.cpp @@ -1,6 +1,8 @@ #include "vmodelingheight.h" #include "../drawTools/vtoolheight.h" +const QString VModelingHeight::ToolType = QStringLiteral("height"); + VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, Tool::Sources typeCreation, @@ -71,10 +73,10 @@ VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointN void VModelingHeight::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - basePointId = domElement.attribute("basePoint", "").toLongLong(); - p1LineId = domElement.attribute("p1Line", "").toLongLong(); - p2LineId = domElement.attribute("p2Line", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); + p1LineId = domElement.attribute(AttrP1Line, "").toLongLong(); + p2LineId = domElement.attribute(AttrP2Line, "").toLongLong(); } RefreshGeometry(); } @@ -83,11 +85,11 @@ void VModelingHeight::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogHeight->getPointName()); - domElement.setAttribute("typeLine", dialogHeight->getTypeLine()); - domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId())); - domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId())); - domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId())); + domElement.setAttribute(AttrName, dialogHeight->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine()); + domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId())); + domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId())); + domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId())); emit FullUpdateTree(); } } @@ -100,18 +102,18 @@ void VModelingHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VModelingHeight::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "endLine"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "basePoint", basePointId); - AddAttribute(domElement, "p1Line", p1LineId); - AddAttribute(domElement, "p2Line", p2LineId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrBasePoint, basePointId); + AddAttribute(domElement, AttrP1Line, p1LineId); + AddAttribute(domElement, AttrP2Line, p2LineId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h index f9fbdd7ab..7ad09f6e3 100644 --- a/tools/modelingTools/vmodelingheight.h +++ b/tools/modelingTools/vmodelingheight.h @@ -38,6 +38,7 @@ public: const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp index 92e556189..6acd7cdd7 100644 --- a/tools/modelingTools/vmodelingline.cpp +++ b/tools/modelingTools/vmodelingline.cpp @@ -21,6 +21,8 @@ #include "vmodelingline.h" +const QString VModelingLine::TagName = QStringLiteral("line"); + VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent): VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), @@ -79,8 +81,8 @@ VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint void VModelingLine::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - firstPoint = domElement.attribute("firstPoint", "").toLongLong(); - secondPoint = domElement.attribute("secondPoint", "").toLongLong(); + firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong(); } VPointF first = VAbstractTool::data.GetModelingPoint(firstPoint); VPointF second = VAbstractTool::data.GetModelingPoint(secondPoint); @@ -91,8 +93,8 @@ void VModelingLine::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("firstPoint", QString().setNum(dialogLine->getFirstPoint())); - domElement.setAttribute("secondPoint", QString().setNum(dialogLine->getSecondPoint())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint())); emit FullUpdateTree(); } } @@ -104,10 +106,10 @@ void VModelingLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ } void VModelingLine::AddToFile(){ - QDomElement domElement = doc->createElement("line"); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "firstPoint", firstPoint); - AddAttribute(domElement, "secondPoint", secondPoint); + QDomElement domElement = doc->createElement(TagName); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrFirstPoint, firstPoint); + AddAttribute(domElement, AttrSecondPoint, secondPoint); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h index 98ec7041f..8bee26207 100644 --- a/tools/modelingTools/vmodelingline.h +++ b/tools/modelingTools/vmodelingline.h @@ -36,6 +36,8 @@ public: static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp index 611749379..af78014b6 100644 --- a/tools/modelingTools/vmodelinglineintersect.cpp +++ b/tools/modelingTools/vmodelinglineintersect.cpp @@ -21,6 +21,8 @@ #include "vmodelinglineintersect.h" +const QString VModelingLineIntersect::ToolType = QStringLiteral("lineIntersect"); + VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent): @@ -101,10 +103,10 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q void VModelingLineIntersect::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - p1Line1 = domElement.attribute("p1Line1", "").toLongLong(); - p2Line1 = domElement.attribute("p2Line1", "").toLongLong(); - p1Line2 = domElement.attribute("p1Line2", "").toLongLong(); - p2Line2 = domElement.attribute("p2Line2", "").toLongLong(); + p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong(); + p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong(); + p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong(); + p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong(); } RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id)); } @@ -113,11 +115,11 @@ void VModelingLineIntersect::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogLineIntersect->getPointName()); - domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1())); - domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1())); - domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2())); - domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2())); + domElement.setAttribute(AttrName, dialogLineIntersect->getPointName()); + domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1())); + domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1())); + domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2())); + domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2())); emit FullUpdateTree(); } } @@ -130,18 +132,18 @@ void VModelingLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev void VModelingLineIntersect::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "lineIntersect"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "p1Line1", p1Line1); - AddAttribute(domElement, "p2Line1", p2Line1); - AddAttribute(domElement, "p1Line2", p1Line2); - AddAttribute(domElement, "p2Line2", p2Line2); + AddAttribute(domElement, AttrP1Line1, p1Line1); + AddAttribute(domElement, AttrP2Line1, p2Line1); + AddAttribute(domElement, AttrP1Line2, p1Line2); + AddAttribute(domElement, AttrP2Line2, p2Line2); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h index b090e5a2e..7051104d1 100644 --- a/tools/modelingTools/vmodelinglineintersect.h +++ b/tools/modelingTools/vmodelinglineintersect.h @@ -39,6 +39,7 @@ public: const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelinglinepoint.cpp b/tools/modelingTools/vmodelinglinepoint.cpp index 361144935..e8c05adb2 100644 --- a/tools/modelingTools/vmodelinglinepoint.cpp +++ b/tools/modelingTools/vmodelinglinepoint.cpp @@ -32,7 +32,7 @@ VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, cons mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); mainLine->setPen(QPen(Qt::black, widthHairLine)); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); - if(typeLine == "none"){ + if(typeLine == TypeLineNone){ mainLine->setVisible(false); } else { mainLine->setVisible(true); @@ -44,7 +44,7 @@ void VModelingLinePoint::RefreshGeometry(){ QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF(); QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF(); mainLine->setLine(QLineF(basePoint - point, QPointF())); - if(typeLine == "none"){ + if(typeLine == TypeLineNone){ mainLine->setVisible(false); } else { mainLine->setVisible(true); diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp index 72ebc2b65..c9a9c2cad 100644 --- a/tools/modelingTools/vmodelingnormal.cpp +++ b/tools/modelingTools/vmodelingnormal.cpp @@ -23,6 +23,8 @@ #include "../drawTools/vtoolnormal.h" #include +const QString VModelingNormal::ToolType = QStringLiteral("normal"); + VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, @@ -99,11 +101,11 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul void VModelingNormal::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); - angle = domElement.attribute("angle", "").toInt(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + angle = domElement.attribute(AttrAngle, "").toInt(); } RefreshGeometry(); } @@ -112,12 +114,12 @@ void VModelingNormal::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogNormal->getPointName()); - domElement.setAttribute("typeLine", dialogNormal->getTypeLine()); - domElement.setAttribute("length", dialogNormal->getFormula()); - domElement.setAttribute("angle", QString().setNum(dialogNormal->getAngle())); - domElement.setAttribute("firstPoint", QString().setNum(dialogNormal->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogNormal->getSecondPointId())); + domElement.setAttribute(AttrName, dialogNormal->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine()); + domElement.setAttribute(AttrLength, dialogNormal->getFormula()); + domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId())); emit FullUpdateTree(); } } @@ -130,19 +132,19 @@ void VModelingNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VModelingNormal::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "normal"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "angle", angle); - AddAttribute(domElement, "firstPoint", basePointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrAngle, angle); + AddAttribute(domElement, AttrFirstPoint, basePointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h index 4e21102d5..c1ef9c146 100644 --- a/tools/modelingTools/vmodelingnormal.h +++ b/tools/modelingTools/vmodelingnormal.h @@ -38,6 +38,7 @@ public: const qint64 &secondPointId, const QString typeLine, const QString pointName, const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingpoint.cpp b/tools/modelingTools/vmodelingpoint.cpp index cfa4ec3f9..4bb1741fa 100644 --- a/tools/modelingTools/vmodelingpoint.cpp +++ b/tools/modelingTools/vmodelingpoint.cpp @@ -22,6 +22,8 @@ #include "vmodelingpoint.h" #include "container/vpointf.h" +const QString VModelingPoint::TagName = QStringLiteral("point"); + VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){ @@ -49,8 +51,8 @@ void VModelingPoint::NameChangePosition(const QPointF pos){ void VModelingPoint::UpdateNamePosition(qreal mx, qreal my){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("mx", QString().setNum(toMM(mx))); - domElement.setAttribute("my", QString().setNum(toMM(my))); + domElement.setAttribute(AttrMx, QString().setNum(toMM(mx))); + domElement.setAttribute(AttrMy, QString().setNum(toMM(my))); emit toolhaveChange(); } } diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h index 6a68b5d80..03a8abe6c 100644 --- a/tools/modelingTools/vmodelingpoint.h +++ b/tools/modelingTools/vmodelingpoint.h @@ -30,6 +30,7 @@ class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{ public: VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); virtual ~VModelingPoint() {} + static const QString TagName; public slots: void NameChangePosition(const QPointF pos); virtual void FullUpdateFromGui(int result) = 0; diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp index 9ea8c6935..11e9bd5ac 100644 --- a/tools/modelingTools/vmodelingpointofcontact.cpp +++ b/tools/modelingTools/vmodelingpointofcontact.cpp @@ -23,6 +23,8 @@ #include "../drawTools/vtoolpointofcontact.h" #include +const QString VModelingPointOfContact::ToolType = QStringLiteral("pointOfContact"); + VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, @@ -100,10 +102,10 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const void VModelingPointOfContact::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - radius = domElement.attribute("radius", ""); - center = domElement.attribute("center", "").toLongLong(); - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + radius = domElement.attribute(AttrRadius, ""); + center = domElement.attribute(AttrCenter, "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id)); } @@ -112,11 +114,11 @@ void VModelingPointOfContact::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogPointOfContact->getPointName()); - domElement.setAttribute("radius", dialogPointOfContact->getRadius()); - domElement.setAttribute("center", QString().setNum(dialogPointOfContact->getCenter())); - domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfContact->getFirstPoint())); - domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfContact->getSecondPoint())); + domElement.setAttribute(AttrName, dialogPointOfContact->getPointName()); + domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius()); + domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint())); emit FullUpdateTree(); } } @@ -129,18 +131,18 @@ void VModelingPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *e void VModelingPointOfContact::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "pointOfContact"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "radius", radius); - AddAttribute(domElement, "center", center); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrRadius, radius); + AddAttribute(domElement, AttrCenter, center); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h index 0f1516a67..6eebac9ec 100644 --- a/tools/modelingTools/vmodelingpointofcontact.h +++ b/tools/modelingTools/vmodelingpointofcontact.h @@ -40,6 +40,7 @@ public: const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingpointofintersection.cpp b/tools/modelingTools/vmodelingpointofintersection.cpp index 70d4db79d..e22e97c7b 100644 --- a/tools/modelingTools/vmodelingpointofintersection.cpp +++ b/tools/modelingTools/vmodelingpointofintersection.cpp @@ -1,5 +1,7 @@ #include "vmodelingpointofintersection.h" +const QString VModelingPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); + VModelingPointOfIntersection::VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent) @@ -60,8 +62,8 @@ VModelingPointOfIntersection *VModelingPointOfIntersection::Create(const qint64 void VModelingPointOfIntersection::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id)); } @@ -70,9 +72,9 @@ void VModelingPointOfIntersection::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogPointOfIntersection->getPointName()); - domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId())); + domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName()); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId())); emit FullUpdateTree(); } } @@ -90,16 +92,16 @@ void VModelingPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEve void VModelingPointOfIntersection::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "pointOfIntersection"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingpointofintersection.h b/tools/modelingTools/vmodelingpointofintersection.h index 1c4c94397..b2c00f4f2 100644 --- a/tools/modelingTools/vmodelingpointofintersection.h +++ b/tools/modelingTools/vmodelingpointofintersection.h @@ -18,6 +18,7 @@ public: const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp index ebb6e38df..d0f32ebfb 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.cpp +++ b/tools/modelingTools/vmodelingshoulderpoint.cpp @@ -23,6 +23,8 @@ #include "../drawTools/vtoolshoulderpoint.h" #include +const QString VModelingShoulderPoint::ToolType = QStringLiteral("shoulder"); + VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation, @@ -104,11 +106,11 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q void VModelingShoulderPoint::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - typeLine = domElement.attribute("typeLine", ""); - formula = domElement.attribute("length", ""); - basePointId = domElement.attribute("p1Line", "").toLongLong(); - p2Line = domElement.attribute("p2Line", "").toLongLong(); - pShoulder = domElement.attribute("pShoulder", "").toLongLong(); + typeLine = domElement.attribute(AttrTypeLine, ""); + formula = domElement.attribute(AttrLength, ""); + basePointId = domElement.attribute(AttrP1Line, "").toLongLong(); + p2Line = domElement.attribute(AttrP2Line, "").toLongLong(); + pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong(); } RefreshGeometry(); } @@ -117,12 +119,12 @@ void VModelingShoulderPoint::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogShoulderPoint->getPointName()); - domElement.setAttribute("typeLine", dialogShoulderPoint->getTypeLine()); - domElement.setAttribute("length", dialogShoulderPoint->getFormula()); - domElement.setAttribute("p1Line", QString().setNum(dialogShoulderPoint->getP1Line())); - domElement.setAttribute("p2Line", QString().setNum(dialogShoulderPoint->getP2Line())); - domElement.setAttribute("pShoulder", QString().setNum(dialogShoulderPoint->getPShoulder())); + domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName()); + domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine()); + domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula()); + domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line())); + domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line())); + domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder())); emit FullUpdateTree(); } } @@ -135,19 +137,19 @@ void VModelingShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev void VModelingShoulderPoint::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "shoulder"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "typeLine", typeLine); - AddAttribute(domElement, "length", formula); - AddAttribute(domElement, "p1Line", basePointId); - AddAttribute(domElement, "p2Line", p2Line); - AddAttribute(domElement, "pShoulder", pShoulder); + AddAttribute(domElement, AttrTypeLine, typeLine); + AddAttribute(domElement, AttrLength, formula); + AddAttribute(domElement, AttrP1Line, basePointId); + AddAttribute(domElement, AttrP2Line, p2Line); + AddAttribute(domElement, AttrPShoulder, pShoulder); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h index 679d5e85c..a9cee71cd 100644 --- a/tools/modelingTools/vmodelingshoulderpoint.h +++ b/tools/modelingTools/vmodelingshoulderpoint.h @@ -40,6 +40,7 @@ public: const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index b2df795d0..4cd48e3c8 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -22,9 +22,11 @@ #include "vmodelingspline.h" #include "geometry/vspline.h" -VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, - Tool::Sources typeCreation, - QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), +const QString VModelingSpline::TagName = QStringLiteral("spline"); +const QString VModelingSpline::ToolType = QStringLiteral("simple"); + +VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, + QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSpline(QSharedPointer()), controlPoints(QVector()){ ignoreFullUpdate = true; VSpline spl = data->GetModelingSpline(id); @@ -135,13 +137,13 @@ void VModelingSpline::FullUpdateFromGui(int result){ dialogSpline->getKCurve()); QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("point1", QString().setNum(spl.GetP1())); - domElement.setAttribute("point4", QString().setNum(spl.GetP4())); - domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1())); - domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2())); - domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1())); - domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2())); - domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve())); + domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1())); + domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4())); + domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); + domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); + domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); + domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); + domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); emit FullUpdateTree(); } } @@ -159,11 +161,11 @@ void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, Spli } QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1())); - domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2())); - domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1())); - domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2())); - domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve())); + domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); + domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); + domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); + domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); + domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); emit FullUpdateTree(); } } @@ -174,17 +176,17 @@ void VModelingSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VModelingSpline::AddToFile(){ VSpline spl = VAbstractTool::data.GetModelingSpline(id); - QDomElement domElement = doc->createElement("spline"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "simple"); - AddAttribute(domElement, "point1", spl.GetP1()); - AddAttribute(domElement, "point4", spl.GetP4()); - AddAttribute(domElement, "angle1", spl.GetAngle1()); - AddAttribute(domElement, "angle2", spl.GetAngle2()); - AddAttribute(domElement, "kAsm1", spl.GetKasm1()); - AddAttribute(domElement, "kAsm2", spl.GetKasm2()); - AddAttribute(domElement, "kCurve", spl.GetKcurve()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrPoint1, spl.GetP1()); + AddAttribute(domElement, AttrPoint4, spl.GetP4()); + AddAttribute(domElement, AttrAngle1, spl.GetAngle1()); + AddAttribute(domElement, AttrAngle2, spl.GetAngle2()); + AddAttribute(domElement, AttrKAsm1, spl.GetKasm1()); + AddAttribute(domElement, AttrKAsm2, spl.GetKasm2()); + AddAttribute(domElement, AttrKCurve, spl.GetKcurve()); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h index 49e9f3da8..b4417fb66 100644 --- a/tools/modelingTools/vmodelingspline.h +++ b/tools/modelingTools/vmodelingspline.h @@ -39,6 +39,8 @@ public: const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; signals: void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint ); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 0c95438fc..04e1d5c01 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -21,6 +21,9 @@ #include "vmodelingsplinepath.h" +const QString VModelingSplinePath::TagName = QStringLiteral("spline"); +const QString VModelingSplinePath::ToolType = QStringLiteral("path"); + VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, QGraphicsItem *parent):VModelingTool(doc, data, id), @@ -125,7 +128,7 @@ void VModelingSplinePath::FullUpdateFromGui(int result){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve())); + domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); } @@ -148,7 +151,7 @@ void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline, CorectControlPoints(spl, splPath, indexSpline); QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve())); + domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); } @@ -174,10 +177,10 @@ void VModelingSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){ QDomElement domElement = nodeList.at(i).toElement(); if(!domElement.isNull()){ VSplinePoint p = path[i]; - domElement.setAttribute("pSpline", QString().setNum(p.P())); - domElement.setAttribute("kAsm1", QString().setNum(p.KAsm1())); - domElement.setAttribute("kAsm2", QString().setNum(p.KAsm2())); - domElement.setAttribute("angle", QString().setNum(p.Angle2())); + domElement.setAttribute(AttrPSpline, QString().setNum(p.P())); + domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1())); + domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2())); + domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2())); } } } @@ -188,11 +191,11 @@ void VModelingSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event void VModelingSplinePath::AddToFile(){ VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id); - QDomElement domElement = doc->createElement("spline"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "path"); - AddAttribute(domElement, "kCurve", splPath.getKCurve()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrKCurve, splPath.getKCurve()); for(qint32 i = 0; i < splPath.CountPoint(); ++i){ AddPathPoint(domElement, splPath[i]); @@ -202,12 +205,12 @@ void VModelingSplinePath::AddToFile(){ } void VModelingSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){ - QDomElement pathPoint = doc->createElement("pathPoint"); + QDomElement pathPoint = doc->createElement(AttrPathPoint); - AddAttribute(pathPoint, "pSpline", splPoint.P()); - AddAttribute(pathPoint, "kAsm1", splPoint.KAsm1()); - AddAttribute(pathPoint, "kAsm2", splPoint.KAsm2()); - AddAttribute(pathPoint, "angle", splPoint.Angle2()); + AddAttribute(pathPoint, AttrPSpline, splPoint.P()); + AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); + AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); + AddAttribute(pathPoint, AttrAngle, splPoint.Angle2()); domElement.appendChild(pathPoint); } diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h index 4cb25f16d..19f44235f 100644 --- a/tools/modelingTools/vmodelingsplinepath.h +++ b/tools/modelingTools/vmodelingsplinepath.h @@ -36,6 +36,8 @@ public: static VModelingSplinePath* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data); static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; signals: void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, const QPointF &splinePoint); diff --git a/tools/modelingTools/vmodelingtriangle.cpp b/tools/modelingTools/vmodelingtriangle.cpp index feeb7c1c5..7a3d91838 100644 --- a/tools/modelingTools/vmodelingtriangle.cpp +++ b/tools/modelingTools/vmodelingtriangle.cpp @@ -1,15 +1,15 @@ #include "vmodelingtriangle.h" #include "../drawTools/vtooltriangle.h" -VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, - const qint64 &axisP1Id, const qint64 &axisP2Id, - const qint64 &firstPointId, const qint64 &secondPointId, +const QString VModelingTriangle::ToolType = QStringLiteral("triangle"); + +VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent) - :VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), - firstPointId(firstPointId), secondPointId(secondPointId), - dialogTriangle(QSharedPointer()) { + :VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), + secondPointId(secondPointId), dialogTriangle(QSharedPointer()) { if(typeCreation == Tool::FromGui){ - AddToFile(); + AddToFile(); } } @@ -30,15 +30,14 @@ VModelingTriangle *VModelingTriangle::Create(QSharedPointer &dia qint64 firstPointId = dialog->getFirstPointId(); qint64 secondPointId = dialog->getSecondPointId(); QString pointName = dialog->getPointName(); - return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, - Document::FullParse, Tool::FromGui); + return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse, + Tool::FromGui); } -VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, - const qint64 &axisP1Id, const qint64 &axisP2Id, - const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VDomDocument *doc, - VContainer *data, const Document::Documents &parse, +VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, + const qint64 &axisP2Id, const qint64 &firstPointId, + const qint64 &secondPointId, const qreal &mx, const qreal &my, + VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){ VModelingTriangle *tool = 0; VPointF axisP1 = data->GetPoint(axisP1Id); @@ -58,8 +57,7 @@ VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &po } } if(parse == Document::FullParse){ - tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, - secondPointId, typeCreation); + tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, secondPointId, typeCreation); doc->AddTool(id, tool); doc->IncrementReferens(axisP1Id); doc->IncrementReferens(axisP2Id); @@ -72,10 +70,10 @@ VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &po void VModelingTriangle::FullUpdateFromFile(){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - axisP1Id = domElement.attribute("axisP1", "").toLongLong(); - axisP2Id = domElement.attribute("axisP2", "").toLongLong(); - firstPointId = domElement.attribute("firstPoint", "").toLongLong(); - secondPointId = domElement.attribute("secondPoint", "").toLongLong(); + axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong(); + axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); } VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id)); } @@ -84,11 +82,11 @@ void VModelingTriangle::FullUpdateFromGui(int result){ if(result == QDialog::Accepted){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("name", dialogTriangle->getPointName()); - domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id())); - domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id())); - domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId())); - domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId())); + domElement.setAttribute(AttrName, dialogTriangle->getPointName()); + domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id())); + domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id())); + domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId())); + domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId())); emit FullUpdateTree(); } @@ -109,18 +107,18 @@ void VModelingTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VModelingTriangle::AddToFile(){ VPointF point = VAbstractTool::data.GetPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "triangle"); - AddAttribute(domElement, "name", point.name()); - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrName, point.name()); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); - AddAttribute(domElement, "axisP1", axisP1Id); - AddAttribute(domElement, "axisP2", axisP2Id); - AddAttribute(domElement, "firstPoint", firstPointId); - AddAttribute(domElement, "secondPoint", secondPointId); + AddAttribute(domElement, AttrAxisP1, axisP1Id); + AddAttribute(domElement, AttrAxisP2, axisP2Id); + AddAttribute(domElement, AttrFirstPoint, firstPointId); + AddAttribute(domElement, AttrSecondPoint, secondPointId); AddToModeling(domElement); } diff --git a/tools/modelingTools/vmodelingtriangle.h b/tools/modelingTools/vmodelingtriangle.h index a9f5176ec..069544bd7 100644 --- a/tools/modelingTools/vmodelingtriangle.h +++ b/tools/modelingTools/vmodelingtriangle.h @@ -38,6 +38,7 @@ public: const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); virtual void FullUpdateFromGui(int result); diff --git a/tools/nodeDetails/vabstractnode.cpp b/tools/nodeDetails/vabstractnode.cpp index 1f4bab332..2e671ea9d 100644 --- a/tools/nodeDetails/vabstractnode.cpp +++ b/tools/nodeDetails/vabstractnode.cpp @@ -22,9 +22,14 @@ #include "vabstractnode.h" #include -VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, - Draw::Draws typeobject, QObject *parent) : - VAbstractTool(doc, data, id, parent), idNode(idNode), typeobject(typeobject){ +const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject"); +const QString VAbstractNode::AttrTypeObject = QStringLiteral("typeObject"); +const QString VAbstractNode::TypeObjectCalculation = QStringLiteral("Calculation"); +const QString VAbstractNode::TypeObjectModeling = QStringLiteral("Modeling"); + +VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, Draw::Draws typeobject, + QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode), + typeobject(typeobject){ _referens = 0; } @@ -34,7 +39,7 @@ void VAbstractNode::AddToModeling(const QDomElement &domElement){ if(ok){ modelingElement.appendChild(domElement); } else { - qCritical()<<"Can't find tag Modeling"<< Q_FUNC_INFO; + qCritical()<createElement("arc"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "modeling"); - AddAttribute(domElement, "idObject", idNode); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrIdObject, idNode); if(typeobject == Draw::Calculation){ - AddAttribute(domElement, "typeObject", "Calculation"); + AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); } else { - AddAttribute(domElement, "typeObject", "Modeling"); + AddAttribute(domElement, AttrTypeObject, ToolType ); } AddToModeling(domElement); diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h index e4a214928..e206e2c6a 100644 --- a/tools/nodeDetails/vnodearc.h +++ b/tools/nodeDetails/vnodearc.h @@ -32,6 +32,8 @@ public: Tool::Sources typeCreation, QGraphicsItem * parent = 0); static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp index b5d568743..c5b1056f8 100644 --- a/tools/nodeDetails/vnodepoint.cpp +++ b/tools/nodeDetails/vnodepoint.cpp @@ -21,6 +21,9 @@ #include "vnodepoint.h" +const QString VNodePoint::TagName = QStringLiteral("point"); +const QString VNodePoint::ToolType = QStringLiteral("modeling"); + VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, typeobject), QGraphicsEllipseItem(parent), @@ -57,18 +60,18 @@ void VNodePoint::FullUpdateFromFile(){ void VNodePoint::AddToFile(){ VPointF point = VAbstractTool::data.GetModelingPoint(id); - QDomElement domElement = doc->createElement("point"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "modeling"); - AddAttribute(domElement, "idObject", idNode); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrIdObject, idNode); if(typeobject == Draw::Calculation){ - AddAttribute(domElement, "typeObject", "Calculation"); + AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); } else { - AddAttribute(domElement, "typeObject", "Modeling"); + AddAttribute(domElement, AttrTypeObject, TypeObjectModeling); } - AddAttribute(domElement, "mx", toMM(point.mx())); - AddAttribute(domElement, "my", toMM(point.my())); + AddAttribute(domElement, AttrMx, toMM(point.mx())); + AddAttribute(domElement, AttrMy, toMM(point.my())); AddToModeling(domElement); } @@ -104,8 +107,8 @@ void VNodePoint::NameChangePosition(const QPointF pos){ void VNodePoint::UpdateNamePosition(qreal mx, qreal my){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("mx", QString().setNum(toMM(mx))); - domElement.setAttribute("my", QString().setNum(toMM(my))); + domElement.setAttribute(AttrMx, QString().setNum(toMM(mx))); + domElement.setAttribute(AttrMy, QString().setNum(toMM(my))); emit toolhaveChange(); } } diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h index 783023fee..e1a6d75e0 100644 --- a/tools/nodeDetails/vnodepoint.h +++ b/tools/nodeDetails/vnodepoint.h @@ -32,6 +32,8 @@ public: Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); void NameChangePosition(const QPointF pos); diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp index 2614ab2f3..cf6092c73 100644 --- a/tools/nodeDetails/vnodespline.cpp +++ b/tools/nodeDetails/vnodespline.cpp @@ -21,6 +21,9 @@ #include "vnodespline.h" +const QString VNodeSpline::TagName = QStringLiteral("spline"); +const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); + VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent) : VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){ @@ -53,15 +56,15 @@ void VNodeSpline::FullUpdateFromFile(){ } void VNodeSpline::AddToFile(){ - QDomElement domElement = doc->createElement("spline"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "modelingSpline"); - AddAttribute(domElement, "idObject", idNode); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrIdObject, idNode); if(typeobject == Draw::Calculation){ - AddAttribute(domElement, "typeObject", "Calculation"); + AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); } else { - AddAttribute(domElement, "typeObject", "Modeling"); + AddAttribute(domElement, AttrTypeObject, TypeObjectModeling); } AddToModeling(domElement); diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h index 47513764e..3e1d381bc 100644 --- a/tools/nodeDetails/vnodespline.h +++ b/tools/nodeDetails/vnodespline.h @@ -32,6 +32,8 @@ public: Tool::Sources typeCreation, QGraphicsItem * parent = 0); static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile (); protected: diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp index 8dd7f4e37..07ac92b53 100644 --- a/tools/nodeDetails/vnodesplinepath.cpp +++ b/tools/nodeDetails/vnodesplinepath.cpp @@ -21,6 +21,9 @@ #include "vnodesplinepath.h" +const QString VNodeSplinePath::TagName = QStringLiteral("spline"); +const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); + VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent) : @@ -57,15 +60,15 @@ void VNodeSplinePath::FullUpdateFromFile(){ } void VNodeSplinePath::AddToFile(){ - QDomElement domElement = doc->createElement("spline"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "type", "modelingPath"); - AddAttribute(domElement, "idObject", idNode); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrType, ToolType); + AddAttribute(domElement, AttrIdObject, idNode); if(typeobject == Draw::Calculation){ - AddAttribute(domElement, "typeObject", "Calculation"); + AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation); } else { - AddAttribute(domElement, "typeObject", "Modeling"); + AddAttribute(domElement, AttrTypeObject, TypeObjectModeling); } AddToModeling(domElement); diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h index 40d85b582..5e623b65c 100644 --- a/tools/nodeDetails/vnodesplinepath.h +++ b/tools/nodeDetails/vnodesplinepath.h @@ -32,6 +32,8 @@ public: Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0); static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); + static const QString TagName; + static const QString ToolType; public slots: virtual void FullUpdateFromFile(); protected: diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index f932b0e06..42677bc56 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -21,6 +21,43 @@ #include "vabstracttool.h" +const QString VAbstractTool::AttrId = QStringLiteral("id"); +const QString VAbstractTool::AttrType = QStringLiteral("type"); +const QString VAbstractTool::AttrMx = QStringLiteral("mx"); +const QString VAbstractTool::AttrMy = QStringLiteral("my"); +const QString VAbstractTool::AttrName = QStringLiteral("name"); +const QString VAbstractTool::AttrX = QStringLiteral("x"); +const QString VAbstractTool::AttrY = QStringLiteral("y"); +const QString VAbstractTool::AttrTypeLine = QStringLiteral("typeLine"); +const QString VAbstractTool::AttrLength = QStringLiteral("length"); +const QString VAbstractTool::AttrBasePoint = QStringLiteral("basePoint"); +const QString VAbstractTool::AttrFirstPoint = QStringLiteral("firstPoint"); +const QString VAbstractTool::AttrSecondPoint = QStringLiteral("secondPoint"); +const QString VAbstractTool::AttrThirdPoint = QStringLiteral("thirdPoint"); +const QString VAbstractTool::AttrCenter = QStringLiteral("center"); +const QString VAbstractTool::AttrRadius = QStringLiteral("radius"); +const QString VAbstractTool::AttrAngle = QStringLiteral("angle"); +const QString VAbstractTool::AttrAngle1 = QStringLiteral("angle1"); +const QString VAbstractTool::AttrAngle2 = QStringLiteral("angle2"); +const QString VAbstractTool::AttrP1Line = QStringLiteral("p1Line"); +const QString VAbstractTool::AttrP2Line = QStringLiteral("p2Line"); +const QString VAbstractTool::AttrP1Line1 = QStringLiteral("p1Line1"); +const QString VAbstractTool::AttrP2Line1 = QStringLiteral("p2Line1"); +const QString VAbstractTool::AttrP1Line2 = QStringLiteral("p1Line2"); +const QString VAbstractTool::AttrP2Line2 = QStringLiteral("p2Line2"); +const QString VAbstractTool::AttrPShoulder = QStringLiteral("pShoulder"); +const QString VAbstractTool::AttrPoint1 = QStringLiteral("point1"); +const QString VAbstractTool::AttrPoint4 = QStringLiteral("point4"); +const QString VAbstractTool::AttrKAsm1 = QStringLiteral("kAsm1"); +const QString VAbstractTool::AttrKAsm2 = QStringLiteral("kAsm2"); +const QString VAbstractTool::AttrKCurve = QStringLiteral("kCurve"); +const QString VAbstractTool::AttrPathPoint = QStringLiteral("pathPoint"); +const QString VAbstractTool::AttrPSpline = QStringLiteral("pSpline"); +const QString VAbstractTool::AttrAxisP1 = QStringLiteral("axisP1"); +const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2"); +const QString VAbstractTool::TypeLineNone = QStringLiteral("none"); +const QString VAbstractTool::TypeLineLine = QStringLiteral("hair"); + VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){ @@ -29,33 +66,6 @@ VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QOb connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree); } -void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value){ - QDomAttr domAttr = doc->createAttribute(name); - domAttr.setValue(QString().setNum(value)); - domElement.setAttributeNode(domAttr); -} - -void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value){ - QDomAttr domAttr = doc->createAttribute(name); - domAttr.setValue(QString().setNum(value)); - domElement.setAttributeNode(domAttr); -} - -void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qreal &value){ - QDomAttr domAttr = doc->createAttribute(name); - domAttr.setValue(QString().setNum(value)); - domElement.setAttributeNode(domAttr); -} - -void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const QString &value){ - QDomAttr domAttr = doc->createAttribute(name); - domAttr.setValue(value); - domElement.setAttributeNode(domAttr); -} - -VAbstractTool::~VAbstractTool(){ -} - QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line){ qreal x1, y1, x2, y2; rec.getCoords(&x1, &y1, &x2, &y2); @@ -76,7 +86,7 @@ QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line){ if ( type == QLineF::BoundedIntersection ){ return point; } - Q_ASSERT_X(type != QLineF::BoundedIntersection, Q_FUNC_INFO, "Немає точки перетину."); + Q_ASSERT_X(type != QLineF::BoundedIntersection, Q_FUNC_INFO, "There is no point of intersection."); return point; } diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index a57b5f254..0b25f29f9 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -29,13 +29,49 @@ class VAbstractTool: public VDataTool{ Q_OBJECT public: VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); - virtual ~VAbstractTool(); + virtual ~VAbstractTool() {} static QPointF LineIntersectRect(QRectF rec, QLineF line); static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2); static QPointF ClosestPoint(QLineF line, QPointF p); static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k); inline qint64 getId() const {return id;} static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c); + static const QString AttrId; + static const QString AttrType; + static const QString AttrMx; + static const QString AttrMy; + static const QString AttrName; + static const QString AttrX; + static const QString AttrY; + static const QString AttrTypeLine; + static const QString AttrLength; + static const QString AttrBasePoint; + static const QString AttrFirstPoint; + static const QString AttrSecondPoint; + static const QString AttrThirdPoint; + static const QString AttrCenter; + static const QString AttrRadius; + static const QString AttrAngle; + static const QString AttrAngle1; + static const QString AttrAngle2; + static const QString AttrP1Line; + static const QString AttrP2Line; + static const QString AttrP1Line1; + static const QString AttrP2Line1; + static const QString AttrP1Line2; + static const QString AttrP2Line2; + static const QString AttrPShoulder; + static const QString AttrPoint1; + static const QString AttrPoint4; + static const QString AttrKAsm1; + static const QString AttrKAsm2; + static const QString AttrKCurve; + static const QString AttrPathPoint; + static const QString AttrPSpline; + static const QString AttrAxisP1; + static const QString AttrAxisP2; + static const QString TypeLineNone; + static const QString TypeLineLine; public slots: virtual void FullUpdateFromFile()=0; signals: @@ -48,14 +84,23 @@ protected: const Qt::GlobalColor baseColor; Qt::GlobalColor currentColor; virtual void AddToFile()=0; - void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value); - void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value); - void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value); - void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); inline const VContainer *getData() const {return &data;} virtual void RemoveReferens(){} void RemoveAllChild(QDomElement &domElement); + template + void AddAttribute(QDomElement &domElement, const QString &name, const T &value){ + QDomAttr domAttr = doc->createAttribute(name); + domAttr.setValue(QString().setNum(value)); + domElement.setAttributeNode(domAttr); + } private: Q_DISABLE_COPY(VAbstractTool) }; + +template <> +inline void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const QString &value){ + QDomAttr domAttr = doc->createAttribute(name); + domAttr.setValue(value); + domElement.setAttributeNode(domAttr); +} #endif // VABSTRACTTOOL_H diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 3129d847b..36dd521f6 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -24,6 +24,16 @@ #include "modelingTools/vmodelingtool.h" #include "modelingTools/modelingtools.h" +const QString VToolDetail::TagName = QStringLiteral("detail"); +const QString VToolDetail::TagNode = QStringLiteral("node"); +const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); +const QString VToolDetail::AttrClosed = QStringLiteral("closed"); +const QString VToolDetail::AttrWidth = QStringLiteral("width"); +const QString VToolDetail::AttrIdObject = QStringLiteral("idObject"); +const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); +const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); +const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); + VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, Tool::Sources typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){ @@ -290,10 +300,10 @@ void VToolDetail::FullUpdateFromGui(int result){ QDomElement domElement = doc->elementById(QString().setNum(id)); if(domElement.isElement()){ VDetail det = dialogDetail->getDetails(); - domElement.setAttribute("name", det.getName()); - domElement.setAttribute("supplement", QString().setNum(det.getSupplement())); - domElement.setAttribute("closed", QString().setNum(det.getClosed())); - domElement.setAttribute("width", QString().setNum(det.getWidth())); + domElement.setAttribute(AttrName, det.getName()); + domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement())); + domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed())); + domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth())); RemoveAllChild(domElement); for(qint32 i = 0; i < det.CountNode(); ++i){ AddNode(domElement, det[i]); @@ -306,15 +316,15 @@ void VToolDetail::FullUpdateFromGui(int result){ void VToolDetail::AddToFile(){ VDetail detail = VAbstractTool::data.GetDetail(id); - QDomElement domElement = doc->createElement("detail"); + QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, "id", id); - AddAttribute(domElement, "name", detail.getName()); - AddAttribute(domElement, "mx", toMM(detail.getMx())); - AddAttribute(domElement, "my", toMM(detail.getMy())); - AddAttribute(domElement, "supplement", detail.getSupplement()); - AddAttribute(domElement, "closed", detail.getClosed()); - AddAttribute(domElement, "width", detail.getWidth()); + AddAttribute(domElement, AttrId, id); + AddAttribute(domElement, AttrName, detail.getName()); + AddAttribute(domElement, AttrMx, toMM(detail.getMx())); + AddAttribute(domElement, AttrMy, toMM(detail.getMy())); + AddAttribute(domElement, AttrSupplement, detail.getSupplement()); + AddAttribute(domElement, AttrClosed, detail.getClosed()); + AddAttribute(domElement, AttrWidth, detail.getWidth()); for(qint32 i = 0; i < detail.CountNode(); ++i){ AddNode(domElement, detail[i]); @@ -334,8 +344,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const //qDebug()<elementById(QString().setNum(id)); if(domElement.isElement()){ - domElement.setAttribute("mx", QString().setNum(toMM(newPos.x()))); - domElement.setAttribute("my", QString().setNum(toMM(newPos.y()))); + domElement.setAttribute(AttrMx, QString().setNum(toMM(newPos.x()))); + domElement.setAttribute(AttrMy, QString().setNum(toMM(newPos.y()))); //I don't now why but signal does not work. doc->FullUpdateTree(); } @@ -398,70 +408,70 @@ void VToolDetail::RemoveReferens(){ } void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){ - QDomElement nod = doc->createElement("node"); + QDomElement nod = doc->createElement(TagNode); - AddAttribute(nod, "idObject", node.getId()); - AddAttribute(nod, "mx", toMM(node.getMx())); - AddAttribute(nod, "my", toMM(node.getMy())); + AddAttribute(nod, AttrIdObject, node.getId()); + AddAttribute(nod, AttrMx, toMM(node.getMx())); + AddAttribute(nod, AttrMy, toMM(node.getMy())); if(node.getTypeNode() == NodeDetail::Contour){ - AddAttribute(nod, "nodeType", "Contour"); + AddAttribute(nod, AttrNodeType, NodeTypeContour); } else { - AddAttribute(nod, "nodeType", "Modeling"); + AddAttribute(nod, AttrNodeType, NodeTypeModeling); } switch(node.getTypeTool()){ case(Tool::AlongLineTool): - AddAttribute(nod, "type", "AlongLineTool"); + AddAttribute(nod, AttrType, QStringLiteral("AlongLineTool")); break; case(Tool::ArcTool): - AddAttribute(nod, "type", "ArcTool"); + AddAttribute(nod, AttrType, QStringLiteral("ArcTool")); break; case(Tool::BisectorTool): - AddAttribute(nod, "type", "BisectorTool"); + AddAttribute(nod, AttrType, QStringLiteral("BisectorTool")); break; case(Tool::EndLineTool): - AddAttribute(nod, "type", "EndLineTool"); + AddAttribute(nod, AttrType, QStringLiteral("EndLineTool")); break; case(Tool::LineIntersectTool): - AddAttribute(nod, "type", "LineIntersectTool"); + AddAttribute(nod, AttrType, QStringLiteral("LineIntersectTool")); break; case(Tool::LineTool): - AddAttribute(nod, "type", "LineTool"); + AddAttribute(nod, AttrType, QStringLiteral("LineTool")); break; case(Tool::NodeArc): - AddAttribute(nod, "type", "NodeArc"); + AddAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; case(Tool::NodePoint): - AddAttribute(nod, "type", "NodePoint"); + AddAttribute(nod, AttrType, QStringLiteral("NodePoint")); break; case(Tool::NodeSpline): - AddAttribute(nod, "type", "NodeSpline"); + AddAttribute(nod, AttrType, QStringLiteral("NodeSpline")); break; case(Tool::NodeSplinePath): - AddAttribute(nod, "type", "NodeSplinePath"); + AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; case(Tool::NormalTool): - AddAttribute(nod, "type", "NormalTool"); + AddAttribute(nod, AttrType, QStringLiteral("NormalTool")); break; case(Tool::PointOfContact): - AddAttribute(nod, "type", "PointOfContact"); + AddAttribute(nod, AttrType, QStringLiteral("PointOfContact")); break; case(Tool::ShoulderPointTool): - AddAttribute(nod, "type", "ShoulderPointTool"); + AddAttribute(nod, AttrType, QStringLiteral("ShoulderPointTool")); break; case(Tool::SplinePathTool): - AddAttribute(nod, "type", "SplinePathTool"); + AddAttribute(nod, AttrType, QStringLiteral("SplinePathTool")); break; case(Tool::SplineTool): - AddAttribute(nod, "type", "SplineTool"); + AddAttribute(nod, AttrType, QStringLiteral("SplineTool")); break; case(Tool::Height): - AddAttribute(nod, "type", "Height"); + AddAttribute(nod, AttrType, QStringLiteral("Height")); break; case(Tool::Triangle): - AddAttribute(nod, "type", "Triangle"); + AddAttribute(nod, AttrType, QStringLiteral("Triangle")); break; case(Tool::PointOfIntersection): - AddAttribute(nod, "type", "PointOfIntersection"); + AddAttribute(nod, AttrType, QStringLiteral("PointOfIntersection")); break; default: qWarning()<<"May be wrong tool type!!! Ignoring."< Date: Tue, 29 Oct 2013 15:47:49 +0200 Subject: [PATCH 66/70] Missed license. --HG-- branch : develop --- tools/modelingTools/vmodelingheight.cpp | 21 +++++++++++++++++++++ tools/modelingTools/vmodelingtriangle.cpp | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/tools/modelingTools/vmodelingheight.cpp b/tools/modelingTools/vmodelingheight.cpp index cbf87545f..b71a69276 100644 --- a/tools/modelingTools/vmodelingheight.cpp +++ b/tools/modelingTools/vmodelingheight.cpp @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #include "vmodelingheight.h" #include "../drawTools/vtoolheight.h" diff --git a/tools/modelingTools/vmodelingtriangle.cpp b/tools/modelingTools/vmodelingtriangle.cpp index 7a3d91838..2e068ab85 100644 --- a/tools/modelingTools/vmodelingtriangle.cpp +++ b/tools/modelingTools/vmodelingtriangle.cpp @@ -1,3 +1,24 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Valentina project All Rights Reserved. + ** + ** This file is part of Valentina. + ** + ** Tox is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + ****************************************************************************/ + #include "vmodelingtriangle.h" #include "../drawTools/vtooltriangle.h" From 04140824cdfda1962334076d6f624d00b890bd54 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 29 Oct 2013 17:01:56 +0200 Subject: [PATCH 67/70] New template InitTool. --HG-- branch : develop --- tools/drawTools/vdrawtool.h | 2 - tools/modelingTools/vmodelingtool.h | 2 - tools/vabstracttool.h | 1 + tools/vtooldetail.cpp | 138 ++++++++-------------------- tools/vtooldetail.h | 2 + 5 files changed, 39 insertions(+), 106 deletions(-) diff --git a/tools/drawTools/vdrawtool.h b/tools/drawTools/vdrawtool.h index da654fb42..e761422ee 100644 --- a/tools/drawTools/vdrawtool.h +++ b/tools/drawTools/vdrawtool.h @@ -38,8 +38,6 @@ public slots: void ChangedNameDraw(const QString oldName, const QString newName); virtual void FullUpdateFromGui(int result)=0; virtual void SetFactor(qreal factor); -signals: - void RemoveTool(QGraphicsItem *tool); protected: bool ignoreContextMenuEvent; bool ignoreFullUpdate; diff --git a/tools/modelingTools/vmodelingtool.h b/tools/modelingTools/vmodelingtool.h index ff7b4da89..014ff996d 100644 --- a/tools/modelingTools/vmodelingtool.h +++ b/tools/modelingTools/vmodelingtool.h @@ -34,8 +34,6 @@ public: inline void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;} public slots: virtual void FullUpdateFromGui(int result)=0; -signals: - void RemoveTool(QGraphicsItem *tool); protected: bool ignoreContextMenuEvent; bool ignoreFullUpdate; diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h index 0b25f29f9..511e43f31 100644 --- a/tools/vabstracttool.h +++ b/tools/vabstracttool.h @@ -78,6 +78,7 @@ signals: void toolhaveChange(); void ChoosedTool(qint64 id, Scene::Scenes type); void FullUpdateTree(); + void RemoveTool(QGraphicsItem *tool); protected: VDomDocument *doc; const qint64 id; diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 36dd521f6..6f0138518 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -38,150 +38,73 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){ VDetail detail = data->GetDetail(id); - QHash* tools = doc->getTools(); - Q_ASSERT(tools != 0); for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ case(Tool::NodePoint):{ - VNodePoint *point = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(point != 0); - connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - point->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::NodeArc):{ - VNodeArc *arc = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(arc != 0); - connect(arc, &VNodeArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - arc->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::NodeSpline):{ - VNodeSpline *spl = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(spl != 0); - connect(spl, &VNodeSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - spl->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::NodeSplinePath):{ - VNodeSplinePath *splPath = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(splPath != 0); - connect(splPath, &VNodeSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - splPath->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::AlongLineTool):{ - VModelingAlongLine *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::ArcTool):{ - VModelingArc *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::BisectorTool):{ - VModelingBisector *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::EndLineTool):{ - VModelingEndLine *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingEndLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingEndLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::LineIntersectTool):{ - VModelingLineIntersect *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::LineTool):{ - VModelingLine *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } case(Tool::NormalTool):{ - VModelingNormal *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + InitTool(scene, detail[i]); break; } - case(Tool::PointOfContact):{ - VModelingPointOfContact *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::PointOfContact): + InitTool(scene, detail[i]); break; - } - case(Tool::ShoulderPointTool):{ - VModelingShoulderPoint *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::ShoulderPointTool): + InitTool(scene, detail[i]); break; - } - case(Tool::SplinePathTool):{ - VModelingSplinePath *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::SplinePathTool): + InitTool(scene, detail[i]); break; - } - case(Tool::SplineTool):{ - VModelingSpline *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::SplineTool): + InitTool(scene, detail[i]); break; - } - case(Tool::Height):{ - VModelingHeight *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingHeight::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingHeight::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::Height): + InitTool(scene, detail[i]); break; - } - case(Tool::Triangle):{ - VModelingTriangle *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingTriangle::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingTriangle::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::Triangle): + InitTool(scene, detail[i]); break; - } - case(Tool::PointOfIntersection):{ - VModelingPointOfIntersection *tool = qobject_cast(tools->value(detail[i].getId())); - Q_ASSERT(tool != 0); - connect(tool, &VModelingPointOfIntersection::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(tool, &VModelingPointOfIntersection::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); - tool->setParentItem(this); + case(Tool::PointOfIntersection): + InitTool(scene, detail[i]); break; - } default: qWarning()<<"Get wrong tool type. Ignore."; break; @@ -484,3 +407,14 @@ void VToolDetail::RefreshGeometry(){ QPainterPath path = VAbstractTool::data.ContourPath(id); this->setPath(path); } + +template +void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node){ + QHash* tools = doc->getTools(); + Q_ASSERT(tools != 0); + Tool *tool = qobject_cast(tools->value(node.getId())); + Q_ASSERT(tool != 0); + connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(tool, &Tool::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); + tool->setParentItem(this); +} diff --git a/tools/vtooldetail.h b/tools/vtooldetail.h index 6708c76a2..4a877e8e6 100644 --- a/tools/vtooldetail.h +++ b/tools/vtooldetail.h @@ -77,6 +77,8 @@ private: VMainGraphicsScene *sceneDetails; void RefreshGeometry (); void AddNode(QDomElement &domElement, VNodeDetail &node); + template + void InitTool(VMainGraphicsScene *scene, const VNodeDetail &node); }; #endif // VTOOLDETAIL_H From beddcb69b8c0c5f223e1daa9f87fe431d8362cba Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 29 Oct 2013 17:17:47 +0200 Subject: [PATCH 68/70] New template ClosedDialog. --HG-- branch : develop --- mainwindow.cpp | 160 +++++++++---------------------------------------- mainwindow.h | 2 + 2 files changed, 29 insertions(+), 133 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 25a070910..536c86482 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -235,21 +235,26 @@ void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool det->AddTool(tool, id, typeTool); } +template +void MainWindow::ClosedDialog(QSharedPointer &dialog, int result){ + if(result == QDialog::Accepted){ + if(mode == Draw::Calculation){ + DrawTool::Create(dialog, currentScene, doc, data); + } else { + ModelingTool *endLine = ModelingTool::Create(dialog, doc, data); + AddToolToDetail(endLine, endLine->getId(), tool, dialog->getIdDetail()); + } + } + ArrowTool(); +} + void MainWindow::ToolEndLine(bool checked){ SetToolButton(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), dialogEndLine, &MainWindow::ClosedDialogEndLine); } void MainWindow::ClosedDialogEndLine(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolEndLine::Create(dialogEndLine, currentScene, doc, data); - } else { - VModelingEndLine *endLine = VModelingEndLine::Create(dialogEndLine, doc, data); - AddToolToDetail(endLine, endLine->getId(), Tool::EndLineTool, dialogEndLine->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogEndLine, result); } void MainWindow::ToolLine(bool checked){ @@ -258,15 +263,7 @@ void MainWindow::ToolLine(bool checked){ } void MainWindow::ClosedDialogLine(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolLine::Create(dialogLine, currentScene, doc, data); - } else { - VModelingLine *line = VModelingLine::Create(dialogLine, doc, data); - AddToolToDetail(line, line->getId(), Tool::LineTool, dialogLine->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogLine, result); } void MainWindow::ToolAlongLine(bool checked){ @@ -275,15 +272,7 @@ void MainWindow::ToolAlongLine(bool checked){ } void MainWindow::ClosedDialogAlongLine(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolAlongLine::Create(dialogAlongLine, currentScene, doc, data); - } else{ - VModelingAlongLine *point = VModelingAlongLine::Create(dialogAlongLine, doc, data); - AddToolToDetail(point, point->getId(), Tool::AlongLineTool, dialogAlongLine->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogAlongLine, result); } void MainWindow::ToolShoulderPoint(bool checked){ @@ -293,16 +282,7 @@ void MainWindow::ToolShoulderPoint(bool checked){ } void MainWindow::ClosedDialogShoulderPoint(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolShoulderPoint::Create(dialogShoulderPoint, currentScene, doc, data); - } else { - VModelingShoulderPoint *point = VModelingShoulderPoint::Create(dialogShoulderPoint, doc, data); - AddToolToDetail(point, point->getId(), Tool::ShoulderPointTool, - dialogShoulderPoint->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogShoulderPoint, result); } void MainWindow::ToolNormal(bool checked){ @@ -311,15 +291,7 @@ void MainWindow::ToolNormal(bool checked){ } void MainWindow::ClosedDialogNormal(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolNormal::Create(dialogNormal, currentScene, doc, data); - } else { - VModelingNormal *point = VModelingNormal::Create(dialogNormal, doc, data); - AddToolToDetail(point, point->getId(), Tool::NormalTool, dialogNormal->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogNormal, result); } void MainWindow::ToolBisector(bool checked){ @@ -328,15 +300,7 @@ void MainWindow::ToolBisector(bool checked){ } void MainWindow::ClosedDialogBisector(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolBisector::Create(dialogBisector, currentScene, doc, data); - } else { - VModelingBisector *point = VModelingBisector::Create(dialogBisector, doc, data); - AddToolToDetail(point, point->getId(), Tool::BisectorTool, dialogBisector->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogBisector, result); } void MainWindow::ToolLineIntersect(bool checked){ @@ -346,17 +310,7 @@ void MainWindow::ToolLineIntersect(bool checked){ } void MainWindow::ClosedDialogLineIntersect(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolLineIntersect::Create(dialogLineIntersect, currentScene, doc, data); - } else { - VModelingLineIntersect *point = VModelingLineIntersect::Create(dialogLineIntersect, doc, - data); - AddToolToDetail(point, point->getId(), Tool::LineIntersectTool, - dialogLineIntersect->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogLineIntersect, result); } void MainWindow::ToolSpline(bool checked){ @@ -365,15 +319,7 @@ void MainWindow::ToolSpline(bool checked){ } void MainWindow::ClosedDialogSpline(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolSpline::Create(dialogSpline, currentScene, doc, data); - } else { - VModelingSpline *spl = VModelingSpline::Create(dialogSpline, doc, data); - AddToolToDetail(spl, spl->getId(), Tool::SplineTool, dialogSpline->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogSpline, result); } void MainWindow::ToolArc(bool checked){ @@ -382,15 +328,7 @@ void MainWindow::ToolArc(bool checked){ } void MainWindow::ClosedDialogArc(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolArc::Create(dialogArc, currentScene, doc, data); - } else { - VModelingArc *arc = VModelingArc::Create(dialogArc, doc, data); - AddToolToDetail(arc, arc->getId(), Tool::ArcTool, dialogArc->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogArc, result); } void MainWindow::ToolSplinePath(bool checked){ @@ -400,15 +338,7 @@ void MainWindow::ToolSplinePath(bool checked){ } void MainWindow::ClosedDialogSplinePath(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolSplinePath::Create(dialogSplinePath, currentScene, doc, data); - } else { - VModelingSplinePath *spl = VModelingSplinePath::Create(dialogSplinePath, doc, data); - AddToolToDetail(spl, spl->getId(), Tool::SplinePathTool, dialogSplinePath->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogSplinePath, result); } void MainWindow::ToolPointOfContact(bool checked){ @@ -418,17 +348,7 @@ void MainWindow::ToolPointOfContact(bool checked){ } void MainWindow::ClosedDialogPointOfContact(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolPointOfContact::Create(dialogPointOfContact, currentScene, doc, data); - } else { - VModelingPointOfContact *point = VModelingPointOfContact::Create(dialogPointOfContact, doc, - data); - AddToolToDetail(point, point->getId(), Tool::PointOfContact, - dialogPointOfContact->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogPointOfContact, result); } void MainWindow::ToolDetail(bool checked){ @@ -464,15 +384,7 @@ void MainWindow::ToolHeight(bool checked){ } void MainWindow::ClosedDialogHeight(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolHeight::Create(dialogHeight, currentScene, doc, data); - } else { - VModelingHeight *point = VModelingHeight::Create(dialogHeight, doc, data); - AddToolToDetail(point, point->getId(), Tool::Height, dialogHeight->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogHeight, result); } void MainWindow::ToolTriangle(bool checked){ @@ -481,15 +393,7 @@ void MainWindow::ToolTriangle(bool checked){ } void MainWindow::ClosedDialogTriangle(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolTriangle::Create(dialogTriangle, currentScene, doc, data); - } else { - VModelingTriangle *point = VModelingTriangle::Create(dialogTriangle, doc, data); - AddToolToDetail(point, point->getId(), Tool::Triangle, dialogTriangle->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogTriangle, result); } void MainWindow::ToolPointOfIntersection(bool checked){ @@ -499,17 +403,7 @@ void MainWindow::ToolPointOfIntersection(bool checked){ } void MainWindow::ClosedDialogPointOfIntersection(int result){ - if(result == QDialog::Accepted){ - if(mode == Draw::Calculation){ - VToolPointOfIntersection::Create(dialogPointOfIntersection, currentScene, doc, data); - } else { - VModelingPointOfIntersection *point = VModelingPointOfIntersection::Create(dialogPointOfIntersection, - doc, data); - AddToolToDetail(point, point->getId(), Tool::PointOfIntersection, - dialogPointOfIntersection->getIdDetail()); - } - } - ArrowTool(); + ClosedDialog(dialogPointOfIntersection, result); } void MainWindow::About(){ diff --git a/mainwindow.h b/mainwindow.h index 7de1307cf..76a331375 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -159,6 +159,8 @@ private: template void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail); + template + void ClosedDialog(QSharedPointer &dialog, int result); bool SafeSaveing(const QString &fileName)const; void AutoSavePattern(); }; From 3c6212b7e1933de4f9e38c159888cfc429270985 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 29 Oct 2013 19:46:58 +0200 Subject: [PATCH 69/70] . --HG-- branch : develop --- tools/vabstracttool.cpp | 70 ++-- tools/vtooldetail.cpp | 49 +-- translations/valentina_ru.ts | 787 +++++++++++++++++++++++++---------- translations/valentina_uk.ts | 785 ++++++++++++++++++++++++---------- 4 files changed, 1169 insertions(+), 522 deletions(-) diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp index 42677bc56..634a3a73f 100644 --- a/tools/vabstracttool.cpp +++ b/tools/vabstracttool.cpp @@ -21,42 +21,42 @@ #include "vabstracttool.h" -const QString VAbstractTool::AttrId = QStringLiteral("id"); -const QString VAbstractTool::AttrType = QStringLiteral("type"); -const QString VAbstractTool::AttrMx = QStringLiteral("mx"); -const QString VAbstractTool::AttrMy = QStringLiteral("my"); -const QString VAbstractTool::AttrName = QStringLiteral("name"); -const QString VAbstractTool::AttrX = QStringLiteral("x"); -const QString VAbstractTool::AttrY = QStringLiteral("y"); -const QString VAbstractTool::AttrTypeLine = QStringLiteral("typeLine"); -const QString VAbstractTool::AttrLength = QStringLiteral("length"); -const QString VAbstractTool::AttrBasePoint = QStringLiteral("basePoint"); -const QString VAbstractTool::AttrFirstPoint = QStringLiteral("firstPoint"); +const QString VAbstractTool::AttrId = QStringLiteral("id"); +const QString VAbstractTool::AttrType = QStringLiteral("type"); +const QString VAbstractTool::AttrMx = QStringLiteral("mx"); +const QString VAbstractTool::AttrMy = QStringLiteral("my"); +const QString VAbstractTool::AttrName = QStringLiteral("name"); +const QString VAbstractTool::AttrX = QStringLiteral("x"); +const QString VAbstractTool::AttrY = QStringLiteral("y"); +const QString VAbstractTool::AttrTypeLine = QStringLiteral("typeLine"); +const QString VAbstractTool::AttrLength = QStringLiteral("length"); +const QString VAbstractTool::AttrBasePoint = QStringLiteral("basePoint"); +const QString VAbstractTool::AttrFirstPoint = QStringLiteral("firstPoint"); const QString VAbstractTool::AttrSecondPoint = QStringLiteral("secondPoint"); -const QString VAbstractTool::AttrThirdPoint = QStringLiteral("thirdPoint"); -const QString VAbstractTool::AttrCenter = QStringLiteral("center"); -const QString VAbstractTool::AttrRadius = QStringLiteral("radius"); -const QString VAbstractTool::AttrAngle = QStringLiteral("angle"); -const QString VAbstractTool::AttrAngle1 = QStringLiteral("angle1"); -const QString VAbstractTool::AttrAngle2 = QStringLiteral("angle2"); -const QString VAbstractTool::AttrP1Line = QStringLiteral("p1Line"); -const QString VAbstractTool::AttrP2Line = QStringLiteral("p2Line"); -const QString VAbstractTool::AttrP1Line1 = QStringLiteral("p1Line1"); -const QString VAbstractTool::AttrP2Line1 = QStringLiteral("p2Line1"); -const QString VAbstractTool::AttrP1Line2 = QStringLiteral("p1Line2"); -const QString VAbstractTool::AttrP2Line2 = QStringLiteral("p2Line2"); -const QString VAbstractTool::AttrPShoulder = QStringLiteral("pShoulder"); -const QString VAbstractTool::AttrPoint1 = QStringLiteral("point1"); -const QString VAbstractTool::AttrPoint4 = QStringLiteral("point4"); -const QString VAbstractTool::AttrKAsm1 = QStringLiteral("kAsm1"); -const QString VAbstractTool::AttrKAsm2 = QStringLiteral("kAsm2"); -const QString VAbstractTool::AttrKCurve = QStringLiteral("kCurve"); -const QString VAbstractTool::AttrPathPoint = QStringLiteral("pathPoint"); -const QString VAbstractTool::AttrPSpline = QStringLiteral("pSpline"); -const QString VAbstractTool::AttrAxisP1 = QStringLiteral("axisP1"); -const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2"); -const QString VAbstractTool::TypeLineNone = QStringLiteral("none"); -const QString VAbstractTool::TypeLineLine = QStringLiteral("hair"); +const QString VAbstractTool::AttrThirdPoint = QStringLiteral("thirdPoint"); +const QString VAbstractTool::AttrCenter = QStringLiteral("center"); +const QString VAbstractTool::AttrRadius = QStringLiteral("radius"); +const QString VAbstractTool::AttrAngle = QStringLiteral("angle"); +const QString VAbstractTool::AttrAngle1 = QStringLiteral("angle1"); +const QString VAbstractTool::AttrAngle2 = QStringLiteral("angle2"); +const QString VAbstractTool::AttrP1Line = QStringLiteral("p1Line"); +const QString VAbstractTool::AttrP2Line = QStringLiteral("p2Line"); +const QString VAbstractTool::AttrP1Line1 = QStringLiteral("p1Line1"); +const QString VAbstractTool::AttrP2Line1 = QStringLiteral("p2Line1"); +const QString VAbstractTool::AttrP1Line2 = QStringLiteral("p1Line2"); +const QString VAbstractTool::AttrP2Line2 = QStringLiteral("p2Line2"); +const QString VAbstractTool::AttrPShoulder = QStringLiteral("pShoulder"); +const QString VAbstractTool::AttrPoint1 = QStringLiteral("point1"); +const QString VAbstractTool::AttrPoint4 = QStringLiteral("point4"); +const QString VAbstractTool::AttrKAsm1 = QStringLiteral("kAsm1"); +const QString VAbstractTool::AttrKAsm2 = QStringLiteral("kAsm2"); +const QString VAbstractTool::AttrKCurve = QStringLiteral("kCurve"); +const QString VAbstractTool::AttrPathPoint = QStringLiteral("pathPoint"); +const QString VAbstractTool::AttrPSpline = QStringLiteral("pSpline"); +const QString VAbstractTool::AttrAxisP1 = QStringLiteral("axisP1"); +const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2"); +const QString VAbstractTool::TypeLineNone = QStringLiteral("none"); +const QString VAbstractTool::TypeLineLine = QStringLiteral("hair"); VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){ diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp index 6f0138518..de0d48269 100644 --- a/tools/vtooldetail.cpp +++ b/tools/vtooldetail.cpp @@ -24,14 +24,14 @@ #include "modelingTools/vmodelingtool.h" #include "modelingTools/modelingtools.h" -const QString VToolDetail::TagName = QStringLiteral("detail"); -const QString VToolDetail::TagNode = QStringLiteral("node"); -const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); -const QString VToolDetail::AttrClosed = QStringLiteral("closed"); -const QString VToolDetail::AttrWidth = QStringLiteral("width"); -const QString VToolDetail::AttrIdObject = QStringLiteral("idObject"); -const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); -const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); +const QString VToolDetail::TagName = QStringLiteral("detail"); +const QString VToolDetail::TagNode = QStringLiteral("node"); +const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); +const QString VToolDetail::AttrClosed = QStringLiteral("closed"); +const QString VToolDetail::AttrWidth = QStringLiteral("width"); +const QString VToolDetail::AttrIdObject = QStringLiteral("idObject"); +const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); +const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, Tool::Sources typeCreation, @@ -40,50 +40,39 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, VDetail detail = data->GetDetail(id); for(qint32 i = 0; i< detail.CountNode(); ++i){ switch(detail[i].getTypeTool()){ - case(Tool::NodePoint):{ + case(Tool::NodePoint): InitTool(scene, detail[i]); break; - } - case(Tool::NodeArc):{ + case(Tool::NodeArc): InitTool(scene, detail[i]); break; - } - case(Tool::NodeSpline):{ + case(Tool::NodeSpline): InitTool(scene, detail[i]); break; - } - case(Tool::NodeSplinePath):{ + case(Tool::NodeSplinePath): InitTool(scene, detail[i]); break; - } - case(Tool::AlongLineTool):{ + case(Tool::AlongLineTool): InitTool(scene, detail[i]); break; - } - case(Tool::ArcTool):{ + case(Tool::ArcTool): InitTool(scene, detail[i]); break; - } - case(Tool::BisectorTool):{ + case(Tool::BisectorTool): InitTool(scene, detail[i]); break; - } - case(Tool::EndLineTool):{ + case(Tool::EndLineTool): InitTool(scene, detail[i]); break; - } - case(Tool::LineIntersectTool):{ + case(Tool::LineIntersectTool): InitTool(scene, detail[i]); break; - } - case(Tool::LineTool):{ + case(Tool::LineTool): InitTool(scene, detail[i]); break; - } - case(Tool::NormalTool):{ + case(Tool::NormalTool): InitTool(scene, detail[i]); break; - } case(Tool::PointOfContact): InitTool(scene, detail[i]); break; diff --git a/translations/valentina_ru.ts b/translations/valentina_ru.ts index a6b0c678c..72d64a1ff 100644 --- a/translations/valentina_ru.ts +++ b/translations/valentina_ru.ts @@ -120,7 +120,7 @@ - + Select second point of line @@ -264,7 +264,7 @@ - + Value angle of line. @@ -398,12 +398,12 @@ - + Select second point of angle - + Select third point of angle @@ -416,22 +416,51 @@ Деталь - - Name detail - Имя детали + + Bias X + - + + Bias Y + + + + + Option + + + + + Name of detail + + + + + Supplement for seams + + + + + Width + + + + Name detail + Имя детали + + + Closed Замкнутая - + Get wrong scene object. Ignore. - + Get wrong tools. Ignore. @@ -558,6 +587,57 @@ + + DialogHeight + + + Dialog + + + + + Name new point + Имя новой точки + + + + Base point + Базовая точка + + + + + + + First point of line + + + + + Second point of line + + + + + Type line + Тип линии + + + + Show line from first point to our point + + + + + Select first point of line + + + + + Select second point of line + + + DialogHistory @@ -567,7 +647,7 @@ - + Tool Инструмент @@ -628,7 +708,17 @@ - + + Point of perpendical from point %1 to line %2_%3 + + + + + Triangle: axis %1_%2, points %3 and %4 + + + + Get wrong tool type. Ignore. @@ -648,23 +738,23 @@ - - - + + + Denotation Обозначение - + The calculated value Расчитаное значение - - - + + + Base value Базовое значение @@ -680,97 +770,102 @@ - - - - - + + + + + Description Опис - - - + + + In size В размерах - - - + + + In growth В ростах - - + + ... - + Lines Линии - - + + Line Линия - + Length of the line Длина линии - + Curves Кривые - - + + Curve Кривая - + Length of the curve Длина кривой - + Arcs Дуги - - + + Arc Дуга - + Length of arc Длина дуги - + Denotation %1 - - + + Can't convert toDouble value. + + + + + Calculated value - - - + + + Length Длина @@ -793,7 +888,7 @@ Вторая точка - + Select second point @@ -833,17 +928,17 @@ Вторая линия - + Select second point of first line - + Select first point of second line - + Select second point of second line @@ -970,7 +1065,7 @@ - + Select second point of line @@ -1084,16 +1179,54 @@ - + Select second point of line - + Select point of center of arc + + DialogPointOfIntersection + + + Dialog + + + + + Name new point + Имя новой точки + + + + Point vertically + + + + + First point of angle + + + + + Point horizontally + + + + + Second point of angle + + + + + Select point horizontally + + + DialogShoulderPoint @@ -1200,12 +1333,12 @@ - + Select second point of line - + Select point of shoulder @@ -1338,7 +1471,7 @@ Коефициент кривизные кривой - + Select point of curve path @@ -1346,33 +1479,114 @@ DialogTool - + Wrong details id. - - - + + + Line Линия - - + + No line - + + Can't find point by name + + + + Error - + + Growth + + + + + Size + + + + Line length + + + Arc length + + + + + Curve length + + + + + DialogTriangle + + + Dialog + + + + + Name new point + Имя новой точки + + + + First point of axis + + + + + + + + First point of line + + + + + Second point of axis + + + + + First point + Первая точка + + + + Second point + Вторая точка + + + + Select second point of axis + + + + + Select first point + + + + + Select second point + + MainWindow @@ -1392,7 +1606,7 @@ Точка - + Tool point of normal. @@ -1403,12 +1617,15 @@ - - - - - - + + + + + + + + + ... @@ -1418,459 +1635,496 @@ - + Tool point on the end line. - + Tool point along line. - + Tool point of bisector. - + Tool point of contact. - + + Tool point of height. + + + + + Tool triangle. + + + + Tools for creating lines. - + Line Линия - + Tool line. - + Tool point of line intersection. - + Tools for creating curves. - + Curve Кривая - + Tool curve. - + Tool path curve. - + Tools for creating arcs. - + Arc Дуга - + Tool arc. - + Tools for creating details. - + Detail Деталь - + Tool new detail. - + File - + Help - + Drawing - + toolBar - + toolBar_2 - + toolBar_3 - + New Новое - + Create a new pattern Создать новое лекало - + Open Открыть - + Open file with pattern Открыть файл с лекалом - + Save Сохранить - + Save pattern Сохранить лекало - - + + Save as Сохранить как - + Save not yet saved pattern Сохранить еще не сохраненное лекало - + Draw Рисование - + Draw mode Режим рисования - + Details Детали - + Deatils mode Режим деталей - - + + Tools pointer Инструмент указатель - + New drawing Новый чертеж - + Add new drawing Добавить новый чертеж - - + + Change the name of drawing Изменить имя чертежа - + Table of variables Таблица переменных - + Tables of variables Таблици переменных - + History История - + Layout Роскладка - + Create layout Создать раскладку - - + + About Qt - - + + About Valentina - + Exit - + Drawing %1 Чертеж %1 - - + + Drawing: Чертеж: - + Enter a name for the drawing. Введите имя чертежа. - - + + Error. Drawing of same name already exists. Ошибка. Чертеж с таким именем уже существует. - + Error creating drawing with the name Ошибка создания чертежа с именем - + Enter a new name for the drawing. Введите новое имя для чертежа. - + Error saving change!!! - + Can't save new name of drawing - - + + Select point - + Select first point - - - + + + Select first point of line - + Select first point of angle - + Select first point of first line - + Select first point curve - + Select point of center of arc - + Select point of curve path - - Valentina v.0.1.0 - - - - + The pattern has been modified. - + Do you want to save your changes? - + Growth: Рост: - + Size: Размер: - + Drawing: Чертеж: - + Lekalo files (*.xml);;All files (*.*) - - + + Lekalo files (*.xml) Файл лекала (*.xml) - + Error saving file. Can't save file. - + Open file Открыть файл - + Got empty file name. - + Could not copy temp file to pattern file - + Could not remove pattern file - + Can't open pattern file. File name empty Не могу открыть файл лекала. Пустое имя файла - - - - - - - + + + + + + + + Error! Ошибка! - + Create new drawing for start working. - + Select points, arcs, curves clockwise. - + + Select base point + + + + + Select first point of axis + + + + + Select point vertically + + + + + Based on Qt %2 (32 bit) + + + + + Built on %3 at %4 + + + + + <h1>%1</h1> %2 <br/><br/> %3 <br/><br/> %4 + + + + Error parsing file. Ошибка парсинга файла. - + Error can't convert value. Ошибка, не могу конвертовать значение. - + Error empty parameter. Ошибка, пустой параметр. - + Error wrong id. Ошибка, неправильный id. - + + Error don't unique id. - + Error parsing pattern file. Ошибка парсинга файла лекала. - + Error in line %1 column %2 Ошибка в линии %1 столбец %2 @@ -1894,6 +2148,7 @@ + Save layout Создать раскладку @@ -1966,55 +2221,63 @@ Стоп - + SVG Generator Example Drawing SVG Generator Example Drawing - + An SVG drawing created by the SVG Generator Example provided with Qt. An SVG drawing created by the SVG Generator Example provided with Qt. + + VAbstractNode + + + Can't find tag Modeling + + + VApplication - - - - - - + + + + + + Error! Ошибка! - + Error parsing file. Program will be terminated. Ошибка парсинга файла. Програма будет закрыта. - + Error bad id. Program will be terminated. Ошибка, неправильный id. Програма будет закрыта. - + Error can't convert value. Program will be terminated. Ошибка не могу конвертировать значение. Програма будет закрыта. - + Error empty parameter. Program will be terminated. Ошибка пустой параметр. Програма будет закрыта. - + Error wrong id. Program will be terminated. Ошибка неправельный id. Програма будет закрыта. - + Something wrong!! @@ -2022,17 +2285,17 @@ VArc - + Can't find id = %1 in table. - + Angle of arc can't be 0 degree. - + Arc have not this number of part. @@ -2040,7 +2303,7 @@ VContainer - + Can't find object Не могу найти объект @@ -2048,122 +2311,137 @@ VDomDocument - + Got wrong parameter id. Need only id > 0. Получен неправельный параметр id. Допустимы только id > 0. - + Can't convert toLongLong parameter Не могу конвертировать toLongLong параметр - + Got empty parameter Получен пустой параметр - + Can't convert toDouble parameter Не могу конвертировать toDouble параметр - + This id is not unique. - + Error creating or updating detail Ошибка создания или обновления детали - + Error creating or updating single point Ошибка создания или обновления базовой точки - + Error creating or updating point of end line Ошибка создания или обновления точки на конце линии - + Error creating or updating point along line Ошибка создания или обновления точки вдоль линии - + Error creating or updating point of shoulder Ошибка создания или обновления точки плеча - + Error creating or updating point of normal Ошибка создания или обновления точки нормали - + Error creating or updating point of bisector Ошибка создания или обновления точки бисектрисы - + Error creating or updating point of lineintersection Ошибка создания или обновления точки пересичения линий - + Error creating or updating point of contact Ошибка создания или обновления точки прикосновения - + Error creating or updating modeling point Ошибка создания или обновления точки + Error creating or updating height + + + + + Error creating or updating triangle + + + + + Error creating or updating point of intersection + + + + Error creating or updating line Ошибка создания или обновления линии - + Error creating or updating simple curve Ошибка создания или обновления кривой - + Error creating or updating curve path Ошибка создания или обновления сложной кривой - + Error creating or updating modeling simple curve Ошибка создания или обновления модельной кривой - + Error creating or updating modeling curve path Ошибка создания или обновления сложной модельной кривой - + Error creating or updating simple arc Ошибка создания или обновления дуги - + Error creating or updating modeling arc Ошибка создания или обновления модельной дуги - + Error! Ошибка! - + Error parsing file. Ошибка парсинга файла. @@ -2184,28 +2462,77 @@ Delete Удалить + + + Can not find the element after which you want to insert. + + + + + Can't find tag Calculation + + + + + VModelingTool + + + Option + + + + + Delete + Удалить + VSplinePath - + Not enough points to create the spline. Не достаточно точок для создания кривой. - - - + + + This spline is not exist. Такой кривой не существует. + + VTableGraphicsView + + + detail don't find + + + + + detail find + + + VToolDetail - + + Options + Параметры + + + Delete Удалить + + VToolTriangle + + + Can't find point. + + + diff --git a/translations/valentina_uk.ts b/translations/valentina_uk.ts index dbbfe8910..6d8446548 100644 --- a/translations/valentina_uk.ts +++ b/translations/valentina_uk.ts @@ -120,7 +120,7 @@ Змінні. Подвійний клік для вибору. - + Select second point of line Виберіть другу точку лінії @@ -264,7 +264,7 @@ Змінні - + Value angle of line. Значення дуги лінії. @@ -398,12 +398,12 @@ Змінні. Подвійний клік для вибору. - + Select second point of angle Виберіть другу точку кута - + Select third point of angle Виберіть третю точку кута @@ -416,22 +416,51 @@ Деталь - - Name detail - Ім'я деталі + + Bias X + - + + Bias Y + + + + + Option + + + + + Name of detail + + + + + Supplement for seams + + + + + Width + + + + Name detail + Ім'я деталі + + + Closed Замкнена - + Get wrong scene object. Ignore. Отримано непаравильний об'єкт сцени. Ігноровано. - + Get wrong tools. Ignore. Отримано неправильний інструмент. Ігноровано. @@ -558,6 +587,57 @@ Змінні. Подвійний клік для вибору. + + DialogHeight + + + Dialog + + + + + Name new point + Ім'я нової точки + + + + Base point + Базова точка + + + + + + + First point of line + Перша точка лінії + + + + Second point of line + Друга точка лінії + + + + Type line + Тип лінії + + + + Show line from first point to our point + Показати лінію від першої точки до нашої точки + + + + Select first point of line + Виберість першу точку лінії + + + + Select second point of line + Виберіть другу точку лінії + + DialogHistory @@ -567,7 +647,7 @@ - + Tool Інструмент @@ -628,7 +708,17 @@ %4 - Точка дотику дуги з центром в точці %1 і лінії %2_%3 - + + Point of perpendical from point %1 to line %2_%3 + + + + + Triangle: axis %1_%2, points %3 and %4 + + + + Get wrong tool type. Ignore. Отримано неправильний тип інструменту. Ігноруємо. @@ -648,23 +738,23 @@ - - - + + + Denotation Позначення - + The calculated value Розраховане значення - - - + + + Base value Базове значення @@ -680,97 +770,102 @@ - - - - - + + + + + Description Опис - - - + + + In size В розмірах - - - + + + In growth В ростах - - + + ... - + Lines Лінії - - + + Line Лінія - + Length of the line Довжина лінії - + Curves Криві - - + + Curve Крива - + Length of the curve Довжина кривої - + Arcs Дуги - - + + Arc Дуга - + Length of arc Довжина дуги - + Denotation %1 Позначення %1 - - + + Can't convert toDouble value. + + + + + Calculated value Розраховане значення - - - + + + Length Довжина @@ -793,7 +888,7 @@ Друга точка - + Select second point Виберіть другу точку @@ -833,17 +928,17 @@ Друга лінія - + Select second point of first line Виберіть другу точка першої лінії - + Select first point of second line Виберіть першу точку другої лінії - + Select second point of second line Виберіть другу точку другої лінії @@ -970,7 +1065,7 @@ Змінні. Подвійний клік для вибору. - + Select second point of line Виберіть другу точку лінії @@ -1084,16 +1179,54 @@ Змінні. Подвійний клік для вибору. - + Select second point of line Виберіть другу точку лінії - + Select point of center of arc Виберіть точку центру дуги + + DialogPointOfIntersection + + + Dialog + + + + + Name new point + Ім'я нової точки + + + + Point vertically + + + + + First point of angle + Перша точка кута + + + + Point horizontally + + + + + Second point of angle + Друга точка кута + + + + Select point horizontally + + + DialogShoulderPoint @@ -1200,12 +1333,12 @@ Змінні. Подвійний клік для вибору. - + Select second point of line Виберіть другу точку лінії - + Select point of shoulder Виберіть точку плеча @@ -1338,7 +1471,7 @@ Коефіцієнт кривизни кривої - + Select point of curve path Виберіть точку складної кривої @@ -1346,33 +1479,114 @@ DialogTool - + Wrong details id. Неправильний id деталі. - - - + + + Line Лінія - - + + No line Без лінії - + + Can't find point by name + + + + Error Помилка - + + Growth + + + + + Size + + + + Line length Довжина лінії + + + Arc length + + + + + Curve length + + + + + DialogTriangle + + + Dialog + + + + + Name new point + Ім'я нової точки + + + + First point of axis + + + + + + + + First point of line + Перша точка лінії + + + + Second point of axis + + + + + First point + Перша точка + + + + Second point + Друга точка + + + + Select second point of axis + + + + + Select first point + Виберість першу точку + + + + Select second point + Виберіть другу точку + MainWindow @@ -1392,7 +1606,7 @@ Точка - + Tool point of normal. Інструмент точка перпендикуляра. @@ -1403,12 +1617,15 @@ - - - - - - + + + + + + + + + ... @@ -1418,332 +1635,342 @@ Інструмент точка плеча. - + Tool point on the end line. Інструмент точка на кінці лінії. - + Tool point along line. Інструмент точка вздовж лінії. - + Tool point of bisector. Інструмент точка бісектриси кута. - + Tool point of contact. Інструмент точка дотику. - + + Tool point of height. + + + + + Tool triangle. + + + + Tools for creating lines. Інструменти для створення ліній. - + Line Лінія - + Tool line. Інструмент лінія. - + Tool point of line intersection. Інструмент точка перетину ліній. - + Tools for creating curves. Інструменти для створення кривих. - + Curve Крива - + Tool curve. Інструмент крива. - + Tool path curve. Інструмент складна крива. - + Tools for creating arcs. Інструменти для створення дуг. - + Arc Дуга - + Tool arc. Інструмент дуга. - + Tools for creating details. Інструменти для створення деталей. - + Detail Деталь - + Tool new detail. Інструмент нова деталь. - + File Файл - + Help Допомога - + Drawing Креслення - + toolBar - + toolBar_2 - + toolBar_3 - + New Новий - + Create a new pattern Створити нове лекало - + Open Відкрити - + Open file with pattern Відкрити файл з лекалами - + Save Зберегти - + Save pattern Зберегти лекало - - + + Save as Зберегти як - + Save not yet saved pattern Зберегти ще не збережене лекало - + Draw Малювання - + Draw mode Режим малювання - + Details Деталь - + Deatils mode Режим деталей - - + + Tools pointer Інструмент вказівник - + New drawing Нове креслення - + Add new drawing Додати нове креслення - - + + Change the name of drawing Змінити ім'я креслення - + Table of variables Таблиця змінних - + Tables of variables Таблиці змінних - + History Історія - + Layout Розкладки - + Create layout Створити розкладку - - + + About Qt Про Qt - - + + About Valentina Про Valentina - + Exit Вихід - + Drawing %1 Креслення %1 - - + + Drawing: Креслення: - + Enter a name for the drawing. Введіть ім'я креслення. - - + + Error. Drawing of same name already exists. Помилка. Креслення з таким ім'ям вже існує. - + Error creating drawing with the name Помилка створення креслення з ім'ям - + Enter a new name for the drawing. Введіть нове ім'я креслення. - + Error saving change!!! - + Can't save new name of drawing - - + + Select point Виберість точку - + Select first point Виберість першу точку - - - + + + Select first point of line Виберість першу точку лінії - + Select first point of angle Виберіть першу точку кута - + Select first point of first line Виберіть першу точку першої лінії - + Select first point curve Виберіть першу точку кривої - + Select point of center of arc Виберіть точку центру дуги - + Select point of curve path Виберіть точку складної кривої @@ -1752,129 +1979,160 @@ Виберіть точки, дуги, криві і д - Valentina v.0.1.0 - Valentina v.0.1.0 + Valentina v.0.1.0 - + The pattern has been modified. Лекало було зміненно. - + Do you want to save your changes? Ви хочете зберегти зміни? - + Growth: Зріст: - + Size: Розмір: - + Drawing: Креслення: - + Lekalo files (*.xml);;All files (*.*) Файли лекала (*.xml);;Всі файли (*.*) - - + + Lekalo files (*.xml) Файл лекала (*.xml) - + Error saving file. Can't save file. Помилка збереження файлу. Не можу зберегти файл. - + Open file Відкрити файл - + Got empty file name. Отримано пусте імя файлу. - + Could not copy temp file to pattern file Не можу копіювати тимчасовий файл до файлу лекала - + Could not remove pattern file Не можу видалити файл лекала - + Can't open pattern file. File name empty Не можу відкрити файл лекала. Пусте ім'я файлу - - - - - - - + + + + + + + + Error! Помилка! - + Create new drawing for start working. Створіть нове креслення для початку роботи. - + Select points, arcs, curves clockwise. Виберіть точки, дуги, криві загодинниковою стрілкою. - + + Select base point + + + + + Select first point of axis + + + + + Select point vertically + + + + + Based on Qt %2 (32 bit) + + + + + Built on %3 at %4 + + + + + <h1>%1</h1> %2 <br/><br/> %3 <br/><br/> %4 + + + + Error parsing file. Помилка парсингу файла. - + Error can't convert value. Помилка, не можу конвертувати значення. - + Error empty parameter. Помилка, пустий параметр. - + Error wrong id. Помикла, неправильний id. - + + Error don't unique id. Помилка, не унікальний id. - + Error parsing pattern file. Помилка парсінгу файлу лекала. - + Error in line %1 column %2 Помилка в лінії %1 стовпчик %2 @@ -1898,6 +2156,7 @@ + Save layout Зберегти розкладку @@ -1970,55 +2229,63 @@ Зупинити - + SVG Generator Example Drawing - + An SVG drawing created by the SVG Generator Example provided with Qt. + + VAbstractNode + + + Can't find tag Modeling + + + VApplication - - - - - - + + + + + + Error! Помилка! - + Error parsing file. Program will be terminated. Помилка парсінгу файла. Програма буде закрита. - + Error bad id. Program will be terminated. Помилка неправильний id. Програма буде закрита. - + Error can't convert value. Program will be terminated. Помилка конвертації значення. Програма буде закрита. - + Error empty parameter. Program will be terminated. Помилка пустий параметр. Програма буде закрита. - + Error wrong id. Program will be terminated. Помилка неправильний id. Програма буде закрита. - + Something wrong!! @@ -2026,17 +2293,17 @@ VArc - + Can't find id = %1 in table. - + Angle of arc can't be 0 degree. - + Arc have not this number of part. @@ -2044,7 +2311,7 @@ VContainer - + Can't find object Не можу знайти об'єкт @@ -2052,122 +2319,137 @@ VDomDocument - + Got wrong parameter id. Need only id > 0. Отримано неправильний id. Допускаються тільки id > 0. - + Can't convert toLongLong parameter Не можу конвертувати toLongLong параметру - + Got empty parameter Отримано пустий параметр - + Can't convert toDouble parameter Не можу конвертувати toDouble параметру - + This id is not unique. Цей id не унікальний. - + Error creating or updating detail Помилка створення чи оновлення деталі - + Error creating or updating single point Помилка створення чи оновлення простої точки - + Error creating or updating point of end line Помилка створення чи оновлення точки кінця відрізку - + Error creating or updating point along line Помилка створення чи оновлення точки вздовж лінії - + Error creating or updating point of shoulder Помилка створення чи оновлення точки плеча - + Error creating or updating point of normal Помилка створення чи оновлення точки нормалі - + Error creating or updating point of bisector Помилка створення чи оновлення точки бісектриси - + Error creating or updating point of lineintersection Помилка створення чи оновлення точки перетину ліній - + Error creating or updating point of contact Помилка створення чи оновлення точки дотику - + Error creating or updating modeling point Помилка створення чи оновлення модельної точки + Error creating or updating height + + + + + Error creating or updating triangle + + + + + Error creating or updating point of intersection + + + + Error creating or updating line Помилка створення чи оновлення лінії - + Error creating or updating simple curve Помилка створення чи оновлення кривої - + Error creating or updating curve path Помилка створення чи оновлення шляху кривих - + Error creating or updating modeling simple curve Помилка створення чи оновлення модельної кривої - + Error creating or updating modeling curve path Помилка створення чи оновлення модельного шляху кривих - + Error creating or updating simple arc Помилка створення чи оновлення дуги - + Error creating or updating modeling arc Помилка створення чи оновлення модельної дуги - + Error! Помилка! - + Error parsing file. Помилка парсингу файла. @@ -2188,28 +2470,77 @@ Delete Видалити + + + Can not find the element after which you want to insert. + + + + + Can't find tag Calculation + + + + + VModelingTool + + + Option + + + + + Delete + Видалити + VSplinePath - + Not enough points to create the spline. Не достатньо точок для створення кривої. - - - + + + This spline is not exist. Такий сплайн не існує. + + VTableGraphicsView + + + detail don't find + + + + + detail find + + + VToolDetail - + + Options + Параметри + + + Delete Видалити + + VToolTriangle + + + Can't find point. + + + From 9ae8671ee46b58a8f571c9552f2a55e11e3b75b0 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 29 Oct 2013 19:49:19 +0200 Subject: [PATCH 70/70] Preparation for new version. --HG-- branch : develop --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index 24e0c06b5..f988bb497 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,7 @@ #include extern const int MAJOR_VERSION = 0; -extern const int MINOR_VERSION = 1; +extern const int MINOR_VERSION = 2; extern const int DEBUG_VERSION = 0; extern const QString APP_VERSION(QStringLiteral("%1.%2.%3").arg(MAJOR_VERSION).arg(MINOR_VERSION).arg(DEBUG_VERSION));