From e76eec5ebd3bb03a4fc93e6540d338b8381450b6 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 25 Jul 2014 15:16:19 +0300 Subject: [PATCH] Refactoring. --HG-- branch : develop --- src/app/mainwindow.cpp | 303 +++++------------------------------------ src/app/mainwindow.h | 26 ---- 2 files changed, 31 insertions(+), 298 deletions(-) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index bf011187b..0c50e3dd3 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -392,26 +392,8 @@ void MainWindow::ApplyDialog() void MainWindow::ToolEndLine(bool checked) { SetToolButtonWithApply(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), - &MainWindow::ClosedDialogEndLine, &MainWindow::ApplyDialogEndLine); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogEndLine actions after apply in DialogEndLine. - */ -void MainWindow::ApplyDialogEndLine() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogEndLine actions after closing DialogEndLine. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogEndLine(int result) -{ - ClosedDialogWithApply(result); + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -422,24 +404,8 @@ void MainWindow::ClosedDialogEndLine(int result) void MainWindow::ToolLine(bool checked) { SetToolButtonWithApply(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), - &MainWindow::ClosedDialogLine, &MainWindow::ApplyDialogLine); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogLine actions after closing DialogLine. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogLine(int result) -{ - ClosedDialogWithApply(result); -} - - -//--------------------------------------------------------------------------------------------------------------------- -void MainWindow::ApplyDialogLine() -{ - ApplyDialog(); + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -450,27 +416,8 @@ void MainWindow::ApplyDialogLine() void MainWindow::ToolAlongLine(bool checked) { SetToolButtonWithApply(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", - tr("Select point"), &MainWindow::ClosedDialogAlongLine, - &MainWindow::ApplyDialogAlongLine); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogAlongLine actions after apply in DialogAlongLine. - */ -void MainWindow::ApplyDialogAlongLine() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogAlongLine actions after closing DialogAlongLine. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogAlongLine(int result) -{ - ClosedDialogWithApply(result); + tr("Select point"), &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -481,27 +428,9 @@ void MainWindow::ClosedDialogAlongLine(int result) void MainWindow::ToolShoulderPoint(bool checked) { SetToolButtonWithApply(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", - tr("Select point of shoulder"), &MainWindow::ClosedDialogShoulderPoint, - &MainWindow::ApplyDialogShoulderPoint); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogShoulderPoint actions after apply in DialogShoulderPoint. - */ -void MainWindow::ApplyDialogShoulderPoint() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogShoulderPoint actions after closing DialogShoulderPoint. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogShoulderPoint(int result) -{ - ClosedDialogWithApply(result); + tr("Select point of shoulder"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -512,27 +441,9 @@ void MainWindow::ClosedDialogShoulderPoint(int result) void MainWindow::ToolNormal(bool checked) { SetToolButtonWithApply(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", - tr("Select first point of line"), &MainWindow::ClosedDialogNormal, - &MainWindow::ApplyDialogNormal); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogNormal actions after apply in DialogNormal. - */ -void MainWindow::ApplyDialogNormal() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogNormal actions after closing DialogNormal. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogNormal(int result) -{ - ClosedDialogWithApply(result); + tr("Select first point of line"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -543,27 +454,9 @@ void MainWindow::ClosedDialogNormal(int result) void MainWindow::ToolBisector(bool checked) { SetToolButtonWithApply(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", - tr("Select first point of angle"), &MainWindow::ClosedDialogBisector, - &MainWindow::ApplyDialogBisector); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogBisector actions after apply in DialogBisector. - */ -void MainWindow::ApplyDialogBisector() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogBisector actions after closing DialogBisector. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogBisector(int result) -{ - ClosedDialogWithApply(result); + tr("Select first point of angle"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -574,17 +467,8 @@ void MainWindow::ClosedDialogBisector(int result) void MainWindow::ToolLineIntersect(bool checked) { SetToolButton(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", - tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogLineIntersect actions after closing DialogLineIntersect. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogLineIntersect(int result) -{ - ClosedDialog(result); + tr("Select first point of first line"), + &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -595,17 +479,7 @@ void MainWindow::ClosedDialogLineIntersect(int result) void MainWindow::ToolSpline(bool checked) { SetToolButton(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", - tr("Select first point curve"), &MainWindow::ClosedDialogSpline); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogSpline actions after closing DialogSpline. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogSpline(int result) -{ - ClosedDialog(result); + tr("Select first point curve"), &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -616,17 +490,7 @@ void MainWindow::ClosedDialogSpline(int result) void MainWindow::ToolCutSpline(bool checked) { SetToolButton(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", - tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogCutSpline actions after closing DialogCutSpline. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogCutSpline(int result) -{ - ClosedDialog(result); + tr("Select simple curve"), &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -637,27 +501,8 @@ void MainWindow::ClosedDialogCutSpline(int result) void MainWindow::ToolArc(bool checked) { SetToolButtonWithApply(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", - tr("Select point of center of arc"), &MainWindow::ClosedDialogArc, - &MainWindow::ApplyDialogArc); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogArc actions after apply in DialogArc. - */ -void MainWindow::ApplyDialogArc() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogArc actions after closing DialogArc. - * @param result result of dialog working.. - */ -void MainWindow::ClosedDialogArc(int result) -{ - ClosedDialogWithApply(result); + tr("Select point of center of arc"), &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -668,17 +513,7 @@ void MainWindow::ClosedDialogArc(int result) void MainWindow::ToolSplinePath(bool checked) { SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", - tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogSplinePath actions after closing DialogSplinePath. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogSplinePath(int result) -{ - ClosedDialog(result); + tr("Select point of curve path"), &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -690,17 +525,7 @@ void MainWindow::ToolCutSplinePath(bool checked) { SetToolButton(checked, Tool::CutSplinePathTool, ":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"), - &MainWindow::ClosedDialogCutSplinePath); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogCutSplinePath actions after closing DialogCutSplinePath. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogCutSplinePath(int result) -{ - ClosedDialog(result); + &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -711,27 +536,9 @@ void MainWindow::ClosedDialogCutSplinePath(int result) void MainWindow::ToolPointOfContact(bool checked) { SetToolButtonWithApply(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", - tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact, - &MainWindow::ApplyDialogPointOfContact); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogPointOfContact actions after apply in DialogPointOfContact. - */ -void MainWindow::ApplyDialogPointOfContact() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogPointOfContact actions after closing DialogPointOfContact. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogPointOfContact(int result) -{ - ClosedDialogWithApply(result); + tr("Select first point of line"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -768,17 +575,7 @@ void MainWindow::ClosedDialogDetail(int result) void MainWindow::ToolHeight(bool checked) { SetToolButton(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"), - &MainWindow::ClosedDialogHeight); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogHeight actions after closing DialogHeight. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogHeight(int result) -{ - ClosedDialog(result); + &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -789,17 +586,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"), &MainWindow::ClosedDialogTriangle); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogTriangle actions after closing DialogTriangle. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogTriangle(int result) -{ - ClosedDialog(result); + tr("Select first point of axis"), &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -811,17 +598,7 @@ void MainWindow::ToolPointOfIntersection(bool checked) { SetToolButton(checked, Tool::PointOfIntersection, ":/cursor/pointofintersect_cursor.png", tr("Select point vertically"), - &MainWindow::ClosedDialogPointOfIntersection); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogPointOfIntersection actions after closing DialogPointOfIntersection. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogPointOfIntersection(int result) -{ - ClosedDialog(result); + &MainWindow::ClosedDialog); } //--------------------------------------------------------------------------------------------------------------------- @@ -856,26 +633,8 @@ void MainWindow::ClosedDialogUnionDetails(int result) void MainWindow::ToolCutArc(bool checked) { SetToolButtonWithApply(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png", - tr("Select arc"), &MainWindow::ClosedDialogCutArc, &MainWindow::ApplyDialogCutArc); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ApplyDialogCutArc actions after apply in DialogCutArc. - */ -void MainWindow::ApplyDialogCutArc() -{ - ApplyDialog(); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief ClosedDialogCutArc actions after closing DialogCutArc. - * @param result result of dialog working. - */ -void MainWindow::ClosedDialogCutArc(int result) -{ - ClosedDialogWithApply(result); + tr("Select arc"), &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index acd8d915e..c331907db 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -105,34 +105,8 @@ public slots: void ToolUnionDetails(bool checked); void ToolCutArc(bool checked); - void ClosedDialogEndLine(int result); - void ApplyDialogEndLine(); - void ClosedDialogLine(int result); - void ApplyDialogLine(); - void ClosedDialogAlongLine(int result); - void ApplyDialogAlongLine(); - void ClosedDialogShoulderPoint(int result); - void ApplyDialogShoulderPoint(); - void ClosedDialogNormal(int result); - void ApplyDialogNormal(); - void ClosedDialogBisector(int result); - void ApplyDialogBisector(); - void ClosedDialogLineIntersect(int result); - void ClosedDialogSpline(int result); - void ClosedDialogArc(int result); - void ApplyDialogArc(); - void ClosedDialogSplinePath(int result); - void ClosedDialogCutSplinePath(int result); - void ClosedDialogPointOfContact(int result); - void ApplyDialogPointOfContact(); void ClosedDialogDetail(int result); - void ClosedDialogHeight(int result); - void ClosedDialogTriangle(int result); - void ClosedDialogPointOfIntersection(int result); void ClosedDialogUnionDetails(int result); - void ClosedDialogCutSpline(int result); - void ClosedDialogCutArc(int result); - void ApplyDialogCutArc(); void About(); void AboutQt();