src/documentmanager.cpp

changeset 235
7ef03c2b46ab
parent 230
a1f3f7d9078b
child 259
c27612f0eac0
equal deleted inserted replaced
234:87ee9824210b 235:7ef03c2b46ab
40 .model = std::make_unique<Model>(this), 40 .model = std::make_unique<Model>(this),
41 .id = modelId, 41 .id = modelId,
42 .opentype = OpenType::ManuallyOpened, 42 .opentype = OpenType::ManuallyOpened,
43 })); 43 }));
44 this->makePolygonCacheForModel(modelId); 44 this->makePolygonCacheForModel(modelId);
45 Q_EMIT this->message(logInfo(tr("New model %1 created").arg(modelId.value)));
45 return modelId; 46 return modelId;
46 } 47 }
47 48
48 Model* DocumentManager::findDependencyByName(const ModelId modelId, const QString& name) 49 Model* DocumentManager::findDependencyByName(const ModelId modelId, const QString& name)
49 { 50 {
133 .opentype = openType, 134 .opentype = openType,
134 .polygonCache = {}, 135 .polygonCache = {},
135 })); 136 }));
136 this->makePolygonCacheForModel(modelId); 137 this->makePolygonCacheForModel(modelId);
137 result = modelId; 138 result = modelId;
139 Q_EMIT this->message(logInfo(tr("Opened %1 as model %2").arg(quoted(path)).arg(modelId.value)));
138 } 140 }
139 else 141 else
140 { 142 {
141 errorStream << file.errorString(); 143 errorStream << file.errorString();
142 } 144 }
301 removeFromSet(prunable, pair.to); 303 removeFromSet(prunable, pair.to);
302 } 304 }
303 for (ModelId idToPrune : prunable) { 305 for (ModelId idToPrune : prunable) {
304 auto it = this->openModels.find(idToPrune); 306 auto it = this->openModels.find(idToPrune);
305 if (it != this->openModels.end()) { 307 if (it != this->openModels.end()) {
308 Q_EMIT this->message(logInfo(tr("Model %1 (%2) pruned").arg(idToPrune.value).arg(it->second.path)));
306 this->openModels.erase(it); 309 this->openModels.erase(it);
307 } 310 }
308 removeFromSet(autoOpened, idToPrune); 311 removeFromSet(autoOpened, idToPrune);
309 std::erase_if(dependencyGraph, [&idToPrune](const GraphEdge<ModelId>& edge) { 312 std::erase_if(dependencyGraph, [&idToPrune](const GraphEdge<ModelId>& edge) {
310 return edge.from == idToPrune; 313 return edge.from == idToPrune;

mercurial