| 396 | } |
| 397 | |
| 398 | void PackProfile::componentDataChanged() |
| 399 | { |
| 400 | auto objPtr = qobject_cast<Component*>(sender()); |
| 401 | if (!objPtr) { |
| 402 | qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "PackProfile got dataChanged signal from a non-Component!"; |
| 403 | return; |
| 404 | } |
| 405 | if (objPtr->getID() == "net.minecraft") { |
| 406 | emit minecraftChanged(); |
| 407 | } |
| 408 | // figure out which one is it... in a seriously dumb way. |
| 409 | int index = 0; |
| 410 | for (auto component : d->components) { |
| 411 | if (component.get() == objPtr) { |
| 412 | emit dataChanged(createIndex(index, 0), createIndex(index, columnCount(QModelIndex()) - 1)); |
| 413 | scheduleSave(); |
| 414 | return; |
| 415 | } |
| 416 | index++; |
| 417 | } |
| 418 | qCWarning(instanceProfileC) << d->m_instance->name() << "|" |
| 419 | << "PackProfile got dataChanged signal from a Component which does not belong to it!"; |
| 420 | } |
| 421 | |
| 422 | bool PackProfile::remove(const int index) |
| 423 | { |
nothing calls this directly
no test coverage detected