Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-25 15:16:19 +03:00
parent 933e63d103
commit e76eec5ebd
2 changed files with 31 additions and 298 deletions

View File

@ -392,26 +392,8 @@ void MainWindow::ApplyDialog()
void MainWindow::ToolEndLine(bool checked) void MainWindow::ToolEndLine(bool checked)
{ {
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
&MainWindow::ClosedDialogEndLine, &MainWindow::ApplyDialogEndLine); &MainWindow::ClosedDialogWithApply<VToolEndLine>,
} &MainWindow::ApplyDialog<VToolEndLine>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogEndLine actions after apply in DialogEndLine.
*/
void MainWindow::ApplyDialogEndLine()
{
ApplyDialog<VToolEndLine>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogEndLine actions after closing DialogEndLine.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogEndLine(int result)
{
ClosedDialogWithApply<VToolEndLine>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -422,24 +404,8 @@ void MainWindow::ClosedDialogEndLine(int result)
void MainWindow::ToolLine(bool checked) void MainWindow::ToolLine(bool checked)
{ {
SetToolButtonWithApply<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), SetToolButtonWithApply<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
&MainWindow::ClosedDialogLine, &MainWindow::ApplyDialogLine); &MainWindow::ClosedDialogWithApply<VToolLine>,
} &MainWindow::ApplyDialog<VToolLine>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogLine actions after closing DialogLine.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogLine(int result)
{
ClosedDialogWithApply<VToolLine>(result);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ApplyDialogLine()
{
ApplyDialog<VToolLine>();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -450,27 +416,8 @@ void MainWindow::ApplyDialogLine()
void MainWindow::ToolAlongLine(bool checked) void MainWindow::ToolAlongLine(bool checked)
{ {
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png",
tr("Select point"), &MainWindow::ClosedDialogAlongLine, tr("Select point"), &MainWindow::ClosedDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDialogAlongLine); &MainWindow::ApplyDialog<VToolAlongLine>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogAlongLine actions after apply in DialogAlongLine.
*/
void MainWindow::ApplyDialogAlongLine()
{
ApplyDialog<VToolAlongLine>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogAlongLine actions after closing DialogAlongLine.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogAlongLine(int result)
{
ClosedDialogWithApply<VToolAlongLine>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -481,27 +428,9 @@ void MainWindow::ClosedDialogAlongLine(int result)
void MainWindow::ToolShoulderPoint(bool checked) void MainWindow::ToolShoulderPoint(bool checked)
{ {
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
tr("Select point of shoulder"), &MainWindow::ClosedDialogShoulderPoint, tr("Select point of shoulder"),
&MainWindow::ApplyDialogShoulderPoint); &MainWindow::ClosedDialogWithApply<VToolShoulderPoint>,
} &MainWindow::ApplyDialog<VToolShoulderPoint>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogShoulderPoint actions after apply in DialogShoulderPoint.
*/
void MainWindow::ApplyDialogShoulderPoint()
{
ApplyDialog<VToolShoulderPoint>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogShoulderPoint actions after closing DialogShoulderPoint.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogShoulderPoint(int result)
{
ClosedDialogWithApply<VToolShoulderPoint>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -512,27 +441,9 @@ void MainWindow::ClosedDialogShoulderPoint(int result)
void MainWindow::ToolNormal(bool checked) void MainWindow::ToolNormal(bool checked)
{ {
SetToolButtonWithApply<DialogNormal>(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", SetToolButtonWithApply<DialogNormal>(checked, Tool::NormalTool, ":/cursor/normal_cursor.png",
tr("Select first point of line"), &MainWindow::ClosedDialogNormal, tr("Select first point of line"),
&MainWindow::ApplyDialogNormal); &MainWindow::ClosedDialogWithApply<VToolNormal>,
} &MainWindow::ApplyDialog<VToolNormal>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogNormal actions after apply in DialogNormal.
*/
void MainWindow::ApplyDialogNormal()
{
ApplyDialog<VToolNormal>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogNormal actions after closing DialogNormal.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogNormal(int result)
{
ClosedDialogWithApply<VToolNormal>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -543,27 +454,9 @@ void MainWindow::ClosedDialogNormal(int result)
void MainWindow::ToolBisector(bool checked) void MainWindow::ToolBisector(bool checked)
{ {
SetToolButtonWithApply<DialogBisector>(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", SetToolButtonWithApply<DialogBisector>(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png",
tr("Select first point of angle"), &MainWindow::ClosedDialogBisector, tr("Select first point of angle"),
&MainWindow::ApplyDialogBisector); &MainWindow::ClosedDialogWithApply<VToolBisector>,
} &MainWindow::ApplyDialog<VToolBisector>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogBisector actions after apply in DialogBisector.
*/
void MainWindow::ApplyDialogBisector()
{
ApplyDialog<VToolBisector>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogBisector actions after closing DialogBisector.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogBisector(int result)
{
ClosedDialogWithApply<VToolBisector>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -574,17 +467,8 @@ void MainWindow::ClosedDialogBisector(int result)
void MainWindow::ToolLineIntersect(bool checked) void MainWindow::ToolLineIntersect(bool checked)
{ {
SetToolButton<DialogLineIntersect>(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", SetToolButton<DialogLineIntersect>(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png",
tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect); tr("Select first point of first line"),
} &MainWindow::ClosedDialog<VToolLineIntersect>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogLineIntersect actions after closing DialogLineIntersect.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogLineIntersect(int result)
{
ClosedDialog<VToolLineIntersect>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -595,17 +479,7 @@ void MainWindow::ClosedDialogLineIntersect(int result)
void MainWindow::ToolSpline(bool checked) void MainWindow::ToolSpline(bool checked)
{ {
SetToolButton<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", SetToolButton<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png",
tr("Select first point curve"), &MainWindow::ClosedDialogSpline); tr("Select first point curve"), &MainWindow::ClosedDialog<VToolSpline>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogSpline actions after closing DialogSpline.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogSpline(int result)
{
ClosedDialog<VToolSpline>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -616,17 +490,7 @@ void MainWindow::ClosedDialogSpline(int result)
void MainWindow::ToolCutSpline(bool checked) void MainWindow::ToolCutSpline(bool checked)
{ {
SetToolButton<DialogCutSpline>(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", SetToolButton<DialogCutSpline>(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png",
tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline); tr("Select simple curve"), &MainWindow::ClosedDialog<VToolCutSpline>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogCutSpline actions after closing DialogCutSpline.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogCutSpline(int result)
{
ClosedDialog<VToolCutSpline>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -637,27 +501,8 @@ void MainWindow::ClosedDialogCutSpline(int result)
void MainWindow::ToolArc(bool checked) void MainWindow::ToolArc(bool checked)
{ {
SetToolButtonWithApply<DialogArc>(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", SetToolButtonWithApply<DialogArc>(checked, Tool::ArcTool, ":/cursor/arc_cursor.png",
tr("Select point of center of arc"), &MainWindow::ClosedDialogArc, tr("Select point of center of arc"), &MainWindow::ClosedDialogWithApply<VToolArc>,
&MainWindow::ApplyDialogArc); &MainWindow::ApplyDialog<VToolArc>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogArc actions after apply in DialogArc.
*/
void MainWindow::ApplyDialogArc()
{
ApplyDialog<VToolArc>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogArc actions after closing DialogArc.
* @param result result of dialog working..
*/
void MainWindow::ClosedDialogArc(int result)
{
ClosedDialogWithApply<VToolArc>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -668,17 +513,7 @@ void MainWindow::ClosedDialogArc(int result)
void MainWindow::ToolSplinePath(bool checked) void MainWindow::ToolSplinePath(bool checked)
{ {
SetToolButton<DialogSplinePath>(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", SetToolButton<DialogSplinePath>(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png",
tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath); tr("Select point of curve path"), &MainWindow::ClosedDialog<VToolSplinePath>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogSplinePath actions after closing DialogSplinePath.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogSplinePath(int result)
{
ClosedDialog<VToolSplinePath>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -690,17 +525,7 @@ void MainWindow::ToolCutSplinePath(bool checked)
{ {
SetToolButton<DialogCutSplinePath>(checked, Tool::CutSplinePathTool, SetToolButton<DialogCutSplinePath>(checked, Tool::CutSplinePathTool,
":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"), ":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"),
&MainWindow::ClosedDialogCutSplinePath); &MainWindow::ClosedDialog<VToolCutSplinePath>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogCutSplinePath actions after closing DialogCutSplinePath.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogCutSplinePath(int result)
{
ClosedDialog<VToolCutSplinePath>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -711,27 +536,9 @@ void MainWindow::ClosedDialogCutSplinePath(int result)
void MainWindow::ToolPointOfContact(bool checked) void MainWindow::ToolPointOfContact(bool checked)
{ {
SetToolButtonWithApply<DialogPointOfContact>(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", SetToolButtonWithApply<DialogPointOfContact>(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png",
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact, tr("Select first point of line"),
&MainWindow::ApplyDialogPointOfContact); &MainWindow::ClosedDialogWithApply<VToolPointOfContact>,
} &MainWindow::ApplyDialog<VToolPointOfContact>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogPointOfContact actions after apply in DialogPointOfContact.
*/
void MainWindow::ApplyDialogPointOfContact()
{
ApplyDialog<VToolPointOfContact>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogPointOfContact actions after closing DialogPointOfContact.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogPointOfContact(int result)
{
ClosedDialogWithApply<VToolPointOfContact>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -768,17 +575,7 @@ void MainWindow::ClosedDialogDetail(int result)
void MainWindow::ToolHeight(bool checked) void MainWindow::ToolHeight(bool checked)
{ {
SetToolButton<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"), SetToolButton<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"),
&MainWindow::ClosedDialogHeight); &MainWindow::ClosedDialog<VToolHeight>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogHeight actions after closing DialogHeight.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogHeight(int result)
{
ClosedDialog<VToolHeight>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -789,17 +586,7 @@ void MainWindow::ClosedDialogHeight(int result)
void MainWindow::ToolTriangle(bool checked) void MainWindow::ToolTriangle(bool checked)
{ {
SetToolButton<DialogTriangle>(checked, Tool::Triangle, ":/cursor/triangle_cursor.png", SetToolButton<DialogTriangle>(checked, Tool::Triangle, ":/cursor/triangle_cursor.png",
tr("Select first point of axis"), &MainWindow::ClosedDialogTriangle); tr("Select first point of axis"), &MainWindow::ClosedDialog<VToolTriangle>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogTriangle actions after closing DialogTriangle.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogTriangle(int result)
{
ClosedDialog<VToolTriangle>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -811,17 +598,7 @@ void MainWindow::ToolPointOfIntersection(bool checked)
{ {
SetToolButton<DialogPointOfIntersection>(checked, Tool::PointOfIntersection, SetToolButton<DialogPointOfIntersection>(checked, Tool::PointOfIntersection,
":/cursor/pointofintersect_cursor.png", tr("Select point vertically"), ":/cursor/pointofintersect_cursor.png", tr("Select point vertically"),
&MainWindow::ClosedDialogPointOfIntersection); &MainWindow::ClosedDialog<VToolPointOfIntersection>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogPointOfIntersection actions after closing DialogPointOfIntersection.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogPointOfIntersection(int result)
{
ClosedDialog<VToolPointOfIntersection>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -856,26 +633,8 @@ void MainWindow::ClosedDialogUnionDetails(int result)
void MainWindow::ToolCutArc(bool checked) void MainWindow::ToolCutArc(bool checked)
{ {
SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png", SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png",
tr("Select arc"), &MainWindow::ClosedDialogCutArc, &MainWindow::ApplyDialogCutArc); tr("Select arc"), &MainWindow::ClosedDialogWithApply<VToolCutArc>,
} &MainWindow::ApplyDialog<VToolCutArc>);
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ApplyDialogCutArc actions after apply in DialogCutArc.
*/
void MainWindow::ApplyDialogCutArc()
{
ApplyDialog<VToolCutArc>();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogCutArc actions after closing DialogCutArc.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogCutArc(int result)
{
ClosedDialogWithApply<VToolCutArc>(result);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -105,34 +105,8 @@ public slots:
void ToolUnionDetails(bool checked); void ToolUnionDetails(bool checked);
void ToolCutArc(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 ClosedDialogDetail(int result);
void ClosedDialogHeight(int result);
void ClosedDialogTriangle(int result);
void ClosedDialogPointOfIntersection(int result);
void ClosedDialogUnionDetails(int result); void ClosedDialogUnionDetails(int result);
void ClosedDialogCutSpline(int result);
void ClosedDialogCutArc(int result);
void ApplyDialogCutArc();
void About(); void About();
void AboutQt(); void AboutQt();