Move campaign mission images to share/ instead of hardcoding them into frontend
authorWuzzy <Wuzzy2@mail.ru>
Sat, 29 Sep 2018 01:17:15 +0200
changeset 13816 e3fee73c51a0
parent 13815 c0a7ef988151
child 13817 0beff00d223a
Move campaign mission images to share/ instead of hardcoding them into frontend Hardcoding campaign mission images prevented add-ons from adding their own preview images.
ChangeLog.txt
QTfrontend/campaign.cpp
QTfrontend/hedgewars.qrc
QTfrontend/res/campaign/A_Classic_Fairytale/backstab.png
QTfrontend/res/campaign/A_Classic_Fairytale/dragon.png
QTfrontend/res/campaign/A_Classic_Fairytale/enemy.png
QTfrontend/res/campaign/A_Classic_Fairytale/epil.png
QTfrontend/res/campaign/A_Classic_Fairytale/family.png
QTfrontend/res/campaign/A_Classic_Fairytale/first_blood.png
QTfrontend/res/campaign/A_Classic_Fairytale/journey.png
QTfrontend/res/campaign/A_Classic_Fairytale/queen.png
QTfrontend/res/campaign/A_Classic_Fairytale/shadow.png
QTfrontend/res/campaign/A_Classic_Fairytale/united.png
QTfrontend/res/campaign/A_Space_Adventure/cosmos.png
QTfrontend/res/campaign/A_Space_Adventure/death01.png
QTfrontend/res/campaign/A_Space_Adventure/death02.png
QTfrontend/res/campaign/A_Space_Adventure/desert01.png
QTfrontend/res/campaign/A_Space_Adventure/desert02.png
QTfrontend/res/campaign/A_Space_Adventure/desert03.png
QTfrontend/res/campaign/A_Space_Adventure/final.png
QTfrontend/res/campaign/A_Space_Adventure/fruit01.png
QTfrontend/res/campaign/A_Space_Adventure/fruit02.png
QTfrontend/res/campaign/A_Space_Adventure/fruit03.png
QTfrontend/res/campaign/A_Space_Adventure/ice01.png
QTfrontend/res/campaign/A_Space_Adventure/ice02.png
QTfrontend/res/campaign/A_Space_Adventure/moon01.png
QTfrontend/res/campaign/A_Space_Adventure/moon02.png
QTfrontend/ui/page/pagecampaign.cpp
share/hedgewars/Data/Graphics/Missions/CMakeLists.txt
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/CMakeLists.txt
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/backstab@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/dragon@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/enemy@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/epil@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/family@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/first_blood@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/journey@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/queen@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/shadow@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/united@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/CMakeLists.txt
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/cosmos@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/death01@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/death02@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/desert01@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/desert02@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/desert03@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/final@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/fruit01@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/fruit02@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/fruit03@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/ice01@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/ice02@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/moon01@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/moon02@2x.png
share/hedgewars/Data/Graphics/Missions/Campaign/CMakeLists.txt
--- a/ChangeLog.txt	Thu Sep 27 00:26:58 2018 +0200
+++ b/ChangeLog.txt	Sat Sep 29 01:17:15 2018 +0200
@@ -40,6 +40,7 @@
 Frontend:
  + Add setting to disable audio dampening when losing window focus
  + Rework player rankings: Losing clans are now ranked in the reverse order they died
+ + Add-ons now support preview images for campaign missions
  * Fix player rankings on round draw: Clans that died in the same turn now have the same rank
  * Fix rare crash when aborting video encoding in progress
  * Fix critical failure to cleanup teams list after rejoining game under certain conditions
--- a/QTfrontend/campaign.cpp	Thu Sep 27 00:26:58 2018 +0200
+++ b/QTfrontend/campaign.cpp	Sat Sep 29 01:17:15 2018 +0200
@@ -137,8 +137,8 @@
                 missionInfo.realName = m_info->value(scriptPrefix+".name", missionInfo.name).toString();
                 missionInfo.description = m_info->value(scriptPrefix + ".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;
+                QString image = campfile.value(QString("Mission %1/Script").arg(i)).toString().replace(QString(".lua"),QString("@2x.png"));
+                missionInfo.image = "physfs://Graphics/Missions/Campaign/"+campaignName+"/"+image;
                 if (!QFile::exists(missionInfo.image))
                     missionInfo.image = ":/res/CampaignDefault.png";
                 missionInfoList.append(missionInfo);
@@ -159,8 +159,8 @@
             missionInfo.realName = m_info->value(scriptPrefix+".name", missionInfo.name).toString();
             missionInfo.description = m_info->value(scriptPrefix + ".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;
+            QString image = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString().replace(QString(".lua"),QString("@2x.png"));
+            missionInfo.image = "physfs://Graphics/Missions/Campaign/"+campaignName+"/"+image;
             if (!QFile::exists(missionInfo.image))
                 missionInfo.image = ":/res/CampaignDefault.png";
             missionInfoList.append(missionInfo);
--- a/QTfrontend/hedgewars.qrc	Thu Sep 27 00:26:58 2018 +0200
+++ b/QTfrontend/hedgewars.qrc	Sat Sep 29 01:17:15 2018 +0200
@@ -35,30 +35,6 @@
         <file>res/botlevels/net3.png</file>
         <file>res/botlevels/net4.png</file>
         <file>res/botlevels/net5.png</file>
-        <file>res/campaign/A_Classic_Fairytale/first_blood.png</file>
-        <file>res/campaign/A_Classic_Fairytale/shadow.png</file>
-        <file>res/campaign/A_Classic_Fairytale/journey.png</file>
-        <file>res/campaign/A_Classic_Fairytale/united.png</file>
-        <file>res/campaign/A_Classic_Fairytale/backstab.png</file>
-        <file>res/campaign/A_Classic_Fairytale/dragon.png</file>
-        <file>res/campaign/A_Classic_Fairytale/family.png</file>
-        <file>res/campaign/A_Classic_Fairytale/queen.png</file>
-        <file>res/campaign/A_Classic_Fairytale/enemy.png</file>
-        <file>res/campaign/A_Classic_Fairytale/epil.png</file>
-        <file>res/campaign/A_Space_Adventure/cosmos.png</file>
-        <file>res/campaign/A_Space_Adventure/moon01.png</file>
-        <file>res/campaign/A_Space_Adventure/moon02.png</file>
-        <file>res/campaign/A_Space_Adventure/ice01.png</file>
-        <file>res/campaign/A_Space_Adventure/ice02.png</file>
-        <file>res/campaign/A_Space_Adventure/desert01.png</file>
-        <file>res/campaign/A_Space_Adventure/desert02.png</file>
-        <file>res/campaign/A_Space_Adventure/desert03.png</file>
-        <file>res/campaign/A_Space_Adventure/fruit01.png</file>
-        <file>res/campaign/A_Space_Adventure/fruit02.png</file>
-        <file>res/campaign/A_Space_Adventure/fruit03.png</file>
-        <file>res/campaign/A_Space_Adventure/death01.png</file>
-        <file>res/campaign/A_Space_Adventure/death02.png</file>
-        <file>res/campaign/A_Space_Adventure/final.png</file>
         <file>res/bonus.png</file>
         <file>res/Hedgehog.png</file>
         <file>res/net.png</file>
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/backstab.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/dragon.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/enemy.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/epil.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/family.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/first_blood.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/journey.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/queen.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/shadow.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/united.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/cosmos.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/death01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/death02.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/desert01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/desert02.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/desert03.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/final.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/fruit01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/fruit02.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/fruit03.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/ice01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/ice02.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/moon01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/moon02.png has changed
--- a/QTfrontend/ui/page/pagecampaign.cpp	Thu Sep 27 00:26:58 2018 +0200
+++ b/QTfrontend/ui/page/pagecampaign.cpp	Sat Sep 29 01:17:15 2018 +0200
@@ -46,7 +46,7 @@
     infoLayout->setRowStretch(1, 1);
 
     // set this as default image first time page is created, this will change in hwform.cpp
-    btnPreview = formattedButton(":/res/campaign/A_Classic_Fairytale/first_blood.png", true);
+    btnPreview = formattedButton("physfs://Graphics/Missions/Campaign/A_Classic_Fairytale/first_blood@2x.png", true);
     btnPreview->setWhatsThis(tr("Start fighting"));
     infoLayout->setAlignment(btnPreview, Qt::AlignHCenter | Qt::AlignVCenter);
 
--- a/share/hedgewars/Data/Graphics/Missions/CMakeLists.txt	Thu Sep 27 00:26:58 2018 +0200
+++ b/share/hedgewars/Data/Graphics/Missions/CMakeLists.txt	Sat Sep 29 01:17:15 2018 +0200
@@ -1,3 +1,4 @@
 add_subdirectory(Training)
 add_subdirectory(Challenge)
 add_subdirectory(Scenario)
+add_subdirectory(Campaign)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/CMakeLists.txt	Sat Sep 29 01:17:15 2018 +0200
@@ -0,0 +1,5 @@
+file(GLOB MissionPics *@2x.png)
+
+install(FILES
+    ${MissionPics}
+    DESTINATION ${SHAREPATH}Data/Graphics/Missions/Campaign/A_Classic_Fairytale)
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/backstab@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/dragon@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/enemy@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/epil@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/family@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/first_blood@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/journey@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/queen@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/shadow@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Classic_Fairytale/united@2x.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/CMakeLists.txt	Sat Sep 29 01:17:15 2018 +0200
@@ -0,0 +1,5 @@
+file(GLOB MissionPics *@2x.png)
+
+install(FILES
+    ${MissionPics}
+    DESTINATION ${SHAREPATH}Data/Graphics/Missions/Campaign/A_Space_Adventure)
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/cosmos@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/death01@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/death02@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/desert01@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/desert02@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/desert03@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/final@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/fruit01@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/fruit02@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/fruit03@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/ice01@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/ice02@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/moon01@2x.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Campaign/A_Space_Adventure/moon02@2x.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Graphics/Missions/Campaign/CMakeLists.txt	Sat Sep 29 01:17:15 2018 +0200
@@ -0,0 +1,2 @@
+add_subdirectory(A_Classic_Fairytale)
+add_subdirectory(A_Space_Adventure)