| 459 | } |
| 460 | |
| 461 | bool ResourceFolderModel::setData(const QModelIndex& index, [[maybe_unused]] const QVariant& value, int role) |
| 462 | { |
| 463 | int row = index.row(); |
| 464 | if (row < 0 || row >= rowCount(index.parent()) || !index.isValid()) |
| 465 | return false; |
| 466 | |
| 467 | if (role == Qt::CheckStateRole) { |
| 468 | if (m_instance != nullptr && m_instance->isRunning()) { |
| 469 | auto response = |
| 470 | CustomMessageBox::selectable(nullptr, tr("Confirm toggle"), |
| 471 | tr("If you enable/disable this resource while the game is running it may crash your game.\n" |
| 472 | "Are you sure you want to do this?"), |
| 473 | QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) |
| 474 | ->exec(); |
| 475 | |
| 476 | if (response != QMessageBox::Yes) |
| 477 | return false; |
| 478 | } |
| 479 | return setResourceEnabled({ index }, EnableAction::TOGGLE); |
| 480 | } |
| 481 | |
| 482 | return false; |
| 483 | } |
| 484 | |
| 485 | QVariant ResourceFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const |
| 486 | { |
nothing calls this directly
no test coverage detected