Fem: Clean up constraint view providers

This commit is contained in:
marioalexis
2024-06-19 14:04:14 -03:00
committed by Chris Hennes
parent 1ba5f02129
commit 464a50d60e
20 changed files with 57 additions and 761 deletions

View File

@@ -24,7 +24,6 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QMessageBox>
#endif
#include "Gui/Control.h"
@@ -50,58 +49,15 @@ ViewProviderFemConstraintFixed::~ViewProviderFemConstraintFixed() = default;
bool ViewProviderFemConstraintFixed::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// When double-clicking on the item for this constraint the
// object unsets and sets its edit mode without closing
// the task panel
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
TaskDlgFemConstraintFixed* constrDlg = qobject_cast<TaskDlgFemConstraintFixed*>(dlg);
if (constrDlg && constrDlg->getConstraintView() != this) {
constrDlg = nullptr; // another constraint left open its task panel
}
if (dlg && !constrDlg) {
// This case will occur in the ShaftWizard application
checkForWizard();
if (!wizardWidget || !wizardSubLayout) {
// No shaft wizard is running
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
if (ret == QMessageBox::Yes) {
Gui::Control().reject();
}
else {
return false;
}
}
else if (constraintDialog) {
// Another FemConstraint* dialog is already open inside the Shaft Wizard
// Ignore the request to open another dialog
return false;
}
else {
constraintDialog = new TaskFemConstraintFixed(this);
return true;
}
}
Gui::Control().closeDialog();
// clear the selection (convenience)
Gui::Selection().clearSelection();
// start the edit dialog
if (constrDlg) {
Gui::Control().showDialog(constrDlg);
}
else {
Gui::Control().showDialog(new TaskDlgFemConstraintFixed(this));
}
Gui::Control().showDialog(new TaskDlgFemConstraintFixed(this));
return true;
}
else {
return ViewProviderDocumentObject::setEdit(ModNum); // clazy:exclude=skipped-base-method
return ViewProviderFemConstraintOnBoundary::setEdit(ModNum);
}
}