From 9bf7106905681fd56a4e14e438935c909269655c Mon Sep 17 00:00:00 2001
From: nordsoft %1: "; // shared prefix
+ QString redPrefix = " %1: "; // shared prefix
QString lineTemplate = prefix + "%2
%2
"; QString listTemplate = "%1: %2
"; QString noteTemplate = "%1
"; + QString compatibleString = prefix + "Mod is compatible"; + QString incompatibleString = redPrefix + "Mod is incompatible"; + QString supportedVersions = redPrefix + "%2 %3 %4"; QString result; @@ -229,6 +233,32 @@ QString CModListView::genModInfoText(CModEntry & mod) if(mod.getValue("contact").isValid()) result += urlTemplate.arg(tr("Home")).arg(mod.getValue("contact").toString()).arg(mod.getValue("contact").toString()); + //compatibility info + if(mod.isCompatible()) + result += compatibleString.arg(tr("Compatibility")); + else + { + auto compatibilityInfo = mod.getValue("compatibility").toMap(); + auto minStr = compatibilityInfo.value("min").toString(); + auto maxStr = compatibilityInfo.value("max").toString(); + + result += incompatibleString.arg(tr("Compatibility")); + if(minStr == maxStr) + result += supportedVersions.arg(tr("Required VCMI version"), minStr, "", ""); + else + { + if(minStr.isEmpty() || maxStr.isEmpty()) + { + if(minStr.isEmpty()) + result += supportedVersions.arg(tr("Supported VCMI version"), maxStr, ", ", "please upgrade mod"); + else + result += supportedVersions.arg(tr("Required VCMI version"), minStr, " ", "or above"); + } + else + result += supportedVersions.arg(tr("Supported VCMI versions"), minStr, " - ", maxStr); + } + } + result += replaceIfNotEmpty(mod.getValue("depends"), lineTemplate.arg(tr("Required mods"))); result += replaceIfNotEmpty(mod.getValue("conflicts"), lineTemplate.arg(tr("Conflicting mods"))); result += replaceIfNotEmpty(mod.getValue("description"), textTemplate.arg(tr("Description")));