Core: Move LCS migration warning to Std_Open command

This commit is contained in:
wmayer
2024-12-15 16:46:03 +01:00
committed by Chris Hennes
parent a2c980f7d6
commit 8fdbdccd8f
6 changed files with 59 additions and 64 deletions

View File

@@ -85,50 +85,6 @@ void ViewProviderCoordinateSystem::attach(App::DocumentObject* pcObject)
addDisplayMaskMode(pcGroupChildren, "Base");
}
void ViewProviderCoordinateSystem::finishRestoring()
{
showMigrationDialog();
}
void ViewProviderCoordinateSystem::showMigrationDialog()
{
auto lcs = dynamic_cast<App::LocalCoordinateSystem*>(getObject());
if (!lcs || !lcs->migrated) {
return;
}
static bool userWarned = false;
if (userWarned || !App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/View")->GetBool("ShowLCSMigrationWarning", true)) {
return;
}
// Display the warning message
QMessageBox msgBox(QMessageBox::Warning,
QObject::tr("File Migration Warning"),
QObject::tr("This file was created with an older version of FreeCAD. "
"Origin axes had incorrect placements, which have now been corrected.\n\n"
"However, if you save this file in the current version and reopen it in an"
" older version of FreeCAD, the origin axes will be misaligned. Additionally, "
"if your file references these origin axes, your file will likely be broken."),
QMessageBox::Ok);
QCheckBox* checkBox = new QCheckBox(QObject::tr("Don't show this warning again"));
msgBox.setCheckBox(checkBox);
msgBox.exec();
// Update static flag if the user has seen the warning
userWarned = true;
// Save preference if the user selects "Don't show again"
if (checkBox->isChecked()) {
App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/View")->SetBool("ShowLCSMigrationWarning", false);
}
}
std::vector<std::string> ViewProviderCoordinateSystem::getDisplayModes() const
{
return { "Base" };