--- a/QTfrontend/campaign.cpp Fri Jun 28 22:38:08 2013 +0300
+++ b/QTfrontend/campaign.cpp Mon Jul 01 18:03:06 2013 +0300
@@ -24,8 +24,7 @@
#include <QLocale>
QList<MissionInfo> getCampMissionList(QString & campaignName, QString & teamName)
-{
- // TODO: add default image if there isn't an available one
+{
QList<MissionInfo> missionInfoList;
QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + teamName + ".hwt", QSettings::IniFormat, 0);
teamfile.setIniCodec("UTF-8");
@@ -63,7 +62,10 @@
missionInfo.script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
missionInfo.description = m_info.value(campaignName+"-"+ missionInfo.script.replace(QString(".lua"),QString("")) + ".desc",
QObject::tr("No description available")).toString();
- missionInfo.image = campfile.value(QString("Mission %1/Script").arg(i)).toString().replace(QString(".lua"),QString(".png"));
+ 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);
}
}
@@ -78,7 +80,10 @@
missionInfo.script = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString();
missionInfo.description = m_info.value(campaignName+"-"+ missionInfo.script.replace(QString(".lua"),QString("")) + ".desc",
QObject::tr("No description available")).toString();
- missionInfo.image = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString().replace(QString(".lua"),QString(".png"));
+ 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);
}
}