QTfrontend/hwform.cpp
branchexperimental3D
changeset 4812 f924be23ffb4
parent 4594 5645462cc78f
child 4746 3ae448aebe7e
child 4831 57b46b5dbfff
equal deleted inserted replaced
4347:0ddb100fea61 4812:f924be23ffb4
    33 #include <QTimer>
    33 #include <QTimer>
    34 #include <QScrollBar>
    34 #include <QScrollBar>
    35 #include <QDataWidgetMapper>
    35 #include <QDataWidgetMapper>
    36 #include <QTableView>
    36 #include <QTableView>
    37 #include <QCryptographicHash>
    37 #include <QCryptographicHash>
       
    38 #include <QSignalMapper>
    38 
    39 
    39 #include "hwform.h"
    40 #include "hwform.h"
    40 #include "game.h"
    41 #include "game.h"
    41 #include "team.h"
    42 #include "team.h"
    42 #include "namegen.h"
    43 #include "namegen.h"
    54 #include "playrecordpage.h"
    55 #include "playrecordpage.h"
    55 #include "input_ip.h"
    56 #include "input_ip.h"
    56 #include "ammoSchemeModel.h"
    57 #include "ammoSchemeModel.h"
    57 #include "bgwidget.h"
    58 #include "bgwidget.h"
    58 #include "xfire.h"
    59 #include "xfire.h"
       
    60 #include "drawmapwidget.h"
    59 
    61 
    60 #ifdef __APPLE__
    62 #ifdef __APPLE__
    61 #include "CocoaInitializer.h"
    63 #include "CocoaInitializer.h"
    62 #include "M3Panel.h"
    64 #include "M3Panel.h"
    63 #ifdef SPARKLE_ENABLED
    65 #ifdef SPARKLE_ENABLED
    75   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    77   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    76 {
    78 {
    77 #ifdef USE_XFIRE
    79 #ifdef USE_XFIRE
    78     xfire_init();
    80     xfire_init();
    79 #endif
    81 #endif
       
    82     game = NULL;
    80     gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
    83     gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
    81     frontendEffects = gameSettings->value("frontend/effects", true).toBool();
    84     frontendEffects = gameSettings->value("frontend/effects", true).toBool();
    82     playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex());
    85     playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex());
    83 
    86 
    84     ui.setupUi(this);
    87     ui.setupUi(this);
    85     setMinimumSize(760, 580);
    88     setMinimumSize(760, 580);
    86     setFocusPolicy(Qt::StrongFocus);
    89     //setFocusPolicy(Qt::StrongFocus);
    87     CustomizePalettes();
    90     CustomizePalettes();
    88 
    91 
    89     ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
    92     ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
    90 
    93 
    91     config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    94     config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
   105 
   108 
   106     UpdateTeamsLists();
   109     UpdateTeamsLists();
   107     UpdateCampaignPage(0);
   110     UpdateCampaignPage(0);
   108     UpdateWeapons();
   111     UpdateWeapons();
   109 
   112 
       
   113     pageSwitchMapper = new QSignalMapper(this);
       
   114     connect(pageSwitchMapper, SIGNAL(mapped(int)), this, SLOT(GoToPage(int)));
       
   115 
   110     connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
   116     connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
   111     onFrontendFullscreen(config->isFrontendFullscreen());
   117     onFrontendFullscreen(config->isFrontendFullscreen());
   112 
   118 
   113     connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer()));
   119     connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   114     connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup()));
   120     pageSwitchMapper->setMapping(ui.pageMain->BtnSinglePlayer, ID_PAGE_SINGLEPLAYER);
   115     connect(ui.pageMain->BtnNet, SIGNAL(clicked()), this, SLOT(GoToNetType()));
   121 
   116     connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), this, SLOT(GoToInfo()));
   122     connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   123     pageSwitchMapper->setMapping(ui.pageMain->BtnSetup, ID_PAGE_SETUP);
       
   124     
       
   125     connect(ui.pageMain->BtnNet, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   126     pageSwitchMapper->setMapping(ui.pageMain->BtnNet, ID_PAGE_NETTYPE);
       
   127     connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   128     pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO);
       
   129 
   117     connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
   130     connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
   118     connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
   131     connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
   119 
   132 
   120     connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave()));
   133     connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave()));
   121     connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard()));
   134     connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard()));
   125 
   138 
   126     connect(ui.pageMultiplayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   139     connect(ui.pageMultiplayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   127     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
   140     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
   128     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
   141     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
   129         ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
   142         ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
   130     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   143     connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   131     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
   144     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   132     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
   145     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
       
   146     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map()));
       
   147     pageSwitchMapper->setMapping(ui.pageMultiplayer->gameCFG, ID_PAGE_DRAWMAP);
       
   148     
   133 
   149 
   134     connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   150     connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   135     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
   151     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
   136     connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo()));
   152     connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo()));
   137 
   153 
   144 #ifndef __APPLE__
   160 #ifndef __APPLE__
   145     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   161     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   146 #endif
   162 #endif
   147 
   163 
   148     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   164     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   149     connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
   165     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
       
   166     connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
       
   167     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
       
   168     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
       
   169     connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
   150     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
   170     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
   151 
   171 
   152     connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   172     connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   153     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
   173     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
   154     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer()));
   174     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   175     pageSwitchMapper->setMapping(ui.pageNet->BtnNetSvrStart, ID_PAGE_NETSERVER);
       
   176 
   155     connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16)));
   177     connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16)));
   156 
   178 
   157     connect(ui.pageNetServer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   179     connect(ui.pageNetServer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   158     connect(ui.pageNetServer->BtnStart, SIGNAL(clicked()), this, SLOT(NetStartServer()));
   180     connect(ui.pageNetServer->BtnStart, SIGNAL(clicked()), this, SLOT(NetStartServer()));
   159 
   181 
   160     connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   182     connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   161     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   183     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   162         ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
   184         ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
   163     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   185     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   164         ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
   186         ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
   165     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   187     connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   166     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
   188     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   167     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
   189     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
       
   190     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map()));
       
   191     pageSwitchMapper->setMapping(ui.pageNetGame->pGameCFG, ID_PAGE_DRAWMAP);
   168 
   192 
   169     connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   193     connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   170     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), this, SLOT(GoToAdmin()));
   194     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   195     pageSwitchMapper->setMapping(ui.pageRoomsList->BtnAdmin, ID_PAGE_ADMIN);
   171 
   196 
   172     connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   197     connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   173 
   198 
   174     connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   199     connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   175 
   200 
   176     connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame()));
   201     connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame()));
   177     connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), this, SLOT(GoToTraining()));
   202     connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   178     connect(ui.pageSinglePlayer->BtnCampaignPage, SIGNAL(clicked()), this, SLOT(GoToCampaign()));
   203     pageSwitchMapper->setMapping(ui.pageSinglePlayer->BtnTrainPage, ID_PAGE_TRAINING);
   179     connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
   204 
       
   205     connect(ui.pageSinglePlayer->BtnCampaignPage, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   206     pageSwitchMapper->setMapping(ui.pageSinglePlayer->BtnCampaignPage, ID_PAGE_CAMPAIGN);
       
   207 
       
   208     connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
       
   209     pageSwitchMapper->setMapping(ui.pageSinglePlayer->BtnMultiplayer, ID_PAGE_MULTIPLAYER);
       
   210 
   180     connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
   211     connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
   181     connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
   212     connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
   182     connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   213     connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   183 
   214 
   184     connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
   215     connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
   192 
   223 
   193     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   224     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   194         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   225         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   195     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   226     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   196         this, SLOT(UpdateWeapons())); // executed second
   227         this, SLOT(UpdateWeapons())); // executed second
   197     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   228     //connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   198         this, SLOT(GoBack())); // executed third
   229     //    this, SLOT(GoBack())); // executed third
   199 
   230 
   200     connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   231     connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   201 
   232 
   202     connect(ui.pageAdmin->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   233     connect(ui.pageAdmin->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   203 
   234 
   204     connect(ui.pageNetType->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   235     connect(ui.pageNetType->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   205     connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet()));
   236     connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet()));
   206     connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
   237     connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
   207 
   238 
       
   239     connect(ui.pageDrawMap->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
       
   240 
   208 
   241 
   209     ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
   242     ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
   210     ui.pageScheme->setModel(ammoSchemeModel);
   243     ui.pageScheme->setModel(ammoSchemeModel);
   211     ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
   244     ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
       
   245     ui.pageOptions->SchemesName->setModel(ammoSchemeModel);
   212 
   246 
   213     wBackground = NULL;
   247     wBackground = NULL;
   214     if (config->isFrontendEffects()) {
   248     if (config->isFrontendEffects()) {
   215        wBackground = new BGWidget(this);
   249        wBackground = new BGWidget(this);
   216        wBackground->setFixedSize(this->width(), this->height());
   250        wBackground->setFixedSize(this->width(), this->height());
   272   else {
   306   else {
   273     setWindowState(windowState() & !Qt::WindowFullScreen);
   307     setWindowState(windowState() & !Qt::WindowFullScreen);
   274   }
   308   }
   275 }
   309 }
   276 
   310 
       
   311 /*
   277 void HWForm::keyReleaseEvent(QKeyEvent *event)
   312 void HWForm::keyReleaseEvent(QKeyEvent *event)
   278 {
   313 {
   279   if (event->key() == Qt::Key_Escape /*|| event->key() == Qt::Key_Backspace*/ )
   314   if (event->key() == Qt::Key_Escape) 
   280     this->GoBack();
   315     this->GoBack();
   281 }
   316 }
       
   317 */
   282 
   318 
   283 void HWForm::CustomizePalettes()
   319 void HWForm::CustomizePalettes()
   284 {
   320 {
   285     QList<QScrollBar *> allSBars = findChildren<QScrollBar *>();
   321     QList<QScrollBar *> allSBars = findChildren<QScrollBar *>();
   286     QPalette pal = palette();
   322     QPalette pal = palette();
   297 {
   333 {
   298     QVector<QComboBox*> combos;
   334     QVector<QComboBox*> combos;
   299     combos.push_back(ui.pageOptions->WeaponsName);
   335     combos.push_back(ui.pageOptions->WeaponsName);
   300     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
   336     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
   301     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
   337     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
       
   338     combos.push_back(ui.pageSelectWeapon->selectWeaponSet);
   302 
   339 
   303     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
   340     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
   304 
   341 
   305     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) {
   342     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) {
   306         (*it)->clear();
   343         (*it)->clear();
   334     ui.pageOptions->CBTeamName->addItems(teamslist);
   371     ui.pageOptions->CBTeamName->addItems(teamslist);
   335     ui.pageCampaign->CBTeam->clear();
   372     ui.pageCampaign->CBTeam->clear();
   336     ui.pageCampaign->CBTeam->addItems(teamslist);
   373     ui.pageCampaign->CBTeam->addItems(teamslist);
   337 }
   374 }
   338 
   375 
   339 void HWForm::GoToMain()
       
   340 {
       
   341     GoToPage(ID_PAGE_MAIN);
       
   342 }
       
   343 
       
   344 void HWForm::GoToSinglePlayer()
       
   345 {
       
   346     GoToPage(ID_PAGE_SINGLEPLAYER);
       
   347 }
       
   348 
       
   349 void HWForm::GoToTraining()
       
   350 {
       
   351     GoToPage(ID_PAGE_TRAINING);
       
   352 }
       
   353 
       
   354 void HWForm::GoToCampaign()
       
   355 {
       
   356     GoToPage(ID_PAGE_CAMPAIGN);
       
   357 }
       
   358 
       
   359 void HWForm::GoToSetup()
       
   360 {
       
   361     GoToPage(ID_PAGE_SETUP);
       
   362 }
       
   363 
       
   364 void HWForm::GoToSelectNewWeapon()
   376 void HWForm::GoToSelectNewWeapon()
   365 {
   377 {
   366     ui.pageSelectWeapon->pWeapons->setWeaponsName(tr("new"));
   378     ui.pageSelectWeapon->pWeapons->newWeaponsName();
   367     GoToPage(ID_PAGE_SELECTWEAPON);
   379     GoToPage(ID_PAGE_SELECTWEAPON);
   368 }
   380 }
   369 
   381 
   370 void HWForm::GoToSelectWeapon()
   382 void HWForm::GoToSelectWeapon()
   371 {
   383 {
   372     ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText());
   384     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
   373     GoToPage(ID_PAGE_SELECTWEAPON);
   385     GoToPage(ID_PAGE_SELECTWEAPON);
   374 }
   386 }
   375 
   387 
   376 void HWForm::GoToSelectWeaponSet(const QString & name)
   388 void HWForm::GoToSelectWeaponSet(int index)
   377 {
   389 {
   378     ui.pageSelectWeapon->pWeapons->setWeaponsName(name);
   390     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(index);
   379     GoToPage(ID_PAGE_SELECTWEAPON);
   391     GoToPage(ID_PAGE_SELECTWEAPON);
   380 }
   392 }
   381 
   393 
   382 void HWForm::GoToInfo()
       
   383 {
       
   384     GoToPage(ID_PAGE_INFO);
       
   385 }
       
   386 
       
   387 void HWForm::GoToMultiplayer()
       
   388 {
       
   389     GoToPage(ID_PAGE_MULTIPLAYER);
       
   390 }
       
   391 
       
   392 void HWForm::GoToSaves()
   394 void HWForm::GoToSaves()
   393 {
   395 {
   394     ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Save);
   396     ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Save);
   395 
   397 
   396     GoToPage(ID_PAGE_DEMOS);
   398     GoToPage(ID_PAGE_DEMOS);
   408     ui.pageNet->updateServersList();
   410     ui.pageNet->updateServersList();
   409 
   411 
   410     GoToPage(ID_PAGE_NET);
   412     GoToPage(ID_PAGE_NET);
   411 }
   413 }
   412 
   414 
   413 void HWForm::GoToNetType()
   415 void HWForm::GoToScheme(int index)
   414 {
   416 {
   415     GoToPage(ID_PAGE_NETTYPE);
   417     ui.pageScheme->selectScheme->setCurrentIndex(index);
   416 }
       
   417 
       
   418 void HWForm::GoToNetServer()
       
   419 {
       
   420     GoToPage(ID_PAGE_NETSERVER);
       
   421 }
       
   422 
       
   423 void HWForm::GoToSchemes()
       
   424 {
       
   425     GoToPage(ID_PAGE_SCHEME);
   418     GoToPage(ID_PAGE_SCHEME);
   426 }
   419 }
   427 
   420 
   428 void HWForm::GoToAdmin()
   421 void HWForm::GoToNewScheme()
   429 {
   422 {
   430     GoToPage(ID_PAGE_ADMIN);
   423     ui.pageScheme->newRow();
       
   424     GoToPage(ID_PAGE_SCHEME);
       
   425 }
       
   426 
       
   427 void HWForm::GoToEditScheme()
       
   428 {
       
   429     ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
       
   430     GoToPage(ID_PAGE_SCHEME);
   431 }
   431 }
   432 
   432 
   433 void HWForm::OnPageShown(quint8 id, quint8 lastid)
   433 void HWForm::OnPageShown(quint8 id, quint8 lastid)
   434 {
   434 {
   435 #ifdef USE_XFIRE
   435 #ifdef USE_XFIRE
   436     updateXfire();
   436     updateXfire();
   437 #endif
   437 #endif
       
   438     if(id == ID_PAGE_DRAWMAP)
       
   439     {
       
   440         DrawMapScene * scene;
       
   441         if(lastid == ID_PAGE_MULTIPLAYER)
       
   442             scene = ui.pageMultiplayer->gameCFG->pMapContainer->getDrawMapScene();
       
   443         else
       
   444             scene = ui.pageNetGame->pGameCFG->pMapContainer->getDrawMapScene();
       
   445 
       
   446         ui.pageDrawMap->drawMapWidget->setScene(scene);
       
   447     }
       
   448     if(lastid == ID_PAGE_DRAWMAP)
       
   449     {
       
   450         if(id == ID_PAGE_MULTIPLAYER)
       
   451             ui.pageMultiplayer->gameCFG->pMapContainer->mapDrawingFinished();
       
   452         else
       
   453             ui.pageNetGame->pGameCFG->pMapContainer->mapDrawingFinished();
       
   454     }
       
   455 
   438     if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
   456     if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
   439         QStringList tmNames = config->GetTeamsList();
   457         QStringList tmNames = config->GetTeamsList();
   440         TeamSelWidget* curTeamSelWidget;
   458         TeamSelWidget* curTeamSelWidget;
   441         ui.pageOptions->BtnNewTeam->setVisible(false);
   459         ui.pageOptions->BtnNewTeam->setVisible(false);
   442         ui.pageOptions->BtnEditTeam->setVisible(false);
   460         ui.pageOptions->BtnEditTeam->setVisible(false);
   455           HWTeam team(*it);
   473           HWTeam team(*it);
   456           team.LoadFromFile();
   474           team.LoadFromFile();
   457           teamsList.push_back(team);
   475           teamsList.push_back(team);
   458         }
   476         }
   459 
   477 
   460         if(lastid == ID_PAGE_SETUP) { // _TEAM
   478         if(lastid == ID_PAGE_SETUP || lastid == ID_PAGE_DRAWMAP) { // _TEAM
   461           if (editedTeam) {
   479           if (editedTeam) {
   462             curTeamSelWidget->addTeam(*editedTeam);
   480             curTeamSelWidget->addTeam(*editedTeam);
   463           }
   481           }
   464         } else if(lastid != ID_PAGE_GAMESTATS
   482         } else if(lastid != ID_PAGE_GAMESTATS
   465                 && lastid != ID_PAGE_INGAME
   483                 && lastid != ID_PAGE_INGAME
   488     else if(lastid == ID_PAGE_ROOMSLIST) // leaving the lobby
   506     else if(lastid == ID_PAGE_ROOMSLIST) // leaving the lobby
   489         ui.pageRoomsList->chatWidget->saveLists(ui.pageOptions->editNetNick->text());
   507         ui.pageRoomsList->chatWidget->saveLists(ui.pageOptions->editNetNick->text());
   490 
   508 
   491     if(id == ID_PAGE_NETGAME) // joining a room
   509     if(id == ID_PAGE_NETGAME) // joining a room
   492         ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text());
   510         ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text());
   493     else if(id == ID_PAGE_ROOMSLIST) // joining the lobby
   511 // joining the lobby 
       
   512     else if(id == ID_PAGE_ROOMSLIST) {
       
   513         if ( hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
       
   514             game->netSuspend = true;
       
   515             game->KillAllTeams();
       
   516         }
   494         ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
   517         ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
   495 }
   518     }
   496 
   519 }
   497 void HWForm::GoToPage(quint8 id)
   520 
   498 {
   521 void HWForm::GoToPage(int id)
   499     quint8 lastid = ui.Pages->currentIndex();
   522 {
       
   523     int lastid = ui.Pages->currentIndex();
   500     PagesStack.push(ui.Pages->currentIndex());
   524     PagesStack.push(ui.Pages->currentIndex());
   501     OnPageShown(id, lastid);
   525     OnPageShown(id, lastid);
   502     ui.Pages->setCurrentIndex(id);
   526     ui.Pages->setCurrentIndex(id);
   503 }
   527 }
   504 
   528 
   505 void HWForm::GoBack()
   529 void HWForm::GoBack()
   506 {
   530 {
   507     quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
   531     int id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
   508     quint8 curid = ui.Pages->currentIndex();
   532     int curid = ui.Pages->currentIndex();
   509     ui.Pages->setCurrentIndex(id);
   533     ui.Pages->setCurrentIndex(id);
   510     OnPageShown(id, curid);
   534     OnPageShown(id, curid);
   511 
   535 
   512     if (id == ID_PAGE_CONNECTING)
   536     if (id == ID_PAGE_CONNECTING)
   513         GoBack();
   537         GoBack();
   519     if ((!hwnet) || (!hwnet->isInRoom()))
   543     if ((!hwnet) || (!hwnet->isInRoom()))
   520         if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME)
   544         if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME)
   521             GoBack();
   545             GoBack();
   522 
   546 
   523     if (curid == ID_PAGE_ROOMSLIST) NetDisconnect();
   547     if (curid == ID_PAGE_ROOMSLIST) NetDisconnect();
       
   548     if (curid == ID_PAGE_NETGAME) hwnet->partRoom();
       
   549     // need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick
       
   550     //if (curid == ID_PAGE_NETGAME && (!game || game->gameState != gsStarted)) hwnet->partRoom();
   524 
   551 
   525     if (curid == ID_PAGE_SCHEME)
   552     if (curid == ID_PAGE_SCHEME)
   526         ammoSchemeModel->Save();
   553         ammoSchemeModel->Save();
   527 }
   554 }
   528 
   555 
   586     GoToPage(ID_PAGE_SETUP_TEAM);
   613     GoToPage(ID_PAGE_SETUP_TEAM);
   587 }
   614 }
   588 
   615 
   589 void HWForm::DeleteTeam()
   616 void HWForm::DeleteTeam()
   590 {
   617 {
   591     editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
   618     QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
   592     editedTeam->DeleteFile();
   619 
   593 
   620     if (reallyDelete.exec() == QMessageBox::Ok) {
   594     // Remove from lists
   621         editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
   595     ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
   622         editedTeam->DeleteFile();
       
   623 
       
   624         // Remove from lists
       
   625         ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
       
   626     }
   596 }
   627 }
   597 
   628 
   598 void HWForm::RandomNames()
   629 void HWForm::RandomNames()
   599 {
   630 {
   600     editedTeam->GetFromPage(this);
   631     editedTeam->GetFromPage(this);
   624     delete editedTeam;
   655     delete editedTeam;
   625     editedTeam=0;
   656     editedTeam=0;
   626     GoBack();
   657     GoBack();
   627 }
   658 }
   628 
   659 
       
   660 void HWForm::DeleteScheme()
       
   661 {
       
   662     ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
       
   663     if (ui.pageOptions->SchemesName->currentIndex() < ammoSchemeModel->numberOfDefaultSchemes) {
       
   664         QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Can not delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
       
   665     } else {
       
   666         ui.pageScheme->deleteRow();
       
   667         ammoSchemeModel->Save();
       
   668     }
       
   669 }
       
   670 
       
   671 void HWForm::DeleteWeaponSet()
       
   672 {
       
   673     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
       
   674     ui.pageSelectWeapon->pWeapons->deleteWeaponsName();
       
   675 }
       
   676 
   629 void HWForm::SimpleGame()
   677 void HWForm::SimpleGame()
   630 {
   678 {
   631     CreateGame(0, 0, *cDefaultAmmoStore);
   679     CreateGame(0, 0, *cDefaultAmmoStore);
   632     game->StartQuick();
   680     game->StartQuick();
   633 }
   681 }
   676     connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
   724     connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
   677     connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected()));
   725     connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected()));
   678     connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   726     connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   679     connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom()));
   727     connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom()));
   680     connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   728     connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   681     connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
   729     //connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
   682 
   730 
   683 // rooms list page stuff
   731 // rooms list page stuff
   684     connect(hwnet, SIGNAL(roomsList(const QStringList&)),
   732     connect(hwnet, SIGNAL(roomsList(const QStringList&)),
   685         ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
   733         ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
   686     connect(hwnet, SIGNAL(adminAccess(bool)),
   734     connect(hwnet, SIGNAL(adminAccess(bool)),
   828     NetConnectServer("localhost", pnetserver->getRunningPort());
   876     NetConnectServer("localhost", pnetserver->getRunningPort());
   829 }
   877 }
   830 
   878 
   831 void HWForm::NetDisconnect()
   879 void HWForm::NetDisconnect()
   832 {
   880 {
   833     //qDebug("NetDisconnect");
       
   834     if(hwnet) {
   881     if(hwnet) {
   835         hwnet->Disconnect();
   882         hwnet->Disconnect();
   836         delete hwnet;
   883         delete hwnet;
   837         hwnet = 0;
   884         hwnet = 0;
   838     }
   885     }
   851 
   898 
   852 void HWForm::ForcedDisconnect()
   899 void HWForm::ForcedDisconnect()
   853 {
   900 {
   854     if(pnetserver) return; // we have server - let it care of all things
   901     if(pnetserver) return; // we have server - let it care of all things
   855     if (hwnet) {
   902     if (hwnet) {
   856         hwnet->deleteLater();
   903         HWNewNet * tmp = hwnet;
   857         hwnet = 0;
   904         hwnet = 0;
       
   905         tmp->deleteLater();
   858         QMessageBox::warning(this, QMessageBox::tr("Network"),
   906         QMessageBox::warning(this, QMessageBox::tr("Network"),
   859                 QMessageBox::tr("Connection to server is lost"));
   907                 QMessageBox::tr("Connection to server is lost"));
   860 
   908 
   861     }
   909     }
   862     if (ui.Pages->currentIndex() != ID_PAGE_NET) GoBack();
   910     if (ui.Pages->currentIndex() != ID_PAGE_NET) GoBack();
   890     game->StartLocal();
   938     game->StartLocal();
   891 }
   939 }
   892 
   940 
   893 void HWForm::GameStateChanged(GameState gameState)
   941 void HWForm::GameStateChanged(GameState gameState)
   894 {
   942 {
       
   943     quint8 id = ui.Pages->currentIndex();
   895     switch(gameState) {
   944     switch(gameState) {
   896         case gsStarted: {
   945         case gsStarted: {
   897             Music(false);
   946             Music(false);
   898             if (wBackground) wBackground->stopAnimation();
   947             if (wBackground) wBackground->stopAnimation();
   899             GoToPage(ID_PAGE_INGAME);
   948             if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoToPage(ID_PAGE_INGAME);
   900             ui.pageGameStats->clear();
   949             ui.pageGameStats->clear();
   901             if (pRegisterServer)
   950             if (pRegisterServer)
   902             {
   951             {
   903                 pRegisterServer->unregister();
   952                 pRegisterServer->unregister();
   904                 pRegisterServer = 0;
   953                 pRegisterServer = 0;
   908             break;
   957             break;
   909         }
   958         }
   910         case gsFinished: {
   959         case gsFinished: {
   911             //setVisible(true);
   960             //setVisible(true);
   912             setFocusPolicy(Qt::StrongFocus);
   961             setFocusPolicy(Qt::StrongFocus);
   913             GoBack();
   962             if (id == ID_PAGE_INGAME) GoBack();
   914             Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
   963             Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
   915             if (wBackground) wBackground->startAnimation();
   964             if (wBackground) wBackground->startAnimation();
   916             GoToPage(ID_PAGE_GAMESTATS);
   965             GoToPage(ID_PAGE_GAMESTATS);
   917             if (hwnet) hwnet->gameFinished();
   966             if (hwnet && (!game || !game->netSuspend)) hwnet->gameFinished();
       
   967             if (game) game->netSuspend = false;
   918             break;
   968             break;
   919         }
   969         }
   920         default: {
   970         default: {
   921             //setVisible(true);
   971             //setVisible(true);
   922             setFocusPolicy(Qt::StrongFocus);
   972             setFocusPolicy(Qt::StrongFocus);
   923             quint8 id = ui.Pages->currentIndex();
   973             quint8 id = ui.Pages->currentIndex();
   924             if (id == ID_PAGE_INGAME) {
   974             if (id == ID_PAGE_INGAME ||
   925                 GoBack();
   975 // was room chief and the game was aborted
       
   976                 (hwnet && hwnet->isRoomChief() && hwnet->isInRoom() && 
       
   977                     (gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed))) {
       
   978                 if (id == ID_PAGE_INGAME) GoBack();
   926                 Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
   979                 Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
   927                 if (wBackground) wBackground->startAnimation();
   980                 if (wBackground) wBackground->startAnimation();
   928                 if (hwnet) hwnet->gameFinished();
   981                 if (hwnet) hwnet->gameFinished();
   929             }
   982             }
   930         };
   983         };
  1087     ui.pageNetGame->pGameCFG->GameSchemes->setCurrentIndex(0);
  1140     ui.pageNetGame->pGameCFG->GameSchemes->setCurrentIndex(0);
  1088 }
  1141 }
  1089 
  1142 
  1090 void HWForm::NetLeftRoom()
  1143 void HWForm::NetLeftRoom()
  1091 {
  1144 {
  1092     if (ui.Pages->currentIndex() == ID_PAGE_NETGAME)
  1145     if (ui.Pages->currentIndex() == ID_PAGE_NETGAME || ui.Pages->currentIndex() == ID_PAGE_INGAME)
  1093         GoBack();
  1146         GoBack();
  1094     else
  1147     else
  1095         qWarning("Left room while not in room");
  1148         qWarning("Left room while not in room");
  1096 }
  1149 }
  1097 
  1150 
  1105     }
  1158     }
  1106 }
  1159 }
  1107 
  1160 
  1108 void HWForm::UpdateCampaignPage(int index)
  1161 void HWForm::UpdateCampaignPage(int index)
  1109 {
  1162 {
       
  1163     Q_UNUSED(index);
       
  1164 
  1110     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1165     HWTeam team(ui.pageCampaign->CBTeam->currentText());
  1111     ui.pageCampaign->CBSelect->clear();
  1166     ui.pageCampaign->CBSelect->clear();
  1112 
  1167 
  1113     QDir tmpdir;
  1168     QDir tmpdir;
  1114     tmpdir.cd(datadir->absolutePath());
  1169     tmpdir.cd(datadir->absolutePath());
  1115     tmpdir.cd("Missions/Campaign");
  1170     tmpdir.cd("Missions/Campaign");
  1116     tmpdir.setFilter(QDir::Files);
  1171     tmpdir.setFilter(QDir::Files);
  1117     QStringList entries = tmpdir.entryList(QStringList("*#*.lua"));
  1172     QStringList entries = tmpdir.entryList(QStringList("*#*.lua"));
  1118     //entries.sort();
  1173     //entries.sort();
  1119     for(int i = 0; (i < entries.count()) && (i <= team.CampaignProgress); i++)
  1174     for(int i = 0; (i < entries.count()) && (i <= team.CampaignProgress); i++)
  1120         ui.pageCampaign->CBSelect->addItem(QString(entries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2"), QString(entries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
  1175         ui.pageCampaign->CBSelect->addItem(QString(entries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(entries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
  1121 }
  1176 }
  1122 
  1177 
  1123 void HWForm::AssociateFiles()
  1178 void HWForm::AssociateFiles()
  1124 {
  1179 {
  1125     bool success = true;
  1180     bool success = true;