62 GBoxHedgehogs = new QGroupBox(this); |
62 GBoxHedgehogs = new QGroupBox(this); |
63 GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
63 GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
64 GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
64 GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
65 QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
65 QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
66 |
66 |
67 signalMapper = new QSignalMapper(this); |
67 signalMapper1 = new QSignalMapper(this); |
|
68 signalMapper2 = new QSignalMapper(this); |
|
69 |
|
70 connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int))); |
68 |
71 |
69 HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
72 HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
70 for(int i = 0; i < 8; i++) |
73 for(int i = 0; i < 8; i++) |
71 { |
74 { |
72 HHHats[i] = new QComboBox(GBoxHedgehogs); |
75 HHHats[i] = new QComboBox(GBoxHedgehogs); |
80 HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
83 HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
81 HHNameEdit[i]->setMaxLength(64); |
84 HHNameEdit[i]->setMaxLength(64); |
82 HHNameEdit[i]->setMinimumWidth(120); |
85 HHNameEdit[i]->setMinimumWidth(120); |
83 GBHLayout->addWidget(HHNameEdit[i], i, 1); |
86 GBHLayout->addWidget(HHNameEdit[i], i, 1); |
84 |
87 |
|
88 connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map())); |
|
89 signalMapper1->setMapping(HHNameEdit[i], i); |
|
90 |
85 randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); |
91 randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); |
86 |
92 |
87 connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map())); |
93 connect(randButton[i], SIGNAL(clicked()), signalMapper2, SLOT(map())); |
88 signalMapper->setMapping(randButton[i], i); |
94 signalMapper2->setMapping(randButton[i], i); |
89 |
|
90 } |
95 } |
91 |
96 |
92 randTeamButton = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, false); |
97 randTeamButton = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, false); |
93 |
98 |
94 vbox1->addWidget(GBoxHedgehogs); |
99 vbox1->addWidget(GBoxHedgehogs); |
340 CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]); |
345 CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]); |
341 pagelayout->addWidget(CBBind[i++], num++, 1); |
346 pagelayout->addWidget(CBBind[i++], num++, 1); |
342 } |
347 } |
343 } |
348 } |
344 |
349 |
|
350 void PageEditTeam::fixHHname(int idx) |
|
351 { |
|
352 HHNameEdit[idx]->setText(HHNameEdit[idx]->text().trimmed()); |
|
353 |
|
354 if (HHNameEdit[idx]->text().isEmpty()) |
|
355 HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1)); |
|
356 } |
|
357 |
345 void PageEditTeam::CBFort_activated(const QString & fortname) |
358 void PageEditTeam::CBFort_activated(const QString & fortname) |
346 { |
359 { |
347 QFile tmp; |
360 QFile tmp; |
348 tmp.setFileName(cfgdir->absolutePath() + "/Data/Forts/" + fortname + "L.png"); |
361 tmp.setFileName(cfgdir->absolutePath() + "/Data/Forts/" + fortname + "L.png"); |
349 if (!tmp.exists()) tmp.setFileName(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
362 if (!tmp.exists()) tmp.setFileName(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |