| 1346 | } |
| 1347 | |
| 1348 | void ModListViewActions::moveOverwriteContentToExistingMod() const |
| 1349 | { |
| 1350 | QStringList mods; |
| 1351 | auto indexesByPriority = m_core.currentProfile()->getAllIndexesByPriority(); |
| 1352 | for (auto& iter : indexesByPriority) { |
| 1353 | if ((iter.second != UINT_MAX)) { |
| 1354 | ModInfo::Ptr modInfo = ModInfo::getByIndex(iter.second); |
| 1355 | if (!modInfo->isSeparator() && !modInfo->isForeign() && !modInfo->isOverwrite()) { |
| 1356 | mods << modInfo->name(); |
| 1357 | } |
| 1358 | } |
| 1359 | } |
| 1360 | |
| 1361 | ListDialog dialog(m_parent); |
| 1362 | dialog.setWindowTitle("Select a mod..."); |
| 1363 | dialog.setChoices(mods); |
| 1364 | |
| 1365 | if (dialog.exec() == QDialog::Accepted) { |
| 1366 | QString result = dialog.getChoice(); |
| 1367 | if (!result.isEmpty()) { |
| 1368 | |
| 1369 | QString modAbsolutePath; |
| 1370 | |
| 1371 | for (const auto& mod : m_core.modList()->allModsByProfilePriority()) { |
| 1372 | if (result.compare(mod) == 0) { |
| 1373 | ModInfo::Ptr modInfo = ModInfo::getByIndex(ModInfo::getIndex(mod)); |
| 1374 | modAbsolutePath = modInfo->absolutePath(); |
| 1375 | break; |
| 1376 | } |
| 1377 | } |
| 1378 | |
| 1379 | if (modAbsolutePath.isNull()) { |
| 1380 | log::warn("Mod {} has not been found, for some reason", result); |
| 1381 | return; |
| 1382 | } |
| 1383 | |
| 1384 | moveOverwriteContentsTo(modAbsolutePath); |
| 1385 | } |
| 1386 | } |
| 1387 | } |
| 1388 | |
| 1389 | void ModListViewActions::clearOverwrite() const |
| 1390 | { |
no test coverage detected