QTfrontend/campaign.cpp
changeset 10017 de822cd3df3a
parent 9998 736015b847e3
child 10108 c68cf030eded
--- a/QTfrontend/campaign.cpp	Tue Jan 21 22:38:13 2014 +0100
+++ b/QTfrontend/campaign.cpp	Tue Jan 21 22:43:06 2014 +0100
@@ -26,31 +26,31 @@
 QList<MissionInfo> getCampMissionList(QString & campaignName, QString & teamName)
 {
     QList<MissionInfo> missionInfoList;
-	QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + teamName + ".hwt", QSettings::IniFormat, 0);
+    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) and 
-			teamfile.childGroups().contains("Campaign " + spaceCampName)){
-		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);
-	}
-	
+    if (!teamfile.childGroups().contains("Campaign " + campaignName) and
+            teamfile.childGroups().contains("Campaign " + spaceCampName)){
+        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();
-    
+
     QSettings campfile("physfs://Missions/Campaign/" + campaignName + "/campaign.ini", QSettings::IniFormat, 0);
     campfile.setIniCodec("UTF-8");
-    
+
     DataManager & dataMgr = DataManager::instance();
         // get locale
         QSettings settings(dataMgr.settingsFileName(),
@@ -69,42 +69,42 @@
 
         QSettings m_info(campaignDescFile, QSettings::IniFormat, 0);
         m_info.setIniCodec("UTF-8");
-    
+
     if(progress>=0 and unlockedMissions==0)
     {
-		for(unsigned int i=progress+1;i>0;i--)
-		{
-			MissionInfo missionInfo;
-			missionInfo.name = campfile.value(QString("Mission %1/Name").arg(i)).toString();
-			QString script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
+        for(unsigned int i=progress+1;i>0;i--)
+        {
+            MissionInfo missionInfo;
+            missionInfo.name = campfile.value(QString("Mission %1/Name").arg(i)).toString();
+            QString script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
             missionInfo.script = script;
-			missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
+            missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
                                             QObject::tr("No description available")).toString();
             QString image = campfile.value(QString("Mission %1/Script").arg(i)).toString().replace(QString(".lua"),QString(".png"));
             missionInfo.image = ":/res/campaign/"+campaignName+"/"+image;
             if (!QFile::exists(missionInfo.image))
-				missionInfo.image = ":/res/CampaignDefault.png";
-			missionInfoList.append(missionInfo);
-		}
-	} 
-	else if(unlockedMissions>0)
-	{
-		for(int i=1;i<=unlockedMissions;i++)
-		{
-			QString missionNum = QString("%1").arg(i);
-			int missionNumber = teamfile.value("Campaign " + campaignName + "/Mission"+missionNum, -1).toInt();
-			MissionInfo missionInfo;
-			missionInfo.name = campfile.value(QString("Mission %1/Name").arg(missionNumber)).toString();
-			QString script = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString();
+                missionInfo.image = ":/res/CampaignDefault.png";
+            missionInfoList.append(missionInfo);
+        }
+    }
+    else if(unlockedMissions>0)
+    {
+        for(int i=1;i<=unlockedMissions;i++)
+        {
+            QString missionNum = QString("%1").arg(i);
+            int missionNumber = teamfile.value("Campaign " + campaignName + "/Mission"+missionNum, -1).toInt();
+            MissionInfo missionInfo;
+            missionInfo.name = campfile.value(QString("Mission %1/Name").arg(missionNumber)).toString();
+            QString script = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString();
             missionInfo.script = script;
-			missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
+            missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
                                             QObject::tr("No description available")).toString();
             QString image = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString().replace(QString(".lua"),QString(".png"));
             missionInfo.image = ":/res/campaign/"+campaignName+"/"+image;
             if (!QFile::exists(missionInfo.image))
-				missionInfo.image = ":/res/CampaignDefault.png";
-			missionInfoList.append(missionInfo);
-		}
-	}
-	return missionInfoList;
+                missionInfo.image = ":/res/CampaignDefault.png";
+            missionInfoList.append(missionInfo);
+        }
+    }
+    return missionInfoList;
 }