32 #include "pagenetserver.h" |
32 #include "pagenetserver.h" |
33 #include "hwconsts.h" |
33 #include "hwconsts.h" |
34 #include "fpsedit.h" |
34 #include "fpsedit.h" |
35 #include "HWApplication.h" |
35 #include "HWApplication.h" |
36 #include "DataManager.h" |
36 #include "DataManager.h" |
|
37 #include "SDL.h" |
37 |
38 |
38 |
39 |
39 const QNetworkProxy::ProxyType proxyTypesMap[] = { |
40 const QNetworkProxy::ProxyType proxyTypesMap[] = { |
40 QNetworkProxy::NoProxy |
41 QNetworkProxy::NoProxy |
41 , QNetworkProxy::NoProxy // dummy value |
42 , QNetworkProxy::NoProxy // dummy value |
72 Form->ui.pageOptions->CBResolution->setCurrentIndex(1); |
73 Form->ui.pageOptions->CBResolution->setCurrentIndex(1); |
73 else |
74 else |
74 Form->ui.pageOptions->CBResolution->setCurrentIndex(0); |
75 Form->ui.pageOptions->CBResolution->setCurrentIndex(0); |
75 } |
76 } |
76 else Form->ui.pageOptions->CBResolution->setCurrentIndex(t); |
77 else Form->ui.pageOptions->CBResolution->setCurrentIndex(t); |
|
78 |
|
79 // Default the windowed resolution to 2/3 of the screen size |
|
80 int screenWidth = SDL_GetVideoInfo()->current_w * 2 / 3; |
|
81 int screenHeight = SDL_GetVideoInfo()->current_h * 2 / 3; |
|
82 QString widthStr; widthStr.setNum(screenWidth); |
|
83 QString heightStr; heightStr.setNum(screenHeight); |
|
84 QString wWidth = value("video/windowedWidth", widthStr).toString(); |
|
85 QString wHeight = value("video/windowedHeight", heightStr).toString(); |
|
86 // If left blank reset the resolution to the default |
|
87 wWidth = (wWidth == "" ? widthStr : wWidth); |
|
88 wHeight = (wHeight == "" ? heightStr : wHeight); |
|
89 Form->ui.pageOptions->windowWidthEdit->setText(wWidth); |
|
90 Form->ui.pageOptions->windowHeightEdit->setText(wHeight); |
|
91 |
77 Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 1 : t); |
92 Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 1 : t); |
78 Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool()); |
93 Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool()); |
79 bool ffscr=value("frontend/fullscreen", false).toBool(); |
94 bool ffscr=value("frontend/fullscreen", false).toBool(); |
80 Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr); |
95 Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr); |
81 |
96 |
198 } |
213 } |
199 |
214 |
200 void GameUIConfig::SaveOptions() |
215 void GameUIConfig::SaveOptions() |
201 { |
216 { |
202 setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText()); |
217 setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText()); |
|
218 setValue("video/windowedWidth", Form->ui.pageOptions->windowWidthEdit->text()); |
|
219 setValue("video/windowedHeight", Form->ui.pageOptions->windowHeightEdit->text()); |
203 setValue("video/fullscreen", vid_Fullscreen()); |
220 setValue("video/fullscreen", vid_Fullscreen()); |
204 |
221 |
205 setValue("video/quality", Form->ui.pageOptions->SLQuality->value()); |
222 setValue("video/quality", Form->ui.pageOptions->SLQuality->value()); |
206 setValue("video/stereo", stereoMode()); |
223 setValue("video/stereo", stereoMode()); |
207 |
224 |
320 } |
337 } |
321 |
338 |
322 QRect GameUIConfig::vid_Resolution() |
339 QRect GameUIConfig::vid_Resolution() |
323 { |
340 { |
324 QRect result(0, 0, 640, 480); |
341 QRect result(0, 0, 640, 480); |
325 QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x'); |
342 if(Form->ui.pageOptions->CBFullscreen->isChecked()) { |
326 if (wh.size() == 2) |
343 QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x'); |
327 { |
344 if (wh.size() == 2) |
328 result.setWidth(wh[0].toInt()); |
345 { |
329 result.setHeight(wh[1].toInt()); |
346 result.setWidth(wh[0].toInt()); |
|
347 result.setHeight(wh[1].toInt()); |
|
348 } |
|
349 } |
|
350 else { |
|
351 result.setWidth(Form->ui.pageOptions->windowWidthEdit->text().toInt()); |
|
352 result.setHeight(Form->ui.pageOptions->windowHeightEdit->text().toInt()); |
330 } |
353 } |
331 return result; |
354 return result; |
332 } |
355 } |
333 |
356 |
334 bool GameUIConfig::vid_Fullscreen() |
357 bool GameUIConfig::vid_Fullscreen() |