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