24 #include <QCryptographicHash> |
24 #include <QCryptographicHash> |
25 |
25 |
26 #include "gameuiconfig.h" |
26 #include "gameuiconfig.h" |
27 #include "hwform.h" |
27 #include "hwform.h" |
28 #include "pageoptions.h" |
28 #include "pageoptions.h" |
|
29 #include "pagevideos.h" |
29 #include "pagenetserver.h" |
30 #include "pagenetserver.h" |
30 #include "hwconsts.h" |
31 #include "hwconsts.h" |
31 #include "fpsedit.h" |
32 #include "fpsedit.h" |
32 #include "HWApplication.h" |
33 #include "HWApplication.h" |
33 |
34 |
40 |
41 |
41 //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt()); |
42 //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt()); |
42 resizeToConfigValues(); |
43 resizeToConfigValues(); |
43 |
44 |
44 reloadValues(); |
45 reloadValues(); |
|
46 reloadVideosValues(); |
45 } |
47 } |
46 |
48 |
47 void GameUIConfig::reloadValues(void) |
49 void GameUIConfig::reloadValues(void) |
48 { |
50 { |
49 Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool()); |
51 Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool()); |
108 depth = HWApplication::desktop()->depth(); |
110 depth = HWApplication::desktop()->depth(); |
109 if (depth < 16) depth = 16; |
111 if (depth < 16) depth = 16; |
110 else if (depth > 16) depth = 32; |
112 else if (depth > 16) depth = 32; |
111 } |
113 } |
112 |
114 |
|
115 void GameUIConfig::reloadVideosValues(void) |
|
116 { |
|
117 Form->ui.pageVideos->framerateBox->setValue(value("videorec/fps",25).toUInt()); |
|
118 bool useGameRes = value("videorec/usegameres",true).toBool(); |
|
119 if (useGameRes) |
|
120 { |
|
121 QRect res = vid_Resolution(); |
|
122 Form->ui.pageVideos->widthEdit->setText(QString::number(res.width())); |
|
123 Form->ui.pageVideos->heightEdit->setText(QString::number(res.height())); |
|
124 } |
|
125 else |
|
126 { |
|
127 Form->ui.pageVideos->widthEdit->setText(value("videorec/width","800").toString()); |
|
128 Form->ui.pageVideos->heightEdit->setText(value("videorec/height","600").toString()); |
|
129 } |
|
130 Form->ui.pageVideos->CBUseGameRes->setChecked(useGameRes); |
|
131 Form->ui.pageVideos->CBRecordAudio->setChecked(value("videorec/audio",true).toBool()); |
|
132 if (!Form->ui.pageVideos->tryCodecs(value("videorec/format","no").toString(), |
|
133 value("videorec/videocodec","no").toString(), |
|
134 value("videorec/audiocodec","no").toString())) |
|
135 Form->ui.pageVideos->setDefaultCodecs(); |
|
136 } |
|
137 |
113 QStringList GameUIConfig::GetTeamsList() |
138 QStringList GameUIConfig::GetTeamsList() |
114 { |
139 { |
115 QDir teamdir; |
140 QDir teamdir; |
116 teamdir.cd(cfgdir->absolutePath() + "/Teams"); |
141 teamdir.cd(cfgdir->absolutePath() + "/Teams"); |
117 QStringList teamslist = teamdir.entryList(QStringList("*.hwt"),QDir::Files|QDir::Hidden); |
142 QStringList teamslist = teamdir.entryList(QStringList("*.hwt"),QDir::Files|QDir::Hidden); |
180 setValue("misc/locale", language()); |
205 setValue("misc/locale", language()); |
181 |
206 |
182 #ifdef SPARKLE_ENABLED |
207 #ifdef SPARKLE_ENABLED |
183 setValue("misc/autoUpdate", isAutoUpdateEnabled()); |
208 setValue("misc/autoUpdate", isAutoUpdateEnabled()); |
184 #endif |
209 #endif |
|
210 |
|
211 Form->gameSettings->sync(); |
|
212 } |
|
213 |
|
214 void GameUIConfig::SaveVideosOptions() |
|
215 { |
|
216 QRect res = rec_Resolution(); |
|
217 setValue("videorec/format", AVFormat()); |
|
218 setValue("videorec/videocodec", videoCodec()); |
|
219 setValue("videorec/audiocodec", audioCodec()); |
|
220 setValue("videorec/fps", rec_Framerate()); |
|
221 setValue("videorec/width", res.width()); |
|
222 setValue("videorec/height", res.height()); |
|
223 setValue("videorec/usegameres", Form->ui.pageVideos->CBUseGameRes->isChecked()); |
|
224 setValue("videorec/audio", recordAudio()); |
|
225 |
185 Form->gameSettings->sync(); |
226 Form->gameSettings->sync(); |
186 } |
227 } |
187 |
228 |
188 QString GameUIConfig::language() |
229 QString GameUIConfig::language() |
189 { |
230 { |
378 |
419 |
379 quint8 GameUIConfig::volume() |
420 quint8 GameUIConfig::volume() |
380 { |
421 { |
381 return Form->ui.pageOptions->volumeBox->value() * 128 / 100; |
422 return Form->ui.pageOptions->volumeBox->value() * 128 / 100; |
382 } |
423 } |
|
424 |
|
425 QString GameUIConfig::AVFormat() |
|
426 { |
|
427 return Form->ui.pageVideos->getFormat(); |
|
428 } |
|
429 |
|
430 QString GameUIConfig::videoCodec() |
|
431 { |
|
432 return Form->ui.pageVideos->getVideoCodec(); |
|
433 } |
|
434 |
|
435 QString GameUIConfig::audioCodec() |
|
436 { |
|
437 return Form->ui.pageVideos->getAudioCodec(); |
|
438 } |
|
439 |
|
440 QRect GameUIConfig::rec_Resolution() |
|
441 { |
|
442 if (Form->ui.pageVideos->CBUseGameRes->isChecked()) |
|
443 return vid_Resolution(); |
|
444 QRect res(0,0,0,0); |
|
445 res.setWidth(Form->ui.pageVideos->widthEdit->text().toUInt()); |
|
446 res.setHeight(Form->ui.pageVideos->heightEdit->text().toUInt()); |
|
447 } |
|
448 |
|
449 int GameUIConfig::rec_Framerate() |
|
450 { |
|
451 return Form->ui.pageVideos->framerateBox->value(); |
|
452 } |
|
453 |
|
454 bool GameUIConfig::recordAudio() |
|
455 { |
|
456 return Form->ui.pageVideos->CBRecordAudio->isChecked(); |
|
457 } |