author | sheepluva |
Thu, 06 May 2010 01:43:56 +0000 | |
changeset 3429 | 1f12646331d4 |
parent 2596 | 41b46f83d088 |
permissions | -rw-r--r-- |
2589 | 1 |
#include "teamedit.h" |
2 |
#include "ui_teamedit.h" |
|
3 |
||
4 |
TeamEdit::TeamEdit(QWidget *parent) : |
|
5 |
QWidget(parent), |
|
6 |
m_ui(new Ui::TeamEdit) |
|
7 |
{ |
|
8 |
m_ui->setupUi(this); |
|
2596
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
9 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
10 |
reset(); |
2589 | 11 |
} |
12 |
||
13 |
TeamEdit::~TeamEdit() |
|
14 |
{ |
|
15 |
delete m_ui; |
|
16 |
} |
|
17 |
||
18 |
void TeamEdit::changeEvent(QEvent *e) |
|
19 |
{ |
|
20 |
QWidget::changeEvent(e); |
|
21 |
switch (e->type()) { |
|
22 |
case QEvent::LanguageChange: |
|
23 |
m_ui->retranslateUi(this); |
|
24 |
break; |
|
25 |
default: |
|
26 |
break; |
|
27 |
} |
|
28 |
} |
|
2594 | 29 |
|
2596
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
30 |
void TeamEdit::reset() |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
31 |
{ |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
32 |
QLayout * l = m_ui->scrollArea->widget()->layout(); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
33 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
34 |
for(int i = 0; i < 8; ++i) |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
35 |
l->itemAt(i)->widget()->setVisible(false); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
36 |
} |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
37 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
38 |
void TeamEdit::setTeam(const QString & teamName, quint32 color) |
2594 | 39 |
{ |
40 |
m_ui->leTeamName->setText(teamName); |
|
41 |
} |
|
42 |
||
43 |
void TeamEdit::setFort(const QString & name) |
|
44 |
{ |
|
45 |
m_ui->leFort->setText(name); |
|
46 |
} |
|
47 |
||
48 |
void TeamEdit::setGrave(const QString & name) |
|
49 |
{ |
|
50 |
m_ui->leGrave->setText(name); |
|
51 |
} |
|
52 |
||
53 |
void TeamEdit::setVoicepack(const QString & name) |
|
54 |
{ |
|
55 |
m_ui->leVoicepack->setText(name); |
|
56 |
} |
|
57 |
||
2596
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
58 |
void TeamEdit::addHedgehog(quint32 level, quint32 health, const QString & name) |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
59 |
{ |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
60 |
QLayout * l = m_ui->scrollArea->widget()->layout(); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
61 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
62 |
int i = 0; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
63 |
while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
64 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
65 |
if(i < 8) |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
66 |
{ |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
67 |
HedgehogEdit * he = qobject_cast<HedgehogEdit *>(l->itemAt(i)->widget()); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
68 |
he->setHedgehog(level, health, name); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
69 |
l->itemAt(i)->widget()->setVisible(true); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
70 |
} |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
71 |
} |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
72 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
73 |
void TeamEdit::setLastHHHat(const QString & name) |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
74 |
{ |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
75 |
QLayout * l = m_ui->scrollArea->widget()->layout(); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
76 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
77 |
int i = 0; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
78 |
while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
79 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
80 |
--i; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
81 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
82 |
HedgehogEdit * he = qobject_cast<HedgehogEdit *>(l->itemAt(i)->widget()); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
83 |
he->setHat(name); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
84 |
} |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
85 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
86 |
void TeamEdit::setLastHHCoords(int x, int y) |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
87 |
{ |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
88 |
QLayout * l = m_ui->scrollArea->widget()->layout(); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
89 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
90 |
int i = 0; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
91 |
while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
92 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
93 |
--i; |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
94 |
|
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
95 |
HedgehogEdit * he = qobject_cast<HedgehogEdit *>(l->itemAt(i)->widget()); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
96 |
he->setCoordinates(x ,y); |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
97 |
} |
41b46f83d088
Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
2594
diff
changeset
|
98 |