64 |
64 |
65 PageMain::PageMain(QWidget* parent) : |
65 PageMain::PageMain(QWidget* parent) : |
66 AbstractPage(parent) |
66 AbstractPage(parent) |
67 { |
67 { |
68 if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true); |
68 if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true); |
69 QGridLayout * pageLayout = new QGridLayout(this); |
69 QGridLayout * pageLayout = new QGridLayout(this); |
70 //pageLayout->setColumnStretch(0, 1); |
70 //pageLayout->setColumnStretch(0, 1); |
71 //pageLayout->setColumnStretch(1, 2); |
71 //pageLayout->setColumnStretch(1, 2); |
72 //pageLayout->setColumnStretch(2, 1); |
72 //pageLayout->setColumnStretch(2, 1); |
73 |
73 |
74 //QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
74 //QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
75 //pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
75 //pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
76 pageLayout->setRowStretch(0, 1); |
76 pageLayout->setRowStretch(0, 1); |
77 pageLayout->setRowStretch(1, 1); |
77 pageLayout->setRowStretch(1, 1); |
78 pageLayout->setRowStretch(2, 0); |
78 pageLayout->setRowStretch(2, 0); |
79 pageLayout->setRowStretch(3, 1); |
79 pageLayout->setRowStretch(3, 1); |
80 pageLayout->setRowStretch(4, 1); |
80 pageLayout->setRowStretch(4, 1); |
81 |
81 |
82 BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
82 BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
83 BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
83 BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
84 pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
84 pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
85 |
85 |
86 BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
86 BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
87 BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); |
87 BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); |
88 pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
88 pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
89 |
89 |
90 BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
90 BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
91 |
91 |
92 //BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
92 //BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
93 BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
93 BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
94 BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
94 BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
95 pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
95 pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
96 //pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
96 //pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
97 |
97 |
98 BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
98 BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
99 } |
99 } |
100 |
100 |
101 PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction * sdli) : |
101 PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction * sdli) : |
102 AbstractPage(parent) |
102 AbstractPage(parent) |
103 { |
103 { |
104 mySdli = sdli; |
104 mySdli = sdli; |
105 QGridLayout * pageLayout = new QGridLayout(this); |
105 QGridLayout * pageLayout = new QGridLayout(this); |
106 QTabWidget * tbw = new QTabWidget(this); |
106 QTabWidget * tbw = new QTabWidget(this); |
107 QWidget * page1 = new QWidget(this); |
107 QWidget * page1 = new QWidget(this); |
108 QWidget * page2 = new QWidget(this); |
108 QWidget * page2 = new QWidget(this); |
109 tbw->addTab(page1, tr("General")); |
109 tbw->addTab(page1, tr("General")); |
110 tbw->addTab(page2, tr("Advanced")); |
110 tbw->addTab(page2, tr("Advanced")); |
111 pageLayout->addWidget(tbw, 0, 0, 1, 3); |
111 pageLayout->addWidget(tbw, 0, 0, 1, 3); |
112 BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
112 BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
113 BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
113 BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
114 BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
114 BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
115 |
115 |
116 QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
116 QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
117 page1Layout->setAlignment(Qt::AlignTop); |
117 page1Layout->setAlignment(Qt::AlignTop); |
118 QGridLayout * page2Layout = new QGridLayout(page2); |
118 QGridLayout * page2Layout = new QGridLayout(page2); |
119 |
119 |
120 // ====== Page 1 ====== |
120 // ====== Page 1 ====== |
121 QVBoxLayout * vbox1 = new QVBoxLayout(); |
121 QVBoxLayout * vbox1 = new QVBoxLayout(); |
122 QVBoxLayout * vbox2 = new QVBoxLayout(); |
122 QVBoxLayout * vbox2 = new QVBoxLayout(); |
123 page1Layout->addLayout(vbox1); |
123 page1Layout->addLayout(vbox1); |
124 page1Layout->addLayout(vbox2); |
124 page1Layout->addLayout(vbox2); |
125 |
125 |
126 GBoxHedgehogs = new QGroupBox(this); |
126 GBoxHedgehogs = new QGroupBox(this); |
127 GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
127 GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
128 GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
128 GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
129 QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
129 QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
130 |
130 |
131 signalMapper = new QSignalMapper(this); |
131 signalMapper = new QSignalMapper(this); |
132 |
132 |
133 HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
133 HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
134 for(int i = 0; i < 8; i++) |
134 for(int i = 0; i < 8; i++) |
135 { |
135 { |
136 HHHats[i] = new QComboBox(GBoxHedgehogs); |
136 HHHats[i] = new QComboBox(GBoxHedgehogs); |
137 HHHats[i]->setModel(hatsModel); |
137 HHHats[i]->setModel(hatsModel); |
138 HHHats[i]->setIconSize(QSize(32, 37)); |
138 HHHats[i]->setIconSize(QSize(32, 37)); |
139 //HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
139 //HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
140 //HHHats[i]->setModelColumn(1); |
140 //HHHats[i]->setModelColumn(1); |
141 //HHHats[i]->setMinimumWidth(132); |
141 //HHHats[i]->setMinimumWidth(132); |
142 GBHLayout->addWidget(HHHats[i], i, 0); |
142 GBHLayout->addWidget(HHHats[i], i, 0); |
143 |
143 |
144 HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
144 HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
145 HHNameEdit[i]->setMaxLength(64); |
145 HHNameEdit[i]->setMaxLength(64); |
146 HHNameEdit[i]->setMinimumWidth(120); |
146 HHNameEdit[i]->setMinimumWidth(120); |
147 GBHLayout->addWidget(HHNameEdit[i], i, 1); |
147 GBHLayout->addWidget(HHNameEdit[i], i, 1); |
148 |
148 |
149 randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); |
149 randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); |
150 |
150 |
151 connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map())); |
151 connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map())); |
152 signalMapper->setMapping(randButton[i], i); |
152 signalMapper->setMapping(randButton[i], i); |
153 |
153 |
154 } |
154 } |
155 |
155 |
156 randTeamButton = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, false); |
156 randTeamButton = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, false); |
157 |
157 |
158 vbox1->addWidget(GBoxHedgehogs); |
158 vbox1->addWidget(GBoxHedgehogs); |
159 |
159 |
160 |
160 |
161 GBoxTeam = new QGroupBox(this); |
161 GBoxTeam = new QGroupBox(this); |
162 GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); |
162 GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); |
163 GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
163 GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
164 QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); |
164 QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); |
165 QLabel * tmpLabel = new QLabel(GBoxTeam); |
165 QLabel * tmpLabel = new QLabel(GBoxTeam); |
166 tmpLabel->setText(QLabel::tr("Name")); |
166 tmpLabel->setText(QLabel::tr("Name")); |
167 GBTLayout->addWidget(tmpLabel, 0, 0); |
167 GBTLayout->addWidget(tmpLabel, 0, 0); |
168 tmpLabel = new QLabel(GBoxTeam); |
168 tmpLabel = new QLabel(GBoxTeam); |
169 tmpLabel->setText(QLabel::tr("Type")); |
169 tmpLabel->setText(QLabel::tr("Type")); |
170 GBTLayout->addWidget(tmpLabel, 1, 0); |
170 GBTLayout->addWidget(tmpLabel, 1, 0); |
171 tmpLabel = new QLabel(GBoxTeam); |
171 tmpLabel = new QLabel(GBoxTeam); |
172 tmpLabel->setText(QLabel::tr("Grave")); |
172 tmpLabel->setText(QLabel::tr("Grave")); |
173 GBTLayout->addWidget(tmpLabel, 2, 0); |
173 GBTLayout->addWidget(tmpLabel, 2, 0); |
174 tmpLabel = new QLabel(GBoxTeam); |
174 tmpLabel = new QLabel(GBoxTeam); |
175 tmpLabel->setText(QLabel::tr("Flag")); |
175 tmpLabel->setText(QLabel::tr("Flag")); |
176 GBTLayout->addWidget(tmpLabel, 3, 0); |
176 GBTLayout->addWidget(tmpLabel, 3, 0); |
177 tmpLabel = new QLabel(GBoxTeam); |
177 tmpLabel = new QLabel(GBoxTeam); |
178 tmpLabel->setText(QLabel::tr("Voice")); |
178 tmpLabel->setText(QLabel::tr("Voice")); |
179 GBTLayout->addWidget(tmpLabel, 4, 0); |
179 GBTLayout->addWidget(tmpLabel, 4, 0); |
180 |
180 |
181 |
181 |
182 TeamNameEdit = new QLineEdit(GBoxTeam); |
182 TeamNameEdit = new QLineEdit(GBoxTeam); |
183 TeamNameEdit->setMaxLength(64); |
183 TeamNameEdit->setMaxLength(64); |
184 GBTLayout->addWidget(TeamNameEdit, 0, 1); |
184 GBTLayout->addWidget(TeamNameEdit, 0, 1); |
185 vbox2->addWidget(GBoxTeam); |
185 vbox2->addWidget(GBoxTeam); |
186 |
186 |
187 CBTeamLvl = new QComboBox(GBoxTeam); |
187 CBTeamLvl = new QComboBox(GBoxTeam); |
188 CBTeamLvl->setIconSize(QSize(48, 48)); |
188 CBTeamLvl->setIconSize(QSize(48, 48)); |
189 CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
189 CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
190 for(int i = 5; i > 0; i--) |
190 for(int i = 5; i > 0; i--) |
191 CBTeamLvl->addItem( |
191 CBTeamLvl->addItem( |
192 QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
192 QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
193 QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
193 QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
194 ); |
194 ); |
195 GBTLayout->addWidget(CBTeamLvl, 1, 1); |
195 GBTLayout->addWidget(CBTeamLvl, 1, 1); |
196 |
196 |
197 CBGrave = new QComboBox(GBoxTeam); |
197 CBGrave = new QComboBox(GBoxTeam); |
198 CBGrave->setMaxCount(65535); |
198 CBGrave->setMaxCount(65535); |
199 CBGrave->setIconSize(QSize(32, 32)); |
199 CBGrave->setIconSize(QSize(32, 32)); |
200 GBTLayout->addWidget(CBGrave, 2, 1); |
200 GBTLayout->addWidget(CBGrave, 2, 1); |
201 |
201 |
202 CBFlag = new QComboBox(GBoxTeam); |
202 CBFlag = new QComboBox(GBoxTeam); |
203 CBFlag->setMaxCount(65535); |
203 CBFlag->setMaxCount(65535); |
204 CBFlag->setIconSize(QSize(22, 15)); |
204 CBFlag->setIconSize(QSize(22, 15)); |
205 GBTLayout->addWidget(CBFlag, 3, 1); |
205 GBTLayout->addWidget(CBFlag, 3, 1); |
206 |
206 |
207 { |
207 { |
208 QHBoxLayout * hbox = new QHBoxLayout(); |
208 QHBoxLayout * hbox = new QHBoxLayout(); |
209 CBVoicepack = new QComboBox(GBoxTeam); |
209 CBVoicepack = new QComboBox(GBoxTeam); |
210 { |
210 { |
211 QDir tmpdir; |
211 QDir tmpdir; |
212 tmpdir.cd(datadir->absolutePath()); |
212 tmpdir.cd(datadir->absolutePath()); |
213 tmpdir.cd("Sounds/voices"); |
213 tmpdir.cd("Sounds/voices"); |
214 QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); |
214 QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); |
215 CBVoicepack->addItems(list); |
215 CBVoicepack->addItems(list); |
216 } |
216 } |
217 hbox->addWidget(CBVoicepack, 100); |
217 hbox->addWidget(CBVoicepack, 100); |
218 BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); |
218 BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); |
219 hbox->setStretchFactor(BtnTestSound, 1); |
219 hbox->setStretchFactor(BtnTestSound, 1); |
220 connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
220 connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
221 GBTLayout->addLayout(hbox, 4, 1); |
221 GBTLayout->addLayout(hbox, 4, 1); |
222 } |
222 } |
223 |
223 |
224 GBoxFort = new QGroupBox(this); |
224 GBoxFort = new QGroupBox(this); |
225 GBoxFort->setTitle(QGroupBox::tr("Fort")); |
225 GBoxFort->setTitle(QGroupBox::tr("Fort")); |
226 QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
226 QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
227 CBFort = new QComboBox(GBoxFort); |
227 CBFort = new QComboBox(GBoxFort); |
228 CBFort->setMaxCount(65535); |
228 CBFort->setMaxCount(65535); |
229 GBFLayout->addWidget(CBFort, 0, 0); |
229 GBFLayout->addWidget(CBFort, 0, 0); |
230 FortPreview = new SquareLabel(GBoxFort); |
230 FortPreview = new SquareLabel(GBoxFort); |
231 FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
231 FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
232 FortPreview->setMinimumSize(128, 128); |
232 FortPreview->setMinimumSize(128, 128); |
233 FortPreview->setPixmap(QPixmap()); |
233 FortPreview->setPixmap(QPixmap()); |
234 // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars |
234 // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars |
235 //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); |
235 //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); |
236 GBFLayout->addWidget(FortPreview, 1, 0); |
236 GBFLayout->addWidget(FortPreview, 1, 0); |
237 vbox2->addWidget(GBoxFort); |
237 vbox2->addWidget(GBoxFort); |
238 |
238 |
239 QDir tmpdir; |
239 QDir tmpdir; |
240 tmpdir.cd(datadir->absolutePath()); |
240 tmpdir.cd(datadir->absolutePath()); |
241 tmpdir.cd("Forts"); |
241 tmpdir.cd("Forts"); |
242 tmpdir.setFilter(QDir::Files); |
242 tmpdir.setFilter(QDir::Files); |
243 |
243 |
244 connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
244 connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
245 CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
245 CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
246 |
246 |
247 tmpdir.cd("../Graphics/Graves"); |
247 tmpdir.cd("../Graphics/Graves"); |
248 QStringList list = tmpdir.entryList(QStringList("*.png")); |
248 QStringList list = tmpdir.entryList(QStringList("*.png")); |
249 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
249 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
250 { |
250 { |
251 QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
251 QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
252 QIcon icon(pix.copy(0, 0, 32, 32)); |
252 QIcon icon(pix.copy(0, 0, 32, 32)); |
253 CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
253 CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
254 } |
254 } |
255 |
255 |
256 tmpdir.cd(datadir->absolutePath()); |
256 tmpdir.cd(datadir->absolutePath()); |
257 tmpdir.cd("Graphics/Flags"); |
257 tmpdir.cd("Graphics/Flags"); |
258 list = tmpdir.entryList(QStringList("*.png")); |
258 list = tmpdir.entryList(QStringList("*.png")); |
259 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
259 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
260 { |
260 { |
261 QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); |
261 QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); |
262 QIcon icon(pix.copy(0, 0, 22, 15)); |
262 QIcon icon(pix.copy(0, 0, 22, 15)); |
263 if(it->compare("cpu.png")) // skip cpu flag |
263 if(it->compare("cpu.png")) // skip cpu flag |
264 CBFlag->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
264 CBFlag->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
265 } |
265 } |
266 |
266 |
267 vbox1->addStretch(); |
267 vbox1->addStretch(); |
268 vbox2->addStretch(); |
268 vbox2->addStretch(); |
269 |
269 |
270 // ====== Page 2 ====== |
270 // ====== Page 2 ====== |
271 GBoxBinds = new QGroupBox(this); |
271 GBoxBinds = new QGroupBox(this); |
272 GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
272 GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
273 QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
273 QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
274 BindsBox = new QToolBox(GBoxBinds); |
274 BindsBox = new QToolBox(GBoxBinds); |
275 BindsBox->setLineWidth(0); |
275 BindsBox->setLineWidth(0); |
276 GBBLayout->addWidget(BindsBox); |
276 GBBLayout->addWidget(BindsBox); |
277 page2Layout->addWidget(GBoxBinds, 0, 0); |
277 page2Layout->addWidget(GBoxBinds, 0, 0); |
278 |
278 |
279 quint16 i = 0; |
279 quint16 i = 0; |
280 quint16 num = 0; |
280 quint16 num = 0; |
281 QWidget * curW = NULL; |
281 QWidget * curW = NULL; |
282 QGridLayout * pagelayout = NULL; |
282 QGridLayout * pagelayout = NULL; |
283 QLabel* l = NULL; |
283 QLabel* l = NULL; |
284 while (i < BINDS_NUMBER) { |
284 while (i < BINDS_NUMBER) { |
285 if(cbinds[i].category != NULL) |
285 if(cbinds[i].category != NULL) |
286 { |
286 { |
287 if(curW != NULL) |
287 if(curW != NULL) |
288 { |
288 { |
289 l = new QLabel(curW); |
289 l = new QLabel(curW); |
290 l->setText(""); |
290 l->setText(""); |
291 pagelayout->addWidget(l, num++, 0, 1, 2); |
291 pagelayout->addWidget(l, num++, 0, 1, 2); |
292 } |
292 } |
293 curW = new QWidget(this); |
293 curW = new QWidget(this); |
294 BindsBox->addItem(curW, QApplication::translate("binds (categories)", cbinds[i].category)); |
294 BindsBox->addItem(curW, QApplication::translate("binds (categories)", cbinds[i].category)); |
295 pagelayout = new QGridLayout(curW); |
295 pagelayout = new QGridLayout(curW); |
296 num = 0; |
296 num = 0; |
297 } |
297 } |
298 if(cbinds[i].description != NULL) |
298 if(cbinds[i].description != NULL) |
299 { |
299 { |
300 l = new QLabel(curW); |
300 l = new QLabel(curW); |
301 l->setText((num > 0 ? QString("\n") : QString("")) + QApplication::translate("binds (descriptions)", cbinds[i].description)); |
301 l->setText((num > 0 ? QString("\n") : QString("")) + QApplication::translate("binds (descriptions)", cbinds[i].description)); |
302 pagelayout->addWidget(l, num++, 0, 1, 2); |
302 pagelayout->addWidget(l, num++, 0, 1, 2); |
303 } |
303 } |
304 |
304 |
305 l = new QLabel(curW); |
305 l = new QLabel(curW); |
306 l->setText(QApplication::translate("binds", cbinds[i].name)); |
306 l->setText(QApplication::translate("binds", cbinds[i].name)); |
307 l->setAlignment(Qt::AlignRight); |
307 l->setAlignment(Qt::AlignRight); |
308 pagelayout->addWidget(l, num, 0); |
308 pagelayout->addWidget(l, num, 0); |
309 CBBind[i] = new QComboBox(curW); |
309 CBBind[i] = new QComboBox(curW); |
310 for(int j = 0; sdlkeys[j][1][0] != '\0'; j++) |
310 for(int j = 0; sdlkeys[j][1][0] != '\0'; j++) |
311 CBBind[i]->addItem(QApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? QApplication::translate("binds (keys)", sdlkeys[j][1]) : QApplication::translate("binds (keys)", "Keyboard") + QString(": ") + QApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]); |
311 CBBind[i]->addItem(QApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? QApplication::translate("binds (keys)", sdlkeys[j][1]) : QApplication::translate("binds (keys)", "Keyboard") + QString(": ") + QApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]); |
312 pagelayout->addWidget(CBBind[i++], num++, 1); |
312 pagelayout->addWidget(CBBind[i++], num++, 1); |
313 } |
313 } |
314 } |
314 } |
315 |
315 |
316 void PageEditTeam::CBFort_activated(const QString & fortname) |
316 void PageEditTeam::CBFort_activated(const QString & fortname) |
317 { |
317 { |
318 QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
318 QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
319 FortPreview->setPixmap(pix); |
319 FortPreview->setPixmap(pix); |
320 } |
320 } |
321 |
321 |
322 void PageEditTeam::testSound() |
322 void PageEditTeam::testSound() |
323 { |
323 { |
324 Mix_Chunk *sound; |
324 Mix_Chunk *sound; |
325 QDir tmpdir; |
325 QDir tmpdir; |
326 mySdli->SDLMusicInit(); |
326 mySdli->SDLMusicInit(); |
327 |
327 |
328 tmpdir.cd(datadir->absolutePath()); |
328 tmpdir.cd(datadir->absolutePath()); |
329 tmpdir.cd("Sounds/voices"); |
329 tmpdir.cd("Sounds/voices"); |
330 tmpdir.cd(CBVoicepack->currentText()); |
330 tmpdir.cd(CBVoicepack->currentText()); |
331 QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files); |
331 QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files); |
332 if (list.size()) { |
332 if (list.size()) { |
333 sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData()); |
333 sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData()); |
334 Mix_PlayChannel(-1, sound, 0); |
334 Mix_PlayChannel(-1, sound, 0); |
335 } |
335 } |
336 } |
336 } |
337 |
337 |
338 PageMultiplayer::PageMultiplayer(QWidget* parent) : |
338 PageMultiplayer::PageMultiplayer(QWidget* parent) : |
339 AbstractPage(parent) |
339 AbstractPage(parent) |
340 { |
340 { |
341 QGridLayout * pageLayout = new QGridLayout(this); |
341 QGridLayout * pageLayout = new QGridLayout(this); |
342 |
342 |
343 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
343 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
344 |
344 |
345 gameCFG = new GameCFGWidget(this); |
345 gameCFG = new GameCFGWidget(this); |
346 pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
346 pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
347 |
347 |
348 pageLayout->setRowStretch(1, 1); |
348 pageLayout->setRowStretch(1, 1); |
349 |
349 |
350 teamsSelect = new TeamSelWidget(this); |
350 teamsSelect = new TeamSelWidget(this); |
351 pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
351 pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
352 |
352 |
353 BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
353 BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
354 } |
354 } |
355 |
355 |
356 PageOptions::PageOptions(QWidget* parent) : |
356 PageOptions::PageOptions(QWidget* parent) : |
357 AbstractPage(parent) |
357 AbstractPage(parent) |
358 { |
358 { |
359 QGridLayout * pageLayout = new QGridLayout(this); |
359 QGridLayout * pageLayout = new QGridLayout(this); |
360 pageLayout->setColumnStretch(0, 100); |
360 pageLayout->setColumnStretch(0, 100); |
361 pageLayout->setColumnStretch(1, 100); |
361 pageLayout->setColumnStretch(1, 100); |
362 pageLayout->setColumnStretch(2, 100); |
362 pageLayout->setColumnStretch(2, 100); |
363 pageLayout->setRowStretch(0, 0); |
363 pageLayout->setRowStretch(0, 0); |
364 pageLayout->setRowStretch(1, 100); |
364 pageLayout->setRowStretch(1, 100); |
365 pageLayout->setRowStretch(2, 0); |
365 pageLayout->setRowStretch(2, 0); |
366 pageLayout->setContentsMargins(7, 7, 7, 0); |
366 pageLayout->setContentsMargins(7, 7, 7, 0); |
367 pageLayout->setSpacing(0); |
367 pageLayout->setSpacing(0); |
368 |
368 |
369 |
369 |
370 QGroupBox * gbTwoBoxes = new QGroupBox(this); |
370 QGroupBox * gbTwoBoxes = new QGroupBox(this); |
371 pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
371 pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
372 QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); |
372 QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); |
373 gbTBLayout->setMargin(0); |
373 gbTBLayout->setMargin(0); |
374 gbTBLayout->setSpacing(0); |
374 gbTBLayout->setSpacing(0); |
375 gbTBLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); |
375 gbTBLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); |
376 { |
376 { |
377 teamsBox = new IconedGroupBox(this); |
377 teamsBox = new IconedGroupBox(this); |
378 //teamsBox->setContentTopPadding(0); |
378 //teamsBox->setContentTopPadding(0); |
379 //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true); |
379 //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true); |
380 teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
380 teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
565 hr->setFrameStyle(QFrame::HLine); |
565 hr->setFrameStyle(QFrame::HLine); |
566 hr->setLineWidth(3); |
566 hr->setLineWidth(3); |
567 hr->setFixedHeight(12); |
567 hr->setFixedHeight(12); |
568 GBAlayout->addWidget(hr); |
568 GBAlayout->addWidget(hr); |
569 |
569 |
570 QLabel *restartNote = new QLabel(this); |
570 QLabel *restartNote = new QLabel(this); |
571 restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply")); |
571 restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply")); |
572 GBAlayout->addWidget(restartNote); |
572 GBAlayout->addWidget(restartNote); |
573 |
573 |
574 gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1); |
574 gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1); |
575 } |
575 } |
576 |
576 |
577 BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); |
577 BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); |
578 BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
578 BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
579 |
579 |
580 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
580 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
581 } |
581 } |
582 |
582 |
583 PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
583 PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
584 { |
584 { |
585 QFont * font14 = new QFont("MS Shell Dlg", 14); |
585 QFont * font14 = new QFont("MS Shell Dlg", 14); |
586 QGridLayout * pageLayout = new QGridLayout(this); |
586 QGridLayout * pageLayout = new QGridLayout(this); |
587 pageLayout->setColumnStretch(0, 1); |
587 pageLayout->setColumnStretch(0, 1); |
588 pageLayout->setColumnStretch(1, 1); |
588 pageLayout->setColumnStretch(1, 1); |
589 pageLayout->setColumnStretch(2, 1); |
589 pageLayout->setColumnStretch(2, 1); |
590 |
590 |
591 BtnNetSvrStart = new QPushButton(this); |
591 BtnNetSvrStart = new QPushButton(this); |
592 BtnNetSvrStart->setFont(*font14); |
592 BtnNetSvrStart->setFont(*font14); |
593 BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
593 BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
594 BtnNetSvrStart->setVisible(haveServer); |
594 BtnNetSvrStart->setVisible(haveServer); |
595 pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
595 pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
596 |
596 |
597 BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
597 BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
598 |
598 |
599 ConnGroupBox = new QGroupBox(this); |
599 ConnGroupBox = new QGroupBox(this); |
600 ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
600 ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
601 pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
601 pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
602 GBClayout = new QGridLayout(ConnGroupBox); |
602 GBClayout = new QGridLayout(ConnGroupBox); |
603 GBClayout->setColumnStretch(0, 1); |
603 GBClayout->setColumnStretch(0, 1); |
604 GBClayout->setColumnStretch(1, 1); |
604 GBClayout->setColumnStretch(1, 1); |
605 GBClayout->setColumnStretch(2, 1); |
605 GBClayout->setColumnStretch(2, 1); |
606 |
606 |
607 BtnNetConnect = new QPushButton(ConnGroupBox); |
607 BtnNetConnect = new QPushButton(ConnGroupBox); |
608 BtnNetConnect->setFont(*font14); |
608 BtnNetConnect->setFont(*font14); |
609 BtnNetConnect->setText(QPushButton::tr("Connect")); |
609 BtnNetConnect->setText(QPushButton::tr("Connect")); |
610 GBClayout->addWidget(BtnNetConnect, 2, 2); |
610 GBClayout->addWidget(BtnNetConnect, 2, 2); |
611 |
611 |
612 tvServersList = new QTableView(ConnGroupBox); |
612 tvServersList = new QTableView(ConnGroupBox); |
613 tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
613 tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
614 GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
614 GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
615 |
615 |
616 BtnUpdateSList = new QPushButton(ConnGroupBox); |
616 BtnUpdateSList = new QPushButton(ConnGroupBox); |
617 BtnUpdateSList->setFont(*font14); |
617 BtnUpdateSList->setFont(*font14); |
618 BtnUpdateSList->setText(QPushButton::tr("Update")); |
618 BtnUpdateSList->setText(QPushButton::tr("Update")); |
619 GBClayout->addWidget(BtnUpdateSList, 2, 0); |
619 GBClayout->addWidget(BtnUpdateSList, 2, 0); |
620 |
620 |
621 BtnSpecifyServer = new QPushButton(ConnGroupBox); |
621 BtnSpecifyServer = new QPushButton(ConnGroupBox); |
622 BtnSpecifyServer->setFont(*font14); |
622 BtnSpecifyServer->setFont(*font14); |
623 BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
623 BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
624 GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
624 GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
625 |
625 |
626 connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
626 connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
627 } |
627 } |
628 |
628 |
629 void PageNet::updateServersList() |
629 void PageNet::updateServersList() |
630 { |
630 { |
631 tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
631 tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
632 |
632 |
633 tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
633 tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
634 |
634 |
635 static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
635 static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
636 |
636 |
637 connect(BtnUpdateSList, SIGNAL(clicked()), static_cast<HWNetServersModel *>(tvServersList->model()), SLOT(updateList())); |
637 connect(BtnUpdateSList, SIGNAL(clicked()), static_cast<HWNetServersModel *>(tvServersList->model()), SLOT(updateList())); |
638 connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
638 connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
639 } |
639 } |
640 |
640 |
641 void PageNet::slotConnect() |
641 void PageNet::slotConnect() |
642 { |
642 { |
643 HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
643 HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
644 QModelIndex mi = tvServersList->currentIndex(); |
644 QModelIndex mi = tvServersList->currentIndex(); |
645 if(!mi.isValid()) |
645 if(!mi.isValid()) |
646 { |
646 { |
647 QMessageBox::information(this, tr("Error"), tr("Please select server from the list above")); |
647 QMessageBox::information(this, tr("Error"), tr("Please select server from the list above")); |
648 return; |
648 return; |
649 } |
649 } |
650 QString host = model->index(mi.row(), 1).data().toString(); |
650 QString host = model->index(mi.row(), 1).data().toString(); |
651 quint16 port = model->index(mi.row(), 2).data().toUInt(); |
651 quint16 port = model->index(mi.row(), 2).data().toUInt(); |
652 |
652 |
653 emit connectClicked(host, port); |
653 emit connectClicked(host, port); |
654 } |
654 } |
655 |
655 |
656 PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
656 PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
657 { |
657 { |
658 QFont * font14 = new QFont("MS Shell Dlg", 14); |
658 QFont * font14 = new QFont("MS Shell Dlg", 14); |
659 QGridLayout * pageLayout = new QGridLayout(this); |
659 QGridLayout * pageLayout = new QGridLayout(this); |
660 pageLayout->setColumnStretch(0, 1); |
660 pageLayout->setColumnStretch(0, 1); |
661 pageLayout->setColumnStretch(1, 1); |
661 pageLayout->setColumnStretch(1, 1); |
662 pageLayout->setColumnStretch(2, 1); |
662 pageLayout->setColumnStretch(2, 1); |
663 |
663 |
664 pageLayout->setRowStretch(0, 1); |
664 pageLayout->setRowStretch(0, 1); |
665 pageLayout->setRowStretch(1, 0); |
665 pageLayout->setRowStretch(1, 0); |
666 |
666 |
667 BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
667 BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
668 |
668 |
669 BtnStart = new QPushButton(this); |
669 BtnStart = new QPushButton(this); |
670 BtnStart->setFont(*font14); |
670 BtnStart->setFont(*font14); |
671 BtnStart->setText(QPushButton::tr("Start")); |
671 BtnStart->setText(QPushButton::tr("Start")); |
672 pageLayout->addWidget(BtnStart, 1, 2); |
672 pageLayout->addWidget(BtnStart, 1, 2); |
673 |
673 |
674 QWidget * wg = new QWidget(this); |
674 QWidget * wg = new QWidget(this); |
675 pageLayout->addWidget(wg, 0, 0, 1, 3); |
675 pageLayout->addWidget(wg, 0, 0, 1, 3); |
676 |
676 |
677 QGridLayout * wgLayout = new QGridLayout(wg); |
677 QGridLayout * wgLayout = new QGridLayout(wg); |
678 wgLayout->setColumnStretch(0, 1); |
678 wgLayout->setColumnStretch(0, 1); |
679 wgLayout->setColumnStretch(1, 3); |
679 wgLayout->setColumnStretch(1, 3); |
680 wgLayout->setColumnStretch(2, 1); |
680 wgLayout->setColumnStretch(2, 1); |
681 |
681 |
682 wgLayout->setRowStretch(0, 0); |
682 wgLayout->setRowStretch(0, 0); |
683 wgLayout->setRowStretch(1, 1); |
683 wgLayout->setRowStretch(1, 1); |
684 |
684 |
685 QGroupBox * gb = new QGroupBox(wg); |
685 QGroupBox * gb = new QGroupBox(wg); |
686 wgLayout->addWidget(gb, 0, 1); |
686 wgLayout->addWidget(gb, 0, 1); |
687 |
687 |
688 QGridLayout * gbLayout = new QGridLayout(gb); |
688 QGridLayout * gbLayout = new QGridLayout(gb); |
689 |
689 |
690 labelSD = new QLabel(gb); |
690 labelSD = new QLabel(gb); |
691 labelSD->setText(QLabel::tr("Server name:")); |
691 labelSD->setText(QLabel::tr("Server name:")); |
692 gbLayout->addWidget(labelSD, 0, 0); |
692 gbLayout->addWidget(labelSD, 0, 0); |
693 |
693 |
694 leServerDescr = new QLineEdit(gb); |
694 leServerDescr = new QLineEdit(gb); |
695 gbLayout->addWidget(leServerDescr, 0, 1); |
695 gbLayout->addWidget(leServerDescr, 0, 1); |
696 |
696 |
697 labelPort = new QLabel(gb); |
697 labelPort = new QLabel(gb); |
698 labelPort->setText(QLabel::tr("Server port:")); |
698 labelPort->setText(QLabel::tr("Server port:")); |
699 gbLayout->addWidget(labelPort, 1, 0); |
699 gbLayout->addWidget(labelPort, 1, 0); |
700 |
700 |
701 sbPort = new QSpinBox(gb); |
701 sbPort = new QSpinBox(gb); |
702 sbPort->setMinimum(0); |
702 sbPort->setMinimum(0); |
703 sbPort->setMaximum(65535); |
703 sbPort->setMaximum(65535); |
704 gbLayout->addWidget(sbPort, 1, 1); |
704 gbLayout->addWidget(sbPort, 1, 1); |
705 |
705 |
706 BtnDefault = new QPushButton(gb); |
706 BtnDefault = new QPushButton(gb); |
707 BtnDefault->setText(QPushButton::tr("default")); |
707 BtnDefault->setText(QPushButton::tr("default")); |
708 gbLayout->addWidget(BtnDefault, 1, 2); |
708 gbLayout->addWidget(BtnDefault, 1, 2); |
709 |
709 |
710 connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
710 connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
711 } |
711 } |
712 |
712 |
713 void PageNetServer::setDefaultPort() |
713 void PageNetServer::setDefaultPort() |
714 { |
714 { |
715 sbPort->setValue(46631); |
715 sbPort->setValue(46631); |
716 } |
716 } |
717 |
717 |
718 PageNetGame::PageNetGame(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : AbstractPage(parent) |
718 PageNetGame::PageNetGame(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : AbstractPage(parent) |
719 { |
719 { |
720 QGridLayout * pageLayout = new QGridLayout(this); |
720 QGridLayout * pageLayout = new QGridLayout(this); |
721 pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
721 pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
722 //pageLayout->setSpacing(1); |
722 //pageLayout->setSpacing(1); |
723 pageLayout->setColumnStretch(0, 50); |
723 pageLayout->setColumnStretch(0, 50); |
724 pageLayout->setColumnStretch(1, 50); |
724 pageLayout->setColumnStretch(1, 50); |
725 |
725 |
726 // chatwidget |
726 // chatwidget |
727 pChatWidget = new HWChatWidget(this, gameSettings, sdli, true); |
727 pChatWidget = new HWChatWidget(this, gameSettings, sdli, true); |
728 pChatWidget->setShowReady(true); // show status bulbs by default |
728 pChatWidget->setShowReady(true); // show status bulbs by default |
729 pageLayout->addWidget(pChatWidget, 1, 0, 1, 2); |
729 pageLayout->addWidget(pChatWidget, 1, 0, 1, 2); |
730 pageLayout->setRowStretch(1, 100); |
730 pageLayout->setRowStretch(1, 100); |
731 |
731 |
732 pGameCFG = new GameCFGWidget(this); |
732 pGameCFG = new GameCFGWidget(this); |
733 pageLayout->addWidget(pGameCFG, 0, 0); |
733 pageLayout->addWidget(pGameCFG, 0, 0); |
734 |
734 |
735 pNetTeamsWidget = new TeamSelWidget(this); |
735 pNetTeamsWidget = new TeamSelWidget(this); |
736 pNetTeamsWidget->setAcceptOuter(true); |
736 pNetTeamsWidget->setAcceptOuter(true); |
737 pageLayout->addWidget(pNetTeamsWidget, 0, 1); |
737 pageLayout->addWidget(pNetTeamsWidget, 0, 1); |
738 |
738 |
739 |
739 |
740 QHBoxLayout * bottomLayout = new QHBoxLayout; |
740 QHBoxLayout * bottomLayout = new QHBoxLayout; |
741 pageLayout->addLayout(bottomLayout, 3, 0, 1, 2); |
741 pageLayout->addLayout(bottomLayout, 3, 0, 1, 2); |
742 |
742 |
743 BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); |
743 BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); |
744 |
744 |
745 BtnGo = new QPushButton(this); |
745 BtnGo = new QPushButton(this); |
746 BtnGo->setToolTip(QPushButton::tr("Ready")); |
746 BtnGo->setToolTip(QPushButton::tr("Ready")); |
747 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
747 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
748 BtnGo->setIconSize(QSize(25, 34)); |
748 BtnGo->setIconSize(QSize(25, 34)); |
749 BtnGo->setMinimumWidth(50); |
749 BtnGo->setMinimumWidth(50); |
750 BtnGo->setMinimumHeight(50); |
750 BtnGo->setMinimumHeight(50); |
751 bottomLayout->addWidget(BtnGo, 4); |
751 bottomLayout->addWidget(BtnGo, 4); |
752 |
752 |
753 |
753 |
754 BtnMaster = addButton(tr("Control"), bottomLayout, 2); |
754 BtnMaster = addButton(tr("Control"), bottomLayout, 2); |
755 QMenu * menu = new QMenu(BtnMaster); |
755 QMenu * menu = new QMenu(BtnMaster); |
756 restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
756 restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
757 restrictJoins->setCheckable(true); |
757 restrictJoins->setCheckable(true); |
758 restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
758 restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
759 restrictTeamAdds->setCheckable(true); |
759 restrictTeamAdds->setCheckable(true); |
760 //menu->addAction(startGame); |
760 //menu->addAction(startGame); |
761 menu->addAction(restrictJoins); |
761 menu->addAction(restrictJoins); |
762 menu->addAction(restrictTeamAdds); |
762 menu->addAction(restrictTeamAdds); |
763 |
763 |
764 BtnMaster->setMenu(menu); |
764 BtnMaster->setMenu(menu); |
765 |
765 |
766 BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); |
766 BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); |
767 |
767 |
768 bottomLayout->insertStretch(1, 100); |
768 bottomLayout->insertStretch(1, 100); |
769 } |
769 } |
770 |
770 |
771 void PageNetGame::setReadyStatus(bool isReady) |
771 void PageNetGame::setReadyStatus(bool isReady) |
772 { |
772 { |
773 if(isReady) |
773 if(isReady) |
774 BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); |
774 BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); |
775 else |
775 else |
776 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
776 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
777 } |
777 } |
778 |
778 |
779 void PageNetGame::setMasterMode(bool isMaster) |
779 void PageNetGame::setMasterMode(bool isMaster) |
780 { |
780 { |
781 BtnMaster->setVisible(isMaster); |
781 BtnMaster->setVisible(isMaster); |
782 BtnStart->setVisible(isMaster); |
782 BtnStart->setVisible(isMaster); |
783 } |
783 } |
784 |
784 |
785 PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
785 PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
786 { |
786 { |
787 QGridLayout * pageLayout = new QGridLayout(this); |
787 QGridLayout * pageLayout = new QGridLayout(this); |
788 pageLayout->setColumnStretch(0, 1); |
788 pageLayout->setColumnStretch(0, 1); |
789 pageLayout->setColumnStretch(1, 1); |
789 pageLayout->setColumnStretch(1, 1); |
790 pageLayout->setColumnStretch(2, 1); |
790 pageLayout->setColumnStretch(2, 1); |
791 |
791 |
792 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
792 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
793 |
793 |
794 about = new About(this); |
794 about = new About(this); |
795 pageLayout->addWidget(about, 0, 0, 1, 3); |
795 pageLayout->addWidget(about, 0, 0, 1, 3); |
796 } |
796 } |
797 |
797 |
798 PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
798 PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
799 { |
799 { |
800 QVBoxLayout * vLayout = new QVBoxLayout(this); |
800 QVBoxLayout * vLayout = new QVBoxLayout(this); |
801 QHBoxLayout * topLine = new QHBoxLayout(); |
801 QHBoxLayout * topLine = new QHBoxLayout(); |
802 QHBoxLayout * middleLine = new QHBoxLayout(); |
802 QHBoxLayout * middleLine = new QHBoxLayout(); |
803 QHBoxLayout * bottomLine = new QHBoxLayout(); |
803 QHBoxLayout * bottomLine = new QHBoxLayout(); |
804 vLayout->addStretch(); |
804 vLayout->addStretch(); |
805 vLayout->addLayout(topLine); |
805 vLayout->addLayout(topLine); |
806 vLayout->addSpacing(30); |
806 vLayout->addSpacing(30); |
807 vLayout->addLayout(middleLine); |
807 vLayout->addLayout(middleLine); |
808 vLayout->addStretch(); |
808 vLayout->addStretch(); |
809 vLayout->addLayout(bottomLine); |
809 vLayout->addLayout(bottomLine); |
810 |
810 |
811 topLine->addStretch(); |
811 topLine->addStretch(); |
812 BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
812 BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
813 BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
813 BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
814 topLine->addSpacing(60); |
814 topLine->addSpacing(60); |
815 BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
815 BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
816 BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
816 BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
817 topLine->addStretch(); |
817 topLine->addStretch(); |
818 |
818 |
819 |
819 |
820 BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
820 BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
821 BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
821 BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
822 |
822 |
823 BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
823 BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
824 bottomLine->addStretch(); |
824 bottomLine->addStretch(); |
825 |
825 |
826 BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
826 BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
827 BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
827 BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
828 BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
828 BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
829 BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
829 BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
830 BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
830 BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
831 } |
831 } |
832 |
832 |
833 PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
833 PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
834 { |
834 { |
835 QGridLayout * pageLayout = new QGridLayout(this); |
835 QGridLayout * pageLayout = new QGridLayout(this); |
836 pageLayout->setColumnStretch(0, 1); |
836 pageLayout->setColumnStretch(0, 1); |
837 pageLayout->setColumnStretch(1, 2); |
837 pageLayout->setColumnStretch(1, 2); |
838 pageLayout->setColumnStretch(2, 1); |
838 pageLayout->setColumnStretch(2, 1); |
839 |
839 |
840 CBSelect = new QComboBox(this); |
840 CBSelect = new QComboBox(this); |
841 |
841 |
842 QDir tmpdir; |
842 QDir tmpdir; |
843 tmpdir.cd(datadir->absolutePath()); |
843 tmpdir.cd(datadir->absolutePath()); |
844 tmpdir.cd("Missions"); |
844 tmpdir.cd("Missions"); |
845 tmpdir.setFilter(QDir::Files); |
845 tmpdir.setFilter(QDir::Files); |
846 CBSelect->addItems(tmpdir.entryList(QStringList("*.hwt")).replaceInStrings(QRegExp("^(.*)\\.hwt"), "\\1")); |
846 CBSelect->addItems(tmpdir.entryList(QStringList("*.hwt")).replaceInStrings(QRegExp("^(.*)\\.hwt"), "\\1")); |
847 |
847 |
848 pageLayout->addWidget(CBSelect, 1, 1); |
848 pageLayout->addWidget(CBSelect, 1, 1); |
849 |
849 |
850 BtnStartTrain = new QPushButton(this); |
850 BtnStartTrain = new QPushButton(this); |
851 BtnStartTrain->setFont(*font14); |
851 BtnStartTrain->setFont(*font14); |
852 BtnStartTrain->setText(QPushButton::tr("Go!")); |
852 BtnStartTrain->setText(QPushButton::tr("Go!")); |
853 pageLayout->addWidget(BtnStartTrain, 1, 2); |
853 pageLayout->addWidget(BtnStartTrain, 1, 2); |
854 |
854 |
855 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
855 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
856 } |
856 } |
857 |
857 |
858 PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
858 PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
859 AbstractPage(parent) |
859 AbstractPage(parent) |
860 { |
860 { |
861 QGridLayout * pageLayout = new QGridLayout(this); |
861 QGridLayout * pageLayout = new QGridLayout(this); |
862 |
862 |
863 pWeapons = new SelWeaponWidget(cAmmoNumber, this); |
863 pWeapons = new SelWeaponWidget(cAmmoNumber, this); |
864 pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
864 pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
865 |
865 |
866 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
866 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
867 BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
867 BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
868 BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
868 BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
869 BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
869 BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
870 BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
870 BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
871 |
871 |
872 connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault())); |
872 connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault())); |
873 connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save())); |
873 connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save())); |
874 } |
874 } |
875 |
875 |
876 PageInGame::PageInGame(QWidget* parent) : |
876 PageInGame::PageInGame(QWidget* parent) : |
877 AbstractPage(parent) |
877 AbstractPage(parent) |
878 { |
878 { |
879 QLabel * label = new QLabel(this); |
879 QLabel * label = new QLabel(this); |
880 label->setText("In game..."); |
880 label->setText("In game..."); |
881 } |
881 } |
882 |
882 |
883 PageRoomsList::PageRoomsList(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : |
883 PageRoomsList::PageRoomsList(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : |
884 AbstractPage(parent) |
884 AbstractPage(parent) |
885 { |
885 { |
886 QGridLayout * pageLayout = new QGridLayout(this); |
886 QGridLayout * pageLayout = new QGridLayout(this); |
887 |
887 |
888 QHBoxLayout * newRoomLayout = new QHBoxLayout(); |
888 QHBoxLayout * newRoomLayout = new QHBoxLayout(); |
889 QLabel * roomNameLabel = new QLabel(this); |
889 QLabel * roomNameLabel = new QLabel(this); |
890 roomNameLabel->setText(tr("Room Name:")); |
890 roomNameLabel->setText(tr("Room Name:")); |
891 roomName = new QLineEdit(this); |
891 roomName = new QLineEdit(this); |
892 roomName->setMaxLength(60); |
892 roomName->setMaxLength(60); |
893 newRoomLayout->addWidget(roomNameLabel); |
893 newRoomLayout->addWidget(roomNameLabel); |
894 newRoomLayout->addWidget(roomName); |
894 newRoomLayout->addWidget(roomName); |
895 pageLayout->addLayout(newRoomLayout, 0, 0); |
895 pageLayout->addLayout(newRoomLayout, 0, 0); |
896 |
896 |
897 roomsList = new QTableWidget(this); |
897 roomsList = new QTableWidget(this); |
898 roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
898 roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
899 roomsList->verticalHeader()->setVisible(false); |
899 roomsList->verticalHeader()->setVisible(false); |
900 roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
900 roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
901 roomsList->setAlternatingRowColors(true); |
901 roomsList->setAlternatingRowColors(true); |
902 pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
902 pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
903 pageLayout->setRowStretch(2, 100); |
903 pageLayout->setRowStretch(2, 100); |
904 |
904 |
905 chatWidget = new HWChatWidget(this, gameSettings, sdli, false); |
905 chatWidget = new HWChatWidget(this, gameSettings, sdli, false); |
906 pageLayout->addWidget(chatWidget, 4, 0, 1, 2); |
906 pageLayout->addWidget(chatWidget, 4, 0, 1, 2); |
907 pageLayout->setRowStretch(4, 350); |
907 pageLayout->setRowStretch(4, 350); |
908 |
908 |
909 BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
909 BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
910 BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
910 BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
911 BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1); |
911 BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1); |
912 |
912 |
913 BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
913 BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
914 BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1); |
914 BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1); |
915 |
915 |
916 connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
916 connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
917 connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
917 connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
918 connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
918 connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
919 connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
919 connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
920 } |
920 } |
921 |
921 |
922 void PageRoomsList::setAdmin(bool flag) |
922 void PageRoomsList::setAdmin(bool flag) |
923 { |
923 { |
924 BtnAdmin->setVisible(flag); |
924 BtnAdmin->setVisible(flag); |
925 } |
925 } |
926 |
926 |
927 void PageRoomsList::setRoomsList(const QStringList & list) |
927 void PageRoomsList::setRoomsList(const QStringList & list) |
928 { |
928 { |
929 roomsList->clear(); |
929 roomsList->clear(); |
930 roomsList->setColumnCount(7); |
930 roomsList->setColumnCount(7); |
931 roomsList->setHorizontalHeaderLabels( |
931 roomsList->setHorizontalHeaderLabels( |
932 QStringList() << |
932 QStringList() << |
933 QTableWidget::tr("Room Name") << |
933 QTableWidget::tr("Room Name") << |
934 QTableWidget::tr("C") << |
934 QTableWidget::tr("C") << |
935 QTableWidget::tr("T") << |
935 QTableWidget::tr("T") << |
936 QTableWidget::tr("Owner") << |
936 QTableWidget::tr("Owner") << |
937 QTableWidget::tr("Map") << |
937 QTableWidget::tr("Map") << |
938 QTableWidget::tr("Rules") << |
938 QTableWidget::tr("Rules") << |
939 QTableWidget::tr("Weapons") |
939 QTableWidget::tr("Weapons") |
940 ); |
940 ); |
941 |
941 |
942 // set minimum sizes |
942 // set minimum sizes |
943 // roomsList->horizontalHeader()->resizeSection(0, 200); |
943 // roomsList->horizontalHeader()->resizeSection(0, 200); |
944 // roomsList->horizontalHeader()->resizeSection(1, 50); |
944 // roomsList->horizontalHeader()->resizeSection(1, 50); |
945 // roomsList->horizontalHeader()->resizeSection(2, 50); |
945 // roomsList->horizontalHeader()->resizeSection(2, 50); |
946 // roomsList->horizontalHeader()->resizeSection(3, 100); |
946 // roomsList->horizontalHeader()->resizeSection(3, 100); |
947 // roomsList->horizontalHeader()->resizeSection(4, 100); |
947 // roomsList->horizontalHeader()->resizeSection(4, 100); |
948 // roomsList->horizontalHeader()->resizeSection(5, 100); |
948 // roomsList->horizontalHeader()->resizeSection(5, 100); |
949 // roomsList->horizontalHeader()->resizeSection(6, 100); |
949 // roomsList->horizontalHeader()->resizeSection(6, 100); |
950 |
950 |
951 // set resize modes |
951 // set resize modes |
952 // roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
952 // roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
953 |
953 |
954 if (list.size() % 8) |
954 if (list.size() % 8) |
955 return; |
955 return; |
956 |
956 |
957 roomsList->setRowCount(list.size() / 8); |
957 roomsList->setRowCount(list.size() / 8); |
958 for(int i = 0, r = 0; i < list.size(); i += 8, r++) |
958 for(int i = 0, r = 0; i < list.size(); i += 8, r++) |
959 { |
959 { |
960 QTableWidgetItem * item; |
960 QTableWidgetItem * item; |
961 item = new QTableWidgetItem(list[i + 1]); // room name |
961 item = new QTableWidgetItem(list[i + 1]); // room name |
962 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
962 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
963 |
963 |
964 // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.) |
964 // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.) |
965 if(list[i].compare("True")) |
965 if(list[i].compare("True")) |
966 { |
966 { |
967 item->setIcon(QIcon(":/res/iconTime.png"));// game is in lobby |
967 item->setIcon(QIcon(":/res/iconTime.png"));// game is in lobby |
968 item->setToolTip(tr("This game is in lobby.\nYou may join and start playing once the game starts.")); |
968 item->setToolTip(tr("This game is in lobby.\nYou may join and start playing once the game starts.")); |
969 } |
969 } |
970 else |
970 else |
971 { |
971 { |
972 item->setIcon(QIcon(":/res/iconDamage.png"));// game has started |
972 item->setIcon(QIcon(":/res/iconDamage.png"));// game has started |
973 item->setToolTip(tr("This game is in progress.\nYou may join and spectate now but you'll have to wait for the game to end to start playing.")); |
973 item->setToolTip(tr("This game is in progress.\nYou may join and spectate now but you'll have to wait for the game to end to start playing.")); |
974 } |
974 } |
975 |
975 |
976 roomsList->setItem(r, 0, item); |
976 roomsList->setItem(r, 0, item); |
977 |
977 |
978 item = new QTableWidgetItem(list[i + 2]); // number of clients |
978 item = new QTableWidgetItem(list[i + 2]); // number of clients |
979 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
979 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
980 item->setTextAlignment(Qt::AlignCenter); |
980 item->setTextAlignment(Qt::AlignCenter); |
981 item->setToolTip(tr("There are %1 clients connected to this room.", "", list[i + 2].toInt()).arg(list[i + 2])); |
981 item->setToolTip(tr("There are %1 clients connected to this room.", "", list[i + 2].toInt()).arg(list[i + 2])); |
982 roomsList->setItem(r, 1, item); |
982 roomsList->setItem(r, 1, item); |
983 |
983 |
984 item = new QTableWidgetItem(list[i + 3]); // number of teams |
984 item = new QTableWidgetItem(list[i + 3]); // number of teams |
985 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
985 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
986 item->setTextAlignment(Qt::AlignCenter); |
986 item->setTextAlignment(Qt::AlignCenter); |
987 item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3])); |
987 item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3])); |
988 roomsList->setItem(r, 2, item); |
988 roomsList->setItem(r, 2, item); |
989 |
989 |
990 item = new QTableWidgetItem(list[i + 4].left(15)); // name of host |
990 item = new QTableWidgetItem(list[i + 4].left(15)); // name of host |
991 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
991 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
992 item->setToolTip(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4])); |
992 item->setToolTip(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4])); |
993 roomsList->setItem(r, 3, item); |
993 roomsList->setItem(r, 3, item); |
994 |
994 |
995 if(list[i + 5].compare("+rnd+")) |
995 if(list[i + 5].compare("+rnd+")) |
996 { |
996 { |
997 item = new QTableWidgetItem(list[i + 5]); // selected map |
997 item = new QTableWidgetItem(list[i + 5]); // selected map |
998 |
998 |
999 // check to see if we've got this map |
999 // check to see if we've got this map |
1000 // not perfect but a start |
1000 // not perfect but a start |
1001 if(!mapList->contains(list[i + 5])) |
1001 if(!mapList->contains(list[i + 5])) |
1002 item->setForeground(QBrush(QColor(255, 0, 0))); |
1002 item->setForeground(QBrush(QColor(255, 0, 0))); |
1003 } |
1003 } |
1004 else |
1004 else |
1005 item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized) |
1005 item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized) |
1006 |
1006 |
1007 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1007 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1008 item->setToolTip(tr("Games may be played on precreated or randomized maps.")); |
1008 item->setToolTip(tr("Games may be played on precreated or randomized maps.")); |
1009 roomsList->setItem(r, 4, item); |
1009 roomsList->setItem(r, 4, item); |
1010 |
1010 |
1011 item = new QTableWidgetItem(list[i + 6].left(20)); // selected game scheme |
1011 item = new QTableWidgetItem(list[i + 6].left(20)); // selected game scheme |
1012 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1012 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1013 item->setToolTip(tr("The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism.")); |
1013 item->setToolTip(tr("The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism.")); |
1014 roomsList->setItem(r, 5, item); |
1014 roomsList->setItem(r, 5, item); |
1015 |
1015 |
1016 item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme |
1016 item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme |
1017 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1017 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1018 item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count.")); |
1018 item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count.")); |
1019 roomsList->setItem(r, 6, item); |
1019 roomsList->setItem(r, 6, item); |
1020 |
1020 |
1021 } |
1021 } |
1022 roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
1022 roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
1023 roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
1023 roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
1024 roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
1024 roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
1025 roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); |
1025 roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); |
1026 roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); |
1026 roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); |
1027 roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); |
1027 roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); |
1028 roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); |
1028 roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); |
1029 |
1029 |
1030 // roomsList->resizeColumnsToContents(); |
1030 // roomsList->resizeColumnsToContents(); |
1031 } |
1031 } |
1032 |
1032 |
1033 void PageRoomsList::onCreateClick() |
1033 void PageRoomsList::onCreateClick() |
1034 { |
1034 { |
1035 if (roomName->text().size()) |
1035 if (roomName->text().size()) |
1036 emit askForCreateRoom(roomName->text()); |
1036 emit askForCreateRoom(roomName->text()); |
1037 else |
1037 else |
1038 QMessageBox::critical(this, |
1038 QMessageBox::critical(this, |
1039 tr("Error"), |
1039 tr("Error"), |
1040 tr("Please enter room name"), |
1040 tr("Please enter room name"), |
1041 tr("OK")); |
1041 tr("OK")); |
1042 } |
1042 } |
1043 |
1043 |
1044 void PageRoomsList::onJoinClick() |
1044 void PageRoomsList::onJoinClick() |
1045 { |
1045 { |
1046 QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1046 QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1047 if (!curritem) |
1047 if (!curritem) |
1048 { |
1048 { |
1049 QMessageBox::critical(this, |
1049 QMessageBox::critical(this, |
1050 tr("Error"), |
1050 tr("Error"), |
1051 tr("Please select room from the list"), |
1051 tr("Please select room from the list"), |
1052 tr("OK")); |
1052 tr("OK")); |
1053 return ; |
1053 return ; |
1054 } |
1054 } |
1055 emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
1055 emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
1056 } |
1056 } |
1057 |
1057 |
1058 void PageRoomsList::onRefreshClick() |
1058 void PageRoomsList::onRefreshClick() |
1059 { |
1059 { |
1060 emit askForRoomList(); |
1060 emit askForRoomList(); |
1061 } |
1061 } |
1062 |
1062 |
1063 |
1063 |
1064 PageConnecting::PageConnecting(QWidget* parent) : |
1064 PageConnecting::PageConnecting(QWidget* parent) : |
1065 AbstractPage(parent) |
1065 AbstractPage(parent) |
1066 { |
1066 { |
1067 QGridLayout * pageLayout = new QGridLayout(this); |
1067 QGridLayout * pageLayout = new QGridLayout(this); |
1068 |
1068 |
1069 QLabel * lblConnecting = new QLabel(this); |
1069 QLabel * lblConnecting = new QLabel(this); |
1070 lblConnecting->setText(tr("Connecting...")); |
1070 lblConnecting->setText(tr("Connecting...")); |
1071 pageLayout->addWidget(lblConnecting); |
1071 pageLayout->addWidget(lblConnecting); |
1072 } |
1072 } |
1073 |
1073 |
1074 PageScheme::PageScheme(QWidget* parent) : |
1074 PageScheme::PageScheme(QWidget* parent) : |
1075 AbstractPage(parent) |
1075 AbstractPage(parent) |
1076 { |
1076 { |
1077 QGridLayout * pageLayout = new QGridLayout(this); |
1077 QGridLayout * pageLayout = new QGridLayout(this); |
1078 QGroupBox * gb = new QGroupBox(this); |
1078 QGroupBox * gb = new QGroupBox(this); |
1079 |
1079 |
1080 QGridLayout * gl = new QGridLayout(); |
1080 QGridLayout * gl = new QGridLayout(); |
1081 gb->setLayout(gl); |
1081 gb->setLayout(gl); |
1082 QSizePolicy sp; |
1082 QSizePolicy sp; |
1083 sp.setVerticalPolicy(QSizePolicy::MinimumExpanding); |
1083 sp.setVerticalPolicy(QSizePolicy::MinimumExpanding); |
1084 sp.setHorizontalPolicy(QSizePolicy::Expanding); |
1084 sp.setHorizontalPolicy(QSizePolicy::Expanding); |
1085 |
1085 |
1086 pageLayout->addWidget(gb, 1,0,13,4); |
1086 pageLayout->addWidget(gb, 1,0,13,4); |
1087 |
1087 |
1088 gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb); |
1088 gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb); |
1089 gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb); |
1089 gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb); |
1090 |
1090 |
1091 gbGameModes->setStyleSheet(".QGroupBox {" |
1091 gbGameModes->setStyleSheet(".QGroupBox {" |
1092 "background-color: #130f2c; background-image:url();" |
1092 "background-color: #130f2c; background-image:url();" |
1093 "}"); |
1093 "}"); |
1094 gbBasicSettings->setStyleSheet(".QGroupBox {" |
1094 gbBasicSettings->setStyleSheet(".QGroupBox {" |
1095 "background-color: #130f2c; background-image:url();" |
1095 "background-color: #130f2c; background-image:url();" |
1096 "}"); |
1096 "}"); |
1097 |
1097 |
1098 gbGameModes->setSizePolicy(sp); |
1098 gbGameModes->setSizePolicy(sp); |
1099 gbBasicSettings->setSizePolicy(sp); |
1099 gbBasicSettings->setSizePolicy(sp); |
1100 gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop); |
1100 gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop); |
1101 gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop); |
1101 gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop); |
1102 |
1102 |
1103 QGridLayout * glGMLayout = new QGridLayout(gbGameModes); |
1103 QGridLayout * glGMLayout = new QGridLayout(gbGameModes); |
1104 QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings); |
1104 QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings); |
1105 gbGameModes->setLayout(glGMLayout); |
1105 gbGameModes->setLayout(glGMLayout); |
1106 gbBasicSettings->setLayout(glBSLayout); |
1106 gbBasicSettings->setLayout(glBSLayout); |
1107 // Left |
1107 // Left |
1108 |
1108 |
1109 TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png"); |
1109 TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png"); |
1110 TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode")); |
1110 TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode")); |
1111 TBW_mode_Forts->setToolTip(tr("Defend your fort and destroy the opponents, two team colours max!")); |
1111 TBW_mode_Forts->setToolTip(tr("Defend your fort and destroy the opponents, two team colours max!")); |
1112 glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1); |
1112 glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1); |
1113 |
1113 |
1114 TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide.png"); |
1114 TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide.png"); |
1115 TBW_teamsDivide->setText(ToggleButtonWidget::tr("Divide Teams")); |
1115 TBW_teamsDivide->setText(ToggleButtonWidget::tr("Divide Teams")); |
1116 TBW_teamsDivide->setToolTip(tr("Teams will start on opposite sides of the terrain, two team colours max!")); |
1116 TBW_teamsDivide->setToolTip(tr("Teams will start on opposite sides of the terrain, two team colours max!")); |
1117 glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1); |
1117 glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1); |
1118 |
1118 |
1119 TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png"); |
1119 TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png"); |
1120 TBW_solid->setText(ToggleButtonWidget::tr("Solid Land")); |
1120 TBW_solid->setText(ToggleButtonWidget::tr("Solid Land")); |
1121 TBW_solid->setToolTip(tr("Land can not be destroyed!")); |
1121 TBW_solid->setToolTip(tr("Land can not be destroyed!")); |
1122 glGMLayout->addWidget(TBW_solid,0,2,1,1); |
1122 glGMLayout->addWidget(TBW_solid,0,2,1,1); |
1123 |
1123 |
1124 TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png"); |
1124 TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png"); |
1125 TBW_border->setText(ToggleButtonWidget::tr("Add Border")); |
1125 TBW_border->setText(ToggleButtonWidget::tr("Add Border")); |
1126 TBW_border->setToolTip(tr("Add an indestructable border around the terrain")); |
1126 TBW_border->setToolTip(tr("Add an indestructable border around the terrain")); |
1127 glGMLayout->addWidget(TBW_border,0,3,1,1); |
1127 glGMLayout->addWidget(TBW_border,0,3,1,1); |
1128 |
1128 |
1129 TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png"); |
1129 TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png"); |
1130 TBW_lowGravity->setText(ToggleButtonWidget::tr("Low Gravity")); |
1130 TBW_lowGravity->setText(ToggleButtonWidget::tr("Low Gravity")); |
1131 TBW_lowGravity->setToolTip(tr("Lower gravity")); |
1131 TBW_lowGravity->setToolTip(tr("Lower gravity")); |
1132 glGMLayout->addWidget(TBW_lowGravity,1,0,1,1); |
1132 glGMLayout->addWidget(TBW_lowGravity,1,0,1,1); |
1133 |
1133 |
1134 TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png"); |
1134 TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png"); |
1135 TBW_laserSight->setText(ToggleButtonWidget::tr("Laser Sight")); |
1135 TBW_laserSight->setText(ToggleButtonWidget::tr("Laser Sight")); |
1136 TBW_laserSight->setToolTip(tr("Assisted aiming with laser sight")); |
1136 TBW_laserSight->setToolTip(tr("Assisted aiming with laser sight")); |
1137 glGMLayout->addWidget(TBW_laserSight,1,1,1,1); |
1137 glGMLayout->addWidget(TBW_laserSight,1,1,1,1); |
1138 |
1138 |
1139 TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png"); |
1139 TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png"); |
1140 TBW_invulnerable->setText(ToggleButtonWidget::tr("Invulnerable")); |
1140 TBW_invulnerable->setText(ToggleButtonWidget::tr("Invulnerable")); |
1141 TBW_invulnerable->setToolTip(tr("All hogs have a personal forcefield")); |
1141 TBW_invulnerable->setToolTip(tr("All hogs have a personal forcefield")); |
1142 glGMLayout->addWidget(TBW_invulnerable,1,2,1,1); |
1142 glGMLayout->addWidget(TBW_invulnerable,1,2,1,1); |
1143 |
1143 |
1144 TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png"); |
1144 TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png"); |
1145 TBW_mines->setText(ToggleButtonWidget::tr("Add Mines")); |
1145 TBW_mines->setText(ToggleButtonWidget::tr("Add Mines")); |
1146 TBW_mines->setToolTip(tr("Enable random mines")); |
1146 TBW_mines->setToolTip(tr("Enable random mines")); |
1147 glGMLayout->addWidget(TBW_mines,1,3,1,1); |
1147 glGMLayout->addWidget(TBW_mines,1,3,1,1); |
1148 |
1148 |
1149 TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png"); |
1149 TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png"); |
1150 TBW_vampiric->setText(ToggleButtonWidget::tr("Vampirism")); |
1150 TBW_vampiric->setText(ToggleButtonWidget::tr("Vampirism")); |
1151 TBW_vampiric->setToolTip(tr("Gain 80% of the damage you do back in health")); |
1151 TBW_vampiric->setToolTip(tr("Gain 80% of the damage you do back in health")); |
1152 glGMLayout->addWidget(TBW_vampiric,2,0,1,1); |
1152 glGMLayout->addWidget(TBW_vampiric,2,0,1,1); |
1153 |
1153 |
1154 TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png"); |
1154 TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png"); |
1155 TBW_karma->setText(ToggleButtonWidget::tr("Karma")); |
1155 TBW_karma->setText(ToggleButtonWidget::tr("Karma")); |
1156 TBW_karma->setToolTip(tr("Share your opponents pain, share their damage")); |
1156 TBW_karma->setToolTip(tr("Share your opponents pain, share their damage")); |
1157 glGMLayout->addWidget(TBW_karma,2,1,1,1); |
1157 glGMLayout->addWidget(TBW_karma,2,1,1,1); |
1158 |
1158 |
1159 TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png"); |
1159 TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png"); |
1160 TBW_artillery->setText(ToggleButtonWidget::tr("Artillery")); |
1160 TBW_artillery->setText(ToggleButtonWidget::tr("Artillery")); |
1161 TBW_artillery->setToolTip(tr("Your hogs are unable to move, put your artillery skills to the test")); |
1161 TBW_artillery->setToolTip(tr("Your hogs are unable to move, put your artillery skills to the test")); |
1162 glGMLayout->addWidget(TBW_artillery,2,2,1,1); |
1162 glGMLayout->addWidget(TBW_artillery,2,2,1,1); |
1163 |
1163 |
1164 TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png"); |
1164 TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png"); |
1165 TBW_randomorder->setText(ToggleButtonWidget::tr("Random Order")); |
1165 TBW_randomorder->setText(ToggleButtonWidget::tr("Random Order")); |
1166 TBW_randomorder->setToolTip(tr("Order of play is random instead of in room order.")); |
1166 TBW_randomorder->setToolTip(tr("Order of play is random instead of in room order.")); |
1167 glGMLayout->addWidget(TBW_randomorder,2,3,1,1); |
1167 glGMLayout->addWidget(TBW_randomorder,2,3,1,1); |
1168 |
1168 |
1169 TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png"); |
1169 TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png"); |
1170 TBW_king->setText(ToggleButtonWidget::tr("King")); |
1170 TBW_king->setText(ToggleButtonWidget::tr("King")); |
1171 TBW_king->setToolTip(tr("Play with a King. If he dies, your side dies.")); |
1171 TBW_king->setToolTip(tr("Play with a King. If he dies, your side dies.")); |
1172 glGMLayout->addWidget(TBW_king,3,0,1,1); |
1172 glGMLayout->addWidget(TBW_king,3,0,1,1); |
1173 |
1173 |
1174 TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png"); |
1174 TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png"); |
1175 TBW_placehog->setText(ToggleButtonWidget::tr("Place Hedgehogs")); |
1175 TBW_placehog->setText(ToggleButtonWidget::tr("Place Hedgehogs")); |
1176 TBW_placehog->setToolTip(tr("Take turns placing your hedgehogs before the start of play.")); |
1176 TBW_placehog->setToolTip(tr("Take turns placing your hedgehogs before the start of play.")); |
1177 glGMLayout->addWidget(TBW_placehog,3,1,1,1); |
1177 glGMLayout->addWidget(TBW_placehog,3,1,1,1); |
1178 |
1178 |
1179 TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png"); |
1179 TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png"); |
1180 TBW_sharedammo->setText(ToggleButtonWidget::tr("Clan Shares Ammo")); |
1180 TBW_sharedammo->setText(ToggleButtonWidget::tr("Clan Shares Ammo")); |
1181 TBW_sharedammo->setToolTip(tr("Ammo is shared between all teams that share a colour.")); |
1181 TBW_sharedammo->setToolTip(tr("Ammo is shared between all teams that share a colour.")); |
1182 glGMLayout->addWidget(TBW_sharedammo,3,2,1,1); |
1182 glGMLayout->addWidget(TBW_sharedammo,3,2,1,1); |
1183 |
1183 |
1184 TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png"); |
1184 TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png"); |
1185 TBW_disablegirders->setText(ToggleButtonWidget::tr("Disable Girders")); |
1185 TBW_disablegirders->setText(ToggleButtonWidget::tr("Disable Girders")); |
1186 TBW_disablegirders->setToolTip(tr("Disable girders when generating random maps.")); |
1186 TBW_disablegirders->setToolTip(tr("Disable girders when generating random maps.")); |
1187 glGMLayout->addWidget(TBW_disablegirders,3,3,1,1); |
1187 glGMLayout->addWidget(TBW_disablegirders,3,3,1,1); |
1188 |
1188 |
1189 // Right |
1189 // Right |
1190 QLabel * l; |
1190 QLabel * l; |
1191 |
1191 |
1192 l = new QLabel(gbBasicSettings); |
1192 l = new QLabel(gbBasicSettings); |
1193 l->setText(QLabel::tr("Damage Modifier")); |
1193 l->setText(QLabel::tr("Damage Modifier")); |
1194 l->setWordWrap(true); |
1194 l->setWordWrap(true); |
1195 glBSLayout->addWidget(l,0,0,1,1); |
1195 glBSLayout->addWidget(l,0,0,1,1); |
1196 l = new QLabel(gbBasicSettings); |
1196 l = new QLabel(gbBasicSettings); |
1197 l->setFixedSize(32,32); |
1197 l->setFixedSize(32,32); |
1198 l->setPixmap(QPixmap(":/res/iconDamage.png")); |
1198 l->setPixmap(QPixmap(":/res/iconDamage.png")); |
1199 glBSLayout->addWidget(l,0,1,1,1); |
1199 glBSLayout->addWidget(l,0,1,1,1); |
1200 |
1200 |
1201 SB_DamageModifier = new QSpinBox(gbBasicSettings); |
1201 SB_DamageModifier = new QSpinBox(gbBasicSettings); |
1202 SB_DamageModifier->setRange(10, 300); |
1202 SB_DamageModifier->setRange(10, 300); |
1203 SB_DamageModifier->setValue(100); |
1203 SB_DamageModifier->setValue(100); |
1204 SB_DamageModifier->setSingleStep(25); |
1204 SB_DamageModifier->setSingleStep(25); |
1205 glBSLayout->addWidget(SB_DamageModifier,0,2,1,1); |
1205 glBSLayout->addWidget(SB_DamageModifier,0,2,1,1); |
1206 |
1206 |
1207 l = new QLabel(gbBasicSettings); |
1207 l = new QLabel(gbBasicSettings); |
1208 l->setText(QLabel::tr("Turn Time")); |
1208 l->setText(QLabel::tr("Turn Time")); |
1209 l->setWordWrap(true); |
1209 l->setWordWrap(true); |
1210 glBSLayout->addWidget(l,1,0,1,1); |
1210 glBSLayout->addWidget(l,1,0,1,1); |
1211 l = new QLabel(gbBasicSettings); |
1211 l = new QLabel(gbBasicSettings); |
1212 l->setFixedSize(32,32); |
1212 l->setFixedSize(32,32); |
1213 l->setPixmap(QPixmap(":/res/iconTime.png")); |
1213 l->setPixmap(QPixmap(":/res/iconTime.png")); |
1214 glBSLayout->addWidget(l,1,1,1,1); |
1214 glBSLayout->addWidget(l,1,1,1,1); |
1215 |
1215 |
1216 SB_TurnTime = new QSpinBox(gbBasicSettings); |
1216 SB_TurnTime = new QSpinBox(gbBasicSettings); |
1217 SB_TurnTime->setRange(1, 99); |
1217 SB_TurnTime->setRange(1, 99); |
1218 SB_TurnTime->setValue(45); |
1218 SB_TurnTime->setValue(45); |
1219 SB_TurnTime->setSingleStep(15); |
1219 SB_TurnTime->setSingleStep(15); |
1220 glBSLayout->addWidget(SB_TurnTime,1,2,1,1); |
1220 glBSLayout->addWidget(SB_TurnTime,1,2,1,1); |
1221 |
1221 |
1222 l = new QLabel(gbBasicSettings); |
1222 l = new QLabel(gbBasicSettings); |
1223 l->setText(QLabel::tr("Initial Health")); |
1223 l->setText(QLabel::tr("Initial Health")); |
1224 l->setWordWrap(true); |
1224 l->setWordWrap(true); |
1225 glBSLayout->addWidget(l,2,0,1,1); |
1225 glBSLayout->addWidget(l,2,0,1,1); |
1226 l = new QLabel(gbBasicSettings); |
1226 l = new QLabel(gbBasicSettings); |
1227 l->setFixedSize(32,32); |
1227 l->setFixedSize(32,32); |
1228 l->setPixmap(QPixmap(":/res/iconHealth.png")); |
1228 l->setPixmap(QPixmap(":/res/iconHealth.png")); |
1229 glBSLayout->addWidget(l,2,1,1,1); |
1229 glBSLayout->addWidget(l,2,1,1,1); |
1230 |
1230 |
1231 SB_InitHealth = new QSpinBox(gbBasicSettings); |
1231 SB_InitHealth = new QSpinBox(gbBasicSettings); |
1232 SB_InitHealth->setRange(50, 200); |
1232 SB_InitHealth->setRange(50, 200); |
1233 SB_InitHealth->setValue(100); |
1233 SB_InitHealth->setValue(100); |
1234 SB_InitHealth->setSingleStep(25); |
1234 SB_InitHealth->setSingleStep(25); |
1235 glBSLayout->addWidget(SB_InitHealth,2,2,1,1); |
1235 glBSLayout->addWidget(SB_InitHealth,2,2,1,1); |
1236 |
1236 |
1237 l = new QLabel(gbBasicSettings); |
1237 l = new QLabel(gbBasicSettings); |
1238 l->setText(QLabel::tr("Sudden Death Timeout")); |
1238 l->setText(QLabel::tr("Sudden Death Timeout")); |
1239 l->setWordWrap(true); |
1239 l->setWordWrap(true); |
1240 glBSLayout->addWidget(l,3,0,1,1); |
1240 glBSLayout->addWidget(l,3,0,1,1); |
1241 l = new QLabel(gbBasicSettings); |
1241 l = new QLabel(gbBasicSettings); |
1242 l->setFixedSize(32,32); |
1242 l->setFixedSize(32,32); |
1243 l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); |
1243 l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); |
1244 glBSLayout->addWidget(l,3,1,1,1); |
1244 glBSLayout->addWidget(l,3,1,1,1); |
1245 |
1245 |
1246 SB_SuddenDeath = new QSpinBox(gbBasicSettings); |
1246 SB_SuddenDeath = new QSpinBox(gbBasicSettings); |
1247 SB_SuddenDeath->setRange(0, 50); |
1247 SB_SuddenDeath->setRange(0, 50); |
1248 SB_SuddenDeath->setValue(15); |
1248 SB_SuddenDeath->setValue(15); |
1249 SB_SuddenDeath->setSingleStep(3); |
1249 SB_SuddenDeath->setSingleStep(3); |
1250 glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1); |
1250 glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1); |
1251 |
1251 |
1252 l = new QLabel(gbBasicSettings); |
1252 l = new QLabel(gbBasicSettings); |
1253 l->setText(QLabel::tr("Crate Drops")); |
1253 l->setText(QLabel::tr("Crate Drops")); |
1254 l->setWordWrap(true); |
1254 l->setWordWrap(true); |
1255 glBSLayout->addWidget(l,4,0,1,1); |
1255 glBSLayout->addWidget(l,4,0,1,1); |
1256 l = new QLabel(gbBasicSettings); |
1256 l = new QLabel(gbBasicSettings); |
1257 l->setFixedSize(32,32); |
1257 l->setFixedSize(32,32); |
1258 l->setPixmap(QPixmap(":/res/iconBox.png")); |
1258 l->setPixmap(QPixmap(":/res/iconBox.png")); |
1259 glBSLayout->addWidget(l,4,1,1,1); |
1259 glBSLayout->addWidget(l,4,1,1,1); |
1260 |
1260 |
1261 SB_CaseProb = new FreqSpinBox(gbBasicSettings); |
1261 SB_CaseProb = new FreqSpinBox(gbBasicSettings); |
1262 SB_CaseProb->setRange(0, 9); |
1262 SB_CaseProb->setRange(0, 9); |
1263 SB_CaseProb->setValue(5); |
1263 SB_CaseProb->setValue(5); |
1264 glBSLayout->addWidget(SB_CaseProb,4,2,1,1); |
1264 glBSLayout->addWidget(SB_CaseProb,4,2,1,1); |
1265 |
1265 |
1266 l = new QLabel(gbBasicSettings); |
1266 l = new QLabel(gbBasicSettings); |
1267 l->setText(QLabel::tr("Mines Time")); |
1267 l->setText(QLabel::tr("Mines Time")); |
1268 l->setWordWrap(true); |
1268 l->setWordWrap(true); |
1269 glBSLayout->addWidget(l,5,0,1,1); |
1269 glBSLayout->addWidget(l,5,0,1,1); |
1270 l = new QLabel(gbBasicSettings); |
1270 l = new QLabel(gbBasicSettings); |
1271 l->setFixedSize(32,32); |
1271 l->setFixedSize(32,32); |
1272 l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon |
1272 l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon |
1273 glBSLayout->addWidget(l,5,1,1,1); |
1273 glBSLayout->addWidget(l,5,1,1,1); |
1274 SB_MinesTime = new QSpinBox(gbBasicSettings); |
1274 SB_MinesTime = new QSpinBox(gbBasicSettings); |
1275 SB_MinesTime->setRange(-1, 3); |
1275 SB_MinesTime->setRange(-1, 3); |
1276 SB_MinesTime->setValue(3); |
1276 SB_MinesTime->setValue(3); |
1277 SB_MinesTime->setSingleStep(1); |
1277 SB_MinesTime->setSingleStep(1); |
1278 SB_MinesTime->setSpecialValueText(tr("Random")); |
1278 SB_MinesTime->setSpecialValueText(tr("Random")); |
1279 SB_MinesTime->setSuffix(" "+ tr("Seconds")); |
1279 SB_MinesTime->setSuffix(" "+ tr("Seconds")); |
1280 glBSLayout->addWidget(SB_MinesTime,5,2,1,1); |
1280 glBSLayout->addWidget(SB_MinesTime,5,2,1,1); |
1281 |
1281 |
1282 l = new QLabel(gbBasicSettings); |
1282 l = new QLabel(gbBasicSettings); |
1283 l->setText(QLabel::tr("Mines")); |
1283 l->setText(QLabel::tr("Mines")); |
1284 l->setWordWrap(true); |
1284 l->setWordWrap(true); |
1285 glBSLayout->addWidget(l,6,0,1,1); |
1285 glBSLayout->addWidget(l,6,0,1,1); |
1286 l = new QLabel(gbBasicSettings); |
1286 l = new QLabel(gbBasicSettings); |
1287 l->setFixedSize(32,32); |
1287 l->setFixedSize(32,32); |
1288 l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon |
1288 l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon |
1289 glBSLayout->addWidget(l,6,1,1,1); |
1289 glBSLayout->addWidget(l,6,1,1,1); |
1290 SB_Mines = new QSpinBox(gbBasicSettings); |
1290 SB_Mines = new QSpinBox(gbBasicSettings); |
1291 SB_Mines->setRange(1, 80); |
1291 SB_Mines->setRange(1, 80); |
1292 SB_Mines->setValue(1); |
1292 SB_Mines->setValue(1); |
1293 SB_Mines->setSingleStep(5); |
1293 SB_Mines->setSingleStep(5); |
1294 glBSLayout->addWidget(SB_Mines,6,2,1,1); |
1294 glBSLayout->addWidget(SB_Mines,6,2,1,1); |
1295 |
1295 |
1296 l = new QLabel(gbBasicSettings); |
1296 l = new QLabel(gbBasicSettings); |
1297 l->setText(QLabel::tr("% Dud Mines")); |
1297 l->setText(QLabel::tr("% Dud Mines")); |
1298 l->setWordWrap(true); |
1298 l->setWordWrap(true); |
1299 glBSLayout->addWidget(l,7,0,1,1); |
1299 glBSLayout->addWidget(l,7,0,1,1); |
1300 l = new QLabel(gbBasicSettings); |
1300 l = new QLabel(gbBasicSettings); |
1301 l->setFixedSize(32,32); |
1301 l->setFixedSize(32,32); |
1302 l->setPixmap(QPixmap(":/res/iconMine.png")); |
1302 l->setPixmap(QPixmap(":/res/iconMine.png")); |
1303 glBSLayout->addWidget(l,7,1,1,1); |
1303 glBSLayout->addWidget(l,7,1,1,1); |
1304 SB_MineDuds = new QSpinBox(gbBasicSettings); |
1304 SB_MineDuds = new QSpinBox(gbBasicSettings); |
1305 SB_MineDuds->setRange(0, 100); |
1305 SB_MineDuds->setRange(0, 100); |
1306 SB_MineDuds->setValue(0); |
1306 SB_MineDuds->setValue(0); |
1307 SB_MineDuds->setSingleStep(5); |
1307 SB_MineDuds->setSingleStep(5); |
1308 glBSLayout->addWidget(SB_MineDuds,7,2,1,1); |
1308 glBSLayout->addWidget(SB_MineDuds,7,2,1,1); |
1309 |
1309 |
1310 |
1310 |
1311 l = new QLabel(gbBasicSettings); |
1311 l = new QLabel(gbBasicSettings); |
1312 l->setText(QLabel::tr("Explosives")); |
1312 l->setText(QLabel::tr("Explosives")); |
1313 l->setWordWrap(true); |
1313 l->setWordWrap(true); |
1314 glBSLayout->addWidget(l,8,0,1,1); |
1314 glBSLayout->addWidget(l,8,0,1,1); |
1315 l = new QLabel(gbBasicSettings); |
1315 l = new QLabel(gbBasicSettings); |
1316 l->setFixedSize(32,32); |
1316 l->setFixedSize(32,32); |
1317 l->setPixmap(QPixmap(":/res/iconDamage.png")); |
1317 l->setPixmap(QPixmap(":/res/iconDamage.png")); |
1318 glBSLayout->addWidget(l,8,1,1,1); |
1318 glBSLayout->addWidget(l,8,1,1,1); |
1319 SB_Explosives = new QSpinBox(gbBasicSettings); |
1319 SB_Explosives = new QSpinBox(gbBasicSettings); |
1320 SB_Explosives->setRange(0, 40); |
1320 SB_Explosives->setRange(0, 40); |
1321 SB_Explosives->setValue(0); |
1321 SB_Explosives->setValue(0); |
1322 SB_Explosives->setSingleStep(1); |
1322 SB_Explosives->setSingleStep(1); |
1323 glBSLayout->addWidget(SB_Explosives,8,2,1,1); |
1323 glBSLayout->addWidget(SB_Explosives,8,2,1,1); |
1324 |
1324 |
1325 |
1325 |
1326 l = new QLabel(gbBasicSettings); |
1326 l = new QLabel(gbBasicSettings); |
1327 l->setText(QLabel::tr("Scheme Name:")); |
1327 l->setText(QLabel::tr("Scheme Name:")); |
1328 |
1328 |
1329 LE_name = new QLineEdit(this); |
1329 LE_name = new QLineEdit(this); |
1330 |
1330 |
1331 gl->addWidget(LE_name,14,1,1,5); |
1331 gl->addWidget(LE_name,14,1,1,5); |
1332 gl->addWidget(l,14,0,1,1); |
1332 gl->addWidget(l,14,0,1,1); |
1333 |
1333 |
1334 mapper = new QDataWidgetMapper(this); |
1334 mapper = new QDataWidgetMapper(this); |
1335 |
1335 |
1336 BtnBack = addButton(":/res/Exit.png", pageLayout, 15, 0, true); |
1336 BtnBack = addButton(":/res/Exit.png", pageLayout, 15, 0, true); |
1337 BtnNew = addButton(tr("New"), pageLayout, 15, 2); |
1337 BtnNew = addButton(tr("New"), pageLayout, 15, 2); |
1338 BtnDelete = addButton(tr("Delete"), pageLayout, 15, 3); |
1338 BtnDelete = addButton(tr("Delete"), pageLayout, 15, 3); |
1339 |
1339 |
1340 selectScheme = new QComboBox(this); |
1340 selectScheme = new QComboBox(this); |
1341 pageLayout->addWidget(selectScheme, 15, 1); |
1341 pageLayout->addWidget(selectScheme, 15, 1); |
1342 |
1342 |
1343 connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); |
1343 connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); |
1344 connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); |
1344 connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); |
1345 connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); |
1345 connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); |
1346 connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); |
1346 connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); |
1347 } |
1347 } |
1348 |
1348 |
1349 void PageScheme::setModel(QAbstractItemModel * model) |
1349 void PageScheme::setModel(QAbstractItemModel * model) |
1350 { |
1350 { |
1351 mapper->setModel(model); |
1351 mapper->setModel(model); |
1352 selectScheme->setModel(model); |
1352 selectScheme->setModel(model); |
1353 |
1353 |
1354 mapper->addMapping(LE_name, 0); |
1354 mapper->addMapping(LE_name, 0); |
1355 mapper->addMapping(TBW_mode_Forts->button(), 1); |
1355 mapper->addMapping(TBW_mode_Forts->button(), 1); |
1356 mapper->addMapping(TBW_teamsDivide->button(), 2); |
1356 mapper->addMapping(TBW_teamsDivide->button(), 2); |
1357 mapper->addMapping(TBW_solid->button(), 3); |
1357 mapper->addMapping(TBW_solid->button(), 3); |
1358 mapper->addMapping(TBW_border->button(), 4); |
1358 mapper->addMapping(TBW_border->button(), 4); |
1359 mapper->addMapping(TBW_lowGravity->button(), 5); |
1359 mapper->addMapping(TBW_lowGravity->button(), 5); |
1360 mapper->addMapping(TBW_laserSight->button(), 6); |
1360 mapper->addMapping(TBW_laserSight->button(), 6); |
1361 mapper->addMapping(TBW_invulnerable->button(), 7); |
1361 mapper->addMapping(TBW_invulnerable->button(), 7); |
1362 mapper->addMapping(TBW_mines->button(), 8); |
1362 mapper->addMapping(TBW_mines->button(), 8); |
1363 mapper->addMapping(TBW_vampiric->button(), 9); |
1363 mapper->addMapping(TBW_vampiric->button(), 9); |
1364 mapper->addMapping(TBW_karma->button(), 10); |
1364 mapper->addMapping(TBW_karma->button(), 10); |
1365 mapper->addMapping(TBW_artillery->button(), 11); |
1365 mapper->addMapping(TBW_artillery->button(), 11); |
1366 mapper->addMapping(TBW_randomorder->button(), 12); |
1366 mapper->addMapping(TBW_randomorder->button(), 12); |
1367 mapper->addMapping(TBW_king->button(), 13); |
1367 mapper->addMapping(TBW_king->button(), 13); |
1368 mapper->addMapping(TBW_placehog->button(), 14); |
1368 mapper->addMapping(TBW_placehog->button(), 14); |
1369 mapper->addMapping(TBW_sharedammo->button(), 15); |
1369 mapper->addMapping(TBW_sharedammo->button(), 15); |
1370 mapper->addMapping(TBW_disablegirders->button(), 16); |
1370 mapper->addMapping(TBW_disablegirders->button(), 16); |
1371 mapper->addMapping(SB_DamageModifier, 17); |
1371 mapper->addMapping(SB_DamageModifier, 17); |
1372 mapper->addMapping(SB_TurnTime, 18); |
1372 mapper->addMapping(SB_TurnTime, 18); |
1373 mapper->addMapping(SB_InitHealth, 19); |
1373 mapper->addMapping(SB_InitHealth, 19); |
1374 mapper->addMapping(SB_SuddenDeath, 20); |
1374 mapper->addMapping(SB_SuddenDeath, 20); |
1375 mapper->addMapping(SB_CaseProb, 21); |
1375 mapper->addMapping(SB_CaseProb, 21); |
1376 mapper->addMapping(SB_MinesTime, 22); |
1376 mapper->addMapping(SB_MinesTime, 22); |
1377 mapper->addMapping(SB_Mines, 23); |
1377 mapper->addMapping(SB_Mines, 23); |
1378 mapper->addMapping(SB_MineDuds, 24); |
1378 mapper->addMapping(SB_MineDuds, 24); |
1379 mapper->addMapping(SB_Explosives, 25); |
1379 mapper->addMapping(SB_Explosives, 25); |
1380 |
1380 |
1381 mapper->toFirst(); |
1381 mapper->toFirst(); |
1382 } |
1382 } |
1383 |
1383 |
1384 void PageScheme::newRow() |
1384 void PageScheme::newRow() |
1385 { |
1385 { |
1386 QAbstractItemModel * model = mapper->model(); |
1386 QAbstractItemModel * model = mapper->model(); |
1387 model->insertRow(model->rowCount()); |
1387 model->insertRow(model->rowCount()); |
1388 selectScheme->setCurrentIndex(model->rowCount() - 1); |
1388 selectScheme->setCurrentIndex(model->rowCount() - 1); |
1389 } |
1389 } |
1390 |
1390 |
1391 void PageScheme::deleteRow() |
1391 void PageScheme::deleteRow() |
1392 { |
1392 { |
1393 QAbstractItemModel * model = mapper->model(); |
1393 QAbstractItemModel * model = mapper->model(); |
1394 model->removeRow(selectScheme->currentIndex()); |
1394 model->removeRow(selectScheme->currentIndex()); |
1395 } |
1395 } |
1396 |
1396 |
1397 void PageScheme::schemeSelected(int n) |
1397 void PageScheme::schemeSelected(int n) |
1398 { |
1398 { |
1399 gbGameModes->setEnabled(n >= 5); // FIXME: derive number from model |
1399 gbGameModes->setEnabled(n >= 5); // FIXME: derive number from model |
1400 gbBasicSettings->setEnabled(n >= 5); |
1400 gbBasicSettings->setEnabled(n >= 5); |
1401 LE_name->setEnabled(n >= 5); |
1401 LE_name->setEnabled(n >= 5); |
1402 } |
1402 } |
1403 |
1403 |
1404 ///////////////////////////////////////////////// |
1404 ///////////////////////////////////////////////// |
1405 |
1405 |
1406 PageAdmin::PageAdmin(QWidget* parent) : |
1406 PageAdmin::PageAdmin(QWidget* parent) : |
1407 AbstractPage(parent) |
1407 AbstractPage(parent) |
1408 { |
1408 { |
1409 QGridLayout * pageLayout = new QGridLayout(this); |
1409 QGridLayout * pageLayout = new QGridLayout(this); |
1410 |
1410 |
1411 QLabel * lblSM = new QLabel(this); |
1411 QLabel * lblSM = new QLabel(this); |
1412 lblSM->setText(tr("Server message:")); |
1412 lblSM->setText(tr("Server message:")); |
1413 pageLayout->addWidget(lblSM, 0, 0); |
1413 pageLayout->addWidget(lblSM, 0, 0); |
1414 |
1414 |
1415 leServerMessage = new QLineEdit(this); |
1415 leServerMessage = new QLineEdit(this); |
1416 pageLayout->addWidget(leServerMessage, 0, 1); |
1416 pageLayout->addWidget(leServerMessage, 0, 1); |
1417 |
1417 |
1418 pbSetSM = addButton(tr("Set message"), pageLayout, 0, 2); |
1418 pbSetSM = addButton(tr("Set message"), pageLayout, 0, 2); |
1419 pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 1, 0); |
1419 pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 1, 0); |
1420 |
1420 |
1421 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
1421 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
1422 |
1422 |
1423 connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged())); |
1423 connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged())); |
1424 } |
1424 } |
1425 |
1425 |
1426 void PageAdmin::smChanged() |
1426 void PageAdmin::smChanged() |
1427 { |
1427 { |
1428 emit setServerMessage(leServerMessage->text()); |
1428 emit setServerMessage(leServerMessage->text()); |
1429 } |
1429 } |
1430 |
1430 |
1431 void PageAdmin::serverMessage(const QString & str) |
1431 void PageAdmin::serverMessage(const QString & str) |
1432 { |
1432 { |
1433 leServerMessage->setText(str); |
1433 leServerMessage->setText(str); |
1434 } |
1434 } |
1435 |
1435 |
1436 ///////////////////////////////////////////////// |
1436 ///////////////////////////////////////////////// |
1437 |
1437 |
1438 PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent) |
1438 PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent) |
1439 { |
1439 { |
1440 QGridLayout * pageLayout = new QGridLayout(this); |
1440 QGridLayout * pageLayout = new QGridLayout(this); |
1441 pageLayout->setRowStretch(0, 10); |
1441 pageLayout->setRowStretch(0, 10); |
1442 pageLayout->setRowStretch(3, 10); |
1442 pageLayout->setRowStretch(3, 10); |
1443 |
1443 |
1444 pageLayout->setColumnStretch(1, 10); |
1444 pageLayout->setColumnStretch(1, 10); |
1445 pageLayout->setColumnStretch(2, 20); |
1445 pageLayout->setColumnStretch(2, 20); |
1446 pageLayout->setColumnStretch(3, 10); |
1446 pageLayout->setColumnStretch(3, 10); |
1447 |
1447 |
1448 BtnLAN = addButton(tr("LAN game"), pageLayout, 1, 2); |
1448 BtnLAN = addButton(tr("LAN game"), pageLayout, 1, 2); |
1449 BtnOfficialServer = addButton(tr("Official server"), pageLayout, 2, 2); |
1449 BtnOfficialServer = addButton(tr("Official server"), pageLayout, 2, 2); |
1450 |
1450 |
1451 // hack: temporary deactivated - requires server modifications that aren't backward compatible (yet) |
1451 // hack: temporary deactivated - requires server modifications that aren't backward compatible (yet) |
1452 //BtnOfficialServer->setEnabled(false); |
1452 //BtnOfficialServer->setEnabled(false); |
1453 |
1453 |
1454 BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
1454 BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
1455 } |
1455 } |