Refactoring. Set Visibility group data in parent class.

This commit is contained in:
Roman Telezhynskyi 2020-03-24 16:58:34 +02:00
parent 82570bf9db
commit 11718f6f44
5 changed files with 26 additions and 40 deletions

View File

@ -75,16 +75,7 @@ void VToolFlippingByAxis::setDialog()
dialogTool->SetAxisType(m_axisType);
dialogTool->SetSuffix(suffix);
vidtype group = doc->GroupLinkedToTool(m_id);
if (group != null_id)
{
dialogTool->SetHasLinkedVisibilityGroup(true);
dialogTool->SetVisibilityGroupName(doc->GetGroupName(group));
}
else
{
dialogTool->SetHasLinkedVisibilityGroup(false);
}
SetDialogVisibilityGroupData(dialogTool);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -75,16 +75,7 @@ void VToolFlippingByLine::setDialog()
dialogTool->SetSecondLinePointId(m_secondLinePointId);
dialogTool->SetSuffix(suffix);
vidtype group = doc->GroupLinkedToTool(m_id);
if (group != null_id)
{
dialogTool->SetHasLinkedVisibilityGroup(true);
dialogTool->SetVisibilityGroupName(doc->GetGroupName(group));
}
else
{
dialogTool->SetHasLinkedVisibilityGroup(false);
}
SetDialogVisibilityGroupData(dialogTool);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -151,6 +151,9 @@ protected:
template <typename T>
void ShowToolVisualization(bool show);
template <typename T>
void SetDialogVisibilityGroupData(QPointer<T> dialogTool);
void InitCurve(quint32 id, VContainer *data, GOType curveType, SceneObject sceneType);
template <typename T>
@ -171,6 +174,25 @@ private:
bool NeedUpdateVisibilityGroup() const;
};
//---------------------------------------------------------------------------------------------------------------------
template<typename T>
void VAbstractOperation::SetDialogVisibilityGroupData(QPointer<T> dialogTool)
{
SCASSERT(not dialogTool.isNull())
vidtype group = doc->GroupLinkedToTool(m_id);
dialogTool->SetGroupCategories(doc->GetGroupCategories());
if (group != null_id)
{
dialogTool->SetHasLinkedVisibilityGroup(true);
dialogTool->SetVisibilityGroupName(doc->GetGroupName(group));
}
else
{
dialogTool->SetHasLinkedVisibilityGroup(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
void VAbstractOperation::ShowToolVisualization(bool show)

View File

@ -129,16 +129,7 @@ void VToolMove::setDialog()
dialogTool->SetSuffix(suffix);
dialogTool->SetRotationOrigPointId(origPointId);
vidtype group = doc->GroupLinkedToTool(m_id);
if (group != null_id)
{
dialogTool->SetHasLinkedVisibilityGroup(true);
dialogTool->SetVisibilityGroupName(doc->GetGroupName(group));
}
else
{
dialogTool->SetHasLinkedVisibilityGroup(false);
}
SetDialogVisibilityGroupData(dialogTool);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -99,16 +99,7 @@ void VToolRotation::setDialog()
dialogTool->SetAngle(formulaAngle);
dialogTool->SetSuffix(suffix);
vidtype group = doc->GroupLinkedToTool(m_id);
if (group != null_id)
{
dialogTool->SetHasLinkedVisibilityGroup(true);
dialogTool->SetVisibilityGroupName(doc->GetGroupName(group));
}
else
{
dialogTool->SetHasLinkedVisibilityGroup(false);
}
SetDialogVisibilityGroupData(dialogTool);
}
//---------------------------------------------------------------------------------------------------------------------