Transfer in LS3 code
This commit is contained in:
committed by
Yorik van Havre
parent
aa81b03bee
commit
445a884682
@@ -1475,6 +1475,7 @@ Document::readObjects(Base::XMLReader& reader)
|
||||
|
||||
void Document::addRecomputeObject(DocumentObject *obj) {
|
||||
if(testStatus(Status::Restoring) && obj) {
|
||||
setStatus(Status::RecomputeOnRestore, true);
|
||||
d->touchedObjs.insert(obj);
|
||||
obj->touch();
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
RestoreError = 10,
|
||||
LinkStampChanged = 11, // Indicates during restore time if any linked document's time stamp has changed
|
||||
IgnoreErrorOnRecompute = 12, // Don't report errors if the recompute failed
|
||||
RecomputeOnRestore = 13, // Mark pending recompute on restore for migration purpose
|
||||
};
|
||||
|
||||
/** @name Properties */
|
||||
|
||||
@@ -379,6 +379,40 @@ Application::Application(bool GUIenabled)
|
||||
App::GetApplication().signalShowHidden.connect(
|
||||
std::bind(&Gui::Application::slotShowHidden, this, sp::_1));
|
||||
// NOLINTEND
|
||||
App::GetApplication().signalFinishOpenDocument.connect([]() {
|
||||
std::vector<App::Document*> docs;
|
||||
for(auto doc : App::GetApplication().getDocuments()) {
|
||||
if(doc->testStatus(App::Document::RecomputeOnRestore)) {
|
||||
docs.push_back(doc);
|
||||
doc->setStatus(App::Document::RecomputeOnRestore, false);
|
||||
}
|
||||
}
|
||||
if(docs.empty() || !App::DocumentParams::getWarnRecomputeOnRestore())
|
||||
return;
|
||||
WaitCursor wc;
|
||||
wc.restoreCursor();
|
||||
auto res = QMessageBox::warning(getMainWindow(), QObject::tr("Recompution required"),
|
||||
QObject::tr("Some document(s) require recomputation for migration purpose. "
|
||||
"It is highly recommended to perform a recomputation before "
|
||||
"any modification to avoid compatibility problem.\n\n"
|
||||
"Do you want to recompute now?"),
|
||||
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
|
||||
if(res != QMessageBox::Yes)
|
||||
return;
|
||||
bool hasError = false;
|
||||
for(auto doc : App::Document::getDependentDocuments(docs,true)) {
|
||||
try {
|
||||
doc->recompute({},false,&hasError);
|
||||
} catch (Base::Exception &e) {
|
||||
e.ReportException();
|
||||
hasError = true;
|
||||
}
|
||||
}
|
||||
if(hasError)
|
||||
QMessageBox::critical(getMainWindow(), QObject::tr("Recompute error"),
|
||||
QObject::tr("Failed to recompute some document(s).\n"
|
||||
"Please check report view for more details."));
|
||||
});
|
||||
|
||||
// install the last active language
|
||||
ParameterGrp::handle hPGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp");
|
||||
|
||||
Reference in New Issue
Block a user