From 79f2ddde2ac0624e92273ab6b096a6d2aef7ecb6 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 26 Feb 2014 11:51:37 +0200 Subject: [PATCH] Vera++. --HG-- branch : feature --- src/dialogs/app/configdialog.cpp | 6 ++-- .../app/dialogindividualmeasurements.h | 5 +-- src/dialogs/app/dialogmeasurements.h | 5 +-- src/dialogs/app/dialogpatternproperties.h | 5 +-- src/dialogs/app/dialogstandardmeasurements.h | 5 +-- src/dialogs/tools/dialogtool.cpp | 2 +- src/dialogs/tools/dialogtool.h | 3 +- src/dialogs/tools/dialoguniondetails.cpp | 3 +- src/mainwindow.cpp | 6 +++- src/tablewindow.cpp | 4 +-- src/tools/drawTools/vtoolbisector.cpp | 7 ++-- src/tools/drawTools/vtoolline.cpp | 4 +-- src/tools/drawTools/vtoolline.h | 4 +-- src/tools/drawTools/vtoolshoulderpoint.cpp | 6 ++-- src/tools/drawTools/vtoolsplinepath.cpp | 2 +- src/tools/vabstracttool.cpp | 14 ++++---- src/tools/vtooluniondetails.h | 7 ++-- src/widgets/textdelegate.cpp | 4 +-- src/xml/vpattern.cpp | 36 ++++++++++--------- 19 files changed, 71 insertions(+), 57 deletions(-) diff --git a/src/dialogs/app/configdialog.cpp b/src/dialogs/app/configdialog.cpp index 283ed3da3..dd287a059 100644 --- a/src/dialogs/app/configdialog.cpp +++ b/src/dialogs/app/configdialog.cpp @@ -125,12 +125,12 @@ void ConfigDialog::createIcons() void ConfigDialog::Apply() { - switch(contentsWidget->currentRow()) + switch (contentsWidget->currentRow()) { - case(0): + case (0): configurationPage->Apply(); break; - case(1): + case (1): patternPage->Apply(); break; default: diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h index bcde13c66..1c97d264e 100644 --- a/src/dialogs/app/dialogindividualmeasurements.h +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -31,8 +31,9 @@ #include -namespace Ui { -class DialogIndividualMeasurements; +namespace Ui +{ + class DialogIndividualMeasurements; } class DialogIndividualMeasurements : public QDialog diff --git a/src/dialogs/app/dialogmeasurements.h b/src/dialogs/app/dialogmeasurements.h index 2a098c32c..23ef5a64e 100644 --- a/src/dialogs/app/dialogmeasurements.h +++ b/src/dialogs/app/dialogmeasurements.h @@ -31,8 +31,9 @@ #include -namespace Ui { -class DialogMeasurements; +namespace Ui +{ + class DialogMeasurements; } namespace Measurements diff --git a/src/dialogs/app/dialogpatternproperties.h b/src/dialogs/app/dialogpatternproperties.h index 9bd8c11f9..3c4fae0c5 100644 --- a/src/dialogs/app/dialogpatternproperties.h +++ b/src/dialogs/app/dialogpatternproperties.h @@ -32,8 +32,9 @@ #include #include "../../xml/vpattern.h" -namespace Ui { -class DialogPatternProperties; +namespace Ui +{ + class DialogPatternProperties; } class DialogPatternProperties : public QDialog diff --git a/src/dialogs/app/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h index d89ed2593..838cc48ce 100644 --- a/src/dialogs/app/dialogstandardmeasurements.h +++ b/src/dialogs/app/dialogstandardmeasurements.h @@ -31,8 +31,9 @@ #include -namespace Ui { -class DialogStandardMeasurements; +namespace Ui +{ + class DialogStandardMeasurements; } class DialogStandardMeasurements : public QDialog diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index d2b23fc1b..03ce0823f 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -213,7 +213,7 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const QString DialogTool::GetTypeLine(const QComboBox *box) const { - switch(lineStyles.indexOf(box->currentText())) + switch (lineStyles.indexOf(box->currentText())) { case 0: //No line return VAbstractTool::TypeLineNone; diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index ee1abf5df..9b68e07bb 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -389,7 +389,8 @@ protected: * @param id don't show this id in list * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 */ - void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, const quint32 &id, + void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, + const quint32 &id, ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const; /** * @brief getCurrentPointId return current point id in combobox diff --git a/src/dialogs/tools/dialoguniondetails.cpp b/src/dialogs/tools/dialoguniondetails.cpp index 73c80a3f6..580bcddc2 100644 --- a/src/dialogs/tools/dialoguniondetails.cpp +++ b/src/dialogs/tools/dialoguniondetails.cpp @@ -72,7 +72,8 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) return det.Containes(id); } -void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index) +void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, + ptrdiff_t &index) { if (idDetail == 0) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f72d42447..cdc622e12 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), - drawMode(true), recentFileActs{0,0,0,0,0}, separatorAct(nullptr), autoSaveTimer(nullptr) + drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr), autoSaveTimer(nullptr) { CreateActions(); CreateMenus(); @@ -1258,9 +1258,13 @@ bool MainWindow::MaybeSave() "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (ret == QMessageBox::Save) + { return Save(); + } else if (ret == QMessageBox::Cancel) + { return false; + } } return true; } diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index c4d489b34..3902fc0c9 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -490,7 +490,7 @@ void TableWindow::EpsFile(const QString &name) const params << "-eps" << tmp.fileName() << name; PdfToPs(name, params); - } + } } void TableWindow::PsFile(const QString &name) const @@ -530,7 +530,7 @@ void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const qDebug() << proc.errorString(); QFile f(name); - if (!f.exists()) + if (f.exists() == false) { QMessageBox msgBox(QMessageBox::Critical, "Critical error!", "Creating file '"+name+"' failed!", QMessageBox::Ok | QMessageBox::Default); diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 7208a4610..b2e42fa59 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -32,10 +32,9 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector"); -VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, - const QString &typeLine, const QString &formula, const quint32 &firstPointId, - const quint32 &secondPointId, const quint32 &thirdPointId, const Tool::Sources &typeCreation, - QGraphicsItem *parent) +VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, + const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0) { this->firstPointId = firstPointId; diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 766d7d998..9589315eb 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -78,8 +78,8 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern * Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, - VMainGraphicsScene *scene, VPattern *doc, VContainer *data, +void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, + const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { Q_CHECK_PTR(scene); diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 056b88a0b..d1e8fc74d 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -78,8 +78,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, - VMainGraphicsScene *scene, VPattern *doc, VContainer *data, + static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, + const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; public slots: diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 95ca09e19..4f137473d 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -32,9 +32,9 @@ const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); -VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, - const QString &typeLine, const QString &formula, const quint32 &p1Line, - const quint32 &p2Line, const quint32 &pShoulder, const Tool::Sources &typeCreation, +VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &p1Line, const quint32 &p2Line, + const quint32 &pShoulder, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder) { diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index caa09ffb0..c58b3b5c3 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -374,7 +374,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement) splPath.getKCurve()); CorectControlPoints(spl, splPath, i); CorectControlPoints(spl, splPath, i); - } + } doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 3832ba14c..e6453f773 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -260,24 +260,24 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool) Qt::PenStyle VAbstractTool::LineStyle() { QStringList styles = Styles(); - switch(styles.indexOf(typeLine)) + switch (styles.indexOf(typeLine)) { - case 0: + case 0: // TypeLineNone return Qt::NoPen; break; - case 1: + case 1: // TypeLineLine return Qt::SolidLine; break; - case 2: + case 2: // TypeLineDashLine return Qt::DashLine; break; - case 3: + case 3: // TypeLineDotLine return Qt::DotLine; break; - case 4: + case 4: // TypeLineDashDotLine return Qt::DashDotLine; break; - case 5: + case 5: // TypeLineDashDotDotLine return Qt::DashDotDotLine; break; default: diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 32505d861..625901f4e 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -80,9 +80,10 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, const quint32 &d2id, - const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, + const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, + VPattern *doc, VContainer *data, const Document::Documents &parse, + const Tool::Sources &typeCreation); /** * @brief GetDetailFromFile parse detail from file. * @param doc dom document container. diff --git a/src/widgets/textdelegate.cpp b/src/widgets/textdelegate.cpp index 54050cb06..a073dadf7 100644 --- a/src/widgets/textdelegate.cpp +++ b/src/widgets/textdelegate.cpp @@ -69,7 +69,7 @@ void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons QLineEdit *lineEdit = qobject_cast(editor); Q_CHECK_PTR(lineEdit); QString text = lineEdit->text(); - if(text.isEmpty()) + if (text.isEmpty()) { text = lastText; } @@ -94,7 +94,7 @@ void TextDelegate::commitAndCloseEditor() lastText = text; emit commitData(lineEdit); } - else if(text.isEmpty() == false) + else if (text.isEmpty() == false) { lineEdit->setText(lastText); emit commitData(lineEdit); diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index c900dbf3c..82f53e3af 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -189,7 +189,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene { QStringList tags; tags << TagDraw << TagIncrements; - switch(tags.indexOf(domElement.tagName())) + switch (tags.indexOf(domElement.tagName())) { case 0: // TagDraw if (parse == Document::FullParse) @@ -450,7 +450,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen { QStringList tags; tags << TagCalculation << TagModeling << TagDetails; - switch(tags.indexOf(domElement.tagName())) + switch (tags.indexOf(domElement.tagName())) { case 0: // TagCalculation data->ClearCalculationGObjects(); @@ -495,7 +495,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene * { QStringList tags; tags << TagPoint << TagLine << TagSpline << TagArc << TagTools; - switch(tags.indexOf(domElement.tagName())) + switch (tags.indexOf(domElement.tagName())) { case 0: // TagPoint ParsePointElement(scene, domElement, parse, domElement.attribute(AttrType, "")); @@ -555,7 +555,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle QStringList types; types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline << VToolDetail::NodeSplinePath; - switch(types.indexOf(t)) + switch (types.indexOf(t)) { case 0: // VToolDetail::NodePoint tool = Tool::NodePoint; @@ -624,7 +624,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType << VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType << VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType; - switch(points.indexOf(type)) { + switch (points.indexOf(type)) + { case 0: //VToolSinglePoint::ToolType { VToolSinglePoint *spoint = 0; @@ -747,8 +748,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); - VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, - angle, mx, my, scene, this,data, parse, Tool::FromFile); + VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, + this, data, parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -815,8 +816,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, - mx, my, scene, this,data, parse, Tool::FromFile); + VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this, + data, parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -834,8 +835,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const VPointF *point = data->GeometricObject(idObject ); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), - mx, my, idObject,Draw::Modeling)); + data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject, + Draw::Modeling)); VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); } catch (const VExceptionBadId &e) @@ -900,8 +901,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, - mx, my, scene, this, data, parse,Tool::FromFile); + VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, + parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -1006,7 +1007,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & QStringList splines; splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType; - switch(splines.indexOf(type)) { + switch (splines.indexOf(type)) + { case 0: //VToolSpline::ToolType try { @@ -1130,7 +1132,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom QStringList arcs; arcs << VToolArc::ToolType << VNodeArc::ToolType; - switch(arcs.indexOf(type)) { + switch (arcs.indexOf(type)) + { case 0: //VToolArc::ToolType try { @@ -1185,7 +1188,8 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d QStringList tools; tools << VToolUnionDetails::ToolType; - switch(tools.indexOf(type)) { + switch (tools.indexOf(type)) + { case 0: //VToolUnionDetails::ToolType try {