Make framerate drop-down list translatable
authorWuzzy <almikes@aol.com>
Wed, 12 Apr 2017 21:23:02 +0200
changeset 12242 76fa467b6833
parent 12241 a0ed4caa6d35
child 12243 41267eea2f96
Make framerate drop-down list translatable
QTfrontend/gameuiconfig.cpp
QTfrontend/ui/page/pageoptions.cpp
--- a/QTfrontend/gameuiconfig.cpp	Wed Apr 12 20:14:17 2017 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Wed Apr 12 21:23:02 2017 +0200
@@ -183,10 +183,9 @@
     Form->ui.pageOptions->setDefaultOptions();
 
     // then load user configuration
-    Form->ui.pageOptions->framerateBox->setCurrentIndex(
-            Form->ui.pageOptions->framerateBox->findData(
-                        value("videorec/framerate", rec_Framerate()).toString() + " fps",
-                    Qt::MatchExactly) );
+    int framerateBoxIndex = Form->ui.pageOptions->framerateBox->findData(value("videorec/framerate", rec_Framerate()).toUInt());
+    if(framerateBoxIndex != -1)
+        Form->ui.pageOptions->framerateBox->setCurrentIndex(framerateBoxIndex);
     Form->ui.pageOptions->bitrateBox->setValue(value("videorec/bitrate", rec_Bitrate()).toUInt());
     bool useGameRes = value("videorec/usegameres",Form->ui.pageOptions->checkUseGameRes->isChecked()).toBool();
     if (useGameRes)
@@ -625,10 +624,7 @@
 
 int GameUIConfig::rec_Framerate()
 {
-    // remove the "fps" label
-    QString fpsText = Form->ui.pageOptions->framerateBox->currentText();
-    QStringList fpsList = fpsText.split(" ");
-    return fpsList.first().toInt();
+    return Form->ui.pageOptions->framerateBox->itemData(Form->ui.pageOptions->framerateBox->currentIndex()).toInt();
 }
 
 int GameUIConfig::rec_Bitrate()
--- a/QTfrontend/ui/page/pageoptions.cpp	Wed Apr 12 20:14:17 2017 +0200
+++ b/QTfrontend/ui/page/pageoptions.cpp	Wed Apr 12 21:23:02 2017 +0200
@@ -818,11 +818,11 @@
         groupVideoRec->layout()->addWidget(labelFramerate, 6, 0);
 
         framerateBox = new QComboBox(groupVideoRec);
-        framerateBox->addItem("24 fps", 24);
-        framerateBox->addItem("25 fps", 25);
-        framerateBox->addItem("30 fps", 30);
-        framerateBox->addItem("50 fps", 50);
-        framerateBox->addItem("60 fps", 60);
+        framerateBox->addItem(QComboBox::tr("24 FPS"), 24);
+        framerateBox->addItem(QComboBox::tr("25 FPS"), 25);
+        framerateBox->addItem(QComboBox::tr("30 FPS"), 30);
+        framerateBox->addItem(QComboBox::tr("50 FPS"), 50);
+        framerateBox->addItem(QComboBox::tr("60 FPS"), 60);
         groupVideoRec->layout()->addWidget(framerateBox, 6, 1);
 
         // label for Bitrate