QTfrontend/hwform.cpp
changeset 15283 16f389fcd462
parent 15281 d111a0d9d499
child 15304 3bf780084c86
equal deleted inserted replaced
15282:7b05af5912cb 15283:16f389fcd462
   127 
   127 
   128 
   128 
   129 // I started handing this down to each place it touches, but it was getting ridiculous
   129 // I started handing this down to each place it touches, but it was getting ridiculous
   130 // and this one flag does not warrant a static class
   130 // and this one flag does not warrant a static class
   131 bool frontendEffects = true;
   131 bool frontendEffects = true;
       
   132 bool demoIsPresent = true;
   132 QString playerHash;
   133 QString playerHash;
   133 
   134 
   134 QIcon finishedIcon;
   135 QIcon finishedIcon;
   135 QIcon notFinishedIcon;
   136 QIcon notFinishedIcon;
   136 GameUIConfig* HWForm::config = NULL;
   137 GameUIConfig* HWForm::config = NULL;
   821             break;
   822             break;
   822         default:
   823         default:
   823             ui.pageGameStats->restartBtnVisible(false);
   824             ui.pageGameStats->restartBtnVisible(false);
   824             break;
   825             break;
   825         }
   826         }
       
   827         ui.pageGameStats->saveDemoBtnEnabled(demoIsPresent);
   826     }
   828     }
   827 
   829 
   828     if (id == ID_PAGE_MAIN)
   830     if (id == ID_PAGE_MAIN)
   829     {
   831     {
   830         ui.pageOptions->setTeamOptionsEnabled(true);
   832         ui.pageOptions->setTeamOptionsEnabled(true);
  1791     quint8 id = ui.Pages->currentIndex();
  1793     quint8 id = ui.Pages->currentIndex();
  1792     switch(gameState)
  1794     switch(gameState)
  1793     {
  1795     {
  1794         case gsStarted:
  1796         case gsStarted:
  1795         {
  1797         {
       
  1798             demoIsPresent = true;
  1796             Music(false);
  1799             Music(false);
  1797             if (wBackground) wBackground->stopAnimation();
  1800             if (wBackground) wBackground->stopAnimation();
  1798             if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoToPage(ID_PAGE_INGAME);
  1801             if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoToPage(ID_PAGE_INGAME);
  1799             ui.pageGameStats->clear();
  1802             ui.pageGameStats->clear();
  1800             if (pRegisterServer)
  1803             if (pRegisterServer)
  1844             if (gameState == gsHalted) close();
  1847             if (gameState == gsHalted) close();
  1845         };
  1848         };
  1846     }
  1849     }
  1847 }
  1850 }
  1848 
  1851 
       
  1852 void HWForm::DemoPresenceChanged(bool hasDemo)
       
  1853 {
       
  1854     demoIsPresent = hasDemo;
       
  1855 }
       
  1856 
  1849 void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo)
  1857 void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo)
  1850 {
  1858 {
  1851     game = new HWGame(config, gamecfg, ammo, pTeamSelWidget);
  1859     game = new HWGame(config, gamecfg, ammo, pTeamSelWidget);
  1852     connect(game, SIGNAL(CampStateChanged(int)), this, SLOT(UpdateCampaignPageProgress(int)));
  1860     connect(game, SIGNAL(CampStateChanged(int)), this, SLOT(UpdateCampaignPageProgress(int)));
  1853     connect(game, SIGNAL(TrainingStateChanged(int)), this, SLOT(UpdateTrainingPageTeam(int)));
  1861     connect(game, SIGNAL(TrainingStateChanged(int)), this, SLOT(UpdateTrainingPageTeam(int)));
  1854     connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
  1862     connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
       
  1863     connect(game, SIGNAL(DemoPresenceChanged(bool)), this, SLOT(DemoPresenceChanged(bool)));
  1855     connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &)));
  1864     connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &)));
  1856     connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowFatalErrorMessage(const QString &)), Qt::QueuedConnection);
  1865     connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowFatalErrorMessage(const QString &)), Qt::QueuedConnection);
  1857     connect(game, SIGNAL(HaveRecord(RecordType, const QByteArray &)), this, SLOT(GetRecord(RecordType, const QByteArray &)));
  1866     connect(game, SIGNAL(HaveRecord(RecordType, const QByteArray &)), this, SLOT(GetRecord(RecordType, const QByteArray &)));
  1858     m_lastDemo = QByteArray();
  1867     m_lastDemo = QByteArray();
  1859 }
  1868 }