Fix keybinds being saved in native/localized form

Keybinds are now both saved and read in portable form
and only converted to native one for display purposes, fixing
them not being read correctly when certain languages are set.

Also get rid of qPrintable() due to it using the system 8-bit codepage
instead of UTF-8, and some unnecessary QString ↔ C string conversions

Co-Authored-by: Cacodemon345 <wahil1976@outlook.com>
This commit is contained in:
Alexander Babikov
2025-05-07 19:03:10 +05:00
parent 19bfa0b442
commit 5918356719
30 changed files with 159 additions and 170 deletions

View File

@@ -43,6 +43,7 @@
#include <QTimer>
#include <QProcess>
#include <QRegularExpression>
#include <QKeySequence>
#include <QLibrary>
#include <QElapsedTimer>
@@ -571,8 +572,6 @@ c16stombs(char dst[], const uint16_t src[], int len)
}
#endif
# define MOUSE_CAPTURE_KEYSEQ "F8+F12"
#ifdef _WIN32
# if defined(__amd64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64)
# define LIB_NAME_GS "gsdll64.dll"
@@ -595,14 +594,8 @@ ProgSettings::reloadStrings()
{
translatedstrings.clear();
translatedstrings[STRING_MOUSE_CAPTURE] = QCoreApplication::translate("", "Click to capture mouse").toStdWString();
char mouseCaptureKeyseq[100];
sprintf(mouseCaptureKeyseq, qPrintable(QCoreApplication::translate("", "Press %s to release mouse")), acc_keys[FindAccelerator("release_mouse")].seq);
translatedstrings[STRING_MOUSE_RELEASE] = QString(mouseCaptureKeyseq).toStdWString();
sprintf(mouseCaptureKeyseq, qPrintable(QCoreApplication::translate("", "Press %s or middle button to release mouse")), acc_keys[FindAccelerator("release_mouse")].seq);
translatedstrings[STRING_MOUSE_RELEASE_MMB] = QString(mouseCaptureKeyseq).toStdWString();
translatedstrings[STRING_MOUSE_RELEASE] = QCoreApplication::translate("", "Press %1 to release mouse").arg(QKeySequence(acc_keys[FindAccelerator("release_mouse")].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText)).toStdWString();
translatedstrings[STRING_MOUSE_RELEASE_MMB] = QCoreApplication::translate("", "Press %1 or middle button to release mouse").arg(QKeySequence(acc_keys[FindAccelerator("release_mouse")].seq, QKeySequence::PortableText).toString(QKeySequence::NativeText)).toStdWString();
translatedstrings[STRING_INVALID_CONFIG] = QCoreApplication::translate("", "Invalid configuration").toStdWString();
translatedstrings[STRING_NO_ST506_ESDI_CDROM] = QCoreApplication::translate("", "MFM/RLL or ESDI CD-ROM drives never existed").toStdWString();
translatedstrings[STRING_PCAP_ERROR_NO_DEVICES] = QCoreApplication::translate("", "No PCap devices found").toStdWString();