62 GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
62 GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
63 QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
63 QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
64 |
64 |
65 HatModel * hatModel = DataManager::instance().hatModel(); |
65 HatModel * hatModel = DataManager::instance().hatModel(); |
66 |
66 |
|
67 GBHLayout->addWidget(new QLabel(tr("Hat")), 0, 0); |
|
68 GBHLayout->addWidget(new QLabel(tr("Name")), 0, 1); |
|
69 |
67 for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
70 for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
68 { |
71 { |
69 HHHats[i] = new QComboBox(GBoxHedgehogs); |
72 HHHats[i] = new HatButton(GBoxHedgehogs); |
70 HHHats[i]->setModel(hatModel); |
73 GBHLayout->addWidget(HHHats[i], i + 1, 0); |
71 HHHats[i]->setIconSize(QSize(32, 37)); |
|
72 //HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
|
73 //HHHats[i]->setModelColumn(1); |
|
74 //HHHats[i]->setMinimumWidth(132); |
|
75 GBHLayout->addWidget(HHHats[i], i, 0); |
|
76 |
74 |
77 HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
75 HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
78 HHNameEdit[i]->setMaxLength(64); |
76 HHNameEdit[i]->setMaxLength(64); |
79 HHNameEdit[i]->setMinimumWidth(120); |
77 HHNameEdit[i]->setMinimumWidth(120); |
80 GBHLayout->addWidget(HHNameEdit[i], i, 1); |
78 HHNameEdit[i]->setFixedHeight(36); |
81 |
79 HHNameEdit[i]->setWhatsThis(tr("This hedgehog's name")); |
82 btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i, 3, 1, 1, true); |
80 HHNameEdit[i]->setStyleSheet("padding: 6px;"); |
83 } |
81 GBHLayout->addWidget(HHNameEdit[i], i + 1, 1); |
84 |
82 |
85 btnRandomTeam = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, 0); |
83 btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i + 1, 3, 1, 1, true); |
|
84 btnRandomHogName[i]->setFixedHeight(HHNameEdit[i]->height()); |
|
85 btnRandomHogName[i]->setWhatsThis(tr("Randomize this hedgehog's name")); |
|
86 } |
|
87 |
|
88 btnRandomTeam = new QPushButton(); |
|
89 btnRandomTeam->setText(tr("Random Team")); |
|
90 btnRandomTeam->setStyleSheet("padding: 6px 10px;"); |
|
91 GBHLayout->addWidget(btnRandomTeam, 9, 0, 1, 4, Qt::AlignCenter); |
|
92 btnRandomTeam->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
86 |
93 |
87 vbox1->addWidget(GBoxHedgehogs); |
94 vbox1->addWidget(GBoxHedgehogs); |
88 |
95 |
89 GBoxTeam = new QGroupBox(this); |
96 GBoxTeam = new QGroupBox(this); |
90 GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); |
97 GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); |
375 HHNameEdit[i]->setText(hh.Name); |
382 HHNameEdit[i]->setText(hh.Name); |
376 |
383 |
377 if (hh.Hat.startsWith("Reserved")) |
384 if (hh.Hat.startsWith("Reserved")) |
378 hh.Hat = "Reserved "+hh.Hat.remove(0,40); |
385 hh.Hat = "Reserved "+hh.Hat.remove(0,40); |
379 |
386 |
380 HHHats[i]->setCurrentIndex(HHHats[i]->findData(hh.Hat, Qt::DisplayRole)); |
387 HHHats[i]->setCurrentHat(hh.Hat); |
381 } |
388 } |
382 |
389 |
383 CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); |
390 CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); |
384 CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); |
391 CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); |
385 |
392 |
407 |
414 |
408 for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
415 for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
409 { |
416 { |
410 HWHog hh; |
417 HWHog hh; |
411 hh.Name = HHNameEdit[i]->text(); |
418 hh.Name = HHNameEdit[i]->text(); |
412 hh.Hat = HHHats[i]->currentText(); |
419 hh.Hat = HHHats[i]->currentHat(); |
413 |
420 |
414 if (hh.Hat.startsWith("Reserved")) |
421 if (hh.Hat.startsWith("Reserved")) |
415 hh.Hat = "Reserved"+m_playerHash+hh.Hat.remove(0,9); |
422 hh.Hat = "Reserved"+m_playerHash+hh.Hat.remove(0,9); |
416 |
423 |
417 team.setHedgehog(i,hh); |
424 team.setHedgehog(i,hh); |