QTfrontend/hwform.cpp
changeset 7235 baa69bd025d9
parent 7180 53ffc8853008
child 7280 fd707afbc3a2
equal deleted inserted replaced
7231:f484455dd055 7235:baa69bd025d9
    74 #include "pagedrawmap.h"
    74 #include "pagedrawmap.h"
    75 #include "pagenettype.h"
    75 #include "pagenettype.h"
    76 #include "pagegamestats.h"
    76 #include "pagegamestats.h"
    77 #include "pageplayrecord.h"
    77 #include "pageplayrecord.h"
    78 #include "pagedata.h"
    78 #include "pagedata.h"
       
    79 #include "pagevideos.h"
    79 #include "hwconsts.h"
    80 #include "hwconsts.h"
    80 #include "newnetclient.h"
    81 #include "newnetclient.h"
    81 #include "gamecfgwidget.h"
    82 #include "gamecfgwidget.h"
    82 #include "netserverslist.h"
    83 #include "netserverslist.h"
    83 #include "netudpserver.h"
    84 #include "netudpserver.h"
   139 
   140 
   140     ui.pageOptions->CBResolution->addItems(SDLInteraction::instance().getResolutions());
   141     ui.pageOptions->CBResolution->addItems(SDLInteraction::instance().getResolutions());
   141 
   142 
   142     config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
   143     config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
   143 
   144 
       
   145     ui.pageVideos->config = config;
       
   146 
   144 #ifdef __APPLE__
   147 #ifdef __APPLE__
   145     panel = new M3Panel;
   148     panel = new M3Panel;
   146 
   149 
   147 #ifdef SPARKLE_ENABLED
   150 #ifdef SPARKLE_ENABLED
   148     AutoUpdater* updater;
   151     AutoUpdater* updater;
   197     pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
   200     pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
   198 
   201 
   199     connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map()));
   202     connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map()));
   200     pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD);
   203     pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD);
   201 
   204 
       
   205     connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   206     pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS);
       
   207 
   202     //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
   208     //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
   203     //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
   209     //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
   204 
   210 
   205     connect(ui.pageFeedback->BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback()));
   211     connect(ui.pageFeedback->BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback()));
   206 
   212 
   287     connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet()));
   293     connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet()));
   288     connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
   294     connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
   289 
   295 
   290     connect(ui.pageConnecting, SIGNAL(cancelConnection()), this, SLOT(GoBack()));
   296     connect(ui.pageConnecting, SIGNAL(cancelConnection()), this, SLOT(GoBack()));
   291 
   297 
       
   298     connect(ui.pageVideos, SIGNAL(goBack()), config, SLOT(SaveVideosOptions()));
   292 
   299 
   293     ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
   300     ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
   294     ui.pageScheme->setModel(ammoSchemeModel);
   301     ui.pageScheme->setModel(ammoSchemeModel);
   295     ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
   302     ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
   296     ui.pageOptions->SchemesName->setModel(ammoSchemeModel);
   303     ui.pageOptions->SchemesName->setModel(ammoSchemeModel);
   602     if (id == ID_PAGE_SETUP)
   609     if (id == ID_PAGE_SETUP)
   603     {
   610     {
   604         config->reloadValues();
   611         config->reloadValues();
   605     }
   612     }
   606 
   613 
       
   614     if (id == ID_PAGE_VIDEOS )
       
   615     {
       
   616         config->reloadVideosValues();
       
   617     }
       
   618 
   607     // load and save ignore/friends lists
   619     // load and save ignore/friends lists
   608     if (lastid == ID_PAGE_NETGAME) // leaving a room
   620     if (lastid == ID_PAGE_NETGAME) // leaving a room
   609         ui.pageNetGame->pChatWidget->saveLists(ui.pageOptions->editNetNick->text());
   621         ui.pageNetGame->pChatWidget->saveLists(ui.pageOptions->editNetNick->text());
   610     else if(lastid == ID_PAGE_ROOMSLIST) // leaving the lobby
   622     else if(lastid == ID_PAGE_ROOMSLIST) // leaving the lobby
   611         ui.pageRoomsList->chatWidget->saveLists(ui.pageOptions->editNetNick->text());
   623         ui.pageRoomsList->chatWidget->saveLists(ui.pageOptions->editNetNick->text());
  1407             demofile.write(demo);
  1419             demofile.write(demo);
  1408             demofile.close();
  1420             demofile.close();
  1409         }
  1421         }
  1410     }
  1422     }
  1411 
  1423 
  1412     QDir videosDir(cfgdir->absolutePath() + "/Videos/");
  1424     // encode videos
       
  1425     QDir videosDir(cfgdir->absolutePath() + "/VideoTemp/");
  1413     QStringList files = videosDir.entryList(QStringList("*.txtout"), QDir::Files);
  1426     QStringList files = videosDir.entryList(QStringList("*.txtout"), QDir::Files);
  1414     for (QStringList::iterator str = files.begin(); str != files.end(); str++)
  1427     foreach (const QString & str, files)
  1415     {
  1428     {
  1416         str->chop(7); // remove ".txtout"
  1429         QString prefix = str;
  1417         // need to rename this file to not open it twice
  1430         prefix.chop(7); // remove ".txtout"
  1418         videosDir.rename(*str + ".txtout", *str + ".txtin");
  1431         videosDir.rename(prefix + ".txtout", prefix + ".txtin"); // rename this file to not open it twice
  1419         HWRecorder* pRecorder = new HWRecorder(config);
  1432         HWRecorder* pRecorder = new HWRecorder(config);
  1420         pRecorder->EncodeVideo(record, *str);
  1433         pRecorder->EncodeVideo(record, prefix);
  1421     }
  1434     }
  1422 }
  1435 }
  1423 
  1436 
  1424 void HWForm::startTraining(const QString & scriptName)
  1437 void HWForm::startTraining(const QString & scriptName)
  1425 {
  1438 {
  1457 {
  1470 {
  1458 #ifdef USE_XFIRE
  1471 #ifdef USE_XFIRE
  1459     xfire_free();
  1472     xfire_free();
  1460 #endif
  1473 #endif
  1461     config->SaveOptions();
  1474     config->SaveOptions();
       
  1475     config->SaveVideosOptions();
  1462     event->accept();
  1476     event->accept();
  1463 }
  1477 }
  1464 
  1478 
  1465 void HWForm::Music(bool checked)
  1479 void HWForm::Music(bool checked)
  1466 {
  1480 {