MCPcopy Create free account
hub / github.com/PrismLauncher/PrismLauncher / insertComponent

Method insertComponent

launcher/minecraft/PackProfile.cpp:389–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389void PackProfile::insertComponent(size_t index, ComponentPtr component)
390{
391 auto id = component->getID();
392 if (id.isEmpty()) {
393 qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Attempt to add a component with empty ID!";
394 return;
395 }
396 if (d->componentIndex.contains(id)) {
397 qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Attempt to add a component that is already present!";
398 return;
399 }
400 beginInsertRows(QModelIndex(), static_cast<int>(index), static_cast<int>(index));
401 d->components.insert(index, component);
402 d->componentIndex[id] = component;
403 endInsertRows();
404 connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
405 scheduleSave();
406}
407
408void PackProfile::componentDataChanged()
409{

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