Tempoary (!!!) workaround for incorrect key combination description in frontend
authorWuzzy <Wuzzy2@mail.ru>
Tue, 27 Aug 2019 23:16:42 +0200
changeset 15375 5a934f83d5eb
parent 15374 0f2fd8d12734
child 15376 24a9afbf33c6
child 15381 5d26d664680d
Tempoary (!!!) workaround for incorrect key combination description in frontend This workaround fixes the incorrect string while preserving translations and the 1.0.0 string freeze. Remember to revert this commit and fix the string in binds.cpp after the 1.0.0 release!
QTfrontend/ui/widget/keybinder.cpp
--- a/QTfrontend/ui/widget/keybinder.cpp	Wed Aug 28 00:10:41 2019 +0300
+++ b/QTfrontend/ui/widget/keybinder.cpp	Tue Aug 27 23:16:42 2019 +0200
@@ -209,7 +209,12 @@
         curTable->insertRow(row);
         curTable->setItem(row, 0, nameCell);
         QTableWidgetItem * bindCell;
-        if (cbinds[i].action != "!MULTI")
+        // Check if the bind text is bad. This was discovered after the 1.0.0,
+        // so we need a little workaround.
+        bool is_broken_strbind = cbinds[i].strbind == "precise + switch + toggle hedgehog tags";
+                                                    // ^ should be "precise + switch + toggle team bars"
+        // TODO: Remove is_broken_strbind after 1.0.0 release.
+        if (cbinds[i].action != "!MULTI" && (!is_broken_strbind))
         {
             bindCell = new QTableWidgetItem(comboBox->currentText());
             nameCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
@@ -218,7 +223,19 @@
         }
         else
         {
-            bindCell = new QTableWidgetItem(HWApplication::translate("binds (combination)", cbinds[i].strbind.toUtf8().constData()));
+            // Apply workaround for the broken 1.0.0 strbind
+            // TODO: Remove the workaround after 1.0.0 release and fix binds.cpp accordingly.
+            if (is_broken_strbind)
+            {
+                // We simply construct the string from other strings we *do* have. :-)
+                QString cellText =
+                    HWApplication::translate("binds", "precise aim") + " + " +
+                    HWApplication::translate("binds", "switch") + " + " +
+                    HWApplication::translate("binds", "toggle team bars");
+                bindCell = new QTableWidgetItem(cellText);
+            }
+            else
+                bindCell = new QTableWidgetItem(HWApplication::translate("binds (combination)", cbinds[i].strbind.toUtf8().constData()));
             nameCell->setFlags(Qt::NoItemFlags);
             bindCell->setFlags(Qt::NoItemFlags);
             bindCell->setIcon(emptyIcon);