src/documentmanager.cpp

changeset 151
e628fc2e0c72
parent 150
b6cbba6e29a1
child 152
03f8e6d42e13
equal deleted inserted replaced
150:b6cbba6e29a1 151:e628fc2e0c72
254 QSaveFile file{*path}; 254 QSaveFile file{*path};
255 file.setDirectWriteFallback(true); 255 file.setDirectWriteFallback(true);
256 if (file.open(QSaveFile::WriteOnly)) 256 if (file.open(QSaveFile::WriteOnly))
257 { 257 {
258 // if path is not nullptr, getModelById will always return a value as well 258 // if path is not nullptr, getModelById will always return a value as well
259 this->getModelById(modelId)->save(&file); 259 ::save(*this->getModelById(modelId), &file);
260 const bool commitSucceeded = file.commit(); 260 const bool commitSucceeded = file.commit();
261 if (not commitSucceeded) 261 if (not commitSucceeded)
262 { 262 {
263 errors << tr("Could not save: %1").arg(file.errorString()); 263 errors << tr("Could not save: %1").arg(file.errorString());
264 return false; 264 return false;
411 } 411 }
412 ModelInfo& modelInfo = this->openModels[modelId]; 412 ModelInfo& modelInfo = this->openModels[modelId];
413 modelInfo.dependencies.clear(); 413 modelInfo.dependencies.clear();
414 for (int i = 0; i < modelInfo.model->size(); i += 1) 414 for (int i = 0; i < modelInfo.model->size(); i += 1)
415 { 415 {
416 const QString referenceName = modelInfo.model->getObjectProperty(i, ldraw::Property::ReferenceName).toString(); 416 const QString referenceName = (*modelInfo.model)[i]->getProperty(ldraw::Property::ReferenceName).toString();
417 if (not referenceName.isEmpty() 417 if (not referenceName.isEmpty()
418 and modelInfo.dependencies.count(referenceName) == 0 418 and modelInfo.dependencies.count(referenceName) == 0
419 and not failedToOpen.contains(referenceName)) 419 and not failedToOpen.contains(referenceName))
420 { 420 {
421 try 421 try

mercurial