Added translation to key shortcut table, modals, and release mouse status line.

This commit is contained in:
=
2025-04-20 15:23:38 -07:00
parent eaff1fcd70
commit 505874f22e
4 changed files with 34 additions and 19 deletions

View File

@@ -717,11 +717,11 @@ msgstr "Autres périfériques"
msgid "Click to capture mouse"
msgstr "Cliquer pour capturer la souris"
msgid "Press %1 to release mouse"
msgstr "Appuyer sur %1 pour libérer la souris"
msgid "Press %s to release mouse"
msgstr "Appuyer sur %s pour libérer la souris"
msgid "Press %1 or middle button to release mouse"
msgstr "Appuyer sur %1 ou le bouton central pour libérer la souris"
msgid "Press %s or middle button to release mouse"
msgstr "Appuyer sur %s ou le bouton central pour libérer la souris"
msgid "Bus"
msgstr "Bus"

View File

@@ -823,10 +823,9 @@ void MainWindow::updateShortcuts()
{
/*
Update menu shortcuts from accelerator table
Note that the "Release mouse" shortcut is hardcoded elsewhere
This section only applies to shortcuts anchored to UI elements
MainWindow::eventFilter
Note that these only work in windowed mode. If you add any new shortcuts,
you have to go duplicate them in MainWindow::eventFilter()
*/
// First we need to wipe all existing accelerators, otherwise Qt will
@@ -1295,7 +1294,10 @@ MainWindow::on_actionFullscreen_triggered()
if (video_fullscreen_first) {
bool wasCaptured = mouse_capture == 1;
QMessageBox questionbox(QMessageBox::Icon::Information, tr("Entering fullscreen mode"), tr("Press Ctrl+Alt+PgDn to return to windowed mode."), QMessageBox::Ok, this);
char strFullscreen[100];
sprintf(strFullscreen, qPrintable(tr("To return to windowed mode, press %s")), acc_keys[FindAccelerator("fullscreen")].seq);
QMessageBox questionbox(QMessageBox::Icon::Information, tr("Entering fullscreen mode"), QString(strFullscreen), QMessageBox::Ok, this);
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
questionbox.setCheckBox(chkbox);
chkbox->setChecked(!video_fullscreen_first);
@@ -1362,15 +1364,21 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
{
this->keyPressEvent((QKeyEvent *) event);
// We check for mouse release even if we aren't fullscreen,
// because it's not a menu accelerator.
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *ke = (QKeyEvent *) event;
if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("release_mouse"))
{
plat_mouse_capture(0);
}
}
if (event->type() == QEvent::KeyPress && video_fullscreen != 0)
{
QKeyEvent *ke = (QKeyEvent *) event;
if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("release_mouse"))
{
qDebug() << ke;
plat_mouse_capture(0);
}
if ((QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("screenshot"))
{
ui->actionTake_screenshot->trigger();

View File

@@ -595,8 +595,14 @@ ProgSettings::reloadStrings()
{
translatedstrings.clear();
translatedstrings[STRING_MOUSE_CAPTURE] = QCoreApplication::translate("", "Click to capture mouse").toStdWString();
translatedstrings[STRING_MOUSE_RELEASE] = QCoreApplication::translate("", "Press %1 to release mouse").arg(QCoreApplication::translate("", MOUSE_CAPTURE_KEYSEQ)).toStdWString();
translatedstrings[STRING_MOUSE_RELEASE_MMB] = QCoreApplication::translate("", "Press %1 or middle button to release mouse").arg(QCoreApplication::translate("", MOUSE_CAPTURE_KEYSEQ)).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_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();

View File

@@ -51,8 +51,8 @@ SettingsInput::SettingsInput(QWidget *parent)
QStringList horizontalHeader;
QStringList verticalHeader;
horizontalHeader.append("Action");
horizontalHeader.append("Keybind");
horizontalHeader.append(tr("Action"));
horizontalHeader.append(tr("Keybind"));
QTableWidget *keyTable = ui->tableKeys;
keyTable->setRowCount(10);
@@ -61,7 +61,7 @@ SettingsInput::SettingsInput(QWidget *parent)
keyTable->setColumnWidth(0, 200);
keyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
QStringList headers;
headers << "Action" << "Bound key";
//headers << "Action" << "Bound key";
keyTable->setHorizontalHeaderLabels(headers);
keyTable->verticalHeader()->setVisible(false);
keyTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
@@ -109,6 +109,7 @@ SettingsInput::save()
strcpy(acc_keys[x].desc, acc_keys_t[x].desc);
strcpy(acc_keys[x].seq, acc_keys_t[x].seq);
}
// ProgSettings::reloadStrings();
}
void
@@ -169,7 +170,7 @@ SettingsInput::refreshInputList()
{
for (int x=0;x<NUM_ACCELS;x++) {
ui->tableKeys->setItem(x, 0, new QTableWidgetItem(acc_keys_t[x].desc));
ui->tableKeys->setItem(x, 0, new QTableWidgetItem(tr(acc_keys_t[x].desc)));
ui->tableKeys->setItem(x, 1, new QTableWidgetItem(acc_keys_t[x].seq));
ui->tableKeys->setItem(x, 2, new QTableWidgetItem(acc_keys_t[x].name));
}