QTfrontend/hwform.cpp
changeset 11957 1201fc039e24
parent 11955 d72a177dbaea
child 11958 de66192866d3
equal deleted inserted replaced
11956:221b38978401 11957:1201fc039e24
  1700 }
  1700 }
  1701 
  1701 
  1702 void HWForm::StartCampaign()
  1702 void HWForm::StartCampaign()
  1703 {
  1703 {
  1704     CreateGame(0, 0, 0);
  1704     CreateGame(0, 0, 0);
  1705     QString camp = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1705     QString camp = ui.pageCampaign->CBCampaign->itemData(ui.pageCampaign->CBCampaign->currentIndex()).toString();
  1706     QString miss = campaignMissionInfo[ui.pageCampaign->CBMission->currentIndex()].script;
  1706     QString miss = campaignMissionInfo[ui.pageCampaign->CBMission->currentIndex()].script;
  1707     QString campTeam = ui.pageCampaign->CBTeam->currentText();
  1707     QString campTeam = ui.pageCampaign->CBTeam->currentText();
  1708     game->StartCampaign(camp, miss, campTeam);
  1708     game->StartCampaign(camp, miss, campTeam);
  1709 }
  1709 }
  1710 
  1710 
  1862 
  1862 
  1863     unsigned int n = entries.count();
  1863     unsigned int n = entries.count();
  1864 
  1864 
  1865     for(unsigned int i = 0; i < n; i++)
  1865     for(unsigned int i = 0; i < n; i++)
  1866     {
  1866     {
  1867         QString campaignName = QString(entries[i]).replace(QString("_"),QString(" "));
  1867         QString campaignName = QString(entries[i]);
  1868         QString tName = team.name();
  1868         QString tName = team.name();
  1869         ui.pageCampaign->CBCampaign->addItem(campaignName, campaignName);
  1869         ui.pageCampaign->CBCampaign->addItem(getRealCampName(campaignName), campaignName);
  1870     }
  1870     }
  1871 }
  1871 }
  1872 
  1872 
  1873 void HWForm::UpdateCampaignPage(int index)
  1873 void HWForm::UpdateCampaignPage(int index)
  1874 {
  1874 {
  1875     Q_UNUSED(index);
  1875     Q_UNUSED(index);
  1876     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1876     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1877     QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1877     QString campaignName = ui.pageCampaign->CBCampaign->itemData(ui.pageCampaign->CBCampaign->currentIndex()).toString();
  1878     QString tName = team.name();
  1878     QString tName = team.name();
  1879 
  1879 
  1880     campaignMissionInfo = getCampMissionList(campaignName,tName);
  1880     campaignMissionInfo = getCampMissionList(campaignName,tName);
  1881     ui.pageCampaign->CBMission->clear();
  1881     ui.pageCampaign->CBMission->clear();
  1882 
  1882 
  1915 }
  1915 }
  1916 
  1916 
  1917 void HWForm::UpdateCampaignPageMission(int index)
  1917 void HWForm::UpdateCampaignPageMission(int index)
  1918 {
  1918 {
  1919     // update thumbnail and description
  1919     // update thumbnail and description
  1920     QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1920     QString campaignName = ui.pageCampaign->CBCampaign->itemData(ui.pageCampaign->CBCampaign->currentIndex()).toString();
  1921     // when campaign changes the UpdateCampaignPageMission is triggered with wrong values
  1921     // when campaign changes the UpdateCampaignPageMission is triggered with wrong values
  1922     // this will cause segfault. This check prevents illegal memory reads
  1922     // this will cause segfault. This check prevents illegal memory reads
  1923     if(index > -1 && index < campaignMissionInfo.count()) {
  1923     if(index > -1 && index < campaignMissionInfo.count()) {
  1924         ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>");
  1924         ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>");
  1925         ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description);
  1925         ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description);
  1940             ui.pageCampaign->CBMission->setCurrentIndex(i);
  1940             ui.pageCampaign->CBMission->setCurrentIndex(i);
  1941             break;
  1941             break;
  1942         }
  1942         }
  1943     }
  1943     }
  1944     int i = ui.pageCampaign->CBCampaign->currentIndex();
  1944     int i = ui.pageCampaign->CBCampaign->currentIndex();
  1945     QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1945     QString campaignName = ui.pageCampaign->CBCampaign->itemData(i).toString();
  1946     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1946     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1947     QString tName = team.name();
  1947     QString tName = team.name();
  1948     if(isCampWon(campaignName, tName))
  1948     if(isCampWon(campaignName, tName))
  1949         ui.pageCampaign->CBCampaign->setItemIcon(i, finishedIcon);
  1949         ui.pageCampaign->CBCampaign->setItemIcon(i, finishedIcon);
  1950     else
  1950     else