QTfrontend/team.cpp
changeset 87 ff213e443336
parent 86 664b536a1c27
child 88 6740a1c4edc9
equal deleted inserted replaced
86:664b536a1c27 87:ff213e443336
    35 #include <QTextStream>
    35 #include <QTextStream>
    36 #include "team.h"
    36 #include "team.h"
    37 #include "hwform.h"
    37 #include "hwform.h"
    38 #include "gameuiconfig.h"
    38 #include "gameuiconfig.h"
    39 #include "predefteams.h"
    39 #include "predefteams.h"
       
    40 #include "pages.h"
    40 
    41 
    41 HWTeam::HWTeam(const QString & teamname, GameUIConfig * config)
    42 HWTeam::HWTeam(const QString & teamname, GameUIConfig * config)
    42 {
    43 {
    43 	this->config = config;
    44 	this->config = config;
    44 	TeamName = teamname;
    45 	TeamName = teamname;
    54 
    55 
    55 HWTeam::HWTeam(quint8 num, GameUIConfig * config)
    56 HWTeam::HWTeam(quint8 num, GameUIConfig * config)
    56 {
    57 {
    57 	this->config = config;
    58 	this->config = config;
    58 	num %= PREDEFTEAMS_COUNT;
    59 	num %= PREDEFTEAMS_COUNT;
    59 	TeamName = pteams[num].TeamName;
    60 	TeamName = QObject::tr(pteams[num].TeamName);
    60 	HHName[0] = pteams[num].hh0name;
    61 	HHName[0] = QObject::tr(pteams[num].hh0name);
    61 	HHName[1] = pteams[num].hh1name;
    62 	HHName[1] = QObject::tr(pteams[num].hh1name);
    62 	HHName[2] = pteams[num].hh2name;
    63 	HHName[2] = QObject::tr(pteams[num].hh2name);
    63 	HHName[3] = pteams[num].hh3name;
    64 	HHName[3] = QObject::tr(pteams[num].hh3name);
    64 	HHName[4] = pteams[num].hh4name;
    65 	HHName[4] = QObject::tr(pteams[num].hh4name);
    65 	HHName[5] = pteams[num].hh5name;
    66 	HHName[5] = QObject::tr(pteams[num].hh5name);
    66 	HHName[6] = pteams[num].hh6name;
    67 	HHName[6] = QObject::tr(pteams[num].hh6name);
    67 	HHName[7] = pteams[num].hh7name;
    68 	HHName[7] = QObject::tr(pteams[num].hh7name);
    68 	Grave = pteams[num].Grave;
    69 	Grave = pteams[num].Grave;
    69 	Fort = pteams[num].Fort;
    70 	Fort = pteams[num].Fort;
       
    71 	for(int i = 0; i < BINDS_NUMBER; i++)
       
    72 	{
       
    73 		binds[i].action = cbinds[i].action;
       
    74 		binds[i].strbind = cbinds[i].strbind;
       
    75 	}
    70 }
    76 }
    71 
    77 
    72 
    78 
    73 bool HWTeam::LoadFromFile()
    79 bool HWTeam::LoadFromFile()
    74 {
    80 {
   144 	return true;
   150 	return true;
   145 }
   151 }
   146 
   152 
   147 void HWTeam::SetToPage(HWForm * hwform)
   153 void HWTeam::SetToPage(HWForm * hwform)
   148 {
   154 {
   149 	hwform->TeamNameEdit->setText(TeamName);
   155 	hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName);
   150 	for(int i = 0; i < 8; i++)
   156 	for(int i = 0; i < 8; i++)
   151 	{
   157 	{
   152 		hwform->HHNameEdit[i]->setText(HHName[i]);
   158 		hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]);
   153 	}
   159 	}
   154 	hwform->ui.CBGrave->setCurrentIndex(hwform->ui.CBGrave->findText(Grave));
   160 	hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
   155 	hwform->CBGrave_activated(Grave);
   161 	hwform->ui.pageEditTeam->CBGrave_activated(Grave);
   156 
   162 
   157 	hwform->ui.CBFort->setCurrentIndex(hwform->ui.CBFort->findText(Fort));
   163 	hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort));
   158 	hwform->CBFort_activated(Fort);
   164 	hwform->ui.pageEditTeam->CBFort_activated(Fort);
   159 
   165 
   160 	for(int i = 0; i < BINDS_NUMBER; i++)
   166 	for(int i = 0; i < BINDS_NUMBER; i++)
   161 	{
   167 	{
   162 		hwform->CBBind[i]->setCurrentIndex(hwform->CBBind[i]->findText(binds[i].strbind));
   168 		hwform->ui.pageEditTeam->CBBind[i]->setCurrentIndex(hwform->ui.pageEditTeam->CBBind[i]->findText(binds[i].strbind));
   163 	}
   169 	}
   164 }
   170 }
   165 
   171 
   166 void HWTeam::GetFromPage(HWForm * hwform)
   172 void HWTeam::GetFromPage(HWForm * hwform)
   167 {
   173 {
   168 	TeamName  = hwform->TeamNameEdit->text();
   174 	TeamName  = hwform->ui.pageEditTeam->TeamNameEdit->text();
   169 	for(int i = 0; i < 8; i++)
   175 	for(int i = 0; i < 8; i++)
   170 	{
   176 	{
   171 		HHName[i] = hwform->HHNameEdit[i]->text();
   177 		HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text();
   172 	}
   178 	}
   173 
   179 
   174 	Grave = hwform->ui.CBGrave->currentText();
   180 	Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
   175 	Fort = hwform->ui.CBFort->currentText();
   181 	Fort = hwform->ui.pageEditTeam->CBFort->currentText();
   176 	for(int i = 0; i < 8; i++)
   182 	for(int i = 0; i < 8; i++)
   177 	{
   183 	{
   178 		binds[i].strbind = hwform->CBBind[i]->currentText();
   184 		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
   179 	}
   185 	}
   180 }
   186 }
   181 
   187 
   182 QByteArray HWTeam::IPCTeamInfo() const
   188 QByteArray HWTeam::IPCTeamInfo() const
   183 {
   189 {