check if save from old campaign name scheme exists and if so rename it to use _ instead of spaces -see
issue #722
--- a/QTfrontend/campaign.cpp Sun Dec 22 15:49:01 2013 -0500
+++ b/QTfrontend/campaign.cpp Mon Dec 23 02:59:44 2013 +0200
@@ -28,6 +28,24 @@
QList<MissionInfo> missionInfoList;
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + teamName + ".hwt", QSettings::IniFormat, 0);
teamfile.setIniCodec("UTF-8");
+
+ // if entry not found check if there is written without _
+ // if then is found rename it to use _
+ QString spaceCampName = campaignName;
+ spaceCampName = spaceCampName.replace(QString("_"),QString(" "));
+ if (teamfile.childGroups().contains("Campaign " + campaignName) == false and
+ teamfile.childGroups().contains("Campaign " + spaceCampName) == true){
+ qDebug("CAMP NAME FOUND");
+ teamfile.beginGroup("Campaign " + spaceCampName);
+ QStringList keys = teamfile.childKeys();
+ teamfile.endGroup();
+ for (int i=0;i<keys.size();i++) {
+ QVariant value = teamfile.value("Campaign " + spaceCampName + "/" + keys[i]);
+ teamfile.setValue("Campaign " + campaignName + "/" + keys[i], value);
+ }
+ teamfile.remove("Campaign " + spaceCampName);
+ }
+
int progress = teamfile.value("Campaign " + campaignName + "/Progress", 0).toInt();
int unlockedMissions = teamfile.value("Campaign " + campaignName + "/UnlockedMissions", 0).toInt();