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

Method insertComponent

launcher/minecraft/PackProfile.cpp:379–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void PackProfile::insertComponent(size_t index, ComponentPtr component)
380{
381 auto id = component->getID();
382 if (id.isEmpty()) {
383 qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Attempt to add a component with empty ID!";
384 return;
385 }
386 if (d->componentIndex.contains(id)) {
387 qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Attempt to add a component that is already present!";
388 return;
389 }
390 beginInsertRows(QModelIndex(), static_cast<int>(index), static_cast<int>(index));
391 d->components.insert(index, component);
392 d->componentIndex[id] = component;
393 endInsertRows();
394 connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
395 scheduleSave();
396}
397
398void PackProfile::componentDataChanged()
399{

Callers 1

resolveDependenciesMethod · 0.80

Calls 7

QModelIndexClass · 0.85
getIDMethod · 0.80
insertMethod · 0.80
isEmptyMethod · 0.45
nameMethod · 0.45
containsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected