198 pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD); |
202 pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD); |
199 |
203 |
200 connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map())); |
204 connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map())); |
201 pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD); |
205 pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD); |
202 |
206 |
|
207 #ifdef VIDEOREC |
|
208 connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
|
209 pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS); |
|
210 #endif |
|
211 |
203 //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); |
212 //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); |
204 //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); |
213 //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); |
205 |
214 |
206 connect(ui.pageFeedback->BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback())); |
215 connect(ui.pageFeedback->BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback())); |
207 |
216 |
208 connect(ui.pageEditTeam, SIGNAL(teamEdited()), this, SLOT(AfterTeamEdit())); |
217 connect(ui.pageEditTeam, SIGNAL(goBack()), this, SLOT(AfterTeamEdit())); |
209 |
218 |
210 connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); |
219 connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); |
211 connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), |
220 connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), |
212 ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool))); |
221 ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool))); |
213 connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup())); |
222 connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup())); |
289 connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet())); |
298 connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet())); |
290 connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer())); |
299 connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer())); |
291 |
300 |
292 connect(ui.pageConnecting, SIGNAL(cancelConnection()), this, SLOT(GoBack())); |
301 connect(ui.pageConnecting, SIGNAL(cancelConnection()), this, SLOT(GoBack())); |
293 |
302 |
|
303 connect(ui.pageVideos, SIGNAL(goBack()), config, SLOT(SaveVideosOptions())); |
294 |
304 |
295 ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini"); |
305 ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini"); |
296 ui.pageScheme->setModel(ammoSchemeModel); |
306 ui.pageScheme->setModel(ammoSchemeModel); |
297 ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel); |
307 ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel); |
298 ui.pageOptions->SchemesName->setModel(ammoSchemeModel); |
308 ui.pageOptions->SchemesName->setModel(ammoSchemeModel); |
1359 game = new HWGame(config, gamecfg, ammo, pTeamSelWidget); |
1381 game = new HWGame(config, gamecfg, ammo, pTeamSelWidget); |
1360 connect(game, SIGNAL(CampStateChanged(int)), this, SLOT(UpdateCampaignPageProgress(int))); |
1382 connect(game, SIGNAL(CampStateChanged(int)), this, SLOT(UpdateCampaignPageProgress(int))); |
1361 connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState))); |
1383 connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState))); |
1362 connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &))); |
1384 connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &))); |
1363 connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection); |
1385 connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection); |
1364 connect(game, SIGNAL(HaveRecord(bool, const QByteArray &)), this, SLOT(GetRecord(bool, const QByteArray &))); |
1386 connect(game, SIGNAL(HaveRecord(RecordType, const QByteArray &)), this, SLOT(GetRecord(RecordType, const QByteArray &))); |
1365 m_lastDemo = QByteArray(); |
1387 m_lastDemo = QByteArray(); |
1366 } |
1388 } |
1367 |
1389 |
1368 void HWForm::ShowErrorMessage(const QString & msg) |
1390 void HWForm::ShowErrorMessage(const QString & msg) |
1369 { |
1391 { |
1370 QMessageBox::warning(this, |
1392 QMessageBox::warning(this, |
1371 "Hedgewars", |
1393 "Hedgewars", |
1372 msg); |
1394 msg); |
1373 } |
1395 } |
1374 |
1396 |
1375 void HWForm::GetRecord(bool isDemo, const QByteArray & record) |
1397 void HWForm::GetRecord(RecordType type, const QByteArray & record) |
1376 { |
1398 { |
1377 QString filename; |
1399 if (type != rtNeither) |
1378 QByteArray demo = record; |
1400 { |
1379 QString recordFileName = |
1401 QString filename; |
1380 config->appendDateTimeToRecordName() ? |
1402 QByteArray demo = record; |
1381 QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm") : |
1403 QString recordFileName = |
1382 "LastRound"; |
1404 config->appendDateTimeToRecordName() ? |
1383 |
1405 QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm") : |
1384 QStringList versionParts = cVersionString->split('-'); |
1406 "LastRound"; |
1385 if ( (versionParts.size() == 2) && (!versionParts[1].isEmpty()) && (versionParts[1].contains(':')) ) |
1407 |
1386 recordFileName = recordFileName + "_" + versionParts[1].replace(':','-'); |
1408 QStringList versionParts = cVersionString->split('-'); |
1387 |
1409 if ( (versionParts.size() == 2) && (!versionParts[1].isEmpty()) && (versionParts[1].contains(':')) ) |
1388 if (isDemo) |
1410 recordFileName = recordFileName + "_" + versionParts[1].replace(':','-'); |
1389 { |
1411 |
1390 demo.replace(QByteArray("\x02TL"), QByteArray("\x02TD")); |
1412 if (type == rtDemo) |
1391 demo.replace(QByteArray("\x02TN"), QByteArray("\x02TD")); |
1413 { |
1392 demo.replace(QByteArray("\x02TS"), QByteArray("\x02TD")); |
1414 demo.replace(QByteArray("\x02TL"), QByteArray("\x02TD")); |
1393 filename = cfgdir->absolutePath() + "/Demos/" + recordFileName + "." + *cProtoVer + ".hwd"; |
1415 demo.replace(QByteArray("\x02TN"), QByteArray("\x02TD")); |
1394 m_lastDemo = demo; |
1416 demo.replace(QByteArray("\x02TS"), QByteArray("\x02TD")); |
1395 } |
1417 filename = cfgdir->absolutePath() + "/Demos/" + recordFileName + "." + *cProtoVer + ".hwd"; |
1396 else |
1418 m_lastDemo = demo; |
1397 { |
1419 } |
1398 demo.replace(QByteArray("\x02TL"), QByteArray("\x02TS")); |
1420 else |
1399 demo.replace(QByteArray("\x02TN"), QByteArray("\x02TS")); |
1421 { |
1400 filename = cfgdir->absolutePath() + "/Saves/" + recordFileName + "." + *cProtoVer + ".hws"; |
1422 demo.replace(QByteArray("\x02TL"), QByteArray("\x02TS")); |
1401 } |
1423 demo.replace(QByteArray("\x02TN"), QByteArray("\x02TS")); |
1402 |
1424 filename = cfgdir->absolutePath() + "/Saves/" + recordFileName + "." + *cProtoVer + ".hws"; |
1403 |
1425 } |
1404 QFile demofile(filename); |
1426 |
1405 if (!demofile.open(QIODevice::WriteOnly)) |
1427 QFile demofile(filename); |
1406 { |
1428 if (!demofile.open(QIODevice::WriteOnly)) |
1407 ShowErrorMessage(tr("Cannot save record to file %1").arg(filename)); |
1429 ShowErrorMessage(tr("Cannot save record to file %1").arg(filename)); |
1408 return ; |
1430 else |
1409 } |
1431 { |
1410 demofile.write(demo); |
1432 demofile.write(demo); |
1411 demofile.close(); |
1433 demofile.close(); |
|
1434 } |
|
1435 } |
|
1436 |
|
1437 ui.pageVideos->startEncoding(record); |
1412 } |
1438 } |
1413 |
1439 |
1414 void HWForm::startTraining(const QString & scriptName) |
1440 void HWForm::startTraining(const QString & scriptName) |
1415 { |
1441 { |
1416 CreateGame(0, 0, 0); |
1442 CreateGame(0, 0, 0); |