MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / load

Method load

launcher/minecraft/PackProfile.cpp:291–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291PackProfile::Result PackProfile::load()
292{
293 auto filename = componentsFilePath();
294
295 // load the new component list and swap it with the current one...
296 ComponentContainer newComponents;
297 if (auto result = loadPackProfile(this, filename, patchesPattern(), newComponents); !result) {
298 qCritical() << d->m_instance->name() << "|" << "Failed to load the component config";
299 return result;
300 }
301 // FIXME: actually use fine-grained updates, not this...
302 beginResetModel();
303 // disconnect all the old components
304 for (auto component : d->components) {
305 disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
306 }
307 d->components.clear();
308 d->componentIndex.clear();
309 for (auto component : newComponents) {
310 if (d->componentIndex.contains(component->m_uid)) {
311 qWarning() << d->m_instance->name() << "|" << "Ignoring duplicate component entry" << component->m_uid;
312 continue;
313 }
314 connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
315 d->components.append(component);
316 d->componentIndex[component->m_uid] = component;
317 }
318 endResetModel();
319 d->loaded = true;
320 return Result::Success();
321}
322
323PackProfile::Result PackProfile::reload(Net::Mode netmode)
324{

Callers

nothing calls this directly

Calls 6

loadPackProfileFunction · 0.85
appendMethod · 0.80
nameMethod · 0.45
getMethod · 0.45
clearMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected