QTfrontend/gameuiconfig.cpp
changeset 8202 9f0e79ab51f0
parent 8190 92792d48574b
child 8206 1633a6510834
equal deleted inserted replaced
8199:886ed135665b 8202:9f0e79ab51f0
   140 }
   140 }
   141 
   141 
   142 void GameUIConfig::reloadVideosValues(void)
   142 void GameUIConfig::reloadVideosValues(void)
   143 {
   143 {
   144     // one pass with default values
   144     // one pass with default values
   145     Form->ui.pageVideos->setDefaultOptions();
   145     Form->ui.pageOptions->setDefaultOptions();
   146 
   146 
   147     // then load user configuration
   147     // then load user configuration
   148     Form->ui.pageVideos->framerateBox->setCurrentIndex(
   148     Form->ui.pageOptions->framerateBox->setCurrentIndex(
   149             Form->ui.pageVideos->framerateBox->findData(
   149             Form->ui.pageOptions->framerateBox->findData(
   150                         value("videorec/framerate", rec_Framerate()).toString() + " fps",
   150                         value("videorec/framerate", rec_Framerate()).toString() + " fps",
   151                     Qt::MatchExactly) );
   151                     Qt::MatchExactly) );
   152     Form->ui.pageVideos->bitrateBox->setValue(value("videorec/bitrate", rec_Bitrate()).toUInt());
   152     Form->ui.pageOptions->bitrateBox->setValue(value("videorec/bitrate", rec_Bitrate()).toUInt());
   153     bool useGameRes = value("videorec/usegameres",Form->ui.pageVideos->checkUseGameRes->isChecked()).toBool();
   153     bool useGameRes = value("videorec/usegameres",Form->ui.pageOptions->checkUseGameRes->isChecked()).toBool();
   154     if (useGameRes)
   154     if (useGameRes)
   155     {
   155     {
   156         QRect res = vid_Resolution();
   156         QRect res = vid_Resolution();
   157         Form->ui.pageVideos->widthEdit->setText(QString::number(res.width()));
   157         Form->ui.pageOptions->widthEdit->setText(QString::number(res.width()));
   158         Form->ui.pageVideos->heightEdit->setText(QString::number(res.height()));
   158         Form->ui.pageOptions->heightEdit->setText(QString::number(res.height()));
   159     }
   159     }
   160     else
   160     else
   161     {
   161     {
   162         Form->ui.pageVideos->widthEdit->setText(value("videorec/width","800").toString());
   162         Form->ui.pageOptions->widthEdit->setText(value("videorec/width","800").toString());
   163         Form->ui.pageVideos->heightEdit->setText(value("videorec/height","600").toString());
   163         Form->ui.pageOptions->heightEdit->setText(value("videorec/height","600").toString());
   164     }
   164     }
   165     Form->ui.pageVideos->checkUseGameRes->setChecked(useGameRes);
   165     Form->ui.pageOptions->checkUseGameRes->setChecked(useGameRes);
   166     Form->ui.pageVideos->checkRecordAudio->setChecked(
   166     Form->ui.pageOptions->checkRecordAudio->setChecked(
   167             value("videorec/audio",Form->ui.pageVideos->checkRecordAudio->isChecked()).toBool() );
   167             value("videorec/audio",Form->ui.pageOptions->checkRecordAudio->isChecked()).toBool() );
   168     if (!Form->ui.pageVideos->tryCodecs(value("videorec/format","no").toString(),
   168     if (!Form->ui.pageOptions->tryCodecs(value("videorec/format","no").toString(),
   169                                         value("videorec/videocodec","no").toString(),
   169                                         value("videorec/videocodec","no").toString(),
   170                                         value("videorec/audiocodec","no").toString()))
   170                                         value("videorec/audiocodec","no").toString()))
   171         Form->ui.pageVideos->setDefaultCodecs();
   171         Form->ui.pageOptions->setDefaultCodecs();
   172 }
   172 }
   173 
   173 
   174 QStringList GameUIConfig::GetTeamsList()
   174 QStringList GameUIConfig::GetTeamsList()
   175 {
   175 {
   176     QDir teamdir;
   176     QDir teamdir;
   300     setValue("videorec/audiocodec", audioCodec());
   300     setValue("videorec/audiocodec", audioCodec());
   301     setValue("videorec/framerate", rec_Framerate());
   301     setValue("videorec/framerate", rec_Framerate());
   302     setValue("videorec/bitrate", rec_Bitrate());
   302     setValue("videorec/bitrate", rec_Bitrate());
   303     setValue("videorec/width", res.width());
   303     setValue("videorec/width", res.width());
   304     setValue("videorec/height", res.height());
   304     setValue("videorec/height", res.height());
   305     setValue("videorec/usegameres", Form->ui.pageVideos->checkUseGameRes->isChecked());
   305     setValue("videorec/usegameres", Form->ui.pageOptions->checkUseGameRes->isChecked());
   306     setValue("videorec/audio", recordAudio());
   306     setValue("videorec/audio", recordAudio());
   307 
   307 
   308     sync();
   308     sync();
   309 }
   309 }
   310 
   310 
   510     return Form->ui.pageOptions->volumeBox->value() * 128 / 100;
   510     return Form->ui.pageOptions->volumeBox->value() * 128 / 100;
   511 }
   511 }
   512 
   512 
   513 QString GameUIConfig::AVFormat()
   513 QString GameUIConfig::AVFormat()
   514 {
   514 {
   515     return Form->ui.pageVideos->format();
   515     return Form->ui.pageOptions->format();
   516 }
   516 }
   517 
   517 
   518 QString GameUIConfig::videoCodec()
   518 QString GameUIConfig::videoCodec()
   519 {
   519 {
   520     return Form->ui.pageVideos->videoCodec();
   520     return Form->ui.pageOptions->videoCodec();
   521 }
   521 }
   522 
   522 
   523 QString GameUIConfig::audioCodec()
   523 QString GameUIConfig::audioCodec()
   524 {
   524 {
   525     return Form->ui.pageVideos->audioCodec();
   525     return Form->ui.pageOptions->audioCodec();
   526 }
   526 }
   527 
   527 
   528 QRect GameUIConfig::rec_Resolution()
   528 QRect GameUIConfig::rec_Resolution()
   529 {
   529 {
   530     if (Form->ui.pageVideos->checkUseGameRes->isChecked())
   530     if (Form->ui.pageOptions->checkUseGameRes->isChecked())
   531         return vid_Resolution();
   531         return vid_Resolution();
   532     QRect res(0,0,0,0);
   532     QRect res(0,0,0,0);
   533     res.setWidth(Form->ui.pageVideos->widthEdit->text().toUInt());
   533     res.setWidth(Form->ui.pageOptions->widthEdit->text().toUInt());
   534     res.setHeight(Form->ui.pageVideos->heightEdit->text().toUInt());
   534     res.setHeight(Form->ui.pageOptions->heightEdit->text().toUInt());
   535     return res;
   535     return res;
   536 }
   536 }
   537 
   537 
   538 int GameUIConfig::rec_Framerate()
   538 int GameUIConfig::rec_Framerate()
   539 {
   539 {
   540     // remove the "fps" label
   540     // remove the "fps" label
   541     QString fpsText = Form->ui.pageVideos->framerateBox->currentText();
   541     QString fpsText = Form->ui.pageOptions->framerateBox->currentText();
   542     QStringList fpsList = fpsText.split(" ");
   542     QStringList fpsList = fpsText.split(" ");
   543     return fpsList.first().toInt();
   543     return fpsList.first().toInt();
   544 }
   544 }
   545 
   545 
   546 int GameUIConfig::rec_Bitrate()
   546 int GameUIConfig::rec_Bitrate()
   547 {
   547 {
   548     return Form->ui.pageVideos->bitrateBox->value();
   548     return Form->ui.pageOptions->bitrateBox->value();
   549 }
   549 }
   550 
   550 
   551 bool GameUIConfig::recordAudio()
   551 bool GameUIConfig::recordAudio()
   552 {
   552 {
   553     return Form->ui.pageVideos->checkRecordAudio->isChecked();
   553     return Form->ui.pageOptions->checkRecordAudio->isChecked();
   554 }
   554 }