]> ruin.nu Git - hbs.git/blob - bs/ui/infoview.ui.h
1a7d70d4d473669b41ba6d2f24d71c550b490adc
[hbs.git] / bs / ui / infoview.ui.h
1 void InfoView::init()
2 {
3
4 }
5
6 void InfoView::destroy()
7 {
8
9 }
10
11 void InfoView::setRaces( std::vector<QString> races)
12 {
13     for (std::vector<QString>::iterator i = races.begin(); i != races.end(); ++i)
14     {
15         RaceCombo->insertItem((*i));
16     }
17     if ( RaceCombo->count() != 0)
18         NewButton->setEnabled(true);
19 }
20
21 void InfoView::setEta( int eta )
22 {
23     EtaSpin->setValue(eta);
24 }
25
26 void InfoView::setFleetName( QString name )
27 {
28     NameLine->setText(name);
29     m_Name = name;
30     if (m_Name == "Home Planet" && m_Group == "Friendly")
31     {
32         GroupCombo->setEnabled(false);
33         BattleCombo->setEnabled(false);
34         ApplyButton->setEnabled(true);
35         NewButton->setEnabled(false);
36         RemoveButton->setEnabled(false);
37         return;
38     }
39     GroupCombo->setEnabled(true);
40     BattleCombo->setEnabled(true);
41     ApplyButton->setEnabled(true);
42     NewButton->setEnabled(true);
43     RemoveButton->setEnabled(true);
44 }
45
46 void InfoView::setRace( QString name )
47 {
48     RaceCombo->setCurrentText(name);
49 }
50
51 void InfoView::InfoView_destroyed( QObject * )
52 {
53
54 }
55
56 void InfoView::CancelButton_clicked()
57 {
58     emit cancel();
59 }
60
61 void InfoView::NewButton_clicked()
62 {
63     emit add();
64 }
65
66 void InfoView::RemoveButton_clicked()
67 {
68     emit remove();
69 }
70
71 void InfoView::setGroup( QString s )
72 {
73     GroupCombo->setCurrentText(s);
74     m_Group = s;
75 }
76
77 void InfoView::setBattles( std::vector<QString> battles )
78 {
79     BattleCombo->clear();
80     
81     for (std::vector<QString>::iterator i = battles.begin(); i != battles.end(); ++i)
82     {
83         BattleCombo->insertItem(*i);
84     }
85 }
86
87 void InfoView::setBattle( QString s )
88 {
89     BattleCombo->setCurrentText(s);
90     m_Battle = s;
91 }
92
93 void InfoView::enableNameChange( bool b )
94 {
95     NameLine->setReadOnly(!b);
96 }
97
98 void InfoView::enableRemove( bool b )
99 {
100     RemoveButton->setEnabled(b);
101 }
102
103 void InfoView::ApplyButton_clicked()
104 {
105     emit apply();
106 }
107
108 QString InfoView::battle()
109 {
110     return BattleCombo->currentText();
111 }
112
113 int InfoView::eta()
114 {
115     return EtaSpin->value();
116 }
117
118 QString InfoView::fleetName()
119 {
120     return NameLine->text();
121 }
122
123 QString InfoView::group()
124 {
125     return GroupCombo->currentText();
126 }
127
128 QString InfoView::race()
129 {
130     return RaceCombo->currentText();
131 }
132
133 void InfoView::slotNameChanged( const QString & s )
134 {
135     if (s != "Home Planet" && m_Name == "Home Planet" && m_Group == "Friendly")
136     {
137         GroupCombo->setEnabled(true);
138         BattleCombo->setEnabled(true);
139         ApplyButton->setEnabled(false);
140         NewButton->setEnabled(true);
141     }
142     if (s == "Home Planet" && m_Name == "Home Planet" && m_Group == "Friendly")
143     {
144         GroupCombo->setEnabled(false);
145         GroupCombo->setCurrentText(m_Group);
146         BattleCombo->setEnabled(false);
147         BattleCombo->setCurrentText(m_Battle);
148         ApplyButton->setEnabled(true);
149         NewButton->setEnabled(false);
150     }
151 }
152
153
154 int InfoView::stays()
155 {
156     return StaySpin->value();
157 }
158
159 void InfoView::setStays( int ticks )
160 {
161     StaySpin->setValue(ticks);
162 }