| 250 | } |
| 251 | |
| 252 | void ModPage::updateModVersions(int prev_count) |
| 253 | { |
| 254 | auto packProfile = (dynamic_cast<MinecraftInstance*>(m_instance))->getPackProfile(); |
| 255 | |
| 256 | QString mcVersion = packProfile->getComponentVersion("net.minecraft"); |
| 257 | |
| 258 | for (int i = 0; i < current.versions.size(); i++) { |
| 259 | auto version = current.versions[i]; |
| 260 | bool valid = false; |
| 261 | for(auto& mcVer : m_filter->versions){ |
| 262 | //NOTE: Flame doesn't care about loader, so passing it changes nothing. |
| 263 | if (validateVersion(version, mcVer.toString(), packProfile->getModLoaders())) { |
| 264 | valid = true; |
| 265 | break; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | // Only add the version if it's valid or using the 'Any' filter, but never if the version is opted out |
| 270 | if ((valid || m_filter->versions.empty()) && !optedOut(version)) |
| 271 | ui->versionSelectionBox->addItem(version.version, QVariant(i)); |
| 272 | } |
| 273 | if (ui->versionSelectionBox->count() == 0 && prev_count != 0) { |
| 274 | ui->versionSelectionBox->addItem(tr("No valid version found!"), QVariant(-1)); |
| 275 | ui->modSelectionButton->setText(tr("Cannot select invalid version :(")); |
| 276 | } |
| 277 | |
| 278 | updateSelectionButton(); |
| 279 | } |
| 280 | |
| 281 | |
| 282 | void ModPage::updateSelectionButton() |
no test coverage detected