Align drop-down text of unfinished campaign missions with finished icons
authorWuzzy <almikes@aol.com>
Tue, 22 Nov 2016 17:02:20 +0100
changeset 11978 4a2da00bbedc
parent 11977 bc7788e8723b
child 11979 188dc80fafa5
Align drop-down text of unfinished campaign missions with finished icons
QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp	Tue Nov 22 16:39:54 2016 +0100
+++ b/QTfrontend/hwform.cpp	Tue Nov 22 17:02:20 2016 +0100
@@ -131,6 +131,7 @@
 QString playerHash;
 
 QIcon finishedIcon;
+QIcon notFinishedIcon;
 GameUIConfig* HWForm::config = NULL;
 
 HWForm::HWForm(QWidget *parent, QString styleSheet)
@@ -168,9 +169,15 @@
     frontendEffects = config->value("frontend/effects", true).toBool();
     playerHash = QString(QCryptographicHash::hash(config->value("net/nick",tr("Guest")+QString("%1").arg(rand())).toString().toUtf8(), QCryptographicHash::Md5).toHex());
 
+    // Icons for finished missions
     finishedIcon.addFile(":/res/missionFinished.png", QSize(), QIcon::Normal, QIcon::On);
     finishedIcon.addFile(":/res/missionFinishedSelected.png", QSize(), QIcon::Selected, QIcon::On);
 
+    // A transparent icon, used to nicely align the unfinished missions with the finished ones
+    QPixmap emptySpace = QPixmap(15, 15);
+    emptySpace.fill(QColor(0, 0, 0, 0));
+    notFinishedIcon = QIcon(emptySpace);
+
     ui.pageRoomsList->setSettings(config);
     ui.pageNetGame->setSettings(config);
     ui.pageNetGame->chatWidget->setSettings(config);
@@ -1895,7 +1902,7 @@
         if(isMissionWon(campaignName, i, tName))
             ui.pageCampaign->CBMission->setItemIcon(i, finishedIcon);
         else
-            ui.pageCampaign->CBMission->setItemIcon(i, QIcon());
+            ui.pageCampaign->CBMission->setItemIcon(i, notFinishedIcon);
     }
 }
 
@@ -1919,7 +1926,7 @@
         if(isCampWon(campaignName, tName))
             ui.pageCampaign->CBCampaign->setItemIcon(i, finishedIcon);
         else
-            ui.pageCampaign->CBCampaign->setItemIcon(i, QIcon());
+            ui.pageCampaign->CBCampaign->setItemIcon(i, notFinishedIcon);
     }
 }
 
@@ -1957,7 +1964,7 @@
     if(isCampWon(campaignName, tName))
         ui.pageCampaign->CBCampaign->setItemIcon(i, finishedIcon);
     else
-        ui.pageCampaign->CBCampaign->setItemIcon(i, QIcon());
+        ui.pageCampaign->CBCampaign->setItemIcon(i, notFinishedIcon);
 }
 
 // used for --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]