--- a/QTfrontend/gameuiconfig.cpp Mon Aug 27 17:40:16 2012 +0200
+++ b/QTfrontend/gameuiconfig.cpp Sun Sep 16 16:54:51 2012 +0200
@@ -27,6 +27,7 @@
#include "gameuiconfig.h"
#include "hwform.h"
#include "pageoptions.h"
+#include "pagevideos.h"
#include "pagenetserver.h"
#include "hwconsts.h"
#include "fpsedit.h"
@@ -44,6 +45,7 @@
resizeToConfigValues();
reloadValues();
+ reloadVideosValues();
}
void GameUIConfig::reloadValues(void)
@@ -66,7 +68,7 @@
Form->ui.pageOptions->SLQuality->setValue(value("video/quality", 5).toUInt());
Form->ui.pageOptions->CBStereoMode->setCurrentIndex(value("video/stereo", 0).toUInt());
- Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
+ Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/effects", true).toBool());
Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool());
Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
@@ -118,6 +120,30 @@
}
}
+void GameUIConfig::reloadVideosValues(void)
+{
+ Form->ui.pageVideos->framerateBox->setValue(value("videorec/fps",25).toUInt());
+ Form->ui.pageVideos->bitrateBox->setValue(value("videorec/bitrate",400).toUInt());
+ bool useGameRes = value("videorec/usegameres",true).toBool();
+ if (useGameRes)
+ {
+ QRect res = vid_Resolution();
+ Form->ui.pageVideos->widthEdit->setText(QString::number(res.width()));
+ Form->ui.pageVideos->heightEdit->setText(QString::number(res.height()));
+ }
+ else
+ {
+ Form->ui.pageVideos->widthEdit->setText(value("videorec/width","800").toString());
+ Form->ui.pageVideos->heightEdit->setText(value("videorec/height","600").toString());
+ }
+ Form->ui.pageVideos->checkUseGameRes->setChecked(useGameRes);
+ Form->ui.pageVideos->checkRecordAudio->setChecked(value("videorec/audio",true).toBool());
+ if (!Form->ui.pageVideos->tryCodecs(value("videorec/format","no").toString(),
+ value("videorec/videocodec","no").toString(),
+ value("videorec/audiocodec","no").toString()))
+ Form->ui.pageVideos->setDefaultCodecs();
+}
+
QStringList GameUIConfig::GetTeamsList()
{
QDir teamdir;
@@ -200,6 +226,22 @@
Form->gameSettings->sync();
}
+void GameUIConfig::SaveVideosOptions()
+{
+ QRect res = rec_Resolution();
+ setValue("videorec/format", AVFormat());
+ setValue("videorec/videocodec", videoCodec());
+ setValue("videorec/audiocodec", audioCodec());
+ setValue("videorec/fps", rec_Framerate());
+ setValue("videorec/bitrate", rec_Bitrate());
+ setValue("videorec/width", res.width());
+ setValue("videorec/height", res.height());
+ setValue("videorec/usegameres", Form->ui.pageVideos->checkUseGameRes->isChecked());
+ setValue("videorec/audio", recordAudio());
+
+ Form->gameSettings->sync();
+}
+
QString GameUIConfig::language()
{
return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString();
@@ -395,3 +437,43 @@
{
return Form->ui.pageOptions->volumeBox->value() * 128 / 100;
}
+
+QString GameUIConfig::AVFormat()
+{
+ return Form->ui.pageVideos->format();
+}
+
+QString GameUIConfig::videoCodec()
+{
+ return Form->ui.pageVideos->videoCodec();
+}
+
+QString GameUIConfig::audioCodec()
+{
+ return Form->ui.pageVideos->audioCodec();
+}
+
+QRect GameUIConfig::rec_Resolution()
+{
+ if (Form->ui.pageVideos->checkUseGameRes->isChecked())
+ return vid_Resolution();
+ QRect res(0,0,0,0);
+ res.setWidth(Form->ui.pageVideos->widthEdit->text().toUInt());
+ res.setHeight(Form->ui.pageVideos->heightEdit->text().toUInt());
+ return res;
+}
+
+int GameUIConfig::rec_Framerate()
+{
+ return Form->ui.pageVideos->framerateBox->value();
+}
+
+int GameUIConfig::rec_Bitrate()
+{
+ return Form->ui.pageVideos->bitrateBox->value();
+}
+
+bool GameUIConfig::recordAudio()
+{
+ return Form->ui.pageVideos->checkRecordAudio->isChecked();
+}