QTfrontend/hwform.cpp
changeset 9184 8bf450fe6cc8
parent 9182 f92e205bc167
child 9197 e4e366013e9a
child 9219 0a4b6bb69f99
equal deleted inserted replaced
9182:f92e205bc167 9184:8bf450fe6cc8
   193     //QShortcut * updateData = new QShortcut(QKeySequence("F5"), this);
   193     //QShortcut * updateData = new QShortcut(QKeySequence("F5"), this);
   194     //connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload()));
   194     //connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload()));
   195 #endif
   195 #endif
   196 
   196 
   197 	previousCampaignName = "";
   197 	previousCampaignName = "";
       
   198 	previousTeamName = "";
   198     UpdateTeamsLists();
   199     UpdateTeamsLists();
   199     InitCampaignPage();
   200     InitCampaignPage();
   200     UpdateCampaignPage(0);
   201     UpdateCampaignPage(0);
   201     UpdateWeapons();
   202     UpdateWeapons();
   202 
   203 
  1891 
  1892 
  1892 
  1893 
  1893 void HWForm::UpdateCampaignPage(int index)
  1894 void HWForm::UpdateCampaignPage(int index)
  1894 {
  1895 {
  1895     Q_UNUSED(index);
  1896     Q_UNUSED(index);
  1896 
  1897     
  1897     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1898     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1898     ui.pageCampaign->CBMission->clear();
  1899     ui.pageCampaign->CBMission->clear();
  1899 
  1900 
  1900     QString campaignName = ui.pageCampaign->CBCampaign->currentText();
  1901     QString campaignName = ui.pageCampaign->CBCampaign->currentText();
  1901     QStringList missionEntries = getCampMissionList(campaignName);
  1902     QStringList missionEntries = getCampMissionList(campaignName);
  1904     unsigned int m = getCampProgress(tName, campaignName);
  1905     unsigned int m = getCampProgress(tName, campaignName);
  1905     
  1906     
  1906     // if the campaign name changes update the campaignMissionDescriptions list
  1907     // if the campaign name changes update the campaignMissionDescriptions list
  1907     // this will be used later in UpdateCampaignPageMission() to update
  1908     // this will be used later in UpdateCampaignPageMission() to update
  1908     // the mission description in the campaign page
  1909     // the mission description in the campaign page
  1909     bool updateMissionList = false;    
  1910     bool updateMissionList = false;
  1910     QSettings * m_info;
  1911     QSettings * m_info;
  1911     if(previousCampaignName.compare(campaignName)!=0) 
  1912     if(previousCampaignName.compare(campaignName)!=0 || 
  1912     {
  1913 			previousTeamName.compare(tName) != 0) 
       
  1914     {
       
  1915 		if (previousTeamName.compare(tName) != 0 && 
       
  1916 				previousTeamName.compare("") != 0)
       
  1917 			index = qMin(m + 1, n);
  1913 		previousCampaignName = campaignName;
  1918 		previousCampaignName = campaignName;
       
  1919 		previousTeamName = tName;
  1914 		updateMissionList = true;
  1920 		updateMissionList = true;
  1915 		// the following code was based on pagetraining.cpp
  1921 		// the following code was based on pagetraining.cpp
  1916 		DataManager & dataMgr = DataManager::instance();    
  1922 		DataManager & dataMgr = DataManager::instance();    
  1917 		// get locale
  1923 		// get locale
  1918 		QSettings settings(dataMgr.settingsFileName(),
  1924 		QSettings settings(dataMgr.settingsFileName(),
  1944 		} 
  1950 		} 
  1945         ui.pageCampaign->CBMission->addItem(QString("Mission %1: ").arg(i) + QString(missionEntries[i-1]), QString(missionEntries[i-1]));       
  1951         ui.pageCampaign->CBMission->addItem(QString("Mission %1: ").arg(i) + QString(missionEntries[i-1]), QString(missionEntries[i-1]));       
  1946     }
  1952     }
  1947     if(updateMissionList)
  1953     if(updateMissionList)
  1948 		delete m_info;
  1954 		delete m_info;
       
  1955 
  1949     UpdateCampaignPageMission(index);
  1956     UpdateCampaignPageMission(index);
  1950 }
  1957 }
  1951 
  1958 
  1952 void HWForm::UpdateCampaignPageMission(int index) 
  1959 void HWForm::UpdateCampaignPageMission(int index) 
  1953 {    
  1960 {