QTfrontend/hwform.cpp
branchwebgl
changeset 9521 8054d9d775fd
parent 9236 ddd675825672
parent 9393 094a176dd623
child 9950 2759212a27de
equal deleted inserted replaced
9282:92af50454cf2 9521:8054d9d775fd
   163 #ifdef VIDEOREC
   163 #ifdef VIDEOREC
   164     ui.pageVideos->init(config);
   164     ui.pageVideos->init(config);
   165 #endif
   165 #endif
   166 
   166 
   167 #ifdef __APPLE__
   167 #ifdef __APPLE__
   168     AutoUpdater* updater = NULL;
       
   169     if (config->isAutoUpdateEnabled())
   168     if (config->isAutoUpdateEnabled())
   170     {
   169     {
   171 #ifdef __APPLE__
   170         AutoUpdater* updater = NULL;
       
   171 
   172 #ifdef SPARKLE_ENABLED
   172 #ifdef SPARKLE_ENABLED
   173         updater = new SparkleAutoUpdater();
   173         updater = new SparkleAutoUpdater();
   174 #endif
       
   175 #endif
   174 #endif
   176         if (updater)
   175         if (updater)
   177         {
   176         {
   178             updater->checkForUpdates();
   177             updater->checkForUpdates();
   179             delete updater;
   178             delete updater;
   656         {
   655         {
   657             curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget;
   656             curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget;
   658         }
   657         }
   659 
   658 
   660         QList<HWTeam> teamsList;
   659         QList<HWTeam> teamsList;
   661         for (QStringList::iterator it = tmNames.begin(); it != tmNames.end(); it++)
   660         for (QStringList::iterator it = tmNames.begin(); it != tmNames.end(); ++it)
   662         {
   661         {
   663             HWTeam team(*it);
   662             HWTeam team(*it);
   664             team.loadFromFile();
   663             team.loadFromFile();
   665             teamsList.push_back(team);
   664             teamsList.push_back(team);
   666         }
   665         }
   702     }
   701     }
   703 }
   702 }
   704 
   703 
   705 void HWForm::GoToPage(int id)
   704 void HWForm::GoToPage(int id)
   706 {
   705 {
   707     bool stopAnim = false;
   706     //bool stopAnim = false;
   708 
   707 
   709     int lastid = ui.Pages->currentIndex();
   708     int lastid = ui.Pages->currentIndex();
   710     PagesStack.push(ui.Pages->currentIndex());
   709     PagesStack.push(ui.Pages->currentIndex());
   711 
   710 
   712     OnPageShown(id, lastid);
   711     OnPageShown(id, lastid);
   719     unnecessary.
   718     unnecessary.
   720    */
   719    */
   721 
   720 
   722 
   721 
   723 #if (QT_VERSION >= 0x040600)
   722 #if (QT_VERSION >= 0x040600)
   724     if (!stopAnim)
   723     //if (!stopAnim)
   725     {
   724     {
   726         /**Start animation :**/
   725         /**Start animation :**/
   727         int coeff = 1;
   726         int coeff = 1;
   728 #ifdef false
   727 #ifdef false
   729         coeff = 2;
   728         coeff = 2;
   815     }
   814     }
   816     /*if (curid == ID_PAGE_DRAWMAP)
   815     /*if (curid == ID_PAGE_DRAWMAP)
   817         stopAnim = true; */
   816         stopAnim = true; */
   818 
   817 
   819     if ((!hwnet) || (!hwnet->isInRoom()))
   818     if ((!hwnet) || (!hwnet->isInRoom()))
   820         if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME)
   819         if (id == ID_PAGE_NETGAME)
   821         {
   820         {
   822             stopAnim = true;
   821             stopAnim = true;
   823             GoBack();
   822             GoBack();
   824         }
   823         }
   825 
   824 
  1721 void HWForm::StartCampaign()
  1720 void HWForm::StartCampaign()
  1722 {
  1721 {
  1723     CreateGame(0, 0, 0);
  1722     CreateGame(0, 0, 0);
  1724 
  1723 
  1725     QComboBox *combo = ui.pageCampaign->CBMission;
  1724     QComboBox *combo = ui.pageCampaign->CBMission;
  1726     QString camp = ui.pageCampaign->CBCampaign->currentText();
  1725     QString camp = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1727     unsigned int mNum = combo->count() - combo->currentIndex();
  1726     unsigned int mNum = combo->count() - combo->currentIndex();
  1728     QString miss = getCampaignScript(camp, mNum);
  1727     QString miss = getCampaignScript(camp, mNum);
  1729     QString campTeam = ui.pageCampaign->CBTeam->currentText();
  1728     QString campTeam = ui.pageCampaign->CBTeam->currentText();
  1730 
  1729 
  1731     game->StartCampaign(camp, miss, campTeam);
  1730     game->StartCampaign(camp, miss, campTeam);
  1886                               );
  1885                               );
  1887 
  1886 
  1888     unsigned int n = entries.count();
  1887     unsigned int n = entries.count();
  1889     for(unsigned int i = 0; i < n; i++)
  1888     for(unsigned int i = 0; i < n; i++)
  1890     {
  1889     {
  1891         ui.pageCampaign->CBCampaign->addItem(QString(entries[i]), QString(entries[i]));
  1890         ui.pageCampaign->CBCampaign->addItem(QString(entries[i]).replace(QString("_"),QString(" ")), QString(entries[i]).replace(QString("_"),QString(" ")));
  1892     }
  1891     }
  1893 }
  1892 }
  1894 
  1893 
  1895 
  1894 
  1896 void HWForm::UpdateCampaignPage(int index)
  1895 void HWForm::UpdateCampaignPage(int index)
  1898     Q_UNUSED(index);
  1897     Q_UNUSED(index);
  1899 
  1898 
  1900     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1899     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1901     ui.pageCampaign->CBMission->clear();
  1900     ui.pageCampaign->CBMission->clear();
  1902 
  1901 
  1903     QString campaignName = ui.pageCampaign->CBCampaign->currentText();
  1902     QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1904     QStringList missionEntries = getCampMissionList(campaignName);
  1903     QStringList missionEntries = getCampMissionList(campaignName);
  1905     QString tName = team.name();
  1904     QString tName = team.name();
  1906     unsigned int n = missionEntries.count();
  1905     unsigned int n = missionEntries.count();
  1907     unsigned int m = getCampProgress(tName, campaignName);
  1906     unsigned int m = getCampProgress(tName, campaignName);
  1908 
  1907 
  1959 }
  1958 }
  1960 
  1959 
  1961 void HWForm::UpdateCampaignPageMission(int index)
  1960 void HWForm::UpdateCampaignPageMission(int index)
  1962 {
  1961 {
  1963     // update thumbnail
  1962     // update thumbnail
  1964     QString campaignName = ui.pageCampaign->CBCampaign->currentText();
  1963     QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
  1965     unsigned int mNum = ui.pageCampaign->CBMission->count() - ui.pageCampaign->CBMission->currentIndex();
  1964     unsigned int mNum = ui.pageCampaign->CBMission->count() - ui.pageCampaign->CBMission->currentIndex();
  1966     QString image = getCampaignImage(campaignName,mNum);
  1965     QString image = getCampaignImage(campaignName,mNum);
  1967     ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+image)));
  1966     ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+image)));
  1968     // update description
  1967     // update description
  1969     // when campaign changes the UpdateCampaignPageMission is triggered with wrong values
  1968     // when campaign changes the UpdateCampaignPageMission is triggered with wrong values
  2007                    + " --locale " + config->language() + ".txt"
  2006                    + " --locale " + config->language() + ".txt"
  2008                    + (config->vid_Fullscreen() ? " --fullscreen" : "")
  2007                    + (config->vid_Fullscreen() ? " --fullscreen" : "")
  2009                    + (config->isShowFPSEnabled() ? " --showfps" : "")
  2008                    + (config->isShowFPSEnabled() ? " --showfps" : "")
  2010                    + (config->isAltDamageEnabled() ? " --altdmg" : "")
  2009                    + (config->isAltDamageEnabled() ? " --altdmg" : "")
  2011                    + " --frame-interval " + QString::number(config->timerInterval())
  2010                    + " --frame-interval " + QString::number(config->timerInterval())
  2012                    + " --raw-quality " + QString::number(config->translateQuality()));
  2011                    + " --raw-quality " + QString::number(config->translateQuality()))
       
  2012                    + (!config->Form->ui.pageOptions->CBTeamTag->isChecked() ? " --no-teamtag" : "")
       
  2013                    + (!config->Form->ui.pageOptions->CBHogTag->isChecked() ? " --no-hogtag" : "")
       
  2014                    + (!config->Form->ui.pageOptions->CBHealthTag->isChecked() ? " --no-healthtag" : "")
       
  2015                    + (config->Form->ui.pageOptions->CBTagOpacity->isChecked() ? " --translucent-tags" : "");
  2013 }
  2016 }
  2014 
  2017 
  2015 void HWForm::AssociateFiles()
  2018 void HWForm::AssociateFiles()
  2016 {
  2019 {
  2017     bool success = true;
  2020     bool success = true;