Sketcher: Reformat to current clang-format standard

This commit is contained in:
Chris Hennes
2023-09-02 12:32:58 -05:00
committed by Chris Hennes
parent 41a1a7a8e6
commit 791fe02934
96 changed files with 2132 additions and 1185 deletions

View File

@@ -242,16 +242,20 @@ CmdSketcherCompCreateRectangles::CmdSketcherCompCreateRectangles()
void CmdSketcherCompCreateRectangles::activated(int iMsg)
{
if (iMsg == 0)
if (iMsg == 0) {
ActivateHandler(getActiveGuiDocument(),
new DrawSketchHandlerBox(DrawSketchHandlerBox::Diagonal));
else if (iMsg == 1)
}
else if (iMsg == 1) {
ActivateHandler(getActiveGuiDocument(),
new DrawSketchHandlerBox(DrawSketchHandlerBox::CenterAndCorner));
else if (iMsg == 2)
}
else if (iMsg == 2) {
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerOblong());
else
}
else {
return;
}
// Since the default icon is reset when enabling/disabling the command we have
// to explicitly set the icon of the used command.
@@ -288,8 +292,9 @@ Gui::Action* CmdSketcherCompCreateRectangles::createAction()
void CmdSketcherCompCreateRectangles::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -314,8 +319,9 @@ void CmdSketcherCompCreateRectangles::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
@@ -455,12 +461,15 @@ CmdSketcherCompCreateArc::CmdSketcherCompCreateArc()
void CmdSketcherCompCreateArc::activated(int iMsg)
{
if (iMsg == 0)
if (iMsg == 0) {
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerArc());
else if (iMsg == 1)
}
else if (iMsg == 1) {
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandler3PointArc());
else
}
else {
return;
}
// Since the default icon is reset when enabling/disabling the command we have
// to explicitly set the icon of the used command.
@@ -495,8 +504,9 @@ Gui::Action* CmdSketcherCompCreateArc::createAction()
void CmdSketcherCompCreateArc::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -518,8 +528,9 @@ void CmdSketcherCompCreateArc::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
@@ -527,14 +538,17 @@ void CmdSketcherCompCreateArc::languageChange()
arc1->setText(QApplication::translate("CmdSketcherCompCreateArc", "Center and end points"));
arc1->setToolTip(QApplication::translate("Sketcher_CreateArc",
"Create an arc by its center and by its end points"));
arc1->setStatusTip(QApplication::translate(
"Sketcher_CreateArc", "Create an arc by its center and by its end points"));
arc1->setStatusTip(
QApplication::translate("Sketcher_CreateArc",
"Create an arc by its center and by its end points"));
QAction* arc2 = a[1];
arc2->setText(QApplication::translate("CmdSketcherCompCreateArc", "End points and rim point"));
arc2->setToolTip(QApplication::translate(
"Sketcher_Create3PointArc", "Create an arc by its end points and a point along the arc"));
arc2->setStatusTip(QApplication::translate(
"Sketcher_Create3PointArc", "Create an arc by its end points and a point along the arc"));
arc2->setToolTip(
QApplication::translate("Sketcher_Create3PointArc",
"Create an arc by its end points and a point along the arc"));
arc2->setStatusTip(
QApplication::translate("Sketcher_Create3PointArc",
"Create an arc by its end points and a point along the arc"));
}
bool CmdSketcherCompCreateArc::isActive()
@@ -814,8 +828,9 @@ Gui::Action* CmdSketcherCompCreateConic::createAction()
void CmdSketcherCompCreateConic::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -848,21 +863,25 @@ void CmdSketcherCompCreateConic::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
QAction* ellipseByCenter = a[0];
ellipseByCenter->setText(QApplication::translate("CmdSketcherCompCreateConic",
"Ellipse by center, major radius, point"));
ellipseByCenter->setToolTip(QApplication::translate(
"Sketcher_CreateEllipseByCenter", "Create an ellipse by center, major radius and point"));
ellipseByCenter->setStatusTip(QApplication::translate(
"Sketcher_CreateEllipseByCenter", "Create an ellipse by center, major radius and point"));
ellipseByCenter->setToolTip(
QApplication::translate("Sketcher_CreateEllipseByCenter",
"Create an ellipse by center, major radius and point"));
ellipseByCenter->setStatusTip(
QApplication::translate("Sketcher_CreateEllipseByCenter",
"Create an ellipse by center, major radius and point"));
QAction* ellipseBy3Points = a[1];
ellipseBy3Points->setText(QApplication::translate(
"CmdSketcherCompCreateConic", "Ellipse by periapsis, apoapsis, minor radius"));
ellipseBy3Points->setText(
QApplication::translate("CmdSketcherCompCreateConic",
"Ellipse by periapsis, apoapsis, minor radius"));
ellipseBy3Points->setToolTip(
QApplication::translate("Sketcher_CreateEllipseBy3Points",
"Create a ellipse by periapsis, apoapsis, and minor radius"));
@@ -870,8 +889,9 @@ void CmdSketcherCompCreateConic::languageChange()
QApplication::translate("Sketcher_CreateEllipseBy3Points",
"Create a ellipse by periapsis, apoapsis, and minor radius"));
QAction* arcofellipse = a[2];
arcofellipse->setText(QApplication::translate(
"CmdSketcherCompCreateConic", "Arc of ellipse by center, major radius, endpoints"));
arcofellipse->setText(
QApplication::translate("CmdSketcherCompCreateConic",
"Arc of ellipse by center, major radius, endpoints"));
arcofellipse->setToolTip(QApplication::translate(
"Sketcher_CreateArcOfEllipse",
"Create an arc of ellipse by its center, major radius, and endpoints"));
@@ -879,8 +899,9 @@ void CmdSketcherCompCreateConic::languageChange()
"Sketcher_CreateArcOfEllipse",
"Create an arc of ellipse by its center, major radius, and endpoints"));
QAction* arcofhyperbola = a[3];
arcofhyperbola->setText(QApplication::translate(
"CmdSketcherCompCreateConic", "Arc of hyperbola by center, major radius, endpoints"));
arcofhyperbola->setText(
QApplication::translate("CmdSketcherCompCreateConic",
"Arc of hyperbola by center, major radius, endpoints"));
arcofhyperbola->setToolTip(QApplication::translate(
"Sketcher_CreateArcOfHyperbola",
"Create an arc of hyperbola by its center, major radius, and endpoints"));
@@ -1117,8 +1138,9 @@ Gui::Action* CmdSketcherCompCreateBSpline::createAction()
void CmdSketcherCompCreateBSpline::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -1149,8 +1171,9 @@ void CmdSketcherCompCreateBSpline::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
@@ -1164,10 +1187,12 @@ void CmdSketcherCompCreateBSpline::languageChange()
QAction* periodicbspline = a[1];
periodicbspline->setText(QApplication::translate("Sketcher_Create_Periodic_BSpline",
"Periodic B-spline by control points"));
periodicbspline->setToolTip(QApplication::translate(
"Sketcher_Create_Periodic_BSpline", "Create a periodic B-spline by control points"));
periodicbspline->setStatusTip(QApplication::translate(
"Sketcher_Create_Periodic_BSpline", "Create a periodic B-spline by control points"));
periodicbspline->setToolTip(
QApplication::translate("Sketcher_Create_Periodic_BSpline",
"Create a periodic B-spline by control points"));
periodicbspline->setStatusTip(
QApplication::translate("Sketcher_Create_Periodic_BSpline",
"Create a periodic B-spline by control points"));
QAction* bsplinebyknot = a[2];
bsplinebyknot->setText(
QApplication::translate("Sketcher_CreateBSplineByInterpolation", "B-spline by knots"));
@@ -1176,12 +1201,15 @@ void CmdSketcherCompCreateBSpline::languageChange()
bsplinebyknot->setStatusTip(QApplication::translate("Sketcher_CreateBSplineByInterpolation",
"Create a B-spline by knots"));
QAction* periodicbsplinebyknot = a[3];
periodicbsplinebyknot->setText(QApplication::translate(
"Sketcher_Create_Periodic_BSplineByInterpolation", "Periodic B-spline by knots"));
periodicbsplinebyknot->setToolTip(QApplication::translate(
"Sketcher_Create_Periodic_BSplineByInterpolation", "Create a periodic B-spline by knots"));
periodicbsplinebyknot->setStatusTip(QApplication::translate(
"Sketcher_Create_Periodic_BSplineByInterpolation", "Create a periodic B-spline by knots"));
periodicbsplinebyknot->setText(
QApplication::translate("Sketcher_Create_Periodic_BSplineByInterpolation",
"Periodic B-spline by knots"));
periodicbsplinebyknot->setToolTip(
QApplication::translate("Sketcher_Create_Periodic_BSplineByInterpolation",
"Create a periodic B-spline by knots"));
periodicbsplinebyknot->setStatusTip(
QApplication::translate("Sketcher_Create_Periodic_BSplineByInterpolation",
"Create a periodic B-spline by knots"));
}
bool CmdSketcherCompCreateBSpline::isActive()
@@ -1238,12 +1266,15 @@ CmdSketcherCompCreateCircle::CmdSketcherCompCreateCircle()
void CmdSketcherCompCreateCircle::activated(int iMsg)
{
if (iMsg == 0)
if (iMsg == 0) {
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerCircle());
else if (iMsg == 1)
}
else if (iMsg == 1) {
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandler3PointCircle());
else
}
else {
return;
}
// Since the default icon is reset when enabling/disabling the command we have
// to explicitly set the icon of the used command.
@@ -1278,8 +1309,9 @@ Gui::Action* CmdSketcherCompCreateCircle::createAction()
void CmdSketcherCompCreateCircle::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -1301,8 +1333,9 @@ void CmdSketcherCompCreateCircle::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
@@ -1489,8 +1522,9 @@ void CmdSketcherCompCreateFillets::updateAction(int mode)
{
Q_UNUSED(mode);
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -1503,8 +1537,9 @@ void CmdSketcherCompCreateFillets::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
@@ -1517,10 +1552,12 @@ void CmdSketcherCompCreateFillets::languageChange()
QAction* pointFillet = a[1];
pointFillet->setText(QApplication::translate("CmdSketcherCompCreateFillets",
"Constraint-preserving sketch fillet"));
pointFillet->setToolTip(QApplication::translate(
"Sketcher_CreatePointFillet", "Fillet that preserves constraints and intersection point"));
pointFillet->setStatusTip(QApplication::translate(
"Sketcher_CreatePointFillet", "Fillet that preserves constraints and intersection point"));
pointFillet->setToolTip(
QApplication::translate("Sketcher_CreatePointFillet",
"Fillet that preserves constraints and intersection point"));
pointFillet->setStatusTip(
QApplication::translate("Sketcher_CreatePointFillet",
"Fillet that preserves constraints and intersection point"));
}
bool CmdSketcherCompCreateFillets::isActive()
@@ -1912,8 +1949,9 @@ void CmdSketcherCreateRegularPolygon::activated(int iMsg)
// Pop-up asking for values
SketcherRegularPolygonDialog srpd;
if (srpd.exec() == QDialog::Accepted)
if (srpd.exec() == QDialog::Accepted) {
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerRegularPolygon(srpd.sides));
}
}
bool CmdSketcherCreateRegularPolygon::isActive()
@@ -1960,9 +1998,10 @@ void CmdSketcherCompCreateRegularPolygon::activated(int iMsg)
case 6: {
// Pop-up asking for values
SketcherRegularPolygonDialog srpd;
if (srpd.exec() == QDialog::Accepted)
if (srpd.exec() == QDialog::Accepted) {
ActivateHandler(getActiveGuiDocument(),
new DrawSketchHandlerRegularPolygon(srpd.sides));
}
} break;
default:
return;
@@ -2011,8 +2050,9 @@ Gui::Action* CmdSketcherCompCreateRegularPolygon::createAction()
void CmdSketcherCompCreateRegularPolygon::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
if (!pcAction) {
return;
}
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
@@ -2045,8 +2085,9 @@ void CmdSketcherCompCreateRegularPolygon::languageChange()
{
Command::languageChange();
if (!_pcAction)
if (!_pcAction) {
return;
}
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
@@ -2062,39 +2103,50 @@ void CmdSketcherCompCreateRegularPolygon::languageChange()
square->setText(QApplication::translate("CmdSketcherCompCreateRegularPolygon", "Square"));
square->setToolTip(QApplication::translate("Sketcher_CreateSquare",
"Create a square by its center and by one corner"));
square->setStatusTip(QApplication::translate(
"Sketcher_CreateSquare", "Create a square by its center and by one corner"));
square->setStatusTip(
QApplication::translate("Sketcher_CreateSquare",
"Create a square by its center and by one corner"));
QAction* pentagon = a[2];
pentagon->setText(QApplication::translate("CmdSketcherCompCreateRegularPolygon", "Pentagon"));
pentagon->setToolTip(QApplication::translate(
"Sketcher_CreatePentagon", "Create a pentagon by its center and by one corner"));
pentagon->setStatusTip(QApplication::translate(
"Sketcher_CreatePentagon", "Create a pentagon by its center and by one corner"));
pentagon->setToolTip(
QApplication::translate("Sketcher_CreatePentagon",
"Create a pentagon by its center and by one corner"));
pentagon->setStatusTip(
QApplication::translate("Sketcher_CreatePentagon",
"Create a pentagon by its center and by one corner"));
QAction* hexagon = a[3];
hexagon->setText(QApplication::translate("CmdSketcherCompCreateRegularPolygon", "Hexagon"));
hexagon->setToolTip(QApplication::translate(
"Sketcher_CreateHexagon", "Create a hexagon by its center and by one corner"));
hexagon->setStatusTip(QApplication::translate(
"Sketcher_CreateHexagon", "Create a hexagon by its center and by one corner"));
hexagon->setToolTip(
QApplication::translate("Sketcher_CreateHexagon",
"Create a hexagon by its center and by one corner"));
hexagon->setStatusTip(
QApplication::translate("Sketcher_CreateHexagon",
"Create a hexagon by its center and by one corner"));
QAction* heptagon = a[4];
heptagon->setText(QApplication::translate("CmdSketcherCompCreateRegularPolygon", "Heptagon"));
heptagon->setToolTip(QApplication::translate(
"Sketcher_CreateHeptagon", "Create a heptagon by its center and by one corner"));
heptagon->setStatusTip(QApplication::translate(
"Sketcher_CreateHeptagon", "Create a heptagon by its center and by one corner"));
heptagon->setToolTip(
QApplication::translate("Sketcher_CreateHeptagon",
"Create a heptagon by its center and by one corner"));
heptagon->setStatusTip(
QApplication::translate("Sketcher_CreateHeptagon",
"Create a heptagon by its center and by one corner"));
QAction* octagon = a[5];
octagon->setText(QApplication::translate("CmdSketcherCompCreateRegularPolygon", "Octagon"));
octagon->setToolTip(QApplication::translate(
"Sketcher_CreateOctagon", "Create an octagon by its center and by one corner"));
octagon->setStatusTip(QApplication::translate(
"Sketcher_CreateOctagon", "Create an octagon by its center and by one corner"));
octagon->setToolTip(
QApplication::translate("Sketcher_CreateOctagon",
"Create an octagon by its center and by one corner"));
octagon->setStatusTip(
QApplication::translate("Sketcher_CreateOctagon",
"Create an octagon by its center and by one corner"));
QAction* regular = a[6];
regular->setText(
QApplication::translate("CmdSketcherCompCreateRegularPolygon", "Regular polygon"));
regular->setToolTip(QApplication::translate(
"Sketcher_CreateOctagon", "Create a regular polygon by its center and by one corner"));
regular->setStatusTip(QApplication::translate(
"Sketcher_CreateOctagon", "Create a regular polygon by its center and by one corner"));
regular->setToolTip(
QApplication::translate("Sketcher_CreateOctagon",
"Create a regular polygon by its center and by one corner"));
regular->setStatusTip(
QApplication::translate("Sketcher_CreateOctagon",
"Create a regular polygon by its center and by one corner"));
}
bool CmdSketcherCompCreateRegularPolygon::isActive()