# HG changeset patch # User Periklis Ntanasis # Date 1372690986 -10800 # Node ID f9b31c3efd3518f643df4af965cfa44ffeaf0f8f # Parent 187ce630dddcc8fbc28a132ad8685100572ceb26 added deafult image if not one available in campaign diff -r 187ce630dddc -r f9b31c3efd35 QTfrontend/campaign.cpp --- 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 QList getCampMissionList(QString & campaignName, QString & teamName) -{ - // TODO: add default image if there isn't an available one +{ QList 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); } } diff -r 187ce630dddc -r f9b31c3efd35 QTfrontend/hedgewars.qrc --- a/QTfrontend/hedgewars.qrc Fri Jun 28 22:38:08 2013 +0300 +++ b/QTfrontend/hedgewars.qrc Mon Jul 01 18:03:06 2013 +0300 @@ -45,6 +45,7 @@ res/About.png res/SimpleGame.png res/Campaign.png + res/CampaignDefault.png res/Multiplayer.png res/Trainings.png res/Background.png diff -r 187ce630dddc -r f9b31c3efd35 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Fri Jun 28 22:38:08 2013 +0300 +++ b/QTfrontend/hwform.cpp Mon Jul 01 18:03:06 2013 +0300 @@ -1917,7 +1917,7 @@ if(index > -1 && index < campaignMissionInfo.count()) { ui.pageCampaign->lbltitle->setText("

"+ui.pageCampaign->CBMission->currentText()+"

"); ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description); - ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+campaignMissionInfo[index].image))); + ui.pageCampaign->btnPreview->setIcon(QIcon(campaignMissionInfo[index].image)); } }